From db600b2cf7bfebf44dd67b5d3103336c8aba0dea Mon Sep 17 00:00:00 2001 From: openvela-robot Date: Sat, 24 May 2014 11:15:15 +0800 Subject: [PATCH] vf_format: rework format list parsing Avoid using AV_PIX_FMT_NB, since that hardcodes the number of pixel formats into lavfi and will break when a shared lavu is updated, adding new pixel formats. --- .gitignore | 38 +- CREDITS | 59 +- Changelog | 575 +- INSTALL | 9 +- LICENSE | 70 +- MAINTAINERS | 566 - Makefile | 135 +- README | 12 +- RELEASE | 2 +- arch.mak | 5 - avconv.c | 2633 +++++ ffmpeg.h => avconv.h | 161 +- ffmpeg_dxva2.c => avconv_dxva2.c | 13 +- ffmpeg_filter.c => avconv_filter.c | 447 +- ffmpeg_opt.c => avconv_opt.c | 980 +- ffmpeg_vda.c => avconv_vda.c | 10 +- ffmpeg_vdpau.c => avconv_vdpau.c | 10 +- avplay.c | 3001 +++++ avprobe.c | 969 ++ ffserver.c => avserver.c | 720 +- cmdutils.c | 721 +- cmdutils.h | 119 +- cmdutils_common_opts.h | 16 +- cmdutils_opencl.c | 274 - common.mak | 93 +- compat/aix/math.h | 14 +- compat/avisynth/avisynth_c.h | 880 -- compat/avisynth/avisynth_c_25.h | 68 - compat/avisynth/avxsynth_c.h | 728 -- .../windowsPorts/basicDataTypeConversions.h | 85 - compat/avisynth/windowsPorts/windows2linux.h | 77 - compat/float/float.h | 8 +- compat/float/limits.h | 8 +- compat/getopt.c | 11 +- compat/msvcrt/snprintf.c | 13 +- compat/msvcrt/snprintf.h | 38 - compat/os2threads.h | 164 - compat/plan9/main.c | 8 +- compat/strtod.c | 8 +- compat/tms470/math.h | 14 +- compat/va_copy.h | 29 - compat/w32pthreads.h | 26 +- configure | 1246 +- doc/APIchanges | 1106 +- doc/Doxyfile | 12 +- doc/Makefile | 143 +- doc/RELEASE_NOTES | 84 +- doc/authors.texi | 11 - doc/{ffmpeg.texi => avconv.texi} | 809 +- doc/avplay.texi | 184 + doc/avprobe.texi | 141 + doc/{ffserver.conf => avserver.conf} | 35 +- doc/avserver.texi | 276 + doc/avtools-common-opts.texi | 186 + doc/avutil.txt | 36 + doc/bitstream_filters.texi | 67 +- doc/build_system.txt | 25 +- doc/codecs.texi | 1107 -- doc/decoders.texi | 185 +- doc/default.css | 165 - doc/demuxers.texi | 434 +- doc/developer.texi | 419 +- doc/devices.texi | 25 - doc/doxy-wrapper.sh | 3 + doc/doxy/doxy_stylesheet.css | 2021 ++++ doc/doxy/footer.html | 9 + doc/doxy/header.html | 16 + doc/encoders.texi | 1717 +-- doc/errno.txt | 174 - doc/eval.texi | 156 + doc/examples/Makefile | 42 - doc/examples/README | 23 - .../{decoding_encoding.c => avcodec.c} | 339 +- doc/examples/avio_reading.c | 134 - doc/examples/demuxing_decoding.c | 386 - doc/examples/filter_audio.c | 8 +- doc/examples/filtering_audio.c | 280 - doc/examples/filtering_video.c | 261 - doc/examples/metadata.c | 4 +- doc/examples/muxing.c | 606 - doc/examples/output.c | 527 + doc/examples/remuxing.c | 165 - doc/examples/resampling_audio.c | 215 - doc/examples/scaling_video.c | 141 - doc/examples/transcode_aac.c | 95 +- doc/examples/transcoding.c | 597 - doc/faq.texi | 314 +- doc/fate.texi | 249 +- doc/fate_config.sh.template | 29 - doc/ffmpeg-bitstream-filters.texi | 45 - doc/ffmpeg-codecs.texi | 42 - doc/ffmpeg-devices.texi | 42 - doc/ffmpeg-filters.texi | 42 - doc/ffmpeg-formats.texi | 42 - doc/ffmpeg-protocols.texi | 42 - doc/ffmpeg-resampler.texi | 44 - doc/ffmpeg-scaler.texi | 43 - doc/ffmpeg-utils.texi | 42 - doc/ffmpeg.txt | 47 - doc/ffplay.texi | 293 - doc/ffprobe.texi | 671 -- doc/ffprobe.xsd | 260 - doc/ffserver.texi | 900 -- doc/fftools-common-opts.texi | 303 - doc/filter_design.txt | 270 - doc/filters.texi | 9977 +++-------------- doc/formats.texi | 212 - doc/general.texi | 308 +- doc/git-howto.texi | 93 +- doc/git-howto.txt | 272 + doc/indevs.texi | 775 +- doc/issue_tracker.txt | 194 - doc/libavcodec.texi | 48 - doc/libavdevice.texi | 45 - doc/libavfilter.texi | 92 +- doc/libavformat.texi | 48 - doc/libavutil.texi | 62 - doc/libswresample.texi | 70 - doc/libswscale.texi | 63 - doc/metadata.texi | 20 +- doc/mips.txt | 75 - doc/multithreading.txt | 4 +- doc/muxers.texi | 742 +- doc/nut.texi | 5 - doc/optimization.txt | 8 +- doc/outdevs.texi | 423 +- doc/platform.texi | 66 +- doc/print_options.c | 10 +- doc/protocols.texi | 620 +- doc/resampler.texi | 232 - doc/scaler.texi | 127 - doc/snow.txt | 638 -- doc/soc.txt | 24 + doc/swresample.txt | 46 - doc/t2h.init | 151 +- doc/texi2pod.pl | 80 +- doc/texidep.pl | 32 - doc/utils.texi | 1064 -- doc/viterbi.txt | 109 + doc/writing_filters.txt | 424 - ffmpeg.c | 3771 ------- ffplay.c | 3745 ------- ffprobe.c | 3012 ----- libavcodec/012v.c | 159 - libavcodec/4xm.c | 153 +- libavcodec/8bps.c | 31 +- libavcodec/8svx.c | 121 +- libavcodec/Makefile | 222 +- libavcodec/a64colors.h | 8 +- libavcodec/a64enc.h | 55 + libavcodec/a64multienc.c | 50 +- libavcodec/a64tables.h | 8 +- libavcodec/aac.h | 37 +- libavcodec/aac_ac3_parser.c | 8 +- libavcodec/aac_ac3_parser.h | 8 +- libavcodec/aac_adtstoasc_bsf.c | 15 +- libavcodec/aac_parser.c | 8 +- libavcodec/aac_tablegen.c | 8 +- libavcodec/aac_tablegen.h | 8 +- libavcodec/aac_tablegen_decl.h | 8 +- libavcodec/aacadtsdec.c | 8 +- libavcodec/aacadtsdec.h | 8 +- libavcodec/aaccoder.c | 22 +- libavcodec/aacdec.c | 293 +- libavcodec/aacdectab.h | 8 +- libavcodec/aacenc.c | 40 +- libavcodec/aacenc.h | 20 +- libavcodec/aacps.c | 32 +- libavcodec/aacps.h | 8 +- libavcodec/aacps_tablegen.c | 8 +- libavcodec/aacps_tablegen.h | 8 +- libavcodec/aacpsdata.c | 8 +- libavcodec/aacpsdsp.c | 10 +- libavcodec/aacpsdsp.h | 9 +- libavcodec/aacpsy.c | 113 +- libavcodec/aacsbr.c | 107 +- libavcodec/aacsbr.h | 10 +- libavcodec/aacsbrdata.h | 14 +- libavcodec/aactab.c | 8 +- libavcodec/aactab.h | 8 +- libavcodec/aandcttab.c | 8 +- libavcodec/aandcttab.h | 8 +- libavcodec/aarch64/asm-offsets.h | 8 +- libavcodec/aarch64/cabac.h | 8 +- libavcodec/aarch64/fft_init_aarch64.c | 8 +- libavcodec/aarch64/fft_neon.S | 8 +- libavcodec/aarch64/h264chroma_init_aarch64.c | 8 +- libavcodec/aarch64/h264cmc_neon.S | 8 +- libavcodec/aarch64/h264dsp_init_aarch64.c | 8 +- libavcodec/aarch64/h264dsp_neon.S | 8 +- libavcodec/aarch64/h264idct_neon.S | 8 +- libavcodec/aarch64/h264qpel_init_aarch64.c | 8 +- libavcodec/aarch64/h264qpel_neon.S | 8 +- libavcodec/aarch64/hpeldsp_init_aarch64.c | 8 +- libavcodec/aarch64/hpeldsp_neon.S | 8 +- libavcodec/aarch64/mdct_neon.S | 8 +- libavcodec/aarch64/mpegaudiodsp_init.c | 8 +- libavcodec/aarch64/mpegaudiodsp_neon.S | 8 +- libavcodec/aarch64/neon.S | 8 +- libavcodec/aarch64/neontest.c | 8 +- libavcodec/aarch64/opus_imdct_init.c | 8 +- libavcodec/aarch64/opus_imdct_neon.S | 8 +- libavcodec/aarch64/rv40dsp_init_aarch64.c | 8 +- libavcodec/aarch64/vc1dsp_init_aarch64.c | 8 +- libavcodec/aarch64/videodsp.S | 8 +- libavcodec/aarch64/videodsp_init.c | 8 +- libavcodec/aarch64/vorbisdsp_init.c | 8 +- libavcodec/aarch64/vorbisdsp_neon.S | 8 +- libavcodec/aasc.c | 64 +- libavcodec/ac3.c | 8 +- libavcodec/ac3.h | 61 +- libavcodec/ac3_parser.c | 30 +- libavcodec/ac3_parser.h | 13 +- libavcodec/ac3dec.c | 234 +- libavcodec/ac3dec.h | 47 +- libavcodec/ac3dec_data.c | 8 +- libavcodec/ac3dec_data.h | 8 +- libavcodec/ac3dec_fixed.c | 176 - libavcodec/ac3dec_float.c | 89 - libavcodec/ac3dsp.c | 80 +- libavcodec/ac3dsp.h | 18 +- libavcodec/ac3enc.c | 26 +- libavcodec/ac3enc.h | 8 +- libavcodec/ac3enc_fixed.c | 23 +- libavcodec/ac3enc_float.c | 24 +- libavcodec/ac3enc_opts_template.c | 8 +- libavcodec/ac3enc_template.c | 39 +- libavcodec/ac3tab.c | 10 +- libavcodec/ac3tab.h | 8 +- libavcodec/acelp_filters.c | 20 +- libavcodec/acelp_filters.h | 43 +- libavcodec/acelp_pitch_delay.c | 20 +- libavcodec/acelp_pitch_delay.h | 8 +- libavcodec/acelp_vectors.c | 56 +- libavcodec/acelp_vectors.h | 63 +- libavcodec/adpcm.c | 373 +- libavcodec/adpcm.h | 12 +- libavcodec/adpcm_data.c | 44 +- libavcodec/adpcm_data.h | 14 +- libavcodec/adpcmenc.c | 60 +- libavcodec/adx.c | 8 +- libavcodec/adx.h | 8 +- libavcodec/adx_parser.c | 8 +- libavcodec/adxdec.c | 19 +- libavcodec/adxenc.c | 12 +- libavcodec/aic.c | 17 +- libavcodec/alac.c | 109 +- libavcodec/alac_data.c | 8 +- libavcodec/alac_data.h | 8 +- libavcodec/alacenc.c | 21 +- libavcodec/aliaspixdec.c | 8 +- libavcodec/aliaspixenc.c | 8 +- libavcodec/allcodecs.c | 133 +- libavcodec/alpha/Makefile | 9 - libavcodec/alpha/asm.h | 186 - libavcodec/alpha/dsputil_alpha.c | 157 - libavcodec/alpha/dsputil_alpha.h | 49 - libavcodec/alpha/dsputil_alpha_asm.S | 167 - libavcodec/alpha/hpeldsp_alpha.c | 213 - libavcodec/alpha/hpeldsp_alpha.h | 28 - libavcodec/alpha/hpeldsp_alpha_asm.S | 125 - libavcodec/alpha/motion_est_alpha.c | 345 - libavcodec/alpha/motion_est_mvi_asm.S | 179 - libavcodec/alpha/mpegvideo_alpha.c | 110 - libavcodec/alpha/regdef.h | 77 - libavcodec/alpha/simple_idct_alpha.c | 303 - libavcodec/alsdec.c | 112 +- libavcodec/amr.h | 8 +- libavcodec/amrnbdata.h | 12 +- libavcodec/amrnbdec.c | 78 +- libavcodec/amrwbdata.h | 10 +- libavcodec/amrwbdec.c | 73 +- libavcodec/anm.c | 16 +- libavcodec/ansi.c | 92 +- libavcodec/apedec.c | 40 +- libavcodec/arm/Makefile | 5 +- libavcodec/arm/aac.h | 8 +- libavcodec/arm/aacpsdsp_init_arm.c | 8 +- libavcodec/arm/aacpsdsp_neon.S | 8 +- libavcodec/arm/ac3dsp_arm.S | 8 +- libavcodec/arm/ac3dsp_armv6.S | 8 +- libavcodec/arm/ac3dsp_init_arm.c | 18 +- libavcodec/arm/ac3dsp_neon.S | 52 +- libavcodec/arm/asm-offsets.h | 8 +- libavcodec/arm/cabac.h | 14 +- libavcodec/arm/dca.h | 84 +- libavcodec/arm/dcadsp_init_arm.c | 8 +- libavcodec/arm/dcadsp_neon.S | 8 +- libavcodec/arm/dcadsp_vfp.S | 8 +- libavcodec/arm/dsputil_arm.S | 8 +- libavcodec/arm/dsputil_arm.h | 8 +- libavcodec/arm/dsputil_armv6.S | 8 +- libavcodec/arm/dsputil_init_arm.c | 10 +- libavcodec/arm/dsputil_init_armv5te.c | 10 +- libavcodec/arm/dsputil_init_armv6.c | 10 +- libavcodec/arm/dsputil_init_neon.c | 10 +- libavcodec/arm/dsputil_neon.S | 8 +- libavcodec/arm/fft_fixed_init_arm.c | 10 +- libavcodec/arm/fft_fixed_neon.S | 8 +- libavcodec/arm/fft_init_arm.c | 10 +- libavcodec/arm/fft_neon.S | 8 +- libavcodec/arm/fft_vfp.S | 8 +- libavcodec/arm/flacdsp_arm.S | 8 +- libavcodec/arm/flacdsp_init_arm.c | 10 +- libavcodec/arm/fmtconvert_init_arm.c | 8 +- libavcodec/arm/fmtconvert_neon.S | 8 +- libavcodec/arm/fmtconvert_vfp.S | 8 +- libavcodec/arm/fmtconvert_vfp_armv6.S | 8 +- libavcodec/arm/h264chroma_init_arm.c | 8 +- libavcodec/arm/h264cmc_neon.S | 8 +- .../{startcode_armv6.S => h264dsp_armv6.S} | 12 +- libavcodec/arm/h264dsp_init_arm.c | 16 +- libavcodec/arm/h264dsp_neon.S | 8 +- libavcodec/arm/h264idct_neon.S | 8 +- libavcodec/arm/h264pred_init_arm.c | 13 +- libavcodec/arm/h264pred_neon.S | 8 +- libavcodec/arm/h264qpel_init_arm.c | 8 +- libavcodec/arm/h264qpel_neon.S | 8 +- libavcodec/arm/hpeldsp_arm.S | 8 +- libavcodec/arm/hpeldsp_arm.h | 10 +- libavcodec/arm/hpeldsp_armv6.S | 8 +- libavcodec/arm/hpeldsp_init_arm.c | 8 +- libavcodec/arm/hpeldsp_init_armv6.c | 8 +- libavcodec/arm/hpeldsp_init_neon.c | 8 +- libavcodec/arm/hpeldsp_neon.S | 8 +- libavcodec/arm/int_neon.S | 14 +- libavcodec/arm/mathops.h | 8 +- libavcodec/arm/mdct_fixed_neon.S | 8 +- libavcodec/arm/mdct_neon.S | 8 +- libavcodec/arm/mdct_vfp.S | 8 +- libavcodec/arm/mlpdsp_armv5te.S | 8 +- libavcodec/arm/mlpdsp_armv6.S | 8 +- libavcodec/arm/mlpdsp_init_arm.c | 8 +- libavcodec/arm/mpegaudiodsp_fixed_armv6.S | 8 +- libavcodec/arm/mpegaudiodsp_init_arm.c | 8 +- libavcodec/arm/mpegvideo_arm.c | 8 +- libavcodec/arm/mpegvideo_arm.h | 8 +- libavcodec/arm/mpegvideo_armv5te.c | 13 +- libavcodec/arm/mpegvideo_armv5te_s.S | 8 +- libavcodec/arm/mpegvideo_neon.S | 8 +- libavcodec/arm/neon.S | 8 +- libavcodec/arm/neontest.c | 8 +- libavcodec/arm/rdft_neon.S | 8 +- libavcodec/arm/rv34dsp_init_arm.c | 8 +- libavcodec/arm/rv34dsp_neon.S | 8 +- libavcodec/arm/rv40dsp_init_arm.c | 8 +- libavcodec/arm/rv40dsp_neon.S | 8 +- libavcodec/arm/sbrdsp_init_arm.c | 8 +- libavcodec/arm/sbrdsp_neon.S | 8 +- libavcodec/arm/simple_idct_arm.S | 10 +- libavcodec/arm/simple_idct_armv5te.S | 8 +- libavcodec/arm/simple_idct_armv6.S | 8 +- libavcodec/arm/simple_idct_neon.S | 8 +- libavcodec/arm/synth_filter_neon.S | 8 +- libavcodec/arm/synth_filter_vfp.S | 8 +- libavcodec/arm/vc1dsp.h | 8 +- libavcodec/arm/vc1dsp_init_arm.c | 12 +- libavcodec/arm/vc1dsp_init_neon.c | 105 +- libavcodec/arm/vc1dsp_neon.S | 8 +- libavcodec/arm/videodsp_arm.h | 8 +- libavcodec/arm/videodsp_armv5te.S | 8 +- libavcodec/arm/videodsp_init_arm.c | 8 +- libavcodec/arm/videodsp_init_armv5te.c | 10 +- libavcodec/arm/vorbisdsp_init_arm.c | 8 +- libavcodec/arm/vorbisdsp_neon.S | 8 +- libavcodec/arm/vp3dsp_init_arm.c | 8 +- libavcodec/arm/vp3dsp_neon.S | 8 +- libavcodec/arm/vp56_arith.h | 8 +- libavcodec/arm/vp6dsp_init_arm.c | 8 +- libavcodec/arm/vp6dsp_neon.S | 8 +- libavcodec/arm/vp8.h | 8 +- libavcodec/arm/vp8_armv6.S | 8 +- libavcodec/arm/vp8dsp.h | 8 +- libavcodec/arm/vp8dsp_armv6.S | 8 +- libavcodec/arm/vp8dsp_init_arm.c | 8 +- libavcodec/arm/vp8dsp_init_armv6.c | 8 +- libavcodec/arm/vp8dsp_init_neon.c | 8 +- libavcodec/arm/vp8dsp_neon.S | 8 +- libavcodec/ass.c | 174 +- libavcodec/ass.h | 82 +- libavcodec/ass_split.c | 476 - libavcodec/ass_split.h | 172 - libavcodec/assdec.c | 78 +- libavcodec/assenc.c | 77 +- libavcodec/asv.c | 8 +- libavcodec/asv.h | 8 +- libavcodec/asvdec.c | 23 +- libavcodec/asvenc.c | 34 +- libavcodec/atrac.c | 11 +- libavcodec/atrac.h | 11 +- libavcodec/atrac1.c | 19 +- libavcodec/atrac1data.h | 10 +- libavcodec/atrac3.c | 53 +- libavcodec/atrac3data.h | 8 +- libavcodec/atrac3plus.c | 10 +- libavcodec/atrac3plus.h | 16 +- libavcodec/atrac3plus_data.h | 8 +- libavcodec/atrac3plusdec.c | 31 +- libavcodec/atrac3plusdsp.c | 8 +- libavcodec/audio_frame_queue.c | 147 +- libavcodec/audio_frame_queue.h | 14 +- libavcodec/audioconvert.c | 120 - libavcodec/audioconvert.h | 84 - libavcodec/aura.c | 12 +- libavcodec/avcodec.h | 1056 +- libavcodec/avcodecres.rc | 55 - libavcodec/avfft.c | 10 +- libavcodec/avfft.h | 8 +- libavcodec/avpacket.c | 248 +- libavcodec/avpicture.c | 73 +- libavcodec/avr32/mathops.h | 8 +- libavcodec/avrndec.c | 131 - libavcodec/avs.c | 18 +- libavcodec/avuidec.c | 130 - libavcodec/avuienc.c | 112 - libavcodec/bethsoftvideo.c | 15 +- libavcodec/bethsoftvideo.h | 8 +- libavcodec/bfi.c | 20 +- libavcodec/bfin/dsputil.S | 10 +- libavcodec/bfin/dsputil_init.c | 8 +- libavcodec/bfin/fdct_bfin.S | 16 +- libavcodec/bfin/hpel_pixels_no_rnd.S | 8 +- libavcodec/bfin/hpeldsp_init.c | 8 +- libavcodec/bfin/idct_bfin.S | 14 +- libavcodec/bfin/mathops.h | 8 +- libavcodec/bfin/pixels.S | 8 +- libavcodec/bfin/pixels.h | 10 +- libavcodec/bfin/vp3dsp.S | 8 +- libavcodec/bfin/vp3dsp_init.c | 8 +- libavcodec/bgmc.c | 18 +- libavcodec/bgmc.h | 12 +- libavcodec/bink.c | 103 +- libavcodec/binkaudio.c | 24 +- libavcodec/binkdata.h | 8 +- libavcodec/binkdsp.c | 8 +- libavcodec/binkdsp.h | 8 +- libavcodec/bintext.c | 258 - libavcodec/bintext.h | 37 - libavcodec/bit_depth_template.c | 13 +- libavcodec/bitstream.c | 86 +- libavcodec/bitstream_filter.c | 16 +- libavcodec/bmp.c | 75 +- libavcodec/bmp.h | 8 +- libavcodec/bmp_parser.c | 8 +- libavcodec/bmpenc.c | 28 +- libavcodec/bmv.c | 29 +- libavcodec/brenderpix.c | 42 +- libavcodec/bytestream.h | 11 +- libavcodec/c93.c | 26 +- libavcodec/cabac.c | 171 +- libavcodec/cabac.h | 11 +- libavcodec/cabac_functions.h | 12 +- libavcodec/cavs.c | 14 +- libavcodec/cavs.h | 10 +- libavcodec/cavs_parser.c | 8 +- libavcodec/cavsdata.c | 8 +- libavcodec/cavsdec.c | 66 +- libavcodec/cavsdsp.c | 8 +- libavcodec/cavsdsp.h | 8 +- libavcodec/cbrt_tablegen.c | 8 +- libavcodec/cbrt_tablegen.h | 10 +- libavcodec/cdgraphics.c | 34 +- libavcodec/cdxl.c | 29 +- libavcodec/celp_filters.c | 22 +- libavcodec/celp_filters.h | 57 +- libavcodec/celp_math.c | 50 +- libavcodec/celp_math.h | 47 +- libavcodec/cga_data.c | 419 +- libavcodec/cga_data.h | 11 +- libavcodec/chomp_bsf.c | 13 +- libavcodec/cinepak.c | 253 +- libavcodec/cinepakenc.c | 1335 --- libavcodec/cljr.c | 72 +- libavcodec/cllc.c | 23 +- libavcodec/cngdec.c | 22 +- libavcodec/cngenc.c | 12 +- libavcodec/codec_desc.c | 525 +- libavcodec/cook.c | 75 +- libavcodec/cook_parser.c | 15 +- libavcodec/cookdata.h | 8 +- libavcodec/copy_block.h | 19 +- libavcodec/cos_tablegen.c | 10 +- libavcodec/cpia.c | 233 - libavcodec/crystalhd.c | 1223 -- libavcodec/cscd.c | 142 +- libavcodec/cyuv.c | 30 +- libavcodec/dca.c | 12 +- libavcodec/dca.h | 8 +- libavcodec/dca_parser.c | 18 +- libavcodec/dcadata.h | 8 +- libavcodec/dcadec.c | 775 +- libavcodec/dcadsp.c | 8 +- libavcodec/dcadsp.h | 10 +- libavcodec/dcaenc.c | 975 -- libavcodec/dcaenc.h | 113 - libavcodec/dcahuff.h | 8 +- libavcodec/dct-test.c | 115 +- libavcodec/dct.c | 10 +- libavcodec/dct.h | 11 +- libavcodec/dct32.h | 8 +- libavcodec/dct32_fixed.c | 8 +- libavcodec/dct32_float.c | 8 +- libavcodec/dct32_template.c | 8 +- libavcodec/dctref.c | 8 +- libavcodec/dctref.h | 8 +- libavcodec/dfa.c | 42 +- libavcodec/dirac.c | 48 +- libavcodec/dirac.h | 11 +- libavcodec/dirac_arith.c | 116 - libavcodec/dirac_arith.h | 191 - libavcodec/dirac_dwt.c | 572 - libavcodec/dirac_dwt.h | 123 - libavcodec/dirac_parser.c | 12 +- libavcodec/diracdec.c | 2001 ---- libavcodec/diracdsp.c | 201 - libavcodec/diracdsp.h | 67 - libavcodec/dnxhd_parser.c | 50 +- libavcodec/dnxhddata.c | 696 +- libavcodec/dnxhddata.h | 20 +- libavcodec/dnxhddec.c | 80 +- libavcodec/dnxhdenc.c | 115 +- libavcodec/dnxhdenc.h | 10 +- libavcodec/dpcm.c | 19 +- libavcodec/dpx.c | 304 +- libavcodec/dpx_parser.c | 108 - libavcodec/dpxenc.c | 164 +- libavcodec/dsd_tablegen.c | 38 - libavcodec/dsd_tablegen.h | 95 - libavcodec/dsddec.c | 167 - libavcodec/dsicinav.c | 71 +- libavcodec/dsputil.c | 263 +- libavcodec/dsputil.h | 24 +- libavcodec/dsputil_template.c | 8 +- libavcodec/dsputilenc_template.c | 10 +- libavcodec/dump_extradata_bsf.c | 13 +- libavcodec/dv.c | 20 +- libavcodec/dv.h | 11 +- libavcodec/dv_profile.c | 46 +- libavcodec/dv_profile.h | 14 +- libavcodec/dv_tablegen.c | 8 +- libavcodec/dv_tablegen.h | 8 +- libavcodec/dvbsub.c | 118 +- libavcodec/dvbsub_parser.c | 10 +- libavcodec/dvbsubdec.c | 238 +- libavcodec/dvd_nav_parser.c | 116 - libavcodec/dvdata.c | 8 +- libavcodec/dvdata.h | 8 +- libavcodec/dvdec.c | 47 +- libavcodec/dvdsub_parser.c | 8 +- libavcodec/dvdsubdec.c | 261 +- libavcodec/dvdsubenc.c | 400 +- libavcodec/dvenc.c | 35 +- libavcodec/dxa.c | 95 +- libavcodec/dxtory.c | 22 +- libavcodec/dxva2.c | 8 +- libavcodec/dxva2.h | 19 +- libavcodec/dxva2_h264.c | 18 +- libavcodec/dxva2_internal.h | 9 +- libavcodec/dxva2_mpeg2.c | 21 +- libavcodec/dxva2_vc1.c | 54 +- libavcodec/eac3_data.c | 8 +- libavcodec/eac3_data.h | 8 +- libavcodec/eac3dec.c | 8 +- libavcodec/eac3enc.c | 16 +- libavcodec/eac3enc.h | 8 +- libavcodec/eacmv.c | 20 +- libavcodec/eaidct.c | 8 +- libavcodec/eaidct.h | 8 +- libavcodec/eamad.c | 55 +- libavcodec/eatgq.c | 24 +- libavcodec/eatgv.c | 34 +- libavcodec/eatqi.c | 15 +- libavcodec/elbg.c | 55 +- libavcodec/elbg.h | 16 +- libavcodec/error_resilience.c | 283 +- libavcodec/error_resilience.h | 13 +- libavcodec/escape124.c | 39 +- libavcodec/escape130.c | 18 +- libavcodec/evrcdata.h | 1499 --- libavcodec/evrcdec.c | 917 -- libavcodec/exif.c | 137 - libavcodec/exif.h | 170 - libavcodec/exr.c | 132 +- libavcodec/faandct.h | 8 +- libavcodec/faanidct.c | 8 +- libavcodec/faanidct.h | 8 +- libavcodec/faxcompr.c | 34 +- libavcodec/faxcompr.h | 8 +- libavcodec/fft-fixed-test.c | 8 +- libavcodec/fft-fixed32-test.c | 21 - libavcodec/fft-internal.h | 29 +- libavcodec/fft-test.c | 50 +- libavcodec/fft.h | 28 +- libavcodec/fft_fixed.c | 9 +- libavcodec/fft_fixed_32.c | 52 - libavcodec/fft_float.c | 9 +- libavcodec/fft_init_table.c | 200 - libavcodec/fft_table.h | 66 - libavcodec/fft_template.c | 192 +- libavcodec/ffv1.c | 164 +- libavcodec/ffv1.h | 65 +- libavcodec/ffv1dec.c | 677 +- libavcodec/ffv1enc.c | 749 +- libavcodec/ffwavesynth.c | 481 - libavcodec/fic.c | 21 +- libavcodec/flac.c | 11 +- libavcodec/flac.h | 8 +- libavcodec/flac_parser.c | 109 +- libavcodec/flacdata.c | 10 +- libavcodec/flacdata.h | 10 +- libavcodec/flacdec.c | 71 +- libavcodec/flacdsp.c | 10 +- libavcodec/flacdsp.h | 9 +- libavcodec/flacdsp_lpc_template.c | 26 +- libavcodec/flacdsp_template.c | 8 +- libavcodec/flacenc.c | 75 +- libavcodec/flashsv.c | 50 +- libavcodec/flashsv2enc.c | 920 -- libavcodec/flashsvenc.c | 14 +- libavcodec/flicvideo.c | 140 +- libavcodec/flv.h | 8 +- libavcodec/flvdec.c | 23 +- libavcodec/flvenc.c | 8 +- libavcodec/fmtconvert.c | 40 +- libavcodec/fmtconvert.h | 13 +- libavcodec/frame_thread_encoder.c | 295 - libavcodec/frame_thread_encoder.h | 26 - libavcodec/fraps.c | 224 +- libavcodec/frwu.c | 43 +- libavcodec/g2meet.c | 51 +- libavcodec/g722.c | 8 +- libavcodec/g722.h | 8 +- libavcodec/g722dec.c | 12 +- libavcodec/g722enc.c | 15 +- libavcodec/g723_1.c | 1304 +-- libavcodec/g723_1_data.h | 171 +- libavcodec/g726.c | 49 +- libavcodec/g729.h | 29 - libavcodec/g729data.h | 382 - libavcodec/g729dec.c | 726 -- libavcodec/g729postfilter.c | 610 - libavcodec/g729postfilter.h | 116 - libavcodec/get_bits.h | 136 +- libavcodec/gif.c | 264 +- libavcodec/gif.h | 49 - libavcodec/gifdec.c | 444 +- libavcodec/golomb-test.c | 12 +- libavcodec/golomb.c | 8 +- libavcodec/golomb.h | 42 +- libavcodec/gsm.h | 8 +- libavcodec/gsm_parser.c | 13 +- libavcodec/gsmdec.c | 17 +- libavcodec/gsmdec_data.c | 8 +- libavcodec/gsmdec_data.h | 8 +- libavcodec/gsmdec_template.c | 8 +- libavcodec/h261.c | 8 +- libavcodec/h261.h | 9 +- libavcodec/h261_parser.c | 22 +- libavcodec/h261data.c | 8 +- libavcodec/h261dec.c | 36 +- libavcodec/h261enc.c | 111 +- libavcodec/h263.c | 8 +- libavcodec/h263.h | 13 +- libavcodec/h263_parser.c | 22 +- libavcodec/h263_parser.h | 8 +- libavcodec/h263data.h | 12 +- libavcodec/h263dec.c | 173 +- libavcodec/h263dsp.c | 8 +- libavcodec/h263dsp.h | 8 +- libavcodec/h264.c | 520 +- libavcodec/h264.h | 113 +- libavcodec/h264_cabac.c | 68 +- libavcodec/h264_cavlc.c | 124 +- libavcodec/h264_direct.c | 17 +- libavcodec/h264_loopfilter.c | 20 +- libavcodec/h264_mb.c | 41 +- libavcodec/h264_mb_template.c | 25 +- libavcodec/h264_mc_template.c | 14 +- libavcodec/h264_mp4toannexb_bsf.c | 59 +- libavcodec/h264_mvpred.h | 18 +- libavcodec/h264_parser.c | 110 +- libavcodec/h264_picture.c | 43 +- libavcodec/h264_ps.c | 146 +- libavcodec/h264_refs.c | 99 +- libavcodec/h264_sei.c | 171 +- libavcodec/h264_slice.c | 455 +- libavcodec/h264addpx_template.c | 8 +- libavcodec/h264chroma.c | 10 +- libavcodec/h264chroma.h | 12 +- libavcodec/h264chroma_template.c | 56 +- libavcodec/h264data.h | 10 +- libavcodec/h264dsp.c | 56 +- libavcodec/h264dsp.h | 8 +- libavcodec/h264dsp_template.c | 46 +- libavcodec/h264idct.c | 16 +- libavcodec/h264idct.h | 10 +- libavcodec/h264idct_template.c | 12 +- libavcodec/h264pred.c | 28 +- libavcodec/h264pred.h | 10 +- libavcodec/h264pred_template.c | 170 +- libavcodec/h264qpel.c | 26 +- libavcodec/h264qpel.h | 8 +- libavcodec/h264qpel_template.c | 116 +- libavcodec/hevc.c | 1587 +-- libavcodec/hevc.h | 128 +- libavcodec/hevc_cabac.c | 679 +- libavcodec/hevc_filter.c | 371 +- libavcodec/hevc_mvs.c | 132 +- libavcodec/hevc_parser.c | 242 +- libavcodec/hevc_ps.c | 41 +- libavcodec/hevc_refs.c | 43 +- libavcodec/hevc_sei.c | 103 +- libavcodec/hevcdsp.c | 138 +- libavcodec/hevcdsp.h | 60 +- libavcodec/hevcdsp_template.c | 1085 +- libavcodec/hevcpred.c | 12 +- libavcodec/hevcpred.h | 45 - libavcodec/hevcpred_template.c | 271 +- libavcodec/hnm4video.c | 97 +- libavcodec/hpel_template.c | 8 +- libavcodec/hpeldsp.c | 10 +- libavcodec/hpeldsp.h | 13 +- libavcodec/huffman.c | 59 +- libavcodec/huffman.h | 13 +- libavcodec/huffyuv.c | 34 +- libavcodec/huffyuv.h | 35 +- libavcodec/huffyuvdec.c | 543 +- libavcodec/huffyuvenc.c | 476 +- libavcodec/idcinvideo.c | 23 +- libavcodec/iff.c | 722 +- libavcodec/iirfilter.c | 15 +- libavcodec/iirfilter.h | 31 +- libavcodec/imc.c | 43 +- libavcodec/imcdata.h | 8 +- libavcodec/imgconvert.c | 191 +- libavcodec/imgconvert.h | 8 +- libavcodec/imx_dump_header_bsf.c | 13 +- libavcodec/indeo2.c | 12 +- libavcodec/indeo2data.h | 8 +- libavcodec/indeo3.c | 99 +- libavcodec/indeo3data.h | 8 +- libavcodec/indeo4.c | 89 +- libavcodec/indeo4data.h | 8 +- libavcodec/indeo5.c | 53 +- libavcodec/indeo5data.h | 8 +- libavcodec/intelh263dec.c | 19 +- libavcodec/internal.h | 76 +- libavcodec/interplayvideo.c | 62 +- libavcodec/intrax8.c | 45 +- libavcodec/intrax8.h | 11 +- libavcodec/intrax8dsp.c | 8 +- libavcodec/intrax8dsp.h | 8 +- libavcodec/intrax8huf.h | 8 +- libavcodec/ituh263dec.c | 66 +- libavcodec/ituh263enc.c | 20 +- libavcodec/ivi_common.c | 89 +- libavcodec/ivi_common.h | 10 +- libavcodec/ivi_dsp.c | 68 +- libavcodec/ivi_dsp.h | 12 +- libavcodec/j2kenc.c | 1055 -- libavcodec/jacosub.h | 45 - libavcodec/jacosubdec.c | 205 - libavcodec/jfdctint.c | 8 +- libavcodec/jfdctint_template.c | 4 +- libavcodec/jpeg2000.c | 125 +- libavcodec/jpeg2000.h | 22 +- libavcodec/jpeg2000dec.c | 474 +- libavcodec/jpeg2000dwt.c | 237 +- libavcodec/jpeg2000dwt.h | 9 +- libavcodec/jpegls.c | 14 +- libavcodec/jpegls.h | 15 +- libavcodec/jpeglsdec.c | 149 +- libavcodec/jpeglsdec.h | 8 +- libavcodec/jpeglsenc.c | 25 +- libavcodec/jrevdct.c | 249 +- libavcodec/jvdec.c | 43 +- libavcodec/kbdwin.c | 22 +- libavcodec/kbdwin.h | 11 +- libavcodec/kgv1dec.c | 43 +- libavcodec/kmvc.c | 37 +- libavcodec/lagarith.c | 151 +- libavcodec/lagarithrac.c | 12 +- libavcodec/lagarithrac.h | 8 +- libavcodec/latm_parser.c | 9 +- libavcodec/lcl.h | 8 +- libavcodec/lcldec.c | 42 +- libavcodec/lclenc.c | 31 +- libavcodec/libaacplus.c | 141 - libavcodec/libavcodec.v | 27 - libavcodec/libcelt_dec.c | 140 - libavcodec/libfaac.c | 30 +- libavcodec/libfdk-aacdec.c | 10 +- libavcodec/libfdk-aacenc.c | 6 +- libavcodec/libgsm.c | 46 +- libavcodec/libilbc.c | 26 +- libavcodec/libmp3lame.c | 23 +- libavcodec/libopencore-amr.c | 40 +- libavcodec/libopenjpegdec.c | 147 +- libavcodec/libopenjpegenc.c | 484 +- libavcodec/libopus.c | 8 +- libavcodec/libopus.h | 8 +- libavcodec/libopusdec.c | 51 +- libavcodec/libopusenc.c | 49 +- libavcodec/libschroedinger.c | 13 +- libavcodec/libschroedinger.h | 8 +- libavcodec/libschroedingerdec.c | 24 +- libavcodec/libschroedingerenc.c | 13 +- libavcodec/libshine.c | 149 - libavcodec/libspeexdec.c | 33 +- libavcodec/libspeexenc.c | 17 +- libavcodec/libstagefright.cpp | 590 - libavcodec/libtheoraenc.c | 72 +- libavcodec/libtwolame.c | 10 +- libavcodec/libutvideo.h | 70 - libavcodec/libutvideodec.cpp | 212 - libavcodec/libutvideoenc.cpp | 246 - libavcodec/libvo-aacenc.c | 20 +- libavcodec/libvo-amrwbenc.c | 18 +- libavcodec/{libvorbisenc.c => libvorbis.c} | 104 +- libavcodec/libvorbisdec.c | 199 - libavcodec/libvpx.c | 21 +- libavcodec/libvpx.h | 10 +- libavcodec/libvpxdec.c | 16 +- libavcodec/libvpxenc.c | 380 +- libavcodec/libwavpackenc.c | 8 +- libavcodec/libwebpenc.c | 8 +- libavcodec/libx264.c | 226 +- libavcodec/libx265.c | 10 +- libavcodec/libxavs.c | 26 +- libavcodec/libxvid.c | 160 +- libavcodec/libxvid.h | 8 +- libavcodec/libxvid_rc.c | 59 +- libavcodec/libzvbi-teletextdec.c | 570 - libavcodec/ljpegenc.c | 70 +- libavcodec/loco.c | 107 +- libavcodec/lossless_videodsp.c | 128 - libavcodec/lossless_videodsp.h | 40 - libavcodec/lpc.c | 26 +- libavcodec/lpc.h | 13 +- libavcodec/lsp.c | 20 +- libavcodec/lsp.h | 8 +- libavcodec/lzw.c | 14 +- libavcodec/lzw.h | 9 +- libavcodec/lzwenc.c | 17 +- libavcodec/mace.c | 19 +- libavcodec/mathops.h | 8 +- libavcodec/mathtables.c | 10 +- libavcodec/mdct_fixed.c | 9 +- libavcodec/mdct_fixed_32.c | 52 - libavcodec/mdct_float.c | 9 +- libavcodec/mdct_template.c | 14 +- libavcodec/mdec.c | 26 +- libavcodec/metasound.c | 10 +- libavcodec/metasound_data.c | 16 +- libavcodec/metasound_data.h | 8 +- libavcodec/microdvddec.c | 377 - libavcodec/mimic.c | 23 +- libavcodec/mips/Makefile | 20 - libavcodec/mips/aaccoder_mips.c | 2498 ----- libavcodec/mips/aacdec_mips.c | 831 -- libavcodec/mips/aacdec_mips.h | 249 - libavcodec/mips/aacpsdsp_mips.c | 459 - libavcodec/mips/aacpsy_mips.h | 230 - libavcodec/mips/aacsbr_mips.c | 618 - libavcodec/mips/aacsbr_mips.h | 493 - libavcodec/mips/ac3dsp_mips.c | 412 - libavcodec/mips/acelp_filters_mips.c | 216 - libavcodec/mips/acelp_vectors_mips.c | 101 - libavcodec/mips/amrwbdec_mips.c | 187 - libavcodec/mips/amrwbdec_mips.h | 62 - libavcodec/mips/celp_filters_mips.c | 288 - libavcodec/mips/celp_math_mips.c | 89 - libavcodec/mips/compute_antialias_fixed.h | 250 - libavcodec/mips/compute_antialias_float.h | 185 - libavcodec/mips/fft_mips.c | 534 - libavcodec/mips/fmtconvert_mips.c | 342 - libavcodec/mips/iirfilter_mips.c | 204 - libavcodec/mips/lsp_mips.h | 109 - libavcodec/mips/mathops.h | 8 +- libavcodec/mips/mpegaudiodsp_mips_fixed.c | 907 -- libavcodec/mips/mpegaudiodsp_mips_float.c | 1250 --- libavcodec/mips/sbrdsp_mips.c | 940 -- libavcodec/mjpeg.c | 12 +- libavcodec/mjpeg.h | 9 +- libavcodec/mjpeg2jpeg_bsf.c | 8 +- libavcodec/mjpeg_parser.c | 68 +- libavcodec/mjpega_dump_header_bsf.c | 13 +- libavcodec/mjpegbdec.c | 18 +- libavcodec/mjpegdec.c | 1097 +- libavcodec/mjpegdec.h | 25 +- libavcodec/mjpegenc.c | 228 +- libavcodec/mjpegenc.h | 17 +- libavcodec/mlp.c | 8 +- libavcodec/mlp.h | 8 +- libavcodec/mlp_parser.c | 55 +- libavcodec/mlp_parser.h | 13 +- libavcodec/mlpdec.c | 74 +- libavcodec/mlpdsp.c | 8 +- libavcodec/mlpdsp.h | 8 +- libavcodec/mmvideo.c | 25 +- libavcodec/motion-test.c | 151 - libavcodec/motion_est.c | 96 +- libavcodec/motion_est_template.c | 64 +- libavcodec/motionpixels.c | 60 +- libavcodec/motionpixels_tablegen.c | 8 +- libavcodec/motionpixels_tablegen.h | 10 +- libavcodec/movsub_bsf.c | 18 +- libavcodec/movtextdec.c | 116 - libavcodec/movtextenc.c | 165 - libavcodec/mp3_header_decompress_bsf.c | 97 - libavcodec/mpc.c | 14 +- libavcodec/mpc.h | 8 +- libavcodec/mpc7.c | 28 +- libavcodec/mpc7data.h | 8 +- libavcodec/mpc8.c | 24 +- libavcodec/mpc8data.h | 8 +- libavcodec/mpc8huff.h | 8 +- libavcodec/mpcdata.h | 46 +- libavcodec/mpeg12.c | 17 +- libavcodec/mpeg12.h | 8 +- libavcodec/mpeg12data.c | 76 +- libavcodec/mpeg12data.h | 11 +- libavcodec/mpeg12dec.c | 502 +- libavcodec/mpeg12enc.c | 141 +- libavcodec/mpeg4audio.c | 18 +- libavcodec/mpeg4audio.h | 8 +- libavcodec/mpeg4data.h | 8 +- libavcodec/mpeg4video.c | 8 +- libavcodec/mpeg4video.h | 28 +- libavcodec/mpeg4video_parser.c | 21 +- libavcodec/mpeg4video_parser.h | 8 +- libavcodec/mpeg4videodec.c | 491 +- libavcodec/mpeg4videoenc.c | 87 +- libavcodec/mpegaudio.c | 8 +- libavcodec/mpegaudio.h | 16 +- libavcodec/mpegaudio_parser.c | 15 +- libavcodec/mpegaudio_tablegen.c | 8 +- libavcodec/mpegaudio_tablegen.h | 15 +- libavcodec/mpegaudiodata.c | 18 +- libavcodec/mpegaudiodata.h | 8 +- libavcodec/mpegaudiodec_fixed.c | 10 +- libavcodec/mpegaudiodec_float.c | 10 +- libavcodec/mpegaudiodec_template.c | 109 +- libavcodec/mpegaudiodecheader.c | 21 +- libavcodec/mpegaudiodecheader.h | 10 +- libavcodec/mpegaudiodectab.h | 8 +- libavcodec/mpegaudiodsp.c | 10 +- libavcodec/mpegaudiodsp.h | 11 +- libavcodec/mpegaudiodsp_data.c | 8 +- libavcodec/mpegaudiodsp_fixed.c | 10 +- libavcodec/mpegaudiodsp_float.c | 10 +- libavcodec/mpegaudiodsp_template.c | 17 +- ...mpegaudioenc_template.c => mpegaudioenc.c} | 90 +- libavcodec/mpegaudioenc_fixed.c | 41 - libavcodec/mpegaudioenc_float.c | 42 - libavcodec/mpegaudiotab.h | 8 +- libavcodec/mpegutils.c | 8 +- libavcodec/mpegutils.h | 8 +- libavcodec/mpegvideo.c | 1199 +- libavcodec/mpegvideo.h | 69 +- libavcodec/mpegvideo_enc.c | 515 +- libavcodec/mpegvideo_motion.c | 38 +- libavcodec/mpegvideo_parser.c | 34 +- libavcodec/mpegvideo_xvmc.c | 61 +- libavcodec/mpl2dec.c | 96 - libavcodec/mqc.c | 8 +- libavcodec/mqc.h | 22 +- libavcodec/mqcdec.c | 8 +- libavcodec/mqcenc.c | 119 - libavcodec/msgsmdec.c | 8 +- libavcodec/msgsmdec.h | 8 +- libavcodec/msmpeg4.c | 41 +- libavcodec/msmpeg4.h | 8 +- libavcodec/msmpeg4data.c | 8 +- libavcodec/msmpeg4data.h | 8 +- libavcodec/msmpeg4dec.c | 39 +- libavcodec/msmpeg4enc.c | 20 +- libavcodec/msrle.c | 29 +- libavcodec/msrledec.c | 81 +- libavcodec/msrledec.h | 8 +- libavcodec/mss1.c | 26 +- libavcodec/mss12.c | 17 +- libavcodec/mss12.h | 22 +- libavcodec/mss2.c | 41 +- libavcodec/mss2dsp.c | 11 +- libavcodec/mss2dsp.h | 8 +- libavcodec/mss3.c | 15 +- libavcodec/mss34dsp.c | 12 +- libavcodec/mss34dsp.h | 8 +- libavcodec/mss4.c | 18 +- libavcodec/msvideo1.c | 14 +- libavcodec/msvideo1enc.c | 305 - libavcodec/mvcdec.c | 8 +- libavcodec/mxpegdec.c | 31 +- libavcodec/nellymoserdec.c | 9 +- libavcodec/nellymoserenc.c | 24 +- libavcodec/noise_bsf.c | 19 +- libavcodec/nuv.c | 67 +- libavcodec/old_codec_ids.h | 399 - libavcodec/on2avc.c | 12 +- libavcodec/on2avcdata.c | 28 +- libavcodec/on2avcdata.h | 28 +- libavcodec/options.c | 91 +- libavcodec/options_table.h | 105 +- libavcodec/opus.c | 8 +- libavcodec/opus.h | 38 +- libavcodec/opus_celt.c | 12 +- libavcodec/opus_imdct.c | 8 +- libavcodec/opus_imdct.h | 8 +- libavcodec/opus_parser.c | 8 +- libavcodec/opus_silk.c | 8 +- libavcodec/opusdec.c | 66 +- libavcodec/paf.c | 44 +- libavcodec/paf.h | 28 - libavcodec/pamenc.c | 75 +- libavcodec/parser.c | 61 +- libavcodec/parser.h | 8 +- libavcodec/pcm-bluray.c | 19 +- libavcodec/pcm-dvd.c | 46 +- libavcodec/pcm.c | 183 +- libavcodec/pcm_tablegen.c | 8 +- libavcodec/pcm_tablegen.h | 8 +- libavcodec/pcx.c | 129 +- libavcodec/pcxenc.c | 30 +- libavcodec/pgssubdec.c | 245 +- libavcodec/pictordec.c | 50 +- libavcodec/pixels.h | 8 +- libavcodec/png.c | 17 +- libavcodec/png.h | 15 +- libavcodec/png_parser.c | 27 +- libavcodec/pngdec.c | 582 +- libavcodec/pngdsp.c | 8 +- libavcodec/pngdsp.h | 8 +- libavcodec/pngenc.c | 158 +- libavcodec/pnm.c | 68 +- libavcodec/pnm.h | 8 +- libavcodec/pnm_parser.c | 8 +- libavcodec/pnmdec.c | 113 +- libavcodec/pnmenc.c | 22 +- libavcodec/ppc/asm.S | 16 +- libavcodec/ppc/dsputil_altivec.c | 8 +- libavcodec/ppc/dsputil_altivec.h | 8 +- libavcodec/ppc/dsputil_ppc.c | 13 +- libavcodec/ppc/fdct_altivec.c | 8 +- libavcodec/ppc/fft_altivec.c | 8 +- libavcodec/ppc/fft_altivec_s.S | 8 +- libavcodec/ppc/fmtconvert_altivec.c | 8 +- libavcodec/ppc/gmc_altivec.c | 12 +- libavcodec/ppc/h264chroma_init.c | 8 +- libavcodec/ppc/h264chroma_template.c | 8 +- libavcodec/ppc/h264dsp.c | 8 +- libavcodec/ppc/h264qpel.c | 8 +- libavcodec/ppc/h264qpel_template.c | 8 +- libavcodec/ppc/hpeldsp_altivec.c | 8 +- libavcodec/ppc/hpeldsp_altivec.h | 8 +- libavcodec/ppc/idct_altivec.c | 12 +- libavcodec/ppc/int_altivec.c | 8 +- libavcodec/ppc/mathops.h | 8 +- libavcodec/ppc/mpegaudiodsp_altivec.c | 8 +- libavcodec/ppc/mpegvideo_altivec.c | 8 +- libavcodec/ppc/vc1dsp_altivec.c | 8 +- libavcodec/ppc/videodsp_ppc.c | 8 +- libavcodec/ppc/vorbisdsp_altivec.c | 8 +- libavcodec/ppc/vp3dsp_altivec.c | 8 +- libavcodec/ppc/vp8dsp_altivec.c | 8 +- libavcodec/proresdata.c | 8 +- libavcodec/proresdata.h | 8 +- libavcodec/{proresdec_lgpl.c => proresdec.c} | 20 +- libavcodec/proresdec.h | 55 - libavcodec/proresdec2.c | 688 -- libavcodec/proresdsp.c | 16 +- libavcodec/proresdsp.h | 13 +- .../{proresenc_kostya.c => proresenc.c} | 24 +- libavcodec/proresenc_anatoliy.c | 626 -- libavcodec/psymodel.c | 34 +- libavcodec/psymodel.h | 10 +- libavcodec/pthread.c | 8 +- libavcodec/pthread_frame.c | 158 +- libavcodec/pthread_internal.h | 8 +- libavcodec/pthread_slice.c | 78 +- libavcodec/ptx.c | 20 +- libavcodec/put_bits.h | 19 +- libavcodec/qcelpdata.h | 40 +- libavcodec/qcelpdec.c | 46 +- libavcodec/qdm2.c | 135 +- libavcodec/qdm2_tablegen.c | 8 +- libavcodec/qdm2_tablegen.h | 29 +- libavcodec/qdm2data.h | 8 +- libavcodec/qdrw.c | 14 +- libavcodec/qpeg.c | 59 +- libavcodec/qtrle.c | 76 +- libavcodec/qtrleenc.c | 156 +- libavcodec/r210dec.c | 29 +- libavcodec/r210enc.c | 123 - libavcodec/ra144.c | 37 +- libavcodec/ra144.h | 20 +- libavcodec/ra144dec.c | 23 +- libavcodec/ra144enc.c | 30 +- libavcodec/ra288.c | 27 +- libavcodec/ra288.h | 8 +- libavcodec/ralf.c | 12 +- libavcodec/ralfdata.h | 8 +- libavcodec/rangecoder.c | 15 +- libavcodec/rangecoder.h | 16 +- libavcodec/ratecontrol.c | 71 +- libavcodec/ratecontrol.h | 16 +- libavcodec/raw.c | 91 +- libavcodec/raw.h | 18 +- libavcodec/rawdec.c | 219 +- libavcodec/rawenc.c | 12 +- libavcodec/rdft.c | 8 +- libavcodec/rdft.h | 8 +- libavcodec/realtextdec.c | 83 - libavcodec/rectangle.h | 21 +- libavcodec/remove_extradata_bsf.c | 13 +- libavcodec/resample.c | 435 - libavcodec/resample2.c | 319 - libavcodec/rl.h | 8 +- libavcodec/rl2.c | 16 +- libavcodec/rle.c | 8 +- libavcodec/rle.h | 8 +- libavcodec/rnd_avg.h | 11 +- libavcodec/roqaudioenc.c | 16 +- libavcodec/roqvideo.c | 8 +- libavcodec/roqvideo.h | 12 +- libavcodec/roqvideodec.c | 33 +- libavcodec/roqvideoenc.c | 79 +- libavcodec/rpza.c | 20 +- libavcodec/rtjpeg.c | 8 +- libavcodec/rtjpeg.h | 8 +- libavcodec/rv10.c | 77 +- libavcodec/rv10enc.c | 8 +- libavcodec/rv20enc.c | 20 +- libavcodec/rv30.c | 25 +- libavcodec/rv30data.h | 10 +- libavcodec/rv30dsp.c | 8 +- libavcodec/rv34.c | 60 +- libavcodec/rv34.h | 10 +- libavcodec/rv34_parser.c | 8 +- libavcodec/rv34data.h | 8 +- libavcodec/rv34dsp.c | 8 +- libavcodec/rv34dsp.h | 8 +- libavcodec/rv34vlc.h | 8 +- libavcodec/rv40.c | 15 +- libavcodec/rv40data.h | 8 +- libavcodec/rv40dsp.c | 13 +- libavcodec/rv40vlc2.h | 8 +- libavcodec/s302m.c | 37 +- libavcodec/s302menc.c | 178 - libavcodec/s3tc.c | 8 +- libavcodec/s3tc.h | 8 +- libavcodec/samidec.c | 158 - libavcodec/sanm.c | 267 +- libavcodec/sbr.h | 38 +- libavcodec/sbrdsp.c | 11 +- libavcodec/sbrdsp.h | 9 +- libavcodec/sgi.h | 8 +- libavcodec/sgidec.c | 53 +- libavcodec/sgienc.c | 23 +- libavcodec/sgirledec.c | 18 +- libavcodec/sh4/README | 6 - libavcodec/shorten.c | 90 +- libavcodec/simple_idct.c | 16 +- libavcodec/simple_idct.h | 13 +- libavcodec/simple_idct_template.c | 58 +- libavcodec/sinewin.c | 8 +- libavcodec/sinewin.h | 8 +- libavcodec/sinewin_tablegen.c | 8 +- libavcodec/sinewin_tablegen.h | 8 +- libavcodec/sipr.c | 12 +- libavcodec/sipr.h | 8 +- libavcodec/sipr16k.c | 9 +- libavcodec/sipr16kdata.h | 8 +- libavcodec/siprdata.h | 8 +- libavcodec/smacker.c | 169 +- libavcodec/smc.c | 14 +- libavcodec/smvjpegdec.c | 209 - libavcodec/snow.c | 709 -- libavcodec/snow.h | 706 -- libavcodec/snow_dwt.c | 865 -- libavcodec/snow_dwt.h | 127 - libavcodec/snowdata.h | 132 - libavcodec/snowdec.c | 607 - libavcodec/snowenc.c | 2005 ---- libavcodec/sonic.c | 1094 -- libavcodec/sp5x.h | 8 +- libavcodec/sp5xdec.c | 19 +- libavcodec/sparc/README | 6 - libavcodec/srtdec.c | 91 +- libavcodec/srtenc.c | 332 - libavcodec/startcode.c | 57 - libavcodec/startcode.h | 35 - libavcodec/subviewerdec.c | 83 - libavcodec/sunrast.c | 63 +- libavcodec/sunrast.h | 8 +- libavcodec/sunrastenc.c | 35 +- libavcodec/svq1.c | 8 +- libavcodec/svq1.h | 8 +- libavcodec/svq13.c | 8 +- libavcodec/svq1_cb.h | 8 +- libavcodec/svq1_vlc.h | 8 +- libavcodec/svq1dec.c | 64 +- libavcodec/svq1enc.c | 63 +- libavcodec/svq1enc_cb.h | 8 +- libavcodec/svq3.c | 127 +- libavcodec/svq3.h | 8 +- libavcodec/synth_filter.c | 8 +- libavcodec/synth_filter.h | 8 +- libavcodec/tableprint.h | 8 +- libavcodec/tak.c | 58 +- libavcodec/tak.h | 13 +- libavcodec/tak_parser.c | 32 +- libavcodec/takdec.c | 345 +- libavcodec/targa.c | 161 +- libavcodec/targa.h | 15 +- libavcodec/targa_y216dec.c | 83 - libavcodec/targaenc.c | 48 +- libavcodec/textdec.c | 149 - libavcodec/thread.h | 23 +- libavcodec/tiertexseqv.c | 14 +- libavcodec/tiff.c | 804 +- libavcodec/tiff.h | 111 +- libavcodec/tiff_common.c | 313 - libavcodec/tiff_common.h | 152 - libavcodec/tiff_data.c | 1870 --- libavcodec/tiff_data.h | 92 - libavcodec/tiffenc.c | 230 +- libavcodec/tmv.c | 16 +- libavcodec/tpel_template.c | 8 +- libavcodec/tpeldsp.c | 8 +- libavcodec/tpeldsp.h | 8 +- libavcodec/truemotion1.c | 18 +- libavcodec/truemotion1data.h | 8 +- libavcodec/truemotion2.c | 108 +- libavcodec/truespeech.c | 12 +- libavcodec/truespeech_data.h | 8 +- libavcodec/tscc.c | 24 +- libavcodec/tscc2.c | 12 +- libavcodec/tscc2data.h | 8 +- libavcodec/tta.c | 367 +- libavcodec/ttadata.c | 52 - libavcodec/ttadata.h | 50 - libavcodec/ttadsp.c | 57 - libavcodec/ttadsp.h | 34 - libavcodec/ttaenc.c | 232 - libavcodec/twinvq.c | 12 +- libavcodec/twinvq.h | 8 +- libavcodec/twinvq_data.h | 8 +- libavcodec/twinvqdec.c | 10 +- libavcodec/txd.c | 22 +- libavcodec/ulti.c | 12 +- libavcodec/ulti_cb.h | 8 +- libavcodec/unary.h | 8 +- libavcodec/utils.c | 1803 +-- libavcodec/utvideo.c | 8 +- libavcodec/utvideo.h | 8 +- libavcodec/utvideodec.c | 16 +- libavcodec/utvideoenc.c | 29 +- libavcodec/v210dec.c | 128 +- libavcodec/v210dec.h | 36 - libavcodec/v210enc.c | 24 +- libavcodec/v210x.c | 8 +- libavcodec/v308dec.c | 83 - libavcodec/v308enc.c | 94 - libavcodec/v408dec.c | 103 - libavcodec/v408enc.c | 113 - libavcodec/v410dec.c | 16 +- libavcodec/v410enc.c | 14 +- libavcodec/vaapi.c | 33 +- libavcodec/vaapi.h | 12 +- libavcodec/vaapi_h264.c | 23 +- libavcodec/vaapi_internal.h | 8 +- libavcodec/vaapi_mpeg.c | 48 - libavcodec/vaapi_mpeg2.c | 12 +- libavcodec/vaapi_mpeg4.c | 21 +- libavcodec/vaapi_vc1.c | 12 +- libavcodec/vb.c | 18 +- libavcodec/vble.c | 107 +- libavcodec/vc1.c | 134 +- libavcodec/vc1.h | 31 +- libavcodec/vc1_parser.c | 289 +- libavcodec/vc1acdata.h | 8 +- libavcodec/vc1data.c | 22 +- libavcodec/vc1data.h | 26 +- libavcodec/vc1dec.c | 388 +- libavcodec/vc1dsp.c | 180 +- libavcodec/vc1dsp.h | 22 +- libavcodec/vcr1.c | 45 +- libavcodec/vda.c | 8 +- libavcodec/vda.h | 30 +- libavcodec/vda_h264.c | 75 +- libavcodec/vda_h264_dec.c | 273 - libavcodec/vda_internal.h | 8 +- libavcodec/vdpau.c | 376 +- libavcodec/vdpau.h | 44 +- libavcodec/vdpau_h264.c | 32 +- libavcodec/vdpau_internal.h | 33 +- libavcodec/vdpau_mpeg12.c | 8 +- libavcodec/vdpau_mpeg4.c | 8 +- libavcodec/vdpau_vc1.c | 12 +- libavcodec/version.h | 30 +- libavcodec/videodsp.c | 9 +- libavcodec/videodsp.h | 27 +- libavcodec/videodsp_template.c | 34 +- libavcodec/vima.c | 18 +- libavcodec/vmdav.c | 108 +- libavcodec/vmnc.c | 33 +- libavcodec/vorbis.c | 27 +- libavcodec/vorbis.h | 8 +- libavcodec/vorbis_data.c | 8 +- libavcodec/vorbis_enc_data.h | 20 +- libavcodec/vorbis_parser.c | 44 +- libavcodec/vorbis_parser.h | 26 +- libavcodec/vorbisdec.c | 191 +- libavcodec/vorbisdsp.c | 8 +- libavcodec/vorbisdsp.h | 8 +- libavcodec/vorbisenc.c | 33 +- libavcodec/vp3.c | 104 +- libavcodec/vp3_parser.c | 8 +- libavcodec/vp3data.h | 8 +- libavcodec/vp3dsp.c | 9 +- libavcodec/vp3dsp.h | 8 +- libavcodec/vp5.c | 37 +- libavcodec/vp56.c | 341 +- libavcodec/vp56.h | 44 +- libavcodec/vp56data.c | 8 +- libavcodec/vp56data.h | 8 +- libavcodec/vp56dsp.c | 8 +- libavcodec/vp56dsp.h | 8 +- libavcodec/vp56rac.c | 8 +- libavcodec/vp5data.h | 8 +- libavcodec/vp6.c | 92 +- libavcodec/vp6data.h | 8 +- libavcodec/vp6dsp.c | 8 +- libavcodec/vp8.c | 144 +- libavcodec/vp8.h | 15 +- libavcodec/vp8_parser.c | 8 +- libavcodec/vp8data.h | 8 +- libavcodec/vp8dsp.c | 24 +- libavcodec/vp8dsp.h | 8 +- libavcodec/vp9.c | 3772 +------ libavcodec/vp9.h | 355 +- libavcodec/vp9_parser.c | 118 - libavcodec/vp9block.c | 1684 +++ libavcodec/vp9data.c | 2133 ++++ libavcodec/vp9data.h | 2173 +--- libavcodec/vp9dsp.c | 1460 +-- libavcodec/vp9dsp.h | 118 - libavcodec/vp9mvs.c | 352 + libavcodec/vp9prob.c | 274 + libavcodec/vqavideo.c | 102 +- libavcodec/wavpack.c | 216 +- libavcodec/wavpack.h | 194 - libavcodec/wavpackenc.c | 2989 ----- libavcodec/wavpackenc.h | 664 -- libavcodec/webp.c | 56 +- libavcodec/webvttdec.c | 100 - libavcodec/webvttenc.c | 219 - libavcodec/wma.c | 28 +- libavcodec/wma.h | 10 +- libavcodec/wma_common.c | 8 +- libavcodec/wma_common.h | 8 +- libavcodec/wmadata.h | 10 +- libavcodec/wmadec.c | 49 +- libavcodec/wmaenc.c | 86 +- libavcodec/wmalosslessdec.c | 75 +- libavcodec/wmaprodata.h | 8 +- libavcodec/wmaprodec.c | 54 +- libavcodec/wmavoice.c | 32 +- libavcodec/wmavoice_data.h | 8 +- libavcodec/wmv2.c | 14 +- libavcodec/wmv2.h | 10 +- libavcodec/wmv2dec.c | 12 +- libavcodec/wmv2dsp.c | 8 +- libavcodec/wmv2dsp.h | 8 +- libavcodec/wmv2enc.c | 25 +- libavcodec/wnv1.c | 18 +- libavcodec/ws-snd1.c | 14 +- libavcodec/x86/Makefile | 29 +- libavcodec/x86/ac3dsp.asm | 8 +- libavcodec/x86/ac3dsp_init.c | 13 +- libavcodec/x86/cabac.h | 58 +- libavcodec/x86/cavsdsp.c | 141 +- libavcodec/x86/constants.c | 8 +- libavcodec/x86/constants.h | 10 +- libavcodec/x86/dca.h | 8 +- libavcodec/x86/dcadsp.asm | 19 +- libavcodec/x86/dcadsp_init.c | 13 +- libavcodec/x86/dct32.asm | 10 +- libavcodec/x86/dct_init.c | 8 +- libavcodec/x86/deinterlace.asm | 8 +- libavcodec/x86/dirac_dwt.c | 202 - libavcodec/x86/dirac_dwt.h | 30 - libavcodec/x86/diracdsp_mmx.c | 157 - libavcodec/x86/diracdsp_mmx.h | 47 - libavcodec/x86/diracdsp_yasm.asm | 264 - libavcodec/x86/dnxhdenc.asm | 8 +- libavcodec/x86/dnxhdenc_init.c | 8 +- libavcodec/x86/dsputil.asm | 230 +- libavcodec/x86/dsputil_init.c | 86 +- libavcodec/x86/dsputil_mmx.c | 214 +- libavcodec/x86/dsputil_qns_template.c | 10 +- libavcodec/x86/dsputil_x86.c | 8 +- libavcodec/x86/dsputil_x86.h | 19 +- libavcodec/x86/dsputilenc.asm | 44 +- libavcodec/x86/dsputilenc_mmx.c | 161 +- libavcodec/x86/dwt_yasm.asm | 306 - libavcodec/x86/fdct.c | 12 +- libavcodec/x86/fft.asm | 23 +- libavcodec/x86/fft.h | 8 +- libavcodec/x86/fft_init.c | 8 +- libavcodec/x86/flacdsp.asm | 74 - libavcodec/x86/flacdsp_init.c | 45 - libavcodec/x86/fmtconvert.asm | 8 +- libavcodec/x86/fmtconvert_init.c | 8 +- libavcodec/x86/fpel.asm | 138 +- libavcodec/x86/fpel.h | 10 +- libavcodec/x86/fpel_mmx.c | 140 + libavcodec/x86/h263_loopfilter.asm | 10 +- libavcodec/x86/h263dsp_init.c | 8 +- libavcodec/x86/h264_chromamc.asm | 8 +- libavcodec/x86/h264_chromamc_10bit.asm | 12 +- libavcodec/x86/h264_deblock.asm | 20 +- libavcodec/x86/h264_deblock_10bit.asm | 16 +- libavcodec/x86/h264_i386.h | 14 +- libavcodec/x86/h264_idct.asm | 8 +- libavcodec/x86/h264_idct_10bit.asm | 24 +- libavcodec/x86/h264_intrapred.asm | 13 +- libavcodec/x86/h264_intrapred_10bit.asm | 50 +- libavcodec/x86/h264_intrapred_init.c | 8 +- libavcodec/x86/h264_qpel.c | 26 +- libavcodec/x86/h264_qpel_10bit.asm | 8 +- libavcodec/x86/h264_qpel_8bit.asm | 8 +- libavcodec/x86/h264_weight.asm | 15 +- libavcodec/x86/h264_weight_10bit.asm | 8 +- libavcodec/x86/h264chroma_init.c | 8 +- libavcodec/x86/h264dsp_init.c | 10 +- libavcodec/x86/hevc_deblock.asm | 831 -- libavcodec/x86/hevc_mc.asm | 1261 --- libavcodec/x86/hevcdsp.h | 123 - libavcodec/x86/hevcdsp_init.c | 414 - libavcodec/x86/hpeldsp.asm | 329 +- libavcodec/x86/hpeldsp.h | 23 +- libavcodec/x86/hpeldsp_init.c | 80 +- libavcodec/x86/hpeldsp_mmx.c | 53 + libavcodec/x86/hpeldsp_rnd_template.c | 8 +- libavcodec/x86/idct_mmx_xvid.c | 8 +- libavcodec/x86/idct_sse2_xvid.c | 29 +- libavcodec/x86/idct_xvid.h | 8 +- libavcodec/x86/imdct36.asm | 35 +- libavcodec/x86/inline_asm.h | 8 +- libavcodec/x86/lossless_videodsp.asm | 292 - libavcodec/x86/lossless_videodsp_init.c | 62 - libavcodec/x86/lpc.c | 14 +- libavcodec/x86/mathops.h | 13 +- libavcodec/x86/mlpdsp.c | 13 +- libavcodec/x86/motion_est.c | 33 +- libavcodec/x86/mpeg4qpel.asm | 10 +- libavcodec/x86/mpegaudiodsp.c | 47 +- libavcodec/x86/mpegvideo.c | 28 +- libavcodec/x86/mpegvideoenc.c | 22 +- libavcodec/x86/mpegvideoenc_template.c | 71 +- libavcodec/x86/pngdsp.asm | 8 +- libavcodec/x86/pngdsp_init.c | 8 +- libavcodec/x86/proresdsp.asm | 134 +- libavcodec/x86/proresdsp_init.c | 10 +- libavcodec/x86/qpel.asm | 8 +- libavcodec/x86/rnd_template.c | 8 +- libavcodec/x86/rv34dsp.asm | 8 +- libavcodec/x86/rv34dsp_init.c | 8 +- libavcodec/x86/rv40dsp.asm | 8 +- libavcodec/x86/rv40dsp_init.c | 58 +- libavcodec/x86/sbrdsp.asm | 214 +- libavcodec/x86/sbrdsp_init.c | 30 +- libavcodec/x86/simple_idct.c | 12 +- libavcodec/x86/snowdsp.c | 909 -- libavcodec/x86/ttadsp.asm | 119 - libavcodec/x86/ttadsp_init.c | 42 - libavcodec/x86/v210-init.c | 48 - libavcodec/x86/v210.asm | 88 - libavcodec/x86/vc1dsp.asm | 8 +- libavcodec/x86/vc1dsp.h | 8 +- libavcodec/x86/vc1dsp_init.c | 15 +- libavcodec/x86/vc1dsp_mmx.c | 120 +- libavcodec/x86/videodsp.asm | 60 +- libavcodec/x86/videodsp_init.c | 45 +- libavcodec/x86/vorbisdsp.asm | 8 +- libavcodec/x86/vorbisdsp_init.c | 8 +- libavcodec/x86/vp3dsp.asm | 8 +- libavcodec/x86/vp3dsp_init.c | 71 +- libavcodec/x86/vp56_arith.h | 23 +- libavcodec/x86/vp6dsp.asm | 8 +- libavcodec/x86/vp6dsp_init.c | 8 +- libavcodec/x86/vp8dsp.asm | 8 +- libavcodec/x86/vp8dsp_init.c | 16 +- libavcodec/x86/vp8dsp_loopfilter.asm | 8 +- libavcodec/x86/{vp9mc.asm => vp9dsp.asm} | 155 +- libavcodec/x86/vp9dsp_init.c | 389 +- libavcodec/x86/vp9intrapred.asm | 1405 --- libavcodec/x86/vp9itxfm.asm | 1669 --- libavcodec/x86/vp9lpf.asm | 817 -- libavcodec/x86/w64xmmtest.c | 15 +- libavcodec/xan.c | 102 +- libavcodec/xbmdec.c | 124 +- libavcodec/xbmenc.c | 33 +- libavcodec/xface.c | 381 - libavcodec/xface.h | 95 - libavcodec/xfacedec.c | 188 - libavcodec/xfaceenc.c | 238 - libavcodec/xiph.c | 10 +- libavcodec/xiph.h | 10 +- libavcodec/xl.c | 15 +- libavcodec/xsubdec.c | 17 +- libavcodec/xsubenc.c | 20 +- libavcodec/xvmc.h | 12 +- libavcodec/xvmc_internal.h | 15 +- libavcodec/xwd.h | 8 +- libavcodec/xwddec.c | 21 +- libavcodec/xwdenc.c | 45 +- libavcodec/xxan.c | 33 +- libavcodec/y41pdec.c | 92 - libavcodec/y41penc.c | 102 - libavcodec/yop.c | 48 +- libavcodec/yuv4dec.c | 84 - libavcodec/yuv4enc.c | 91 - libavcodec/zerocodec.c | 6 +- libavcodec/zmbv.c | 123 +- libavcodec/zmbvenc.c | 12 +- libavdevice/Makefile | 42 +- libavdevice/alldevices.c | 28 +- libavdevice/alsa-audio-common.c | 85 +- libavdevice/alsa-audio-dec.c | 63 +- libavdevice/alsa-audio-enc.c | 63 +- libavdevice/alsa-audio.h | 22 +- libavdevice/avdevice.c | 205 +- libavdevice/avdevice.h | 428 +- libavdevice/avdeviceres.rc | 55 - libavdevice/avfoundation.m | 374 - libavdevice/bktr.c | 30 +- libavdevice/caca.c | 241 - libavdevice/decklink_enc.cpp | 588 - libavdevice/decklink_enc.h | 43 - libavdevice/decklink_enc_c.c | 56 - libavdevice/dshow.c | 1098 -- libavdevice/dshow_capture.h | 279 - libavdevice/dshow_common.c | 190 - libavdevice/dshow_enummediatypes.c | 103 - libavdevice/dshow_enumpins.c | 105 - libavdevice/dshow_filter.c | 202 - libavdevice/dshow_pin.c | 362 - libavdevice/dv1394.c | 13 +- libavdevice/dv1394.h | 8 +- libavdevice/{fbdev_dec.c => fbdev.c} | 94 +- libavdevice/fbdev_common.c | 129 - libavdevice/fbdev_common.h | 38 - libavdevice/fbdev_enc.c | 220 - libavdevice/gdigrab.c | 630 -- libavdevice/iec61883.c | 498 - libavdevice/jack_audio.c | 33 +- libavdevice/lavfi.c | 440 - libavdevice/libcdio.c | 11 +- libavdevice/libdc1394.c | 9 +- libavdevice/openal-dec.c | 253 - libavdevice/opengl_enc.c | 1306 --- libavdevice/opengl_enc_shaders.h | 188 - libavdevice/oss_audio.c | 26 +- libavdevice/{pulse_audio_dec.c => pulse.c} | 80 +- libavdevice/pulse_audio_common.c | 249 - libavdevice/pulse_audio_common.h | 38 - libavdevice/pulse_audio_enc.c | 796 -- libavdevice/qtkit.m | 358 - libavdevice/sdl.c | 375 - libavdevice/sndio_common.c | 10 +- libavdevice/sndio_common.h | 10 +- libavdevice/sndio_dec.c | 9 +- libavdevice/sndio_enc.c | 19 +- libavdevice/timefilter.c | 52 +- libavdevice/timefilter.h | 27 +- libavdevice/v4l.c | 363 - libavdevice/v4l2-common.c | 102 - libavdevice/v4l2-common.h | 62 - libavdevice/v4l2.c | 817 +- libavdevice/v4l2enc.c | 118 - libavdevice/version.h | 16 +- libavdevice/vfwcap.c | 54 +- libavdevice/x11grab.c | 106 +- libavdevice/xv.c | 367 - libavfilter/Makefile | 164 +- libavfilter/aeval.c | 466 - libavfilter/af_aconvert.c | 196 - libavfilter/af_adelay.c | 282 - libavfilter/af_aecho.c | 359 - libavfilter/af_afade.c | 300 - libavfilter/af_aformat.c | 29 +- libavfilter/af_amerge.c | 350 - libavfilter/af_amix.c | 50 +- libavfilter/af_anull.c | 27 +- libavfilter/af_apad.c | 155 - libavfilter/af_aphaser.c | 358 - libavfilter/af_aresample.c | 318 - libavfilter/af_asetnsamples.c | 196 - libavfilter/af_asetrate.c | 119 - libavfilter/af_ashowinfo.c | 55 +- libavfilter/af_astats.c | 274 - libavfilter/af_astreamsync.c | 240 - libavfilter/af_asyncts.c | 39 +- libavfilter/af_atempo.c | 1196 -- libavfilter/af_biquads.c | 620 - libavfilter/af_bs2b.c | 16 +- libavfilter/af_channelmap.c | 28 +- libavfilter/af_channelsplit.c | 40 +- libavfilter/af_compand.c | 139 +- libavfilter/af_earwax.c | 172 - libavfilter/af_join.c | 53 +- libavfilter/af_ladspa.c | 705 -- libavfilter/af_pan.c | 427 - libavfilter/af_replaygain.c | 613 - libavfilter/af_resample.c | 27 +- libavfilter/af_silencedetect.c | 212 - libavfilter/af_volume.c | 204 +- libavfilter/af_volume.h | 36 +- libavfilter/af_volumedetect.c | 159 - libavfilter/all_channel_layouts.inc | 68 - libavfilter/allfilters.c | 137 +- libavfilter/asink_anullsink.c | 10 +- libavfilter/asrc_abuffer.h | 91 - libavfilter/asrc_anullsrc.c | 117 +- libavfilter/asrc_flite.c | 283 - libavfilter/asrc_sine.c | 223 - libavfilter/audio.c | 58 +- libavfilter/audio.h | 50 +- libavfilter/avcodec.c | 157 - libavfilter/avcodec.h | 110 - libavfilter/avf_avectorscope.c | 274 - libavfilter/avf_concat.c | 426 - libavfilter/avf_showspectrum.c | 527 - libavfilter/avf_showwaves.c | 256 - libavfilter/avfilter.c | 606 +- libavfilter/avfilter.h | 462 +- libavfilter/avfiltergraph.c | 598 +- libavfilter/avfiltergraph.h | 9 +- libavfilter/avfilterres.rc | 55 - libavfilter/bbox.c | 75 - libavfilter/bbox.h | 44 - libavfilter/buffer.c | 106 +- libavfilter/bufferqueue.h | 121 - libavfilter/buffersink.c | 426 +- libavfilter/buffersink.h | 102 +- libavfilter/buffersrc.c | 198 +- libavfilter/buffersrc.h | 83 +- libavfilter/deshake.h | 103 - libavfilter/deshake_opencl.c | 200 - libavfilter/deshake_opencl.h | 45 - libavfilter/deshake_opencl_kernel.h | 225 - libavfilter/drawutils.c | 489 +- libavfilter/drawutils.h | 120 +- libavfilter/dualinput.c | 83 - libavfilter/dualinput.h | 46 - libavfilter/f_ebur128.c | 941 -- libavfilter/f_interleave.c | 259 - libavfilter/f_perms.c | 178 - libavfilter/f_select.c | 533 - libavfilter/f_sendcmd.c | 576 - libavfilter/f_zmq.c | 275 - libavfilter/fifo.c | 12 +- libavfilter/filtfmts.c | 77 +- libavfilter/formats.c | 332 +- libavfilter/formats.h | 65 +- libavfilter/framesync.c | 329 - libavfilter/framesync.h | 296 - libavfilter/gradfun.h | 16 +- libavfilter/graphdump.c | 165 - libavfilter/graphparser.c | 133 +- libavfilter/internal.h | 163 +- libavfilter/lavfutils.c | 103 - libavfilter/lavfutils.h | 43 - libavfilter/libavfilter.v | 1 - libavfilter/libmpcodecs/av_helpers.h | 27 - libavfilter/libmpcodecs/cpudetect.h | 60 - libavfilter/libmpcodecs/img_format.c | 244 - libavfilter/libmpcodecs/img_format.h | 309 - libavfilter/libmpcodecs/libvo/fastmemcpy.h | 99 - libavfilter/libmpcodecs/libvo/video_out.h | 300 - libavfilter/libmpcodecs/mp_image.c | 257 - libavfilter/libmpcodecs/mp_image.h | 159 - libavfilter/libmpcodecs/mp_msg.h | 166 - libavfilter/libmpcodecs/mpc_info.h | 43 - libavfilter/libmpcodecs/vf.h | 169 - libavfilter/libmpcodecs/vf_eq.c | 240 - libavfilter/libmpcodecs/vf_eq2.c | 519 - libavfilter/libmpcodecs/vf_fspp.c | 2125 ---- libavfilter/libmpcodecs/vf_ilpack.c | 458 - libavfilter/libmpcodecs/vf_pp7.c | 491 - libavfilter/libmpcodecs/vf_softpulldown.c | 163 - libavfilter/libmpcodecs/vf_uspp.c | 394 - libavfilter/libmpcodecs/vfcap.h | 56 - libavfilter/lswsutils.c | 50 - libavfilter/lswsutils.h | 38 - libavfilter/opencl_allkernels.c | 41 - libavfilter/opencl_allkernels.h | 29 - libavfilter/pthread.c | 13 +- libavfilter/setpts.c | 163 +- libavfilter/settb.c | 73 +- libavfilter/split.c | 88 +- libavfilter/src_movie.c | 613 - libavfilter/thread.h | 8 +- libavfilter/transform.c | 201 - libavfilter/transform.h | 127 - libavfilter/trim.c | 121 +- libavfilter/unsharp.h | 81 - libavfilter/unsharp_opencl.c | 389 - libavfilter/unsharp_opencl.h | 34 - libavfilter/unsharp_opencl_kernel.h | 286 - libavfilter/version.h | 31 +- libavfilter/vf_alphamerge.c | 207 - libavfilter/vf_aspect.c | 184 +- libavfilter/vf_bbox.c | 134 - libavfilter/vf_blackdetect.c | 209 - libavfilter/vf_blackframe.c | 59 +- libavfilter/vf_blend.c | 465 - libavfilter/vf_boxblur.c | 99 +- libavfilter/vf_colorbalance.c | 213 - libavfilter/vf_colorchannelmixer.c | 360 - libavfilter/vf_colormatrix.c | 411 - libavfilter/vf_copy.c | 22 +- libavfilter/vf_crop.c | 158 +- libavfilter/vf_cropdetect.c | 74 +- libavfilter/vf_curves.c | 570 - libavfilter/vf_dctdnoiz.c | 433 - libavfilter/vf_decimate.c | 403 - libavfilter/vf_dejudder.c | 187 - libavfilter/vf_delogo.c | 125 +- libavfilter/vf_deshake.c | 580 - libavfilter/vf_drawbox.c | 333 +- libavfilter/vf_drawtext.c | 1240 +- libavfilter/vf_edgedetect.c | 394 - libavfilter/vf_elbg.c | 212 - libavfilter/vf_extractplanes.c | 335 - libavfilter/vf_fade.c | 305 +- libavfilter/vf_field.c | 111 - libavfilter/vf_fieldmatch.c | 984 -- libavfilter/vf_fieldorder.c | 97 +- libavfilter/vf_format.c | 188 +- libavfilter/vf_fps.c | 87 +- libavfilter/vf_framepack.c | 8 +- libavfilter/vf_framestep.c | 101 - libavfilter/vf_frei0r.c | 175 +- libavfilter/vf_geq.c | 280 - libavfilter/vf_gradfun.c | 54 +- libavfilter/vf_hflip.c | 139 +- libavfilter/vf_histeq.c | 281 - libavfilter/vf_histogram.c | 376 - libavfilter/vf_hqdn3d.c | 74 +- libavfilter/vf_hqdn3d.h | 12 +- libavfilter/vf_hue.c | 453 - libavfilter/vf_idet.c | 308 - libavfilter/vf_il.c | 212 - libavfilter/vf_interlace.c | 58 +- libavfilter/vf_kerndeint.c | 318 - libavfilter/vf_libopencv.c | 62 +- libavfilter/vf_lut.c | 220 +- libavfilter/vf_lut3d.c | 815 -- libavfilter/vf_mcdeint.c | 315 - libavfilter/vf_mergeplanes.c | 313 - libavfilter/vf_mp.c | 794 -- libavfilter/vf_mpdecimate.c | 257 - libavfilter/vf_noise.c | 490 - libavfilter/vf_null.c | 23 +- libavfilter/vf_overlay.c | 683 +- libavfilter/vf_owdenoise.c | 342 - libavfilter/vf_pad.c | 209 +- libavfilter/vf_perspective.c | 403 - libavfilter/vf_phase.c | 329 - libavfilter/vf_pixdesctest.c | 38 +- libavfilter/vf_pp.c | 186 - libavfilter/vf_psnr.c | 386 - libavfilter/vf_pullup.c | 780 -- libavfilter/vf_pullup.h | 71 - libavfilter/vf_removelogo.c | 585 - libavfilter/vf_rotate.c | 567 - libavfilter/vf_sab.c | 339 - libavfilter/vf_scale.c | 400 +- libavfilter/vf_select.c | 362 + libavfilter/vf_separatefields.c | 146 - libavfilter/vf_setfield.c | 94 - libavfilter/vf_showinfo.c | 75 +- libavfilter/vf_shuffleplanes.c | 10 +- libavfilter/vf_smartblur.c | 304 - libavfilter/vf_spp.c | 437 - libavfilter/vf_spp.h | 59 - libavfilter/vf_stereo3d.c | 664 -- libavfilter/vf_subtitles.c | 436 - libavfilter/vf_super2xsai.c | 352 - libavfilter/vf_swapuv.c | 110 - libavfilter/vf_telecine.c | 285 - libavfilter/vf_thumbnail.c | 239 - libavfilter/vf_tile.c | 245 - libavfilter/vf_tinterlace.c | 398 - libavfilter/vf_transpose.c | 221 +- libavfilter/vf_unsharp.c | 222 +- libavfilter/vf_vflip.c | 24 +- libavfilter/vf_vidstabdetect.c | 217 - libavfilter/vf_vidstabtransform.c | 319 - libavfilter/vf_vignette.c | 346 - libavfilter/vf_w3fdif.c | 394 - libavfilter/vf_yadif.c | 253 +- libavfilter/video.c | 17 +- libavfilter/video.h | 10 +- libavfilter/vidstabutils.c | 85 - libavfilter/vidstabutils.h | 36 - libavfilter/vsink_nullsink.c | 8 +- libavfilter/vsrc_cellauto.c | 337 - libavfilter/vsrc_color.c | 202 + libavfilter/vsrc_life.c | 450 - libavfilter/vsrc_mandelbrot.c | 430 - libavfilter/vsrc_movie.c | 286 + libavfilter/vsrc_mptestsrc.c | 361 - libavfilter/vsrc_nullsrc.c | 136 + libavfilter/vsrc_testsrc.c | 772 +- libavfilter/x86/Makefile | 5 +- libavfilter/x86/af_volume.asm | 10 +- libavfilter/x86/af_volume_init.c | 8 +- libavfilter/x86/vf_gradfun.asm | 8 +- libavfilter/x86/vf_gradfun_init.c | 61 +- libavfilter/x86/vf_hqdn3d.asm | 8 +- libavfilter/x86/vf_hqdn3d_init.c | 10 +- libavfilter/x86/vf_pullup.asm | 178 - libavfilter/x86/vf_pullup_init.c | 41 - libavfilter/x86/vf_spp.c | 233 - libavfilter/x86/vf_yadif.asm | 38 +- libavfilter/x86/vf_yadif_init.c | 68 +- libavfilter/x86/yadif-10.asm | 282 - libavfilter/x86/yadif-16.asm | 347 - libavfilter/yadif.h | 50 +- libavformat/4xm.c | 29 +- libavformat/Makefile | 125 +- libavformat/a64.c | 9 +- libavformat/aacdec.c | 26 +- libavformat/ac3dec.c | 77 +- libavformat/act.c | 207 - libavformat/adp.c | 98 - libavformat/adtsenc.c | 38 +- libavformat/adxdec.c | 16 +- libavformat/aea.c | 8 +- libavformat/afc.c | 79 - libavformat/aiff.h | 14 +- libavformat/aiffdec.c | 97 +- libavformat/aiffenc.c | 198 +- libavformat/allformats.c | 87 +- libavformat/amr.c | 28 +- libavformat/anm.c | 10 +- libavformat/apc.c | 19 +- libavformat/ape.c | 52 +- libavformat/apetag.c | 100 +- libavformat/apetag.h | 12 +- libavformat/aqtitledec.c | 148 - libavformat/asf.c | 9 +- libavformat/asf.h | 19 +- libavformat/asfcrypt.c | 8 +- libavformat/asfcrypt.h | 8 +- libavformat/asfdec.c | 305 +- libavformat/asfenc.c | 238 +- libavformat/assdec.c | 224 +- libavformat/assenc.c | 44 +- libavformat/ast.c | 29 - libavformat/ast.h | 30 - libavformat/astdec.c | 122 - libavformat/astenc.c | 214 - libavformat/au.c | 103 +- libavformat/audiointerleave.c | 41 +- libavformat/audiointerleave.h | 8 +- libavformat/avc.c | 8 +- libavformat/avc.h | 8 +- libavformat/avformat.h | 772 +- libavformat/avformatres.rc | 55 - libavformat/avi.h | 8 +- libavformat/avidec.c | 495 +- libavformat/avienc.c | 133 +- libavformat/avio.c | 122 +- libavformat/avio.h | 94 +- libavformat/avio_internal.h | 25 +- libavformat/aviobuf.c | 204 +- libavformat/avisynth.c | 48 +- libavformat/avlanguage.c | 8 +- libavformat/avlanguage.h | 8 +- libavformat/avr.c | 99 - libavformat/avs.c | 13 +- libavformat/bethsoftvid.c | 18 +- libavformat/bfi.c | 18 +- libavformat/bink.c | 40 +- libavformat/bintext.c | 388 - libavformat/bit.c | 156 - libavformat/bluray.c | 235 - libavformat/bmv.c | 8 +- libavformat/boadec.c | 78 - libavformat/brstm.c | 297 - libavformat/c93.c | 10 +- libavformat/cache.c | 140 - libavformat/caf.c | 56 +- libavformat/caf.h | 8 +- libavformat/cafdec.c | 53 +- libavformat/cafenc.c | 286 - libavformat/cavsvideodec.c | 8 +- libavformat/cdg.c | 15 +- libavformat/cdxl.c | 53 +- libavformat/cinedec.c | 301 - libavformat/concat.c | 13 +- libavformat/concatdec.c | 631 -- libavformat/crcenc.c | 9 +- libavformat/crypto.c | 14 +- libavformat/cutils.c | 29 +- libavformat/data_uri.c | 118 - libavformat/daud.c | 12 +- libavformat/dfa.c | 21 +- libavformat/diracdec.c | 23 +- libavformat/dnxhddec.c | 10 +- libavformat/dsfdec.c | 159 - libavformat/dsicin.c | 13 +- libavformat/dtsdec.c | 15 +- libavformat/dtshddec.c | 139 - libavformat/dv.c | 131 +- libavformat/dv.h | 10 +- libavformat/dvenc.c | 64 +- libavformat/dxa.c | 36 +- libavformat/eacdata.c | 17 +- libavformat/electronicarts.c | 111 +- libavformat/epafdec.c | 104 - libavformat/ffm.h | 11 +- libavformat/ffmdec.c | 188 +- libavformat/ffmenc.c | 68 +- libavformat/ffmeta.h | 8 +- libavformat/ffmetadec.c | 16 +- libavformat/ffmetaenc.c | 8 +- libavformat/file.c | 70 +- libavformat/filmstripdec.c | 12 +- libavformat/filmstripenc.c | 10 +- libavformat/flac_picture.c | 26 +- libavformat/flac_picture.h | 11 +- libavformat/flacdec.c | 86 +- libavformat/flacenc.c | 39 +- libavformat/flacenc.h | 8 +- libavformat/flacenc_header.c | 8 +- libavformat/flic.c | 23 +- libavformat/flv.h | 32 +- libavformat/flvdec.c | 281 +- libavformat/flvenc.c | 109 +- libavformat/format.c | 36 +- libavformat/framecrcenc.c | 35 +- libavformat/framehash.c | 11 +- libavformat/frmdec.c | 110 - libavformat/ftp.c | 766 -- libavformat/g722.c | 11 +- libavformat/g723_1.c | 10 +- libavformat/g729dec.c | 103 - libavformat/gif.c | 388 +- libavformat/gifdec.c | 334 - libavformat/golomb_tab.c | 1 - libavformat/gopher.c | 8 +- libavformat/gsmdec.c | 13 +- libavformat/gxf.c | 85 +- libavformat/gxf.h | 8 +- libavformat/gxfenc.c | 182 +- libavformat/h261dec.c | 45 +- libavformat/h263dec.c | 31 +- libavformat/h264dec.c | 8 +- libavformat/hdsenc.c | 34 +- libavformat/hevc.c | 8 +- libavformat/hevc.h | 10 +- libavformat/hevcdec.c | 8 +- libavformat/hls.c | 1527 +-- libavformat/hlsenc.c | 46 +- libavformat/hlsproto.c | 10 +- libavformat/hnm.c | 12 +- libavformat/http.c | 234 +- libavformat/http.h | 10 +- libavformat/httpauth.c | 13 +- libavformat/httpauth.h | 8 +- libavformat/icodec.c | 182 - libavformat/icoenc.c | 202 - libavformat/id3v1.c | 11 +- libavformat/id3v1.h | 8 +- libavformat/id3v2.c | 355 +- libavformat/id3v2.h | 36 +- libavformat/id3v2enc.c | 158 +- libavformat/idcin.c | 58 +- libavformat/idroqdec.c | 13 +- libavformat/idroqenc.c | 38 +- libavformat/iff.c | 585 +- libavformat/ilbc.c | 8 +- libavformat/img2.c | 14 +- libavformat/img2.h | 61 - libavformat/img2_alias_pix.c | 65 - libavformat/img2_brender_pix.c | 49 - libavformat/img2dec.c | 314 +- libavformat/img2enc.c | 132 +- libavformat/ingenientdec.c | 21 +- libavformat/internal.h | 79 +- libavformat/ipmovie.c | 50 +- libavformat/ircam.c | 47 - libavformat/ircam.h | 30 - libavformat/ircamdec.c | 115 - libavformat/ircamenc.c | 62 - libavformat/isom.c | 141 +- libavformat/isom.h | 28 +- libavformat/iss.c | 28 +- libavformat/iv8.c | 8 +- libavformat/ivfdec.c | 8 +- libavformat/ivfenc.c | 8 +- libavformat/jacosubdec.c | 271 - libavformat/jacosubenc.c | 42 - libavformat/jvdec.c | 22 +- libavformat/latmenc.c | 91 +- libavformat/libavformat.v | 33 - libavformat/libgme.c | 201 - libavformat/libmodplug.c | 382 - libavformat/libnut.c | 324 - libavformat/libquvi.c | 146 - libavformat/librtmp.c | 11 +- libavformat/libssh.c | 310 - libavformat/lmlm4.c | 14 +- libavformat/loasdec.c | 94 - libavformat/lvfdec.c | 152 - libavformat/lxfdec.c | 16 +- libavformat/m4vdec.c | 10 +- libavformat/matroska.c | 52 +- libavformat/matroska.h | 43 +- libavformat/matroskadec.c | 787 +- libavformat/matroskaenc.c | 634 +- libavformat/md5enc.c | 85 +- libavformat/md5proto.c | 8 +- libavformat/metadata.c | 10 +- libavformat/metadata.h | 8 +- libavformat/mgsts.c | 106 - libavformat/microdvddec.c | 203 - libavformat/microdvdenc.c | 67 - libavformat/mkvtimestamp_v2.c | 50 - libavformat/mlvdec.c | 471 - libavformat/mm.c | 9 +- libavformat/mmf.c | 92 +- libavformat/mms.c | 8 +- libavformat/mms.h | 8 +- libavformat/mmsh.c | 77 +- libavformat/mmst.c | 29 +- libavformat/mov.c | 844 +- libavformat/mov_chan.c | 11 +- libavformat/mov_chan.h | 8 +- libavformat/movenc.c | 1014 +- libavformat/movenc.h | 26 +- libavformat/movenchint.c | 17 +- libavformat/mp3dec.c | 214 +- libavformat/mp3enc.c | 159 +- libavformat/mpc.c | 17 +- libavformat/mpc8.c | 38 +- libavformat/mpeg.c | 584 +- libavformat/mpeg.h | 11 +- libavformat/mpegenc.c | 76 +- libavformat/mpegts.c | 825 +- libavformat/mpegts.h | 18 +- libavformat/mpegtsenc.c | 398 +- libavformat/mpegvideodec.c | 55 +- libavformat/mpjpeg.c | 19 +- libavformat/mpl2dec.c | 146 - libavformat/mpsubdec.c | 144 - libavformat/msnwc_tcp.c | 14 +- libavformat/mtv.c | 69 +- libavformat/mux.c | 547 +- libavformat/mvdec.c | 10 +- libavformat/mvi.c | 12 +- libavformat/mxf.c | 10 +- libavformat/mxf.h | 20 +- libavformat/mxfdec.c | 398 +- libavformat/mxfenc.c | 458 +- libavformat/mxg.c | 24 +- libavformat/ncdec.c | 10 +- libavformat/network.c | 56 +- libavformat/network.h | 23 +- libavformat/nistspheredec.c | 131 - libavformat/noproxy-test.c | 8 +- libavformat/nsvdec.c | 65 +- libavformat/nullenc.c | 10 +- libavformat/nut.c | 193 +- libavformat/nut.h | 16 +- libavformat/nutdec.c | 264 +- libavformat/nutenc.c | 433 +- libavformat/nuv.c | 101 +- libavformat/oggdec.c | 400 +- libavformat/oggdec.h | 9 +- libavformat/oggenc.c | 149 +- libavformat/oggparsecelt.c | 27 +- libavformat/oggparsedirac.c | 8 +- libavformat/oggparseflac.c | 38 +- libavformat/oggparseogm.c | 28 +- libavformat/oggparseopus.c | 100 +- libavformat/oggparseskeleton.c | 25 +- libavformat/oggparsespeex.c | 10 +- libavformat/oggparsetheora.c | 40 - libavformat/oggparsevorbis.c | 104 +- libavformat/oggparsevp8.c | 137 - libavformat/oma.c | 8 +- libavformat/oma.h | 8 +- libavformat/omadec.c | 28 +- libavformat/omaenc.c | 13 +- libavformat/options.c | 22 +- libavformat/options_table.h | 39 +- libavformat/os_support.c | 8 +- libavformat/os_support.h | 19 +- libavformat/paf.c | 21 +- libavformat/pcm.c | 26 +- libavformat/pcm.h | 9 +- libavformat/pcmdec.c | 68 +- libavformat/pcmenc.c | 8 +- libavformat/pjsdec.c | 138 - libavformat/pmpdec.c | 92 +- libavformat/psxstr.c | 69 +- libavformat/pva.c | 44 +- libavformat/pvfdec.c | 75 - libavformat/qcp.c | 16 +- libavformat/qtpalette.h | 8 +- libavformat/r3d.c | 19 +- libavformat/rawdec.c | 105 +- libavformat/rawdec.h | 10 +- libavformat/rawenc.c | 85 +- libavformat/rawenc.h | 8 +- libavformat/rawvideodec.c | 40 +- libavformat/rdt.c | 12 +- libavformat/rdt.h | 8 +- libavformat/realtextdec.c | 153 - libavformat/redspark.c | 170 - libavformat/replaygain.c | 11 +- libavformat/replaygain.h | 8 +- libavformat/riff.c | 47 +- libavformat/riff.h | 37 +- libavformat/riffdec.c | 65 +- libavformat/riffenc.c | 89 +- libavformat/rl2.c | 27 +- libavformat/rm.c | 8 +- libavformat/rm.h | 10 +- libavformat/rmdec.c | 236 +- libavformat/rmenc.c | 17 +- libavformat/rmsipr.c | 8 +- libavformat/rmsipr.h | 8 +- libavformat/rpl.c | 33 +- libavformat/rsd.c | 168 - libavformat/rso.c | 8 +- libavformat/rso.h | 8 +- libavformat/rsodec.c | 29 +- libavformat/rsoenc.c | 8 +- libavformat/rtmp.h | 8 +- libavformat/rtmpcrypt.c | 8 +- libavformat/rtmpcrypt.h | 8 +- libavformat/rtmpdh.c | 8 +- libavformat/rtmpdh.h | 8 +- libavformat/rtmphttp.c | 8 +- libavformat/rtmppkt.c | 9 +- libavformat/rtmppkt.h | 8 +- libavformat/rtmpproto.c | 49 +- libavformat/rtp.c | 11 +- libavformat/rtp.h | 8 +- libavformat/rtpdec.c | 17 +- libavformat/rtpdec.h | 12 +- libavformat/rtpdec_amr.c | 8 +- libavformat/rtpdec_asf.c | 8 +- libavformat/rtpdec_formats.h | 8 +- libavformat/rtpdec_g726.c | 8 +- libavformat/rtpdec_h263.c | 8 +- libavformat/rtpdec_h263_rfc2190.c | 8 +- libavformat/rtpdec_h264.c | 8 +- libavformat/rtpdec_ilbc.c | 8 +- libavformat/rtpdec_jpeg.c | 8 +- libavformat/rtpdec_latm.c | 13 +- libavformat/rtpdec_mpeg12.c | 8 +- libavformat/rtpdec_mpeg4.c | 14 +- libavformat/rtpdec_mpegts.c | 8 +- libavformat/rtpdec_qcelp.c | 8 +- libavformat/rtpdec_qdm2.c | 16 +- libavformat/rtpdec_qt.c | 8 +- libavformat/rtpdec_svq3.c | 13 +- libavformat/rtpdec_vp8.c | 8 +- libavformat/rtpdec_xiph.c | 22 +- libavformat/rtpenc.c | 25 +- libavformat/rtpenc.h | 12 +- libavformat/rtpenc_aac.c | 8 +- libavformat/rtpenc_amr.c | 8 +- libavformat/rtpenc_chain.c | 12 +- libavformat/rtpenc_chain.h | 8 +- libavformat/rtpenc_h263.c | 12 +- libavformat/rtpenc_h263_rfc2190.c | 8 +- libavformat/rtpenc_h264.c | 8 +- libavformat/rtpenc_jpeg.c | 8 +- libavformat/rtpenc_latm.c | 8 +- libavformat/rtpenc_mpv.c | 8 +- libavformat/rtpenc_vp8.c | 8 +- libavformat/rtpenc_xiph.c | 11 +- libavformat/rtpproto.c | 52 +- libavformat/rtpproto.h | 8 +- libavformat/rtsp.c | 64 +- libavformat/rtsp.h | 21 +- libavformat/rtspcodes.h | 118 +- libavformat/rtspdec.c | 14 +- libavformat/rtspenc.c | 11 +- libavformat/samidec.c | 137 - libavformat/sapdec.c | 8 +- libavformat/sapenc.c | 13 +- libavformat/sauce.c | 10 +- libavformat/sauce.h | 8 +- libavformat/sbgdec.c | 1511 --- libavformat/sctp.c | 16 +- libavformat/sdp.c | 26 +- libavformat/sdr2.c | 121 - libavformat/seek-test.c | 43 +- libavformat/seek.c | 8 +- libavformat/seek.h | 8 +- libavformat/segafilm.c | 85 +- libavformat/segment.c | 762 +- libavformat/sierravmd.c | 89 +- libavformat/siff.c | 62 +- libavformat/smacker.c | 67 +- libavformat/smjpeg.c | 8 +- libavformat/smjpeg.h | 8 +- libavformat/smjpegdec.c | 14 +- libavformat/smjpegenc.c | 10 +- libavformat/smoothstreamingenc.c | 24 +- libavformat/smush.c | 18 +- libavformat/sol.c | 15 +- libavformat/sox.h | 8 +- libavformat/soxdec.c | 38 +- libavformat/soxenc.c | 23 +- libavformat/spdif.c | 8 +- libavformat/spdif.h | 11 +- libavformat/spdifdec.c | 35 +- libavformat/spdifenc.c | 30 +- libavformat/srtdec.c | 145 +- libavformat/srtenc.c | 115 - libavformat/srtp.c | 8 +- libavformat/srtp.h | 8 +- libavformat/srtpproto.c | 8 +- libavformat/subfile.c | 147 - libavformat/subtitles.c | 283 - libavformat/subtitles.h | 124 - libavformat/subviewer1dec.c | 124 - libavformat/subviewerdec.c | 194 - libavformat/swf.c | 8 +- libavformat/swf.h | 105 +- libavformat/swfdec.c | 333 +- libavformat/swfenc.c | 26 +- libavformat/takdec.c | 50 +- libavformat/tcp.c | 69 +- libavformat/tedcaptionsdec.c | 366 - libavformat/tee.c | 497 - libavformat/thp.c | 49 +- libavformat/tiertexseq.c | 8 +- libavformat/tls.c | 63 +- libavformat/tmv.c | 10 +- libavformat/tta.c | 91 +- libavformat/tty.c | 43 +- libavformat/txd.c | 33 +- libavformat/udp.c | 299 +- libavformat/uncodedframecrcenc.c | 172 - libavformat/unix.c | 11 +- libavformat/url-test.c | 8 +- libavformat/url.c | 8 +- libavformat/url.h | 18 +- libavformat/urldecode.c | 8 +- libavformat/urldecode.h | 8 +- libavformat/utils.c | 2221 +--- libavformat/vc1test.c | 15 +- libavformat/vc1testenc.c | 11 +- libavformat/version.h | 36 +- libavformat/vivo.c | 313 - libavformat/voc.c | 8 +- libavformat/voc.h | 8 +- libavformat/vocdec.c | 12 +- libavformat/vocenc.c | 22 +- libavformat/vorbiscomment.c | 9 +- libavformat/vorbiscomment.h | 8 +- libavformat/vplayerdec.c | 128 - libavformat/vqf.c | 23 +- libavformat/w64.c | 50 - libavformat/w64.h | 31 - libavformat/wavdec.c | 357 +- libavformat/wavenc.c | 206 +- libavformat/wc3movie.c | 19 +- libavformat/webvttdec.c | 223 - libavformat/webvttenc.c | 100 - libavformat/westwood_aud.c | 10 +- libavformat/westwood_vqa.c | 51 +- libavformat/{wtvdec.c => wtv.c} | 295 +- libavformat/wtv.h | 60 - libavformat/wtv_common.c | 84 - libavformat/wtvenc.c | 845 -- libavformat/wv.c | 8 +- libavformat/wv.h | 8 +- libavformat/wvdec.c | 20 +- libavformat/wvenc.c | 12 +- libavformat/xa.c | 11 +- libavformat/xmv.c | 190 +- libavformat/xwma.c | 33 +- libavformat/yop.c | 25 +- libavformat/yuv4mpeg.h | 8 +- libavformat/yuv4mpegdec.c | 83 +- libavformat/yuv4mpegenc.c | 161 +- libavresample/Makefile | 3 - libavresample/aarch64/asm-offsets.h | 8 +- libavresample/aarch64/audio_convert_init.c | 8 +- libavresample/aarch64/audio_convert_neon.S | 8 +- libavresample/aarch64/neontest.c | 8 +- libavresample/aarch64/resample_init.c | 8 +- libavresample/aarch64/resample_neon.S | 8 +- libavresample/arm/audio_convert_init.c | 8 +- libavresample/arm/audio_convert_neon.S | 8 +- libavresample/arm/neontest.c | 8 +- libavresample/audio_convert.c | 8 +- libavresample/audio_convert.h | 8 +- libavresample/audio_data.c | 8 +- libavresample/audio_data.h | 8 +- libavresample/audio_mix.c | 8 +- libavresample/audio_mix.h | 8 +- libavresample/audio_mix_matrix.c | 8 +- libavresample/avresample-test.c | 8 +- libavresample/avresample.h | 10 +- libavresample/avresampleres.rc | 55 - libavresample/dither.c | 8 +- libavresample/dither.h | 8 +- libavresample/internal.h | 8 +- libavresample/options.c | 8 +- libavresample/resample.c | 8 +- libavresample/resample.h | 8 +- libavresample/resample_template.c | 8 +- libavresample/utils.c | 14 +- libavresample/version.h | 8 +- libavresample/x86/audio_convert.asm | 42 +- libavresample/x86/audio_convert_init.c | 8 +- libavresample/x86/audio_mix.asm | 16 +- libavresample/x86/audio_mix_init.c | 8 +- libavresample/x86/dither.asm | 8 +- libavresample/x86/dither_init.c | 8 +- libavresample/x86/util.asm | 8 +- libavresample/x86/w64xmmtest.c | 8 +- libavutil/Makefile | 57 +- libavutil/aarch64/asm.S | 8 +- libavutil/aarch64/bswap.h | 8 +- libavutil/aarch64/cpu.c | 8 +- libavutil/aarch64/cpu.h | 8 +- libavutil/aarch64/float_dsp_init.c | 8 +- libavutil/aarch64/float_dsp_neon.S | 8 +- libavutil/aarch64/neontest.h | 8 +- libavutil/adler32.c | 46 +- libavutil/adler32.h | 8 +- libavutil/aes.c | 12 +- libavutil/aes.h | 12 +- libavutil/arm/asm.S | 8 +- libavutil/arm/bswap.h | 8 +- libavutil/arm/cpu.c | 8 +- libavutil/arm/cpu.h | 8 +- libavutil/arm/float_dsp_arm.h | 8 +- libavutil/arm/float_dsp_init_arm.c | 8 +- libavutil/arm/float_dsp_init_neon.c | 8 +- libavutil/arm/float_dsp_init_vfp.c | 8 +- libavutil/arm/float_dsp_neon.S | 8 +- libavutil/arm/float_dsp_vfp.S | 8 +- libavutil/arm/intmath.h | 8 +- libavutil/arm/intreadwrite.h | 8 +- libavutil/arm/neontest.h | 8 +- libavutil/arm/timer.h | 8 +- libavutil/atomic.c | 14 +- libavutil/atomic.h | 8 +- libavutil/atomic_gcc.h | 8 +- libavutil/atomic_suncc.h | 8 +- libavutil/atomic_win32.h | 8 +- libavutil/attributes.h | 44 +- libavutil/audio_fifo.c | 10 +- libavutil/audio_fifo.h | 15 +- libavutil/avassert.h | 10 +- libavutil/avr32/bswap.h | 8 +- libavutil/avr32/intreadwrite.h | 8 +- libavutil/avstring.c | 155 +- libavutil/avstring.h | 140 +- libavutil/avutil.h | 84 +- libavutil/avutilres.rc | 55 - libavutil/base64.c | 172 +- libavutil/base64.h | 20 +- libavutil/bfin/asm.h | 8 +- libavutil/bfin/attributes.h | 8 +- libavutil/bfin/bswap.h | 8 +- libavutil/bfin/timer.h | 8 +- libavutil/blowfish.c | 52 +- libavutil/blowfish.h | 9 +- libavutil/bprint.c | 381 - libavutil/bprint.h | 216 - libavutil/bswap.h | 8 +- libavutil/buffer.c | 41 +- libavutil/buffer.h | 19 +- libavutil/buffer_internal.h | 10 +- libavutil/channel_layout.c | 198 +- libavutil/channel_layout.h | 51 +- libavutil/colorspace.h | 8 +- libavutil/common.h | 79 +- libavutil/cpu.c | 120 +- libavutil/cpu.h | 42 +- libavutil/cpu_internal.h | 8 +- libavutil/crc.c | 60 +- libavutil/crc.h | 19 +- libavutil/des.c | 18 +- libavutil/des.h | 8 +- libavutil/dict.c | 25 +- libavutil/dict.h | 45 +- libavutil/display.c | 14 +- libavutil/display.h | 8 +- libavutil/downmix_info.c | 8 +- libavutil/downmix_info.h | 8 +- libavutil/dynarray.h | 70 - libavutil/error.c | 93 +- libavutil/error.h | 73 +- libavutil/eval.c | 226 +- libavutil/eval.h | 12 +- libavutil/fifo.c | 92 +- libavutil/fifo.h | 39 +- libavutil/file.c | 74 +- libavutil/file.h | 20 +- libavutil/file_open.c | 52 +- libavutil/fixed_dsp.c | 98 - libavutil/fixed_dsp.h | 144 - libavutil/float_dsp.c | 15 +- libavutil/float_dsp.h | 11 +- libavutil/frame.c | 166 +- libavutil/frame.h | 180 +- libavutil/hash.c | 239 - libavutil/hash.h | 112 - libavutil/hmac.c | 128 +- libavutil/hmac.h | 12 +- libavutil/imgutils.c | 145 +- libavutil/imgutils.h | 70 +- libavutil/integer.c | 196 - libavutil/integer.h | 86 - libavutil/internal.h | 55 +- libavutil/intfloat.h | 8 +- libavutil/intfloat_readwrite.c | 101 - libavutil/intfloat_readwrite.h | 44 - libavutil/intmath.c | 8 +- libavutil/intmath.h | 12 +- libavutil/intreadwrite.h | 94 +- libavutil/lfg.c | 12 +- libavutil/lfg.h | 8 +- libavutil/libavutil.v | 2 +- libavutil/libm.h | 19 +- libavutil/{lls1.c => lls.c} | 49 +- libavutil/{lls2.h => lls.h} | 31 +- libavutil/lls1.h | 54 - libavutil/lls2.c | 160 - libavutil/log.c | 320 +- libavutil/log.h | 80 +- libavutil/log2_tab.c | 10 +- libavutil/lzo.c | 60 +- libavutil/lzo.h | 8 +- libavutil/macros.h | 8 +- libavutil/mathematics.c | 62 +- libavutil/mathematics.h | 63 +- libavutil/md5.c | 103 +- libavutil/md5.h | 46 +- libavutil/mem.c | 175 +- libavutil/mem.h | 125 +- libavutil/mips/Makefile | 1 - libavutil/mips/float_dsp_mips.c | 383 - libavutil/mips/intreadwrite.h | 8 +- libavutil/mips/libm_mips.h | 73 - libavutil/murmur3.c | 192 - libavutil/murmur3.h | 32 - libavutil/old_pix_fmts.h | 55 +- libavutil/opencl.c | 837 -- libavutil/opencl.h | 330 - libavutil/opencl_internal.c | 59 - libavutil/opencl_internal.h | 33 - libavutil/opt.c | 1068 +- libavutil/opt.h | 340 +- libavutil/parseutils.c | 292 +- libavutil/parseutils.h | 77 +- libavutil/pca.c | 248 - libavutil/pca.h | 35 - libavutil/pixdesc.c | 845 +- libavutil/pixdesc.h | 87 +- libavutil/pixfmt.h | 160 +- libavutil/ppc/cpu.c | 10 +- libavutil/ppc/cpu.h | 8 +- libavutil/ppc/float_dsp_altivec.c | 8 +- libavutil/ppc/float_dsp_altivec.h | 8 +- libavutil/ppc/float_dsp_init.c | 8 +- libavutil/ppc/intreadwrite.h | 8 +- libavutil/ppc/timer.h | 15 +- libavutil/ppc/types_altivec.h | 8 +- libavutil/ppc/util_altivec.h | 8 +- libavutil/qsort.h | 117 - libavutil/random_seed.c | 73 +- libavutil/random_seed.h | 19 +- libavutil/rational.c | 73 +- libavutil/rational.h | 21 +- libavutil/rc4.c | 8 +- libavutil/rc4.h | 8 +- libavutil/replaygain.h | 8 +- libavutil/ripemd.c | 515 - libavutil/ripemd.h | 75 - libavutil/samplefmt.c | 61 +- libavutil/samplefmt.h | 60 +- libavutil/sh4/bswap.h | 8 +- libavutil/sha.c | 129 +- libavutil/sha.h | 12 +- libavutil/sha512.c | 345 - libavutil/sha512.h | 75 - libavutil/softfloat.c | 71 - libavutil/softfloat.h | 126 - libavutil/stereo3d.c | 8 +- libavutil/stereo3d.h | 8 +- libavutil/threadmessage.c | 184 - libavutil/threadmessage.h | 91 - libavutil/time.c | 30 +- libavutil/time.h | 25 +- libavutil/timecode.c | 218 - libavutil/timecode.h | 140 - libavutil/timer.h | 14 +- libavutil/timestamp.h | 78 - libavutil/tomi/intreadwrite.h | 8 +- libavutil/tree.c | 46 +- libavutil/tree.h | 20 +- libavutil/utf8.c | 73 - libavutil/utils.c | 72 +- libavutil/version.h | 49 +- libavutil/x86/asm.h | 50 +- libavutil/x86/bswap.h | 8 +- libavutil/x86/cpu.c | 10 +- libavutil/x86/cpu.h | 8 +- libavutil/x86/cpuid.asm | 8 +- libavutil/x86/emms.asm | 8 +- libavutil/x86/emms.h | 12 +- libavutil/x86/float_dsp.asm | 97 +- libavutil/x86/float_dsp_init.c | 16 +- libavutil/x86/intreadwrite.h | 8 +- libavutil/x86/lls.asm | 19 +- libavutil/x86/lls_init.c | 18 +- libavutil/x86/timer.h | 9 +- libavutil/x86/w64xmmtest.h | 8 +- libavutil/x86/x86inc.asm | 23 +- libavutil/x86/x86util.asm | 60 +- libavutil/x86_cpu.h | 1 - libavutil/xga_font_data.c | 417 - libavutil/xga_font_data.h | 35 - libavutil/xtea.c | 101 +- libavutil/xtea.h | 9 +- libpostproc/Makefile | 12 - libpostproc/libpostproc.v | 4 - libpostproc/postprocess.c | 1049 -- libpostproc/postprocess.h | 106 - libpostproc/postprocess_altivec_template.c | 1210 -- libpostproc/postprocess_internal.h | 179 - libpostproc/postprocess_template.c | 3721 ------ libpostproc/postprocres.rc | 55 - libpostproc/version.h | 45 - library.mak | 21 +- libswresample/Makefile | 21 - libswresample/arm/Makefile | 5 - libswresample/arm/audio_convert_init.c | 67 - libswresample/arm/audio_convert_neon.S | 363 - libswresample/arm/neontest.c | 29 - libswresample/audioconvert.c | 224 - libswresample/audioconvert.h | 78 - libswresample/dither.c | 148 - libswresample/dither_template.c | 67 - libswresample/libswresample.v | 4 - libswresample/log2_tab.c | 1 - libswresample/noise_shaping_data.c | 224 - libswresample/rematrix.c | 505 - libswresample/rematrix_template.c | 106 - libswresample/resample.c | 405 - libswresample/resample_template.c | 248 - libswresample/soxr_resample.c | 93 - libswresample/swresample-test.c | 414 - libswresample/swresample.c | 946 -- libswresample/swresample.h | 328 - libswresample/swresample_internal.h | 199 - libswresample/swresampleres.rc | 55 - libswresample/version.h | 45 - libswresample/x86/Makefile | 5 - libswresample/x86/audio_convert.asm | 465 - libswresample/x86/rematrix.asm | 250 - libswresample/x86/resample_mmx.h | 306 - libswresample/x86/swresample_x86.c | 200 - libswresample/x86/w64xmmtest.c | 29 - libswscale/Makefile | 5 - libswscale/arm/Makefile | 4 - libswscale/arm/rgb2yuv_neon_16.S | 80 - libswscale/arm/rgb2yuv_neon_32.S | 119 - libswscale/arm/rgb2yuv_neon_common.S | 291 - libswscale/arm/swscale_unscaled.c | 79 - libswscale/bayer_template.c | 236 - libswscale/bfin/internal_bfin.S | 8 +- libswscale/bfin/swscale_bfin.c | 8 +- libswscale/bfin/yuv2rgb_bfin.c | 11 +- libswscale/colorspace-test.c | 18 +- libswscale/input.c | 650 +- libswscale/options.c | 31 +- libswscale/output.c | 1031 +- libswscale/ppc/swscale_altivec.c | 10 +- libswscale/ppc/yuv2rgb_altivec.c | 26 +- libswscale/ppc/yuv2rgb_altivec.h | 8 +- libswscale/ppc/yuv2yuv_altivec.c | 8 +- libswscale/rgb2rgb.c | 120 +- libswscale/rgb2rgb.h | 28 +- libswscale/rgb2rgb_template.c | 105 +- libswscale/swscale-test.c | 70 +- libswscale/swscale.c | 633 +- libswscale/swscale.h | 22 +- libswscale/swscale_internal.h | 241 +- libswscale/swscale_unscaled.c | 1359 +-- libswscale/swscaleres.rc | 55 - libswscale/utils.c | 779 +- libswscale/version.h | 15 +- libswscale/x86/Makefile | 2 - libswscale/x86/input.asm | 204 +- libswscale/x86/output.asm | 12 +- libswscale/x86/rgb2rgb.c | 17 +- libswscale/x86/rgb2rgb_template.c | 173 +- libswscale/x86/scale.asm | 12 +- libswscale/x86/swscale.c | 140 +- libswscale/x86/swscale_template.c | 226 +- libswscale/x86/w64xmmtest.c | 8 +- libswscale/x86/yuv2rgb.c | 25 +- libswscale/x86/yuv2rgb_template.c | 46 +- libswscale/yuv2rgb.c | 125 +- ...px-720p.ffpreset => libvpx-1080p.avpreset} | 4 +- ...60.ffpreset => libvpx-1080p50_60.avpreset} | 4 +- ...vpx-360p.ffpreset => libvpx-360p.avpreset} | 4 +- ...px-1080p.ffpreset => libvpx-720p.avpreset} | 4 +- ..._60.ffpreset => libvpx-720p50_60.avpreset} | 4 +- presets/libx264-baseline.avpreset | 1 + presets/libx264-fast.avpreset | 1 + presets/libx264-fast_firstpass.avpreset | 2 + presets/libx264-faster.avpreset | 1 + presets/libx264-faster_firstpass.avpreset | 2 + ...d320.ffpreset => libx264-ipod320.avpreset} | 4 +- ...d640.ffpreset => libx264-ipod640.avpreset} | 4 +- presets/libx264-lossless_fast.avpreset | 2 + presets/libx264-lossless_max.avpreset | 2 + presets/libx264-lossless_medium.avpreset | 2 + presets/libx264-lossless_slow.avpreset | 2 + presets/libx264-lossless_slower.avpreset | 2 + presets/libx264-lossless_ultrafast.avpreset | 2 + presets/libx264-main.avpreset | 1 + presets/libx264-medium.avpreset | 1 + presets/libx264-medium_firstpass.avpreset | 2 + presets/libx264-placebo.avpreset | 1 + presets/libx264-placebo_firstpass.avpreset | 2 + presets/libx264-slow.avpreset | 1 + presets/libx264-slow_firstpass.avpreset | 2 + presets/libx264-slower.avpreset | 1 + presets/libx264-slower_firstpass.avpreset | 2 + presets/libx264-superfast.avpreset | 1 + presets/libx264-superfast_firstpass.avpreset | 2 + presets/libx264-ultrafast.avpreset | 1 + presets/libx264-ultrafast_firstpass.avpreset | 2 + presets/libx264-veryfast.avpreset | 1 + presets/libx264-veryfast_firstpass.avpreset | 2 + presets/libx264-veryslow.avpreset | 1 + presets/libx264-veryslow_firstpass.avpreset | 2 + tests/Makefile | 69 +- tests/audiogen.c | 8 +- tests/base64.c | 8 +- tests/copycooker.sh | 30 - tests/fate-run.sh | 86 +- tests/fate-update.sh | 55 - tests/fate-valgrind.supp | 31 - tests/fate.sh | 6 +- tests/fate/aac.mak | 23 +- tests/fate/ac3.mak | 3 +- tests/fate/acodec.mak | 59 +- tests/fate/adpcm.mak | 15 - tests/fate/audio.mak | 39 +- tests/fate/avformat.mak | 23 +- tests/fate/cover-art.mak | 23 +- tests/fate/demux.mak | 96 +- tests/fate/ea.mak | 15 +- tests/fate/exif.mak | 18 - tests/fate/ffmpeg.mak | 48 - tests/fate/ffprobe.mak | 33 - tests/fate/fft.mak | 21 +- tests/fate/filter-audio.mak | 29 +- tests/fate/filter-video.mak | 242 +- tests/fate/flac.mak | 4 +- tests/fate/gif.mak | 27 - tests/fate/h264.mak | 366 +- tests/fate/hevc.mak | 44 +- tests/fate/image.mak | 48 +- tests/fate/libavcodec.mak | 2 +- tests/fate/libavresample.mak | 14 +- tests/fate/libavutil.mak | 26 - tests/fate/libswresample.mak | 374 - tests/fate/lossless-audio.mak | 27 +- tests/fate/lossless-video.mak | 24 +- tests/fate/microsoft.mak | 17 +- tests/fate/mp3.mak | 4 - tests/fate/opus.mak | 4 +- tests/fate/pcm.mak | 24 +- tests/fate/probe.mak | 14 +- tests/fate/prores.mak | 16 +- tests/fate/qt.mak | 37 +- tests/fate/real.mak | 20 +- tests/fate/screen.mak | 17 +- tests/fate/seek.mak | 6 - tests/fate/subtitles.mak | 65 - tests/fate/utvideo.mak | 2 +- tests/fate/vcodec.mak | 92 +- tests/fate/video.mak | 176 +- tests/fate/voice.mak | 24 +- tests/fate/vpx.mak | 12 +- tests/fate/vqf.mak | 11 +- tests/fate/wavpack.mak | 58 +- tests/ffserver-regression.sh | 39 - tests/ffserver.conf | 307 - tests/ffserver.regression.ref | 10 - .../filtergraphs/alphamerge_alphaextract_rgb | 4 - .../filtergraphs/alphamerge_alphaextract_yuv | 4 - tests/filtergraphs/concat | 8 - tests/filtergraphs/gradfun | 2 - tests/filtergraphs/hqdn3d | 1 - tests/filtergraphs/overlay | 1 - tests/filtergraphs/overlay_rgb | 4 - tests/filtergraphs/overlay_yuv420 | 4 - tests/filtergraphs/overlay_yuv422 | 4 - tests/filtergraphs/overlay_yuv444 | 4 - tests/filtergraphs/scalenorm | 4 - tests/lavf-regression.sh | 131 +- tests/md5.sh | 2 +- tests/ref/acodec/adpcm-adx | 2 +- tests/ref/acodec/adpcm-ima_qt | 4 +- tests/ref/acodec/adpcm-ima_wav | 2 +- tests/ref/acodec/adpcm-ms | 2 +- tests/ref/acodec/adpcm-swf | 2 +- tests/ref/acodec/adpcm-yamaha | 2 +- tests/ref/acodec/adpcm_ima_qt | 4 - tests/ref/acodec/alac | 6 +- tests/ref/acodec/flac | 6 +- tests/ref/acodec/g723_1 | 4 - tests/ref/acodec/mp2 | 2 +- tests/ref/acodec/mp2fixed | 4 - tests/ref/acodec/pcm-alaw | 2 +- tests/ref/acodec/pcm-f32be | 6 +- tests/ref/acodec/pcm-f32le | 2 +- tests/ref/acodec/pcm-f64be | 6 +- tests/ref/acodec/pcm-f64le | 2 +- tests/ref/acodec/pcm-mulaw | 2 +- tests/ref/acodec/pcm-s16be | 6 +- tests/ref/acodec/pcm-s16be_planar | 4 - tests/ref/acodec/pcm-s16le | 6 +- tests/ref/acodec/pcm-s16le_planar | 4 - tests/ref/acodec/pcm-s24be | 6 +- tests/ref/acodec/pcm-s24le | 2 +- tests/ref/acodec/pcm-s24le_planar | 4 - tests/ref/acodec/pcm-s32be | 6 +- tests/ref/acodec/pcm-s32le | 2 +- tests/ref/acodec/pcm-s32le_planar | 4 - tests/ref/acodec/pcm-s8 | 6 +- tests/ref/acodec/pcm-s8_planar | 4 - tests/ref/acodec/pcm-u16be | 4 - tests/ref/acodec/pcm-u16le | 4 - tests/ref/acodec/pcm-u24be | 4 - tests/ref/acodec/pcm-u24le | 4 - tests/ref/acodec/pcm-u32be | 4 - tests/ref/acodec/pcm-u32le | 4 - tests/ref/acodec/pcm-u8 | 6 +- tests/ref/acodec/roqaudio | 4 - tests/ref/fate/4xm-1 | 30 +- tests/ref/fate/4xm-2 | 320 +- tests/ref/fate/8bps | 24 +- tests/ref/fate/aasc | 1 - tests/ref/fate/acodec-aref | 4 - tests/ref/fate/adpcm-4xm | 27 - tests/ref/fate/adpcm-afc | 13 - tests/ref/fate/adpcm-dtk | 33 - tests/ref/fate/adpcm-ima-amv | 310 +- tests/ref/fate/adpcm-ima-oki | 1 - tests/ref/fate/adpcm-ima-rad | 1 - tests/ref/fate/adpcm-ima-smjpeg | 698 +- tests/ref/fate/aliaspix-bgr | 2 +- tests/ref/fate/aliaspix-gray | 2 +- tests/ref/fate/ansi256 | 9 - tests/ref/fate/armovie-escape124 | 200 +- tests/ref/fate/ast | 1 - tests/ref/fate/avio-direct | 59 - tests/ref/fate/bethsoft-vid | 140 +- tests/ref/fate/bmpparser | 8 +- tests/ref/fate/bprint | 16 - tests/ref/fate/brstm | 1 - tests/ref/fate/cavs | 343 +- tests/ref/fate/cdgraphics | 440 +- tests/ref/fate/cdxl-bitline-ham6 | 22 +- tests/ref/fate/cdxl-ham6 | 34 +- tests/ref/fate/cdxl-ham8 | 4 +- tests/ref/fate/cdxl-pal8 | 24 +- tests/ref/fate/cdxl-pal8-small | 94 +- tests/ref/fate/cine-demux | 1 - tests/ref/fate/cljr | 72 +- tests/ref/fate/cllc-argb | 1 - tests/ref/fate/cllc-rgb | 1 - tests/ref/fate/cllc-yuy2-noblock | 1 - tests/ref/fate/crc | 1 - tests/ref/fate/creatureshock-avs | 114 +- tests/ref/fate/cvid-grayscale | 304 +- tests/ref/fate/cvid-palette | 114 +- tests/ref/fate/cvid-partial | 157 +- tests/ref/fate/d-cinema-demux | 2 +- tests/ref/fate/dfa1 | 50 +- tests/ref/fate/dfa10 | 16 +- tests/ref/fate/dfa11 | 18 +- tests/ref/fate/dfa2 | 34 +- tests/ref/fate/dfa3 | 20 +- tests/ref/fate/dfa4 | 27 +- tests/ref/fate/dfa5 | 30 +- tests/ref/fate/dfa6 | 24 +- tests/ref/fate/dfa7 | 24 +- tests/ref/fate/dfa8 | 72 +- tests/ref/fate/dfa9 | 12 +- tests/ref/fate/dirac | 3 - tests/ref/fate/ea-cmv | 388 +- tests/ref/fate/ea-mad | 194 +- tests/ref/fate/ea-tgq | 558 +- tests/ref/fate/ea-tqi | 54 +- tests/ref/fate/eval | 78 - tests/ref/fate/exif-image-embedded | 404 - tests/ref/fate/exif-image-jpg | 226 - tests/ref/fate/exif-image-tiff | 27 - tests/ref/fate/exif-image-webp | 226 - tests/ref/fate/ffmpeg-filter_complex | 6 - tests/ref/fate/ffmpeg-lavfi | 6 - tests/ref/fate/ffprobe_compact | 32 - tests/ref/fate/ffprobe_csv | 32 - tests/ref/fate/ffprobe_default | 647 -- tests/ref/fate/ffprobe_flat | 583 - tests/ref/fate/ffprobe_ini | 662 -- tests/ref/fate/ffprobe_json | 641 -- tests/ref/fate/ffprobe_xml | 57 - tests/ref/fate/fic-avi | 1 - tests/ref/fate/film-cvid | 220 +- tests/ref/fate/filter-adelay | 261 - .../fate/filter-alphaextract_alphamerge_rgb | 51 - .../fate/filter-alphaextract_alphamerge_yuv | 51 - tests/ref/fate/filter-colorchannelmixer | 51 - tests/ref/fate/filter-colormatrix1 | 1 - tests/ref/fate/filter-colormatrix2 | 1 - tests/ref/fate/filter-concat | 202 - tests/ref/fate/filter-crop | 2 +- tests/ref/fate/filter-crop_scale | 2 +- tests/ref/fate/filter-crop_scale_vflip | 2 +- tests/ref/fate/filter-crop_vflip | 2 +- tests/ref/fate/filter-curves | 6 - tests/ref/fate/filter-delogo | 220 +- tests/ref/fate/filter-drawbox | 100 +- tests/ref/fate/filter-edgedetect | 1 - tests/ref/fate/filter-edgedetect-colormix | 1 - tests/ref/fate/filter-fade | 98 +- tests/ref/fate/filter-fieldmatch | 63 - tests/ref/fate/filter-framepack-frameseq | 26 +- tests/ref/fate/filter-gradfun-sample | 21 - tests/ref/fate/filter-histogram-levels | 51 - tests/ref/fate/filter-histogram-waveform | 51 - tests/ref/fate/filter-hqdn3d-sample | 74 - tests/ref/fate/filter-hue | 1 - tests/ref/fate/filter-idet | 1 - tests/ref/fate/filter-lavd-life | 11 - tests/ref/fate/filter-lavd-scalenorm | 11 - tests/ref/fate/filter-lavd-testsrc | 71 - tests/ref/fate/filter-mcdeint-fast | 31 - tests/ref/fate/filter-mcdeint-medium | 31 - tests/ref/fate/filter-metadata-ebur128 | 280 - tests/ref/fate/filter-metadata-scenedetect | 10 - tests/ref/fate/filter-metadata-silencedetect | 512 - tests/ref/fate/filter-null | 2 +- tests/ref/fate/filter-overlay | 100 +- tests/ref/fate/filter-overlay_rgb | 51 - tests/ref/fate/filter-overlay_yuv420 | 51 - tests/ref/fate/filter-overlay_yuv422 | 51 - tests/ref/fate/filter-overlay_yuv444 | 51 - tests/ref/fate/filter-pad | 1 - tests/ref/fate/filter-phase | 51 - tests/ref/fate/filter-pixdesc | 208 +- tests/ref/fate/filter-pixfmts-copy | 209 +- tests/ref/fate/filter-pixfmts-crop | 156 +- tests/ref/fate/filter-pixfmts-field | 119 - tests/ref/fate/filter-pixfmts-fieldorder | 92 - tests/ref/fate/filter-pixfmts-hflip | 156 +- tests/ref/fate/filter-pixfmts-histeq | 6 - tests/ref/fate/filter-pixfmts-il | 118 - tests/ref/fate/filter-pixfmts-kerndeint | 10 - tests/ref/fate/filter-pixfmts-lut | 19 - tests/ref/fate/filter-pixfmts-null | 209 +- tests/ref/fate/filter-pixfmts-pad | 44 +- tests/ref/fate/filter-pixfmts-rotate | 20 - tests/ref/fate/filter-pixfmts-scale | 209 +- tests/ref/fate/filter-pixfmts-super2xsai | 14 - tests/ref/fate/filter-pixfmts-swapuv | 62 - .../ref/fate/filter-pixfmts-tinterlace_merge | 14 - tests/ref/fate/filter-pixfmts-tinterlace_pad | 14 - tests/ref/fate/filter-pixfmts-vflip | 209 +- tests/ref/fate/filter-pp | 1 - tests/ref/fate/filter-pp2 | 1 - tests/ref/fate/filter-pp3 | 1 - tests/ref/fate/filter-pp4 | 1 - tests/ref/fate/filter-pp5 | 1 - tests/ref/fate/filter-pp6 | 1 - tests/ref/fate/filter-scale200 | 2 +- tests/ref/fate/filter-scale500 | 2 +- tests/ref/fate/filter-select | 1 - tests/ref/fate/filter-separatefields | 101 - tests/ref/fate/filter-setdar | 1 - tests/ref/fate/filter-setpts | 89 +- tests/ref/fate/filter-setsar | 1 - tests/ref/fate/filter-stereo3d-abr-ml | 6 - tests/ref/fate/filter-stereo3d-abr-mr | 6 - tests/ref/fate/filter-stereo3d-al-sbsl | 6 - tests/ref/fate/filter-stereo3d-ar-abl | 6 - tests/ref/fate/filter-stereo3d-sbsl-abl | 6 - tests/ref/fate/filter-stereo3d-sbsl-abr | 6 - tests/ref/fate/filter-stereo3d-sbsl-al | 6 - tests/ref/fate/filter-stereo3d-sbsl-sbsr | 6 - tests/ref/fate/filter-telecine | 63 - tests/ref/fate/filter-thumbnail | 1 - tests/ref/fate/filter-tile | 1 - tests/ref/fate/filter-unsharp | 100 +- tests/ref/fate/filter-vflip | 2 +- tests/ref/fate/filter-vflip_crop | 2 +- tests/ref/fate/filter-vflip_vflip | 2 +- tests/ref/fate/filter-yadif-mode0 | 63 +- tests/ref/fate/filter-yadif-mode1 | 123 +- tests/ref/fate/flic-af11-palette-change | 232 +- tests/ref/fate/flic-magiccarpet | 80 +- tests/ref/fate/force_key_frames | 4 - tests/ref/fate/fraps-v2 | 8 + tests/ref/fate/fraps-v3 | 2 + tests/ref/fate/g729-0 | 1000 -- tests/ref/fate/g729-1 | 1000 -- tests/ref/fate/gif-color | 174 - tests/ref/fate/gif-demux | 37 - tests/ref/fate/gif-disposal-background | 6 - tests/ref/fate/gif-disposal-restore | 3 - tests/ref/fate/gif-gray | 37 - tests/ref/fate/gifenc-bgr4_byte | 174 - tests/ref/fate/gifenc-bgr8 | 174 - tests/ref/fate/gifenc-gray | 174 - tests/ref/fate/gifenc-pal8 | 174 - tests/ref/fate/gifenc-rgb4_byte | 174 - tests/ref/fate/gifenc-rgb8 | 174 - .../h264-conformance-frext-hi422fr10_sony_b | 6 - .../h264-conformance-frext-hi422fr13_sony_b | 6 - .../h264-conformance-frext-hi422fr1_sony_a | 6 - .../h264-conformance-frext-hi422fr6_sony_a | 6 - ...264-conformance-frext-pph422i1_panasonic_a | 11 - ...264-conformance-frext-pph422i2_panasonic_a | 11 - ...264-conformance-frext-pph422i3_panasonic_a | 11 - ...264-conformance-frext-pph422i4_panasonic_a | 11 - ...264-conformance-frext-pph422i5_panasonic_a | 11 - ...264-conformance-frext-pph422i6_panasonic_a | 11 - ...264-conformance-frext-pph422i7_panasonic_a | 11 - tests/ref/fate/h264-crop-to-container | 8 +- tests/ref/fate/h264-extreme-plane-pred | 4 - tests/ref/fate/h264-lossless | 20 +- ... => hevc-conformance-DBLK_A_MAIN10_VIXS_2} | 0 tests/ref/fate/hevc-conformance-DBLK_A_SONY_3 | 58 +- tests/ref/fate/hevc-conformance-DBLK_B_SONY_3 | 58 +- tests/ref/fate/hevc-conformance-DBLK_C_SONY_3 | 58 +- tests/ref/fate/hevc-conformance-DBLK_D_VIXS_1 | 9 + tests/ref/fate/hevc-conformance-DBLK_E_VIXS_1 | 9 + tests/ref/fate/hevc-conformance-DBLK_F_VIXS_1 | 9 + tests/ref/fate/hevc-conformance-DBLK_G_VIXS_1 | 9 + .../fate/hevc-conformance-DELTAQP_A_BRCM_4 | 97 - .../fate/hevc-conformance-DELTAQP_B_SONY_3 | 58 +- .../fate/hevc-conformance-DELTAQP_C_SONY_3 | 58 +- tests/ref/fate/hevc-conformance-ENTP_A_LG_2 | 51 + .../fate/hevc-conformance-ENTP_A_Qualcomm_1 | 25 - tests/ref/fate/hevc-conformance-ENTP_B_LG_2 | 51 + .../fate/hevc-conformance-ENTP_B_Qualcomm_1 | 25 - tests/ref/fate/hevc-conformance-ENTP_C_LG_3 | 51 + .../fate/hevc-conformance-ENTP_C_Qualcomm_1 | 25 - .../ref/fate/hevc-conformance-FILLER_A_Sony_1 | 61 - .../ref/fate/hevc-conformance-HRD_A_Fujitsu_2 | 97 - .../ref/fate/hevc-conformance-INITQP_A_Sony_1 | 61 - .../ref/fate/hevc-conformance-INITQP_B_Sony_1 | 91 - .../hevc-conformance-IPRED_C_Mitsubishi_2 | 5 + .../hevc-conformance-IPRED_C_Mitsubishi_3 | 5 - .../hevc-conformance-NoOutPrior_A_Qualcomm_1 | 41 - .../hevc-conformance-NoOutPrior_B_Qualcomm_1 | 48 - .../fate/hevc-conformance-OPFLAG_A_Qualcomm_1 | 501 - .../fate/hevc-conformance-OPFLAG_B_Qualcomm_1 | 99 - .../fate/hevc-conformance-OPFLAG_C_Qualcomm_1 | 97 - .../ref/fate/hevc-conformance-POC_A_Bossen_3 | 8 +- .../fate/hevc-conformance-RPS_D_ericsson_6 | 134 +- .../ref/fate/hevc-conformance-WP_B_Toshiba_3 | 510 +- .../hevc-conformance-WP_MAIN10_B_Toshiba_3 | 510 +- tests/ref/fate/hmac | 30 +- tests/ref/fate/idroq-video-encode | 2 +- tests/ref/fate/indeo3 | 80 +- tests/ref/fate/indeo5 | 1 + tests/ref/fate/interplay-mve-16bit | 102 +- tests/ref/fate/interplay-mve-8bit | 222 +- tests/ref/fate/iv8-demux | 10 +- tests/ref/fate/jv | 13 +- tests/ref/fate/jv-demux | 20 - tests/ref/fate/kgv1 | 8 +- tests/ref/fate/lagarith-red | 26 - tests/ref/fate/lmlm4-demux | 168 +- tests/ref/fate/lossless-tak | 1 - tests/ref/fate/lossless-tta-encrypted | 1 - tests/ref/fate/mapchan-6ch-extract-2 | 2 - .../fate/mapchan-6ch-extract-2-downmix-mono | 1 - tests/ref/fate/mapchan-silent-mono | 1 - tests/ref/fate/mjpegb | 22 +- tests/ref/fate/mkv | 217 - tests/ref/fate/mlv-demux | 1 - tests/ref/fate/motionpixels | 220 +- tests/ref/fate/mpeg2-field-enc | 62 +- tests/ref/fate/mss2-wmv | 202 +- tests/ref/fate/msvideo1-16bit | 60 +- tests/ref/fate/mtv | 2 +- tests/ref/fate/murmur3 | 1 - tests/ref/fate/mxf-demux | 170 +- tests/ref/fate/mxpeg | 31 - tests/ref/fate/nc-demux | 176 +- tests/ref/fate/nistsphere-demux | 1 - tests/ref/fate/nsv-demux | 108 +- tests/ref/fate/nuv-rtjpeg | 18 +- tests/ref/fate/nuv-rtjpeg-fh | 102 +- tests/ref/fate/oggvp8-demux | 71 - tests/ref/fate/paf-demux | 160 - tests/ref/fate/parseutils | 43 +- tests/ref/fate/pictor | 2 +- tests/ref/fate/pmp-demux | 106 - tests/ref/fate/pngparser | 8 +- tests/ref/fate/prores-422 | 6 +- tests/ref/fate/prores-422_hq | 6 +- tests/ref/fate/prores-422_lt | 6 +- tests/ref/fate/prores-422_proxy | 6 +- tests/ref/fate/prores-alpha | 6 +- tests/ref/fate/prores-alpha_skip | 3 - tests/ref/fate/prores-transparency | 5 - tests/ref/fate/prores-transparency_skip | 5 - tests/ref/fate/ptx | 2 +- tests/ref/fate/pva-demux | 53 +- tests/ref/fate/qtrle-16bit | 168 +- tests/ref/fate/qtrle-1bit | 78 +- tests/ref/fate/qtrle-24bit | 68 +- tests/ref/fate/qtrle-2bit | 78 +- tests/ref/fate/qtrle-32bit | 54 +- tests/ref/fate/qtrle-4bit | 78 +- tests/ref/fate/qtrle-8bit | 334 +- tests/ref/fate/quickdraw | 4 +- tests/ref/fate/random_seed | 1 - tests/ref/fate/redcode-demux | 2 +- tests/ref/fate/redspark-demux | 1 - tests/ref/fate/ripemd | 28 - tests/ref/fate/rpza | 62 +- tests/ref/fate/rsd-demux | 1 - tests/ref/fate/rv30 | 220 +- tests/ref/fate/rv40 | 481 +- tests/ref/fate/sanm | 10 +- tests/ref/fate/sgi-gray | 2 +- tests/ref/fate/sgi-gray16 | 2 +- tests/ref/fate/sgi-rgb24 | 2 +- tests/ref/fate/sgi-rgb48 | 2 +- tests/ref/fate/sgi-rgba | 2 +- tests/ref/fate/sgi-rgba64 | 2 +- tests/ref/fate/sha512 | 28 - tests/ref/fate/sierra-vmd-video | 234 +- tests/ref/fate/smc | 240 +- tests/ref/fate/smjpeg | 425 - tests/ref/fate/smjpeg-demux | 2 +- tests/ref/fate/smvjpeg | 13 - tests/ref/fate/sub-aqtitle | 1 - tests/ref/fate/sub-charenc | 1 - tests/ref/fate/sub-jacosub | 1 - tests/ref/fate/sub-microdvd | 1 - tests/ref/fate/sub-microdvd-remux | 1 - tests/ref/fate/sub-movtext | 1 - tests/ref/fate/sub-movtextenc | 1 - tests/ref/fate/sub-mpl2 | 1 - tests/ref/fate/sub-mpsub | 1 - tests/ref/fate/sub-mpsub-frames | 1 - tests/ref/fate/sub-pjs | 1 - tests/ref/fate/sub-realtext | 1 - tests/ref/fate/sub-sami | 1 - tests/ref/fate/sub-srt | 2 +- tests/ref/fate/sub-subripenc | 1 - tests/ref/fate/sub-subviewer | 1 - tests/ref/fate/sub-subviewer1 | 1 - tests/ref/fate/sub-vplayer | 1 - tests/ref/fate/sub-webvtt | 1 - tests/ref/fate/sub-webvttenc | 1 - tests/ref/fate/sub2video | 95 - tests/ref/fate/svq1 | 300 +- tests/ref/fate/svq3 | 360 +- tests/ref/fate/theora-coeff-level64 | 18 +- tests/ref/fate/timefilter | 12 +- tests/ref/fate/truemotion1-15 | 210 +- tests/ref/fate/truemotion1-24 | 1 - tests/ref/fate/tscc-15bit | 450 +- tests/ref/fate/unknown_layout-ac3 | 1 - tests/ref/fate/unknown_layout-pcm | 1 - tests/ref/fate/utvideoenc_rgb_left | 4 - tests/ref/fate/utvideoenc_rgb_median | 4 - tests/ref/fate/utvideoenc_rgb_none | 4 - tests/ref/fate/utvideoenc_rgba_left | 4 - tests/ref/fate/utvideoenc_rgba_median | 4 - tests/ref/fate/utvideoenc_rgba_none | 4 - tests/ref/fate/utvideoenc_yuv420_left | 4 - tests/ref/fate/utvideoenc_yuv420_median | 4 - tests/ref/fate/utvideoenc_yuv420_none | 4 - tests/ref/fate/utvideoenc_yuv422_left | 4 - tests/ref/fate/utvideoenc_yuv422_median | 4 - tests/ref/fate/utvideoenc_yuv422_none | 4 - tests/ref/fate/v210 | 2 +- tests/ref/fate/v410enc | 2 +- tests/ref/fate/vc1-ism | 242 +- tests/ref/fate/vc1_sa10143 | 28 +- tests/ref/fate/vcr2 | 158 - tests/ref/fate/vmnc-16bit | 384 +- tests/ref/fate/vp5 | 1 - tests/ref/fate/vp60 | 192 +- tests/ref/fate/vp6a | 188 +- tests/ref/fate/vp6a-skip_alpha | 94 - tests/ref/fate/vp6f | 350 +- tests/ref/fate/vp8-alpha | 121 - tests/ref/fate/vp8-sign-bias | 7 +- tests/ref/fate/vp8-size-change | 66 +- tests/ref/fate/vp8-test-vector-001 | 4 - tests/ref/fate/vp8-test-vector-002 | 4 - tests/ref/fate/vp8-test-vector-003 | 4 - tests/ref/fate/vp8-test-vector-004 | 4 - tests/ref/fate/vp8-test-vector-005 | 4 - tests/ref/fate/vp8-test-vector-006 | 4 - tests/ref/fate/vp8-test-vector-007 | 4 - tests/ref/fate/vp8-test-vector-008 | 4 - tests/ref/fate/vp8-test-vector-009 | 4 - tests/ref/fate/vp8-test-vector-010 | 4 - tests/ref/fate/vp8-test-vector-011 | 4 - tests/ref/fate/vp8-test-vector-012 | 4 - tests/ref/fate/vp8-test-vector-013 | 4 - tests/ref/fate/vp8-test-vector-014 | 4 - tests/ref/fate/vp8-test-vector-015 | 4 - tests/ref/fate/vp8-test-vector-016 | 4 - tests/ref/fate/vp8-test-vector-017 | 4 - tests/ref/fate/vp9-00-quantizer-00 | 10 +- tests/ref/fate/vp9-00-quantizer-01 | 10 +- tests/ref/fate/vp9-00-quantizer-02 | 10 +- tests/ref/fate/vp9-00-quantizer-03 | 10 +- tests/ref/fate/vp9-00-quantizer-04 | 10 +- tests/ref/fate/vp9-00-quantizer-05 | 10 +- tests/ref/fate/vp9-00-quantizer-06 | 10 +- tests/ref/fate/vp9-00-quantizer-07 | 10 +- tests/ref/fate/vp9-00-quantizer-08 | 10 +- tests/ref/fate/vp9-00-quantizer-09 | 10 +- tests/ref/fate/vp9-00-quantizer-10 | 10 +- tests/ref/fate/vp9-00-quantizer-11 | 10 +- tests/ref/fate/vp9-00-quantizer-12 | 10 +- tests/ref/fate/vp9-00-quantizer-13 | 10 +- tests/ref/fate/vp9-00-quantizer-14 | 10 +- tests/ref/fate/vp9-00-quantizer-15 | 10 +- tests/ref/fate/vp9-00-quantizer-16 | 10 +- tests/ref/fate/vp9-00-quantizer-17 | 10 +- tests/ref/fate/vp9-00-quantizer-18 | 10 +- tests/ref/fate/vp9-00-quantizer-19 | 10 +- tests/ref/fate/vp9-00-quantizer-20 | 10 +- tests/ref/fate/vp9-00-quantizer-21 | 10 +- tests/ref/fate/vp9-00-quantizer-22 | 10 +- tests/ref/fate/vp9-00-quantizer-23 | 10 +- tests/ref/fate/vp9-00-quantizer-24 | 10 +- tests/ref/fate/vp9-00-quantizer-25 | 10 +- tests/ref/fate/vp9-00-quantizer-26 | 10 +- tests/ref/fate/vp9-00-quantizer-27 | 10 +- tests/ref/fate/vp9-00-quantizer-28 | 10 +- tests/ref/fate/vp9-00-quantizer-29 | 10 +- tests/ref/fate/vp9-00-quantizer-30 | 10 +- tests/ref/fate/vp9-00-quantizer-31 | 10 +- tests/ref/fate/vp9-00-quantizer-32 | 10 +- tests/ref/fate/vp9-00-quantizer-33 | 10 +- tests/ref/fate/vp9-00-quantizer-34 | 10 +- tests/ref/fate/vp9-00-quantizer-35 | 10 +- tests/ref/fate/vp9-00-quantizer-36 | 10 +- tests/ref/fate/vp9-00-quantizer-37 | 10 +- tests/ref/fate/vp9-00-quantizer-38 | 10 +- tests/ref/fate/vp9-00-quantizer-39 | 10 +- tests/ref/fate/vp9-00-quantizer-40 | 10 +- tests/ref/fate/vp9-00-quantizer-41 | 10 +- tests/ref/fate/vp9-00-quantizer-42 | 10 +- tests/ref/fate/vp9-00-quantizer-43 | 10 +- tests/ref/fate/vp9-00-quantizer-44 | 10 +- tests/ref/fate/vp9-00-quantizer-45 | 10 +- tests/ref/fate/vp9-00-quantizer-46 | 10 +- tests/ref/fate/vp9-00-quantizer-47 | 10 +- tests/ref/fate/vp9-00-quantizer-48 | 10 +- tests/ref/fate/vp9-00-quantizer-49 | 10 +- tests/ref/fate/vp9-00-quantizer-50 | 10 +- tests/ref/fate/vp9-00-quantizer-51 | 10 +- tests/ref/fate/vp9-00-quantizer-52 | 10 +- tests/ref/fate/vp9-00-quantizer-53 | 10 +- tests/ref/fate/vp9-00-quantizer-54 | 10 +- tests/ref/fate/vp9-00-quantizer-55 | 10 +- tests/ref/fate/vp9-00-quantizer-56 | 10 +- tests/ref/fate/vp9-00-quantizer-57 | 10 +- tests/ref/fate/vp9-00-quantizer-58 | 10 +- tests/ref/fate/vp9-00-quantizer-59 | 10 +- tests/ref/fate/vp9-00-quantizer-60 | 10 +- tests/ref/fate/vp9-00-quantizer-61 | 10 +- tests/ref/fate/vp9-00-quantizer-62 | 10 +- tests/ref/fate/vp9-00-quantizer-63 | 10 +- tests/ref/fate/vp9-01-sharpness-1 | 26 +- tests/ref/fate/vp9-01-sharpness-2 | 26 +- tests/ref/fate/vp9-01-sharpness-3 | 26 +- tests/ref/fate/vp9-01-sharpness-4 | 26 +- tests/ref/fate/vp9-01-sharpness-5 | 26 +- tests/ref/fate/vp9-01-sharpness-6 | 26 +- tests/ref/fate/vp9-01-sharpness-7 | 26 +- tests/ref/fate/vp9-02-size-08x08 | 26 +- tests/ref/fate/vp9-02-size-08x10 | 26 +- tests/ref/fate/vp9-02-size-08x16 | 26 +- tests/ref/fate/vp9-02-size-08x18 | 26 +- tests/ref/fate/vp9-02-size-08x32 | 26 +- tests/ref/fate/vp9-02-size-08x34 | 26 +- tests/ref/fate/vp9-02-size-08x64 | 26 +- tests/ref/fate/vp9-02-size-08x66 | 26 +- tests/ref/fate/vp9-02-size-10x08 | 26 +- tests/ref/fate/vp9-02-size-10x10 | 26 +- tests/ref/fate/vp9-02-size-10x16 | 26 +- tests/ref/fate/vp9-02-size-10x18 | 26 +- tests/ref/fate/vp9-02-size-10x32 | 26 +- tests/ref/fate/vp9-02-size-10x34 | 26 +- tests/ref/fate/vp9-02-size-10x64 | 26 +- tests/ref/fate/vp9-02-size-10x66 | 26 +- tests/ref/fate/vp9-02-size-16x08 | 26 +- tests/ref/fate/vp9-02-size-16x10 | 26 +- tests/ref/fate/vp9-02-size-16x16 | 26 +- tests/ref/fate/vp9-02-size-16x18 | 26 +- tests/ref/fate/vp9-02-size-16x32 | 26 +- tests/ref/fate/vp9-02-size-16x34 | 26 +- tests/ref/fate/vp9-02-size-16x64 | 26 +- tests/ref/fate/vp9-02-size-16x66 | 26 +- tests/ref/fate/vp9-02-size-18x08 | 26 +- tests/ref/fate/vp9-02-size-18x10 | 26 +- tests/ref/fate/vp9-02-size-18x16 | 26 +- tests/ref/fate/vp9-02-size-18x18 | 26 +- tests/ref/fate/vp9-02-size-18x32 | 26 +- tests/ref/fate/vp9-02-size-18x34 | 26 +- tests/ref/fate/vp9-02-size-18x64 | 26 +- tests/ref/fate/vp9-02-size-18x66 | 26 +- tests/ref/fate/vp9-02-size-32x08 | 26 +- tests/ref/fate/vp9-02-size-32x10 | 26 +- tests/ref/fate/vp9-02-size-32x16 | 26 +- tests/ref/fate/vp9-02-size-32x18 | 26 +- tests/ref/fate/vp9-02-size-32x32 | 26 +- tests/ref/fate/vp9-02-size-32x34 | 26 +- tests/ref/fate/vp9-02-size-32x64 | 26 +- tests/ref/fate/vp9-02-size-32x66 | 26 +- tests/ref/fate/vp9-02-size-34x08 | 26 +- tests/ref/fate/vp9-02-size-34x10 | 26 +- tests/ref/fate/vp9-02-size-34x16 | 26 +- tests/ref/fate/vp9-02-size-34x18 | 26 +- tests/ref/fate/vp9-02-size-34x32 | 26 +- tests/ref/fate/vp9-02-size-34x34 | 26 +- tests/ref/fate/vp9-02-size-34x64 | 26 +- tests/ref/fate/vp9-02-size-34x66 | 26 +- tests/ref/fate/vp9-02-size-64x08 | 26 +- tests/ref/fate/vp9-02-size-64x10 | 26 +- tests/ref/fate/vp9-02-size-64x16 | 26 +- tests/ref/fate/vp9-02-size-64x18 | 26 +- tests/ref/fate/vp9-02-size-64x32 | 26 +- tests/ref/fate/vp9-02-size-64x34 | 26 +- tests/ref/fate/vp9-02-size-64x64 | 26 +- tests/ref/fate/vp9-02-size-64x66 | 26 +- tests/ref/fate/vp9-02-size-66x08 | 26 +- tests/ref/fate/vp9-02-size-66x10 | 26 +- tests/ref/fate/vp9-02-size-66x16 | 26 +- tests/ref/fate/vp9-02-size-66x18 | 26 +- tests/ref/fate/vp9-02-size-66x32 | 26 +- tests/ref/fate/vp9-02-size-66x34 | 26 +- tests/ref/fate/vp9-02-size-66x64 | 26 +- tests/ref/fate/vp9-02-size-66x66 | 26 +- tests/ref/fate/vp9-03-deltaq | 10 +- tests/ref/fate/vp9-03-size-196x196 | 26 +- tests/ref/fate/vp9-03-size-196x198 | 26 +- tests/ref/fate/vp9-03-size-196x200 | 26 +- tests/ref/fate/vp9-03-size-196x202 | 26 +- tests/ref/fate/vp9-03-size-196x208 | 26 +- tests/ref/fate/vp9-03-size-196x210 | 26 +- tests/ref/fate/vp9-03-size-196x224 | 26 +- tests/ref/fate/vp9-03-size-196x226 | 26 +- tests/ref/fate/vp9-03-size-198x196 | 26 +- tests/ref/fate/vp9-03-size-198x198 | 26 +- tests/ref/fate/vp9-03-size-198x200 | 26 +- tests/ref/fate/vp9-03-size-198x202 | 26 +- tests/ref/fate/vp9-03-size-198x208 | 26 +- tests/ref/fate/vp9-03-size-198x210 | 26 +- tests/ref/fate/vp9-03-size-198x224 | 26 +- tests/ref/fate/vp9-03-size-198x226 | 26 +- tests/ref/fate/vp9-03-size-200x196 | 26 +- tests/ref/fate/vp9-03-size-200x198 | 26 +- tests/ref/fate/vp9-03-size-200x200 | 26 +- tests/ref/fate/vp9-03-size-200x202 | 26 +- tests/ref/fate/vp9-03-size-200x208 | 26 +- tests/ref/fate/vp9-03-size-200x210 | 26 +- tests/ref/fate/vp9-03-size-200x224 | 26 +- tests/ref/fate/vp9-03-size-200x226 | 26 +- tests/ref/fate/vp9-03-size-202x196 | 26 +- tests/ref/fate/vp9-03-size-202x198 | 26 +- tests/ref/fate/vp9-03-size-202x200 | 26 +- tests/ref/fate/vp9-03-size-202x202 | 26 +- tests/ref/fate/vp9-03-size-202x208 | 26 +- tests/ref/fate/vp9-03-size-202x210 | 26 +- tests/ref/fate/vp9-03-size-202x224 | 26 +- tests/ref/fate/vp9-03-size-202x226 | 26 +- tests/ref/fate/vp9-03-size-208x196 | 26 +- tests/ref/fate/vp9-03-size-208x198 | 26 +- tests/ref/fate/vp9-03-size-208x200 | 26 +- tests/ref/fate/vp9-03-size-208x202 | 26 +- tests/ref/fate/vp9-03-size-208x208 | 26 +- tests/ref/fate/vp9-03-size-208x210 | 26 +- tests/ref/fate/vp9-03-size-208x224 | 26 +- tests/ref/fate/vp9-03-size-208x226 | 26 +- tests/ref/fate/vp9-03-size-210x196 | 26 +- tests/ref/fate/vp9-03-size-210x198 | 26 +- tests/ref/fate/vp9-03-size-210x200 | 26 +- tests/ref/fate/vp9-03-size-210x202 | 26 +- tests/ref/fate/vp9-03-size-210x208 | 26 +- tests/ref/fate/vp9-03-size-210x210 | 26 +- tests/ref/fate/vp9-03-size-210x224 | 26 +- tests/ref/fate/vp9-03-size-210x226 | 26 +- tests/ref/fate/vp9-03-size-224x196 | 26 +- tests/ref/fate/vp9-03-size-224x198 | 26 +- tests/ref/fate/vp9-03-size-224x200 | 26 +- tests/ref/fate/vp9-03-size-224x202 | 26 +- tests/ref/fate/vp9-03-size-224x208 | 26 +- tests/ref/fate/vp9-03-size-224x210 | 26 +- tests/ref/fate/vp9-03-size-224x224 | 26 +- tests/ref/fate/vp9-03-size-224x226 | 26 +- tests/ref/fate/vp9-03-size-226x196 | 26 +- tests/ref/fate/vp9-03-size-226x198 | 26 +- tests/ref/fate/vp9-03-size-226x200 | 26 +- tests/ref/fate/vp9-03-size-226x202 | 26 +- tests/ref/fate/vp9-03-size-226x208 | 26 +- tests/ref/fate/vp9-03-size-226x210 | 26 +- tests/ref/fate/vp9-03-size-226x224 | 26 +- tests/ref/fate/vp9-03-size-226x226 | 26 +- tests/ref/fate/vp9-2pass-akiyo | 106 +- tests/ref/fate/vp9-parallelmode-akiyo | 56 +- tests/ref/fate/vp9-segmentation-aq-akiyo | 56 +- tests/ref/fate/vp9-segmentation-sf-akiyo | 56 +- tests/ref/fate/vp9-tiling-pedestrian | 4 - tests/ref/fate/vqa-cc | 68 +- tests/ref/fate/wmv8-drm | 260 +- tests/ref/fate/wmv8-drm-nodec | 256 +- tests/ref/fate/wmv8-x8intra | 474 - tests/ref/fate/wtv-demux | 86 +- tests/ref/fate/xbm11 | 2 +- tests/ref/fate/xface | 2 - tests/ref/fate/xmv-demux | 176 +- tests/ref/fate/xvid-custom-matrix | 44 +- tests/ref/fate/xvid-idctmmx | 44 +- tests/ref/fate/yop | 12 +- tests/ref/fate/zmbv-15bit | 318 +- tests/ref/fate/zmbv-16bit | 238 +- tests/ref/fate/zmbv-8bit | 1 - tests/ref/lavf-fate/latm | 3 - tests/ref/lavf-fate/mp3 | 3 - tests/ref/lavf-fate/ogg_vp3 | 3 - tests/ref/lavf/aiff | 4 +- tests/ref/lavf/asf | 4 +- tests/ref/lavf/ast | 3 - tests/ref/lavf/au | 4 +- tests/ref/lavf/avi | 6 +- tests/ref/lavf/bmp | 2 +- tests/ref/lavf/caf | 3 - tests/ref/lavf/dpx | 19 +- tests/ref/lavf/dv_fmt | 8 +- tests/ref/lavf/ffm | 4 +- tests/ref/lavf/flm | 3 - tests/ref/lavf/flv_fmt | 6 +- tests/ref/lavf/gif | 6 +- tests/ref/lavf/gxf | 12 +- tests/ref/lavf/ircam | 3 - tests/ref/lavf/ismv | 9 - tests/ref/lavf/jpg | 2 +- tests/ref/lavf/mkv | 9 +- tests/ref/lavf/mmf | 4 +- tests/ref/lavf/mov | 15 +- tests/ref/lavf/mpg | 10 +- tests/ref/lavf/mxf | 12 +- tests/ref/lavf/mxf_d10 | 4 +- tests/ref/lavf/nut | 6 +- tests/ref/lavf/ogg | 4 +- tests/ref/lavf/pam | 17 +- tests/ref/lavf/pcx | 4 +- tests/ref/lavf/pgm | 4 +- tests/ref/lavf/pgmpipe | 4 +- tests/ref/lavf/pixfmt | 16 +- tests/ref/lavf/png | 12 +- tests/ref/lavf/ppm | 2 +- tests/ref/lavf/rm | 4 +- tests/ref/lavf/sgi | 2 +- tests/ref/lavf/smjpeg | 3 - tests/ref/lavf/sunrast | 2 +- tests/ref/lavf/swf | 6 +- tests/ref/lavf/tga | 2 +- tests/ref/lavf/tiff | 2 +- tests/ref/lavf/ts | 6 +- tests/ref/lavf/voc | 2 +- tests/ref/lavf/voc_s16 | 4 +- tests/ref/lavf/w64 | 3 - tests/ref/lavf/wav | 4 +- tests/ref/lavf/wtv | 3 - tests/ref/lavf/xbm | 3 - tests/ref/lavf/xwd | 23 +- tests/ref/seek/acodec-flac | 58 +- tests/ref/seek/acodec-mp2 | 8 +- tests/ref/seek/acodec-pcm-f32be | 54 +- tests/ref/seek/acodec-pcm-f64be | 54 +- tests/ref/seek/acodec-pcm-s16le | 54 +- tests/ref/seek/acodec-pcm-u8 | 54 +- tests/ref/seek/lavf-aiff | 30 +- tests/ref/seek/lavf-asf | 54 +- tests/ref/seek/lavf-au | 30 +- tests/ref/seek/lavf-avi | 36 +- tests/ref/seek/lavf-bmp | 9 +- tests/ref/seek/lavf-dv_fmt | 54 +- tests/ref/seek/lavf-ffm | 26 +- tests/ref/seek/lavf-flv_fmt | 36 +- tests/ref/seek/lavf-gif | 67 +- tests/ref/seek/lavf-gxf | 36 +- tests/ref/seek/lavf-jpg | 9 +- tests/ref/seek/lavf-mkv | 59 +- tests/ref/seek/lavf-mmf | 53 +- tests/ref/seek/lavf-mov | 60 +- tests/ref/seek/lavf-mpg | 54 +- tests/ref/seek/lavf-mxf | 24 +- tests/ref/seek/lavf-nut | 86 +- tests/ref/seek/lavf-ogg | 63 +- tests/ref/seek/lavf-pcx | 9 +- tests/ref/seek/lavf-pgm | 9 +- tests/ref/seek/lavf-ppm | 9 +- tests/ref/seek/lavf-rm | 54 +- tests/ref/seek/lavf-sgi | 9 +- tests/ref/seek/lavf-tga | 9 +- tests/ref/seek/lavf-tiff | 9 +- tests/ref/seek/lavf-ts | 42 +- tests/ref/seek/lavf-voc | 24 +- tests/ref/seek/lavf-wav | 30 +- tests/ref/seek/lavf-wtv | 48 - tests/ref/seek/vsynth2-dnxhd-1080i | 24 +- tests/ref/seek/vsynth2-dnxhd-720p | 24 +- tests/ref/seek/vsynth2-dnxhd-720p-rd | 24 +- tests/ref/seek/vsynth2-dv | 54 +- tests/ref/seek/vsynth2-dv-411 | 54 +- tests/ref/seek/vsynth2-dv-50 | 54 +- tests/ref/seek/vsynth2-ffv1 | 40 +- tests/ref/seek/vsynth2-flv | 8 +- tests/ref/seek/vsynth2-h261 | 28 +- tests/ref/seek/vsynth2-h263 | 8 +- tests/ref/seek/vsynth2-h263p | 28 +- tests/ref/seek/vsynth2-ljpeg | 40 +- tests/ref/seek/vsynth2-mjpeg | 30 +- tests/ref/seek/vsynth2-mpeg1 | 46 +- tests/ref/seek/vsynth2-mpeg1b | 36 +- tests/ref/seek/vsynth2-mpeg2-422 | 48 +- tests/ref/seek/vsynth2-mpeg2-idct-int | 24 +- tests/ref/seek/vsynth2-mpeg2-ilace | 40 +- tests/ref/seek/vsynth2-mpeg2-ivlc-qprd | 26 +- tests/ref/seek/vsynth2-mpeg2-thread | 48 +- tests/ref/seek/vsynth2-mpeg2-thread-ivlc | 48 +- tests/ref/seek/vsynth2-mpeg4 | 32 +- tests/ref/seek/vsynth2-mpeg4-adap | 16 +- tests/ref/seek/vsynth2-mpeg4-error | 40 +- tests/ref/seek/vsynth2-mpeg4-nr | 28 +- tests/ref/seek/vsynth2-mpeg4-qpel | 40 +- tests/ref/seek/vsynth2-mpeg4-qprd | 16 +- tests/ref/seek/vsynth2-mpeg4-rc | 28 +- tests/ref/seek/vsynth2-mpeg4-thread | 24 +- tests/ref/seek/vsynth2-msmpeg4 | 8 +- tests/ref/seek/vsynth2-msmpeg4v2 | 8 +- tests/ref/seek/vsynth2-rv10 | 17 +- tests/ref/seek/vsynth2-rv20 | 14 +- tests/ref/seek/vsynth2-snow | 46 - tests/ref/seek/vsynth2-snow-ll | 46 - tests/ref/seek/vsynth2-svq1 | 24 +- tests/ref/seek/vsynth2-wmv1 | 8 +- tests/ref/seek/vsynth2-wmv2 | 16 +- tests/ref/vsynth/vsynth1-amv | 4 - tests/ref/vsynth/vsynth1-asv1 | 2 +- tests/ref/vsynth/vsynth1-asv2 | 2 +- tests/ref/vsynth/vsynth1-avui | 4 - tests/ref/vsynth/vsynth1-cljr | 6 +- tests/ref/vsynth/vsynth1-dnxhd-1080i | 6 +- tests/ref/vsynth/vsynth1-dnxhd-720p | 6 +- tests/ref/vsynth/vsynth1-dnxhd-720p-10bit | 4 +- tests/ref/vsynth/vsynth1-dnxhd-720p-rd | 4 +- tests/ref/vsynth/vsynth1-dnxhd_1080i | 4 - tests/ref/vsynth/vsynth1-dv | 2 +- tests/ref/vsynth/vsynth1-dv-411 | 2 +- tests/ref/vsynth/vsynth1-dv-50 | 2 +- tests/ref/vsynth/vsynth1-dv_411 | 4 - tests/ref/vsynth/vsynth1-ffv1 | 4 +- tests/ref/vsynth/vsynth1-ffv1.0 | 4 - tests/ref/vsynth/vsynth1-ffvhuff | 2 +- tests/ref/vsynth/vsynth1-ffvhuff420p12 | 4 - tests/ref/vsynth/vsynth1-ffvhuff422p10left | 4 - tests/ref/vsynth/vsynth1-ffvhuff444 | 4 - tests/ref/vsynth/vsynth1-ffvhuff444p16 | 4 - tests/ref/vsynth/vsynth1-flashsv | 4 +- tests/ref/vsynth/vsynth1-flashsv2 | 4 - tests/ref/vsynth/vsynth1-flv | 6 +- tests/ref/vsynth/vsynth1-h261 | 6 +- tests/ref/vsynth/vsynth1-h261-trellis | 4 - tests/ref/vsynth/vsynth1-h263 | 4 +- tests/ref/vsynth/vsynth1-h263-obmc | 6 +- tests/ref/vsynth/vsynth1-h263p | 6 +- tests/ref/vsynth/vsynth1-huffyuv | 2 +- tests/ref/vsynth/vsynth1-jpeg2000 | 4 - tests/ref/vsynth/vsynth1-jpeg2000-97 | 4 - tests/ref/vsynth/vsynth1-jpegls | 6 +- tests/ref/vsynth/vsynth1-ljpeg | 4 +- tests/ref/vsynth/vsynth1-mjpeg | 6 +- tests/ref/vsynth/vsynth1-mjpeg-422 | 4 - tests/ref/vsynth/vsynth1-mjpeg-444 | 4 - tests/ref/vsynth/vsynth1-mpeg1 | 8 +- tests/ref/vsynth/vsynth1-mpeg1b | 6 +- tests/ref/vsynth/vsynth1-mpeg2 | 6 +- tests/ref/vsynth/vsynth1-mpeg2-422 | 8 +- tests/ref/vsynth/vsynth1-mpeg2-idct-int | 2 +- tests/ref/vsynth/vsynth1-mpeg2-ilace | 6 +- tests/ref/vsynth/vsynth1-mpeg2-ivlc-qprd | 8 +- tests/ref/vsynth/vsynth1-mpeg2-thread | 6 +- tests/ref/vsynth/vsynth1-mpeg2-thread-ivlc | 6 +- tests/ref/vsynth/vsynth1-mpeg4 | 6 +- tests/ref/vsynth/vsynth1-mpeg4-adap | 6 +- tests/ref/vsynth/vsynth1-mpeg4-adv | 4 +- tests/ref/vsynth/vsynth1-mpeg4-error | 8 +- tests/ref/vsynth/vsynth1-mpeg4-nr | 8 +- tests/ref/vsynth/vsynth1-mpeg4-qpel | 8 +- tests/ref/vsynth/vsynth1-mpeg4-qprd | 6 +- tests/ref/vsynth/vsynth1-mpeg4-rc | 6 +- tests/ref/vsynth/vsynth1-mpeg4-thread | 6 +- tests/ref/vsynth/vsynth1-mpng | 4 - tests/ref/vsynth/vsynth1-msmpeg4 | 6 +- tests/ref/vsynth/vsynth1-msmpeg4v2 | 6 +- tests/ref/vsynth/vsynth1-msvideo1 | 4 - tests/ref/vsynth/vsynth1-prores | 8 +- tests/ref/vsynth/vsynth1-prores_ks | 4 - tests/ref/vsynth/vsynth1-qtrle | 8 +- tests/ref/vsynth/vsynth1-qtrlegray | 4 - tests/ref/vsynth/vsynth1-r210 | 4 - tests/ref/vsynth/vsynth1-rgb | 6 +- tests/ref/vsynth/vsynth1-rv10 | 6 +- tests/ref/vsynth/vsynth1-rv20 | 6 +- tests/ref/vsynth/vsynth1-snow | 4 - tests/ref/vsynth/vsynth1-snow-hpel | 4 - tests/ref/vsynth/vsynth1-snow-ll | 4 - tests/ref/vsynth/vsynth1-svq1 | 4 +- tests/ref/vsynth/vsynth1-v210 | 2 +- tests/ref/vsynth/vsynth1-v308 | 4 - tests/ref/vsynth/vsynth1-v408 | 4 - tests/ref/vsynth/vsynth1-wmv1 | 6 +- tests/ref/vsynth/vsynth1-wmv2 | 6 +- tests/ref/vsynth/vsynth1-y41p | 4 - tests/ref/vsynth/vsynth1-yuv | 2 +- tests/ref/vsynth/vsynth1-yuv4 | 4 - tests/ref/vsynth/vsynth1-zlib | 4 - tests/ref/vsynth/vsynth1-zmbv | 4 - tests/ref/vsynth/vsynth2-amv | 4 - tests/ref/vsynth/vsynth2-asv1 | 2 +- tests/ref/vsynth/vsynth2-asv2 | 2 +- tests/ref/vsynth/vsynth2-avui | 4 - tests/ref/vsynth/vsynth2-cljr | 6 +- tests/ref/vsynth/vsynth2-dnxhd-1080i | 6 +- tests/ref/vsynth/vsynth2-dnxhd-720p | 6 +- tests/ref/vsynth/vsynth2-dnxhd-720p-10bit | 6 +- tests/ref/vsynth/vsynth2-dnxhd-720p-rd | 4 +- tests/ref/vsynth/vsynth2-dnxhd_1080i | 4 - tests/ref/vsynth/vsynth2-dv | 2 +- tests/ref/vsynth/vsynth2-dv-411 | 2 +- tests/ref/vsynth/vsynth2-dv-50 | 2 +- tests/ref/vsynth/vsynth2-dv_411 | 4 - tests/ref/vsynth/vsynth2-ffv1 | 4 +- tests/ref/vsynth/vsynth2-ffv1.0 | 4 - tests/ref/vsynth/vsynth2-ffvhuff | 2 +- tests/ref/vsynth/vsynth2-ffvhuff420p12 | 4 - tests/ref/vsynth/vsynth2-ffvhuff422p10left | 4 - tests/ref/vsynth/vsynth2-ffvhuff444 | 4 - tests/ref/vsynth/vsynth2-ffvhuff444p16 | 4 - tests/ref/vsynth/vsynth2-flashsv | 4 +- tests/ref/vsynth/vsynth2-flashsv2 | 4 - tests/ref/vsynth/vsynth2-flv | 8 +- tests/ref/vsynth/vsynth2-h261 | 6 +- tests/ref/vsynth/vsynth2-h261-trellis | 4 - tests/ref/vsynth/vsynth2-h263 | 6 +- tests/ref/vsynth/vsynth2-h263-obmc | 6 +- tests/ref/vsynth/vsynth2-h263p | 6 +- tests/ref/vsynth/vsynth2-huffyuv | 2 +- tests/ref/vsynth/vsynth2-jpeg2000 | 4 - tests/ref/vsynth/vsynth2-jpeg2000-97 | 4 - tests/ref/vsynth/vsynth2-jpegls | 6 +- tests/ref/vsynth/vsynth2-ljpeg | 4 +- tests/ref/vsynth/vsynth2-mjpeg | 6 +- tests/ref/vsynth/vsynth2-mjpeg-422 | 4 - tests/ref/vsynth/vsynth2-mjpeg-444 | 4 - tests/ref/vsynth/vsynth2-mpeg1 | 6 +- tests/ref/vsynth/vsynth2-mpeg1b | 6 +- tests/ref/vsynth/vsynth2-mpeg2 | 6 +- tests/ref/vsynth/vsynth2-mpeg2-422 | 8 +- tests/ref/vsynth/vsynth2-mpeg2-idct-int | 2 +- tests/ref/vsynth/vsynth2-mpeg2-ilace | 6 +- tests/ref/vsynth/vsynth2-mpeg2-ivlc-qprd | 2 +- tests/ref/vsynth/vsynth2-mpeg2-thread | 6 +- tests/ref/vsynth/vsynth2-mpeg2-thread-ivlc | 6 +- tests/ref/vsynth/vsynth2-mpeg4 | 6 +- tests/ref/vsynth/vsynth2-mpeg4-adap | 6 +- tests/ref/vsynth/vsynth2-mpeg4-adv | 2 +- tests/ref/vsynth/vsynth2-mpeg4-error | 8 +- tests/ref/vsynth/vsynth2-mpeg4-nr | 6 +- tests/ref/vsynth/vsynth2-mpeg4-qpel | 6 +- tests/ref/vsynth/vsynth2-mpeg4-qprd | 6 +- tests/ref/vsynth/vsynth2-mpeg4-rc | 6 +- tests/ref/vsynth/vsynth2-mpeg4-thread | 6 +- tests/ref/vsynth/vsynth2-mpng | 4 - tests/ref/vsynth/vsynth2-msmpeg4 | 8 +- tests/ref/vsynth/vsynth2-msmpeg4v2 | 8 +- tests/ref/vsynth/vsynth2-msvideo1 | 4 - tests/ref/vsynth/vsynth2-prores | 8 +- tests/ref/vsynth/vsynth2-prores_ks | 4 - tests/ref/vsynth/vsynth2-qtrle | 8 +- tests/ref/vsynth/vsynth2-qtrlegray | 4 - tests/ref/vsynth/vsynth2-r210 | 4 - tests/ref/vsynth/vsynth2-rgb | 6 +- tests/ref/vsynth/vsynth2-rv10 | 6 +- tests/ref/vsynth/vsynth2-rv20 | 6 +- tests/ref/vsynth/vsynth2-snow | 4 - tests/ref/vsynth/vsynth2-snow-hpel | 4 - tests/ref/vsynth/vsynth2-snow-ll | 4 - tests/ref/vsynth/vsynth2-svq1 | 4 +- tests/ref/vsynth/vsynth2-v210 | 2 +- tests/ref/vsynth/vsynth2-v308 | 4 - tests/ref/vsynth/vsynth2-v408 | 4 - tests/ref/vsynth/vsynth2-wmv1 | 6 +- tests/ref/vsynth/vsynth2-wmv2 | 6 +- tests/ref/vsynth/vsynth2-y41p | 4 - tests/ref/vsynth/vsynth2-yuv | 2 +- tests/ref/vsynth/vsynth2-yuv4 | 4 - tests/ref/vsynth/vsynth2-zlib | 4 - tests/ref/vsynth/vsynth2-zmbv | 4 - tests/ref/vsynth1/cljr | 4 - tests/ref/vsynth1/yuv | 4 - tests/ref/vsynth2/cljr | 4 - tests/ref/vsynth2/huffyuv | 4 - tests/ref/vsynth2/yuv | 4 - tests/regression-funcs.sh | 26 +- tests/rotozoom.c | 8 +- tests/test.ffmeta | 9 - tests/tiny_psnr.c | 171 +- tests/tiny_ssim.c | 246 - tests/utils.c | 10 +- tests/videogen.c | 8 +- tools/aviocat.c | 12 +- tools/bisect-create | 46 - tools/bookmarklets.html | 55 - tools/build_libstagefright | 58 - tools/clean-diff | 11 - tools/crypto_bench.c | 358 - tools/cws2fws.c | 14 +- tools/dvd2concat | 127 - tools/enum_options.c | 143 - tools/ffescape.c | 180 - tools/ffeval.c | 139 - tools/ffhash.c | 151 - tools/fourcc2pixfmt.c | 123 - tools/gen-rc | 121 - tools/graph2dot.c | 33 +- tools/ismindex.c | 24 +- tools/make_chlayout_test | 114 - tools/missing_codec_desc | 36 - tools/normalize.py | 33 - tools/patcheck | 12 +- tools/pktdumper.c | 8 +- tools/plotframes | 164 - tools/probetest.c | 70 +- tools/qt-faststart.c | 18 +- tools/seek_print.c | 105 - tools/trasher.c | 13 +- tools/uncoded_frame.c | 279 - tools/unwrap-diff | 2 - tools/yuvcmp.c | 182 - tools/zmqsend.c | 167 - tools/zmqshell.py | 26 - version.sh | 42 +- 3692 files changed, 72748 insertions(+), 326051 deletions(-) delete mode 100644 MAINTAINERS create mode 100644 avconv.c rename ffmpeg.h => avconv.h (71%) rename ffmpeg_dxva2.c => avconv_dxva2.c (98%) rename ffmpeg_filter.c => avconv_filter.c (57%) rename ffmpeg_opt.c => avconv_opt.c (69%) rename ffmpeg_vda.c => avconv_vda.c (93%) rename ffmpeg_vdpau.c => avconv_vdpau.c (97%) create mode 100644 avplay.c create mode 100644 avprobe.c rename ffserver.c => avserver.c (88%) delete mode 100644 cmdutils_opencl.c delete mode 100644 compat/avisynth/avisynth_c.h delete mode 100644 compat/avisynth/avisynth_c_25.h delete mode 100644 compat/avisynth/avxsynth_c.h delete mode 100644 compat/avisynth/windowsPorts/basicDataTypeConversions.h delete mode 100644 compat/avisynth/windowsPorts/windows2linux.h delete mode 100644 compat/msvcrt/snprintf.h delete mode 100644 compat/os2threads.h delete mode 100644 compat/va_copy.h delete mode 100644 doc/authors.texi rename doc/{ffmpeg.texi => avconv.texi} (57%) create mode 100644 doc/avplay.texi create mode 100644 doc/avprobe.texi rename doc/{ffserver.conf => avserver.conf} (91%) create mode 100644 doc/avserver.texi create mode 100644 doc/avtools-common-opts.texi create mode 100644 doc/avutil.txt delete mode 100644 doc/codecs.texi delete mode 100644 doc/default.css delete mode 100644 doc/devices.texi create mode 100644 doc/doxy/doxy_stylesheet.css create mode 100644 doc/doxy/footer.html create mode 100644 doc/doxy/header.html delete mode 100644 doc/errno.txt create mode 100644 doc/eval.texi delete mode 100644 doc/examples/Makefile delete mode 100644 doc/examples/README rename doc/examples/{decoding_encoding.c => avcodec.c} (56%) delete mode 100644 doc/examples/avio_reading.c delete mode 100644 doc/examples/demuxing_decoding.c delete mode 100644 doc/examples/filtering_audio.c delete mode 100644 doc/examples/filtering_video.c delete mode 100644 doc/examples/muxing.c create mode 100644 doc/examples/output.c delete mode 100644 doc/examples/remuxing.c delete mode 100644 doc/examples/resampling_audio.c delete mode 100644 doc/examples/scaling_video.c delete mode 100644 doc/examples/transcoding.c delete mode 100644 doc/fate_config.sh.template delete mode 100644 doc/ffmpeg-bitstream-filters.texi delete mode 100644 doc/ffmpeg-codecs.texi delete mode 100644 doc/ffmpeg-devices.texi delete mode 100644 doc/ffmpeg-filters.texi delete mode 100644 doc/ffmpeg-formats.texi delete mode 100644 doc/ffmpeg-protocols.texi delete mode 100644 doc/ffmpeg-resampler.texi delete mode 100644 doc/ffmpeg-scaler.texi delete mode 100644 doc/ffmpeg-utils.texi delete mode 100644 doc/ffmpeg.txt delete mode 100644 doc/ffplay.texi delete mode 100644 doc/ffprobe.texi delete mode 100644 doc/ffprobe.xsd delete mode 100644 doc/ffserver.texi delete mode 100644 doc/fftools-common-opts.texi delete mode 100644 doc/filter_design.txt delete mode 100644 doc/formats.texi create mode 100644 doc/git-howto.txt delete mode 100644 doc/issue_tracker.txt delete mode 100644 doc/libavcodec.texi delete mode 100644 doc/libavdevice.texi delete mode 100644 doc/libavformat.texi delete mode 100644 doc/libavutil.texi delete mode 100644 doc/libswresample.texi delete mode 100644 doc/libswscale.texi delete mode 100644 doc/mips.txt delete mode 100644 doc/resampler.texi delete mode 100644 doc/scaler.texi delete mode 100644 doc/snow.txt create mode 100644 doc/soc.txt delete mode 100644 doc/swresample.txt mode change 100644 => 100755 doc/texi2pod.pl delete mode 100644 doc/texidep.pl delete mode 100644 doc/utils.texi create mode 100644 doc/viterbi.txt delete mode 100644 doc/writing_filters.txt delete mode 100644 ffmpeg.c delete mode 100644 ffplay.c delete mode 100644 ffprobe.c delete mode 100644 libavcodec/012v.c create mode 100644 libavcodec/a64enc.h delete mode 100644 libavcodec/ac3dec_fixed.c delete mode 100644 libavcodec/ac3dec_float.c delete mode 100644 libavcodec/alpha/Makefile delete mode 100644 libavcodec/alpha/asm.h delete mode 100644 libavcodec/alpha/dsputil_alpha.c delete mode 100644 libavcodec/alpha/dsputil_alpha.h delete mode 100644 libavcodec/alpha/dsputil_alpha_asm.S delete mode 100644 libavcodec/alpha/hpeldsp_alpha.c delete mode 100644 libavcodec/alpha/hpeldsp_alpha.h delete mode 100644 libavcodec/alpha/hpeldsp_alpha_asm.S delete mode 100644 libavcodec/alpha/motion_est_alpha.c delete mode 100644 libavcodec/alpha/motion_est_mvi_asm.S delete mode 100644 libavcodec/alpha/mpegvideo_alpha.c delete mode 100644 libavcodec/alpha/regdef.h delete mode 100644 libavcodec/alpha/simple_idct_alpha.c rename libavcodec/arm/{startcode_armv6.S => h264dsp_armv6.S} (95%) delete mode 100644 libavcodec/ass_split.c delete mode 100644 libavcodec/ass_split.h delete mode 100644 libavcodec/audioconvert.c delete mode 100644 libavcodec/audioconvert.h delete mode 100644 libavcodec/avcodecres.rc delete mode 100644 libavcodec/avrndec.c delete mode 100644 libavcodec/avuidec.c delete mode 100644 libavcodec/avuienc.c delete mode 100644 libavcodec/bintext.c delete mode 100644 libavcodec/bintext.h delete mode 100644 libavcodec/cinepakenc.c delete mode 100644 libavcodec/cpia.c delete mode 100644 libavcodec/crystalhd.c delete mode 100644 libavcodec/dcaenc.c delete mode 100644 libavcodec/dcaenc.h delete mode 100644 libavcodec/dirac_arith.c delete mode 100644 libavcodec/dirac_arith.h delete mode 100644 libavcodec/dirac_dwt.c delete mode 100644 libavcodec/dirac_dwt.h delete mode 100644 libavcodec/diracdec.c delete mode 100644 libavcodec/diracdsp.c delete mode 100644 libavcodec/diracdsp.h delete mode 100644 libavcodec/dpx_parser.c delete mode 100644 libavcodec/dsd_tablegen.c delete mode 100644 libavcodec/dsd_tablegen.h delete mode 100644 libavcodec/dsddec.c delete mode 100644 libavcodec/dvd_nav_parser.c delete mode 100644 libavcodec/evrcdata.h delete mode 100644 libavcodec/evrcdec.c delete mode 100644 libavcodec/exif.c delete mode 100644 libavcodec/exif.h delete mode 100644 libavcodec/fft-fixed32-test.c delete mode 100644 libavcodec/fft_fixed_32.c delete mode 100644 libavcodec/fft_init_table.c delete mode 100644 libavcodec/fft_table.h delete mode 100644 libavcodec/ffwavesynth.c delete mode 100644 libavcodec/flashsv2enc.c delete mode 100644 libavcodec/frame_thread_encoder.c delete mode 100644 libavcodec/frame_thread_encoder.h delete mode 100644 libavcodec/g729.h delete mode 100644 libavcodec/g729data.h delete mode 100644 libavcodec/g729dec.c delete mode 100644 libavcodec/g729postfilter.c delete mode 100644 libavcodec/g729postfilter.h delete mode 100644 libavcodec/gif.h delete mode 100644 libavcodec/hevcpred.h delete mode 100644 libavcodec/j2kenc.c delete mode 100644 libavcodec/jacosub.h delete mode 100644 libavcodec/jacosubdec.c delete mode 100644 libavcodec/libaacplus.c delete mode 100644 libavcodec/libcelt_dec.c delete mode 100644 libavcodec/libshine.c delete mode 100644 libavcodec/libstagefright.cpp delete mode 100644 libavcodec/libutvideo.h delete mode 100644 libavcodec/libutvideodec.cpp delete mode 100644 libavcodec/libutvideoenc.cpp rename libavcodec/{libvorbisenc.c => libvorbis.c} (77%) delete mode 100644 libavcodec/libvorbisdec.c delete mode 100644 libavcodec/libzvbi-teletextdec.c delete mode 100644 libavcodec/lossless_videodsp.c delete mode 100644 libavcodec/lossless_videodsp.h delete mode 100644 libavcodec/mdct_fixed_32.c delete mode 100644 libavcodec/microdvddec.c delete mode 100644 libavcodec/mips/Makefile delete mode 100644 libavcodec/mips/aaccoder_mips.c delete mode 100644 libavcodec/mips/aacdec_mips.c delete mode 100644 libavcodec/mips/aacdec_mips.h delete mode 100644 libavcodec/mips/aacpsdsp_mips.c delete mode 100644 libavcodec/mips/aacpsy_mips.h delete mode 100644 libavcodec/mips/aacsbr_mips.c delete mode 100644 libavcodec/mips/aacsbr_mips.h delete mode 100644 libavcodec/mips/ac3dsp_mips.c delete mode 100644 libavcodec/mips/acelp_filters_mips.c delete mode 100644 libavcodec/mips/acelp_vectors_mips.c delete mode 100644 libavcodec/mips/amrwbdec_mips.c delete mode 100644 libavcodec/mips/amrwbdec_mips.h delete mode 100644 libavcodec/mips/celp_filters_mips.c delete mode 100644 libavcodec/mips/celp_math_mips.c delete mode 100644 libavcodec/mips/compute_antialias_fixed.h delete mode 100644 libavcodec/mips/compute_antialias_float.h delete mode 100644 libavcodec/mips/fft_mips.c delete mode 100644 libavcodec/mips/fmtconvert_mips.c delete mode 100644 libavcodec/mips/iirfilter_mips.c delete mode 100644 libavcodec/mips/lsp_mips.h delete mode 100644 libavcodec/mips/mpegaudiodsp_mips_fixed.c delete mode 100644 libavcodec/mips/mpegaudiodsp_mips_float.c delete mode 100644 libavcodec/mips/sbrdsp_mips.c delete mode 100644 libavcodec/motion-test.c delete mode 100644 libavcodec/movtextdec.c delete mode 100644 libavcodec/movtextenc.c delete mode 100644 libavcodec/mp3_header_decompress_bsf.c rename libavcodec/{mpegaudioenc_template.c => mpegaudioenc.c} (90%) delete mode 100644 libavcodec/mpegaudioenc_fixed.c delete mode 100644 libavcodec/mpegaudioenc_float.c delete mode 100644 libavcodec/mpl2dec.c delete mode 100644 libavcodec/mqcenc.c delete mode 100644 libavcodec/msvideo1enc.c delete mode 100644 libavcodec/old_codec_ids.h delete mode 100644 libavcodec/paf.h rename libavcodec/{proresdec_lgpl.c => proresdec.c} (98%) delete mode 100644 libavcodec/proresdec.h delete mode 100644 libavcodec/proresdec2.c rename libavcodec/{proresenc_kostya.c => proresenc.c} (98%) delete mode 100644 libavcodec/proresenc_anatoliy.c delete mode 100644 libavcodec/r210enc.c delete mode 100644 libavcodec/realtextdec.c delete mode 100644 libavcodec/resample.c delete mode 100644 libavcodec/resample2.c delete mode 100644 libavcodec/s302menc.c delete mode 100644 libavcodec/samidec.c delete mode 100644 libavcodec/sh4/README delete mode 100644 libavcodec/smvjpegdec.c delete mode 100644 libavcodec/snow.c delete mode 100644 libavcodec/snow.h delete mode 100644 libavcodec/snow_dwt.c delete mode 100644 libavcodec/snow_dwt.h delete mode 100644 libavcodec/snowdata.h delete mode 100644 libavcodec/snowdec.c delete mode 100644 libavcodec/snowenc.c delete mode 100644 libavcodec/sonic.c delete mode 100644 libavcodec/sparc/README delete mode 100644 libavcodec/srtenc.c delete mode 100644 libavcodec/startcode.c delete mode 100644 libavcodec/startcode.h delete mode 100644 libavcodec/subviewerdec.c delete mode 100644 libavcodec/targa_y216dec.c delete mode 100644 libavcodec/textdec.c delete mode 100644 libavcodec/tiff_common.c delete mode 100644 libavcodec/tiff_common.h delete mode 100644 libavcodec/tiff_data.c delete mode 100644 libavcodec/tiff_data.h delete mode 100644 libavcodec/ttadata.c delete mode 100644 libavcodec/ttadata.h delete mode 100644 libavcodec/ttadsp.c delete mode 100644 libavcodec/ttadsp.h delete mode 100644 libavcodec/ttaenc.c delete mode 100644 libavcodec/v210dec.h delete mode 100644 libavcodec/v308dec.c delete mode 100644 libavcodec/v308enc.c delete mode 100644 libavcodec/v408dec.c delete mode 100644 libavcodec/v408enc.c delete mode 100644 libavcodec/vaapi_mpeg.c delete mode 100644 libavcodec/vda_h264_dec.c delete mode 100644 libavcodec/vp9_parser.c create mode 100644 libavcodec/vp9block.c create mode 100644 libavcodec/vp9data.c delete mode 100644 libavcodec/vp9dsp.h create mode 100644 libavcodec/vp9mvs.c create mode 100644 libavcodec/vp9prob.c delete mode 100644 libavcodec/wavpack.h delete mode 100644 libavcodec/wavpackenc.c delete mode 100644 libavcodec/wavpackenc.h delete mode 100644 libavcodec/webvttdec.c delete mode 100644 libavcodec/webvttenc.c delete mode 100644 libavcodec/x86/dirac_dwt.c delete mode 100644 libavcodec/x86/dirac_dwt.h delete mode 100644 libavcodec/x86/diracdsp_mmx.c delete mode 100644 libavcodec/x86/diracdsp_mmx.h delete mode 100644 libavcodec/x86/diracdsp_yasm.asm delete mode 100644 libavcodec/x86/dwt_yasm.asm delete mode 100644 libavcodec/x86/flacdsp.asm delete mode 100644 libavcodec/x86/flacdsp_init.c create mode 100644 libavcodec/x86/fpel_mmx.c delete mode 100644 libavcodec/x86/hevc_deblock.asm delete mode 100644 libavcodec/x86/hevc_mc.asm delete mode 100644 libavcodec/x86/hevcdsp.h delete mode 100644 libavcodec/x86/hevcdsp_init.c create mode 100644 libavcodec/x86/hpeldsp_mmx.c delete mode 100644 libavcodec/x86/lossless_videodsp.asm delete mode 100644 libavcodec/x86/lossless_videodsp_init.c delete mode 100644 libavcodec/x86/snowdsp.c delete mode 100644 libavcodec/x86/ttadsp.asm delete mode 100644 libavcodec/x86/ttadsp_init.c delete mode 100644 libavcodec/x86/v210-init.c delete mode 100644 libavcodec/x86/v210.asm rename libavcodec/x86/{vp9mc.asm => vp9dsp.asm} (67%) delete mode 100644 libavcodec/x86/vp9intrapred.asm delete mode 100644 libavcodec/x86/vp9itxfm.asm delete mode 100644 libavcodec/x86/vp9lpf.asm delete mode 100644 libavcodec/xface.c delete mode 100644 libavcodec/xface.h delete mode 100644 libavcodec/xfacedec.c delete mode 100644 libavcodec/xfaceenc.c delete mode 100644 libavcodec/y41pdec.c delete mode 100644 libavcodec/y41penc.c delete mode 100644 libavcodec/yuv4dec.c delete mode 100644 libavcodec/yuv4enc.c delete mode 100644 libavdevice/avdeviceres.rc delete mode 100644 libavdevice/avfoundation.m delete mode 100644 libavdevice/caca.c delete mode 100644 libavdevice/decklink_enc.cpp delete mode 100644 libavdevice/decklink_enc.h delete mode 100644 libavdevice/decklink_enc_c.c delete mode 100644 libavdevice/dshow.c delete mode 100644 libavdevice/dshow_capture.h delete mode 100644 libavdevice/dshow_common.c delete mode 100644 libavdevice/dshow_enummediatypes.c delete mode 100644 libavdevice/dshow_enumpins.c delete mode 100644 libavdevice/dshow_filter.c delete mode 100644 libavdevice/dshow_pin.c rename libavdevice/{fbdev_dec.c => fbdev.c} (69%) delete mode 100644 libavdevice/fbdev_common.c delete mode 100644 libavdevice/fbdev_common.h delete mode 100644 libavdevice/fbdev_enc.c delete mode 100644 libavdevice/gdigrab.c delete mode 100644 libavdevice/iec61883.c delete mode 100644 libavdevice/lavfi.c delete mode 100644 libavdevice/openal-dec.c delete mode 100644 libavdevice/opengl_enc.c delete mode 100644 libavdevice/opengl_enc_shaders.h rename libavdevice/{pulse_audio_dec.c => pulse.c} (60%) delete mode 100644 libavdevice/pulse_audio_common.c delete mode 100644 libavdevice/pulse_audio_common.h delete mode 100644 libavdevice/pulse_audio_enc.c delete mode 100644 libavdevice/qtkit.m delete mode 100644 libavdevice/sdl.c delete mode 100644 libavdevice/v4l.c delete mode 100644 libavdevice/v4l2-common.c delete mode 100644 libavdevice/v4l2-common.h delete mode 100644 libavdevice/v4l2enc.c delete mode 100644 libavdevice/xv.c delete mode 100644 libavfilter/aeval.c delete mode 100644 libavfilter/af_aconvert.c delete mode 100644 libavfilter/af_adelay.c delete mode 100644 libavfilter/af_aecho.c delete mode 100644 libavfilter/af_afade.c delete mode 100644 libavfilter/af_amerge.c delete mode 100644 libavfilter/af_apad.c delete mode 100644 libavfilter/af_aphaser.c delete mode 100644 libavfilter/af_aresample.c delete mode 100644 libavfilter/af_asetnsamples.c delete mode 100644 libavfilter/af_asetrate.c delete mode 100644 libavfilter/af_astats.c delete mode 100644 libavfilter/af_astreamsync.c delete mode 100644 libavfilter/af_atempo.c delete mode 100644 libavfilter/af_biquads.c delete mode 100644 libavfilter/af_earwax.c delete mode 100644 libavfilter/af_ladspa.c delete mode 100644 libavfilter/af_pan.c delete mode 100644 libavfilter/af_replaygain.c delete mode 100644 libavfilter/af_silencedetect.c delete mode 100644 libavfilter/af_volumedetect.c delete mode 100644 libavfilter/all_channel_layouts.inc delete mode 100644 libavfilter/asrc_abuffer.h delete mode 100644 libavfilter/asrc_flite.c delete mode 100644 libavfilter/asrc_sine.c delete mode 100644 libavfilter/avcodec.c delete mode 100644 libavfilter/avcodec.h delete mode 100644 libavfilter/avf_avectorscope.c delete mode 100644 libavfilter/avf_concat.c delete mode 100644 libavfilter/avf_showspectrum.c delete mode 100644 libavfilter/avf_showwaves.c delete mode 100644 libavfilter/avfilterres.rc delete mode 100644 libavfilter/bbox.c delete mode 100644 libavfilter/bbox.h delete mode 100644 libavfilter/bufferqueue.h delete mode 100644 libavfilter/deshake.h delete mode 100644 libavfilter/deshake_opencl.c delete mode 100644 libavfilter/deshake_opencl.h delete mode 100644 libavfilter/deshake_opencl_kernel.h delete mode 100644 libavfilter/dualinput.c delete mode 100644 libavfilter/dualinput.h delete mode 100644 libavfilter/f_ebur128.c delete mode 100644 libavfilter/f_interleave.c delete mode 100644 libavfilter/f_perms.c delete mode 100644 libavfilter/f_select.c delete mode 100644 libavfilter/f_sendcmd.c delete mode 100644 libavfilter/f_zmq.c delete mode 100644 libavfilter/framesync.c delete mode 100644 libavfilter/framesync.h delete mode 100644 libavfilter/graphdump.c delete mode 100644 libavfilter/lavfutils.c delete mode 100644 libavfilter/lavfutils.h delete mode 100644 libavfilter/libmpcodecs/av_helpers.h delete mode 100644 libavfilter/libmpcodecs/cpudetect.h delete mode 100644 libavfilter/libmpcodecs/img_format.c delete mode 100644 libavfilter/libmpcodecs/img_format.h delete mode 100644 libavfilter/libmpcodecs/libvo/fastmemcpy.h delete mode 100644 libavfilter/libmpcodecs/libvo/video_out.h delete mode 100644 libavfilter/libmpcodecs/mp_image.c delete mode 100644 libavfilter/libmpcodecs/mp_image.h delete mode 100644 libavfilter/libmpcodecs/mp_msg.h delete mode 100644 libavfilter/libmpcodecs/mpc_info.h delete mode 100644 libavfilter/libmpcodecs/vf.h delete mode 100644 libavfilter/libmpcodecs/vf_eq.c delete mode 100644 libavfilter/libmpcodecs/vf_eq2.c delete mode 100644 libavfilter/libmpcodecs/vf_fspp.c delete mode 100644 libavfilter/libmpcodecs/vf_ilpack.c delete mode 100644 libavfilter/libmpcodecs/vf_pp7.c delete mode 100644 libavfilter/libmpcodecs/vf_softpulldown.c delete mode 100644 libavfilter/libmpcodecs/vf_uspp.c delete mode 100644 libavfilter/libmpcodecs/vfcap.h delete mode 100644 libavfilter/lswsutils.c delete mode 100644 libavfilter/lswsutils.h delete mode 100644 libavfilter/opencl_allkernels.c delete mode 100644 libavfilter/opencl_allkernels.h delete mode 100644 libavfilter/src_movie.c delete mode 100644 libavfilter/transform.c delete mode 100644 libavfilter/transform.h delete mode 100644 libavfilter/unsharp.h delete mode 100644 libavfilter/unsharp_opencl.c delete mode 100644 libavfilter/unsharp_opencl.h delete mode 100644 libavfilter/unsharp_opencl_kernel.h delete mode 100644 libavfilter/vf_alphamerge.c delete mode 100644 libavfilter/vf_bbox.c delete mode 100644 libavfilter/vf_blackdetect.c delete mode 100644 libavfilter/vf_blend.c delete mode 100644 libavfilter/vf_colorbalance.c delete mode 100644 libavfilter/vf_colorchannelmixer.c delete mode 100644 libavfilter/vf_colormatrix.c delete mode 100644 libavfilter/vf_curves.c delete mode 100644 libavfilter/vf_dctdnoiz.c delete mode 100644 libavfilter/vf_decimate.c delete mode 100644 libavfilter/vf_dejudder.c delete mode 100644 libavfilter/vf_deshake.c delete mode 100644 libavfilter/vf_edgedetect.c delete mode 100644 libavfilter/vf_elbg.c delete mode 100644 libavfilter/vf_extractplanes.c delete mode 100644 libavfilter/vf_field.c delete mode 100644 libavfilter/vf_fieldmatch.c delete mode 100644 libavfilter/vf_framestep.c delete mode 100644 libavfilter/vf_geq.c delete mode 100644 libavfilter/vf_histeq.c delete mode 100644 libavfilter/vf_histogram.c delete mode 100644 libavfilter/vf_hue.c delete mode 100644 libavfilter/vf_idet.c delete mode 100644 libavfilter/vf_il.c delete mode 100644 libavfilter/vf_kerndeint.c delete mode 100644 libavfilter/vf_lut3d.c delete mode 100644 libavfilter/vf_mcdeint.c delete mode 100644 libavfilter/vf_mergeplanes.c delete mode 100644 libavfilter/vf_mp.c delete mode 100644 libavfilter/vf_mpdecimate.c delete mode 100644 libavfilter/vf_noise.c delete mode 100644 libavfilter/vf_owdenoise.c delete mode 100644 libavfilter/vf_perspective.c delete mode 100644 libavfilter/vf_phase.c delete mode 100644 libavfilter/vf_pp.c delete mode 100644 libavfilter/vf_psnr.c delete mode 100644 libavfilter/vf_pullup.c delete mode 100644 libavfilter/vf_pullup.h delete mode 100644 libavfilter/vf_removelogo.c delete mode 100644 libavfilter/vf_rotate.c delete mode 100644 libavfilter/vf_sab.c create mode 100644 libavfilter/vf_select.c delete mode 100644 libavfilter/vf_separatefields.c delete mode 100644 libavfilter/vf_setfield.c delete mode 100644 libavfilter/vf_smartblur.c delete mode 100644 libavfilter/vf_spp.c delete mode 100644 libavfilter/vf_spp.h delete mode 100644 libavfilter/vf_stereo3d.c delete mode 100644 libavfilter/vf_subtitles.c delete mode 100644 libavfilter/vf_super2xsai.c delete mode 100644 libavfilter/vf_swapuv.c delete mode 100644 libavfilter/vf_telecine.c delete mode 100644 libavfilter/vf_thumbnail.c delete mode 100644 libavfilter/vf_tile.c delete mode 100644 libavfilter/vf_tinterlace.c delete mode 100644 libavfilter/vf_vidstabdetect.c delete mode 100644 libavfilter/vf_vidstabtransform.c delete mode 100644 libavfilter/vf_vignette.c delete mode 100644 libavfilter/vf_w3fdif.c delete mode 100644 libavfilter/vidstabutils.c delete mode 100644 libavfilter/vidstabutils.h delete mode 100644 libavfilter/vsrc_cellauto.c create mode 100644 libavfilter/vsrc_color.c delete mode 100644 libavfilter/vsrc_life.c delete mode 100644 libavfilter/vsrc_mandelbrot.c create mode 100644 libavfilter/vsrc_movie.c delete mode 100644 libavfilter/vsrc_mptestsrc.c create mode 100644 libavfilter/vsrc_nullsrc.c delete mode 100644 libavfilter/x86/vf_pullup.asm delete mode 100644 libavfilter/x86/vf_pullup_init.c delete mode 100644 libavfilter/x86/vf_spp.c delete mode 100644 libavfilter/x86/yadif-10.asm delete mode 100644 libavfilter/x86/yadif-16.asm delete mode 100644 libavformat/act.c delete mode 100644 libavformat/adp.c delete mode 100644 libavformat/afc.c delete mode 100644 libavformat/aqtitledec.c delete mode 100644 libavformat/ast.c delete mode 100644 libavformat/ast.h delete mode 100644 libavformat/astdec.c delete mode 100644 libavformat/astenc.c delete mode 100644 libavformat/avformatres.rc delete mode 100644 libavformat/avr.c delete mode 100644 libavformat/bintext.c delete mode 100644 libavformat/bit.c delete mode 100644 libavformat/bluray.c delete mode 100644 libavformat/boadec.c delete mode 100644 libavformat/brstm.c delete mode 100644 libavformat/cache.c delete mode 100644 libavformat/cafenc.c delete mode 100644 libavformat/cinedec.c delete mode 100644 libavformat/concatdec.c delete mode 100644 libavformat/data_uri.c delete mode 100644 libavformat/dsfdec.c delete mode 100644 libavformat/dtshddec.c delete mode 100644 libavformat/epafdec.c delete mode 100644 libavformat/frmdec.c delete mode 100644 libavformat/ftp.c delete mode 100644 libavformat/g729dec.c delete mode 100644 libavformat/gifdec.c delete mode 100644 libavformat/golomb_tab.c delete mode 100644 libavformat/icodec.c delete mode 100644 libavformat/icoenc.c delete mode 100644 libavformat/img2.h delete mode 100644 libavformat/img2_alias_pix.c delete mode 100644 libavformat/img2_brender_pix.c delete mode 100644 libavformat/ircam.c delete mode 100644 libavformat/ircam.h delete mode 100644 libavformat/ircamdec.c delete mode 100644 libavformat/ircamenc.c delete mode 100644 libavformat/jacosubdec.c delete mode 100644 libavformat/jacosubenc.c delete mode 100644 libavformat/libgme.c delete mode 100644 libavformat/libmodplug.c delete mode 100644 libavformat/libnut.c delete mode 100644 libavformat/libquvi.c delete mode 100644 libavformat/libssh.c delete mode 100644 libavformat/loasdec.c delete mode 100644 libavformat/lvfdec.c delete mode 100644 libavformat/mgsts.c delete mode 100644 libavformat/microdvddec.c delete mode 100644 libavformat/microdvdenc.c delete mode 100644 libavformat/mkvtimestamp_v2.c delete mode 100644 libavformat/mlvdec.c delete mode 100644 libavformat/mpl2dec.c delete mode 100644 libavformat/mpsubdec.c delete mode 100644 libavformat/nistspheredec.c delete mode 100644 libavformat/oggparsevp8.c delete mode 100644 libavformat/pjsdec.c delete mode 100644 libavformat/pvfdec.c delete mode 100644 libavformat/realtextdec.c delete mode 100644 libavformat/redspark.c delete mode 100644 libavformat/rsd.c delete mode 100644 libavformat/samidec.c delete mode 100644 libavformat/sbgdec.c delete mode 100644 libavformat/sdr2.c delete mode 100644 libavformat/srtenc.c delete mode 100644 libavformat/subfile.c delete mode 100644 libavformat/subtitles.c delete mode 100644 libavformat/subtitles.h delete mode 100644 libavformat/subviewer1dec.c delete mode 100644 libavformat/subviewerdec.c delete mode 100644 libavformat/tedcaptionsdec.c delete mode 100644 libavformat/tee.c delete mode 100644 libavformat/uncodedframecrcenc.c delete mode 100644 libavformat/vivo.c delete mode 100644 libavformat/vplayerdec.c delete mode 100644 libavformat/w64.c delete mode 100644 libavformat/w64.h delete mode 100644 libavformat/webvttdec.c delete mode 100644 libavformat/webvttenc.c rename libavformat/{wtvdec.c => wtv.c} (80%) delete mode 100644 libavformat/wtv.h delete mode 100644 libavformat/wtv_common.c delete mode 100644 libavformat/wtvenc.c delete mode 100644 libavresample/avresampleres.rc delete mode 100644 libavutil/avutilres.rc delete mode 100644 libavutil/bprint.c delete mode 100644 libavutil/bprint.h delete mode 100644 libavutil/dynarray.h delete mode 100644 libavutil/fixed_dsp.c delete mode 100644 libavutil/fixed_dsp.h delete mode 100644 libavutil/hash.c delete mode 100644 libavutil/hash.h delete mode 100644 libavutil/integer.c delete mode 100644 libavutil/integer.h delete mode 100644 libavutil/intfloat_readwrite.c delete mode 100644 libavutil/intfloat_readwrite.h rename libavutil/{lls1.c => lls.c} (83%) rename libavutil/{lls2.h => lls.h} (64%) delete mode 100644 libavutil/lls1.h delete mode 100644 libavutil/lls2.c delete mode 100644 libavutil/mips/Makefile delete mode 100644 libavutil/mips/float_dsp_mips.c delete mode 100644 libavutil/mips/libm_mips.h delete mode 100644 libavutil/murmur3.c delete mode 100644 libavutil/murmur3.h delete mode 100644 libavutil/opencl.c delete mode 100644 libavutil/opencl.h delete mode 100644 libavutil/opencl_internal.c delete mode 100644 libavutil/opencl_internal.h delete mode 100644 libavutil/pca.c delete mode 100644 libavutil/pca.h delete mode 100644 libavutil/qsort.h delete mode 100644 libavutil/ripemd.c delete mode 100644 libavutil/ripemd.h delete mode 100644 libavutil/sha512.c delete mode 100644 libavutil/sha512.h delete mode 100644 libavutil/softfloat.c delete mode 100644 libavutil/softfloat.h delete mode 100644 libavutil/threadmessage.c delete mode 100644 libavutil/threadmessage.h delete mode 100644 libavutil/timecode.c delete mode 100644 libavutil/timecode.h delete mode 100644 libavutil/timestamp.h delete mode 100644 libavutil/utf8.c delete mode 100644 libavutil/x86_cpu.h delete mode 100644 libavutil/xga_font_data.c delete mode 100644 libavutil/xga_font_data.h delete mode 100644 libpostproc/Makefile delete mode 100644 libpostproc/libpostproc.v delete mode 100644 libpostproc/postprocess.c delete mode 100644 libpostproc/postprocess.h delete mode 100644 libpostproc/postprocess_altivec_template.c delete mode 100644 libpostproc/postprocess_internal.h delete mode 100644 libpostproc/postprocess_template.c delete mode 100644 libpostproc/postprocres.rc delete mode 100644 libpostproc/version.h delete mode 100644 libswresample/Makefile delete mode 100644 libswresample/arm/Makefile delete mode 100644 libswresample/arm/audio_convert_init.c delete mode 100644 libswresample/arm/audio_convert_neon.S delete mode 100644 libswresample/arm/neontest.c delete mode 100644 libswresample/audioconvert.c delete mode 100644 libswresample/audioconvert.h delete mode 100644 libswresample/dither.c delete mode 100644 libswresample/dither_template.c delete mode 100644 libswresample/libswresample.v delete mode 100644 libswresample/log2_tab.c delete mode 100644 libswresample/noise_shaping_data.c delete mode 100644 libswresample/rematrix.c delete mode 100644 libswresample/rematrix_template.c delete mode 100644 libswresample/resample.c delete mode 100644 libswresample/resample_template.c delete mode 100644 libswresample/soxr_resample.c delete mode 100644 libswresample/swresample-test.c delete mode 100644 libswresample/swresample.c delete mode 100644 libswresample/swresample.h delete mode 100644 libswresample/swresample_internal.h delete mode 100644 libswresample/swresampleres.rc delete mode 100644 libswresample/version.h delete mode 100644 libswresample/x86/Makefile delete mode 100644 libswresample/x86/audio_convert.asm delete mode 100644 libswresample/x86/rematrix.asm delete mode 100644 libswresample/x86/resample_mmx.h delete mode 100644 libswresample/x86/swresample_x86.c delete mode 100644 libswresample/x86/w64xmmtest.c delete mode 100644 libswscale/arm/Makefile delete mode 100644 libswscale/arm/rgb2yuv_neon_16.S delete mode 100644 libswscale/arm/rgb2yuv_neon_32.S delete mode 100644 libswscale/arm/rgb2yuv_neon_common.S delete mode 100644 libswscale/arm/swscale_unscaled.c delete mode 100644 libswscale/bayer_template.c delete mode 100644 libswscale/swscaleres.rc rename presets/{libvpx-720p.ffpreset => libvpx-1080p.avpreset} (88%) rename presets/{libvpx-720p50_60.ffpreset => libvpx-1080p50_60.avpreset} (88%) rename presets/{libvpx-360p.ffpreset => libvpx-360p.avpreset} (88%) rename presets/{libvpx-1080p.ffpreset => libvpx-720p.avpreset} (88%) rename presets/{libvpx-1080p50_60.ffpreset => libvpx-720p50_60.avpreset} (88%) create mode 100644 presets/libx264-baseline.avpreset create mode 100644 presets/libx264-fast.avpreset create mode 100644 presets/libx264-fast_firstpass.avpreset create mode 100644 presets/libx264-faster.avpreset create mode 100644 presets/libx264-faster_firstpass.avpreset rename presets/{libx264-ipod320.ffpreset => libx264-ipod320.avpreset} (54%) rename presets/{libx264-ipod640.ffpreset => libx264-ipod640.avpreset} (55%) create mode 100644 presets/libx264-lossless_fast.avpreset create mode 100644 presets/libx264-lossless_max.avpreset create mode 100644 presets/libx264-lossless_medium.avpreset create mode 100644 presets/libx264-lossless_slow.avpreset create mode 100644 presets/libx264-lossless_slower.avpreset create mode 100644 presets/libx264-lossless_ultrafast.avpreset create mode 100644 presets/libx264-main.avpreset create mode 100644 presets/libx264-medium.avpreset create mode 100644 presets/libx264-medium_firstpass.avpreset create mode 100644 presets/libx264-placebo.avpreset create mode 100644 presets/libx264-placebo_firstpass.avpreset create mode 100644 presets/libx264-slow.avpreset create mode 100644 presets/libx264-slow_firstpass.avpreset create mode 100644 presets/libx264-slower.avpreset create mode 100644 presets/libx264-slower_firstpass.avpreset create mode 100644 presets/libx264-superfast.avpreset create mode 100644 presets/libx264-superfast_firstpass.avpreset create mode 100644 presets/libx264-ultrafast.avpreset create mode 100644 presets/libx264-ultrafast_firstpass.avpreset create mode 100644 presets/libx264-veryfast.avpreset create mode 100644 presets/libx264-veryfast_firstpass.avpreset create mode 100644 presets/libx264-veryslow.avpreset create mode 100644 presets/libx264-veryslow_firstpass.avpreset delete mode 100755 tests/copycooker.sh delete mode 100755 tests/fate-update.sh delete mode 100644 tests/fate-valgrind.supp delete mode 100644 tests/fate/exif.mak delete mode 100644 tests/fate/ffmpeg.mak delete mode 100644 tests/fate/ffprobe.mak delete mode 100644 tests/fate/gif.mak delete mode 100644 tests/fate/libswresample.mak delete mode 100644 tests/fate/subtitles.mak delete mode 100755 tests/ffserver-regression.sh delete mode 100644 tests/ffserver.conf delete mode 100644 tests/ffserver.regression.ref delete mode 100644 tests/filtergraphs/alphamerge_alphaextract_rgb delete mode 100644 tests/filtergraphs/alphamerge_alphaextract_yuv delete mode 100644 tests/filtergraphs/concat delete mode 100644 tests/filtergraphs/gradfun delete mode 100644 tests/filtergraphs/hqdn3d delete mode 100644 tests/filtergraphs/overlay_rgb delete mode 100644 tests/filtergraphs/overlay_yuv420 delete mode 100644 tests/filtergraphs/overlay_yuv422 delete mode 100644 tests/filtergraphs/overlay_yuv444 delete mode 100644 tests/filtergraphs/scalenorm delete mode 100644 tests/ref/acodec/adpcm_ima_qt delete mode 100644 tests/ref/acodec/g723_1 delete mode 100644 tests/ref/acodec/mp2fixed delete mode 100644 tests/ref/acodec/pcm-s16be_planar delete mode 100644 tests/ref/acodec/pcm-s16le_planar delete mode 100644 tests/ref/acodec/pcm-s24le_planar delete mode 100644 tests/ref/acodec/pcm-s32le_planar delete mode 100644 tests/ref/acodec/pcm-s8_planar delete mode 100644 tests/ref/acodec/pcm-u16be delete mode 100644 tests/ref/acodec/pcm-u16le delete mode 100644 tests/ref/acodec/pcm-u24be delete mode 100644 tests/ref/acodec/pcm-u24le delete mode 100644 tests/ref/acodec/pcm-u32be delete mode 100644 tests/ref/acodec/pcm-u32le delete mode 100644 tests/ref/acodec/roqaudio delete mode 100644 tests/ref/fate/acodec-aref delete mode 100644 tests/ref/fate/adpcm-4xm delete mode 100644 tests/ref/fate/adpcm-afc delete mode 100644 tests/ref/fate/adpcm-dtk delete mode 100644 tests/ref/fate/adpcm-ima-oki delete mode 100644 tests/ref/fate/adpcm-ima-rad delete mode 100644 tests/ref/fate/ansi256 delete mode 100644 tests/ref/fate/ast delete mode 100644 tests/ref/fate/avio-direct delete mode 100644 tests/ref/fate/bprint delete mode 100644 tests/ref/fate/brstm delete mode 100644 tests/ref/fate/cine-demux delete mode 100644 tests/ref/fate/dirac delete mode 100644 tests/ref/fate/exif-image-embedded delete mode 100644 tests/ref/fate/exif-image-jpg delete mode 100644 tests/ref/fate/exif-image-tiff delete mode 100644 tests/ref/fate/exif-image-webp delete mode 100644 tests/ref/fate/ffmpeg-filter_complex delete mode 100644 tests/ref/fate/ffmpeg-lavfi delete mode 100644 tests/ref/fate/ffprobe_compact delete mode 100644 tests/ref/fate/ffprobe_csv delete mode 100644 tests/ref/fate/ffprobe_default delete mode 100644 tests/ref/fate/ffprobe_flat delete mode 100644 tests/ref/fate/ffprobe_ini delete mode 100644 tests/ref/fate/ffprobe_json delete mode 100644 tests/ref/fate/ffprobe_xml delete mode 100644 tests/ref/fate/filter-adelay delete mode 100644 tests/ref/fate/filter-alphaextract_alphamerge_rgb delete mode 100644 tests/ref/fate/filter-alphaextract_alphamerge_yuv delete mode 100644 tests/ref/fate/filter-colorchannelmixer delete mode 100644 tests/ref/fate/filter-colormatrix1 delete mode 100644 tests/ref/fate/filter-colormatrix2 delete mode 100644 tests/ref/fate/filter-concat delete mode 100644 tests/ref/fate/filter-curves delete mode 100644 tests/ref/fate/filter-edgedetect delete mode 100644 tests/ref/fate/filter-edgedetect-colormix delete mode 100644 tests/ref/fate/filter-fieldmatch delete mode 100644 tests/ref/fate/filter-gradfun-sample delete mode 100644 tests/ref/fate/filter-histogram-levels delete mode 100644 tests/ref/fate/filter-histogram-waveform delete mode 100644 tests/ref/fate/filter-hqdn3d-sample delete mode 100644 tests/ref/fate/filter-hue delete mode 100644 tests/ref/fate/filter-idet delete mode 100644 tests/ref/fate/filter-lavd-life delete mode 100644 tests/ref/fate/filter-lavd-scalenorm delete mode 100644 tests/ref/fate/filter-lavd-testsrc delete mode 100644 tests/ref/fate/filter-mcdeint-fast delete mode 100644 tests/ref/fate/filter-mcdeint-medium delete mode 100644 tests/ref/fate/filter-metadata-ebur128 delete mode 100644 tests/ref/fate/filter-metadata-scenedetect delete mode 100644 tests/ref/fate/filter-metadata-silencedetect delete mode 100644 tests/ref/fate/filter-overlay_rgb delete mode 100644 tests/ref/fate/filter-overlay_yuv420 delete mode 100644 tests/ref/fate/filter-overlay_yuv422 delete mode 100644 tests/ref/fate/filter-overlay_yuv444 delete mode 100644 tests/ref/fate/filter-pad delete mode 100644 tests/ref/fate/filter-phase delete mode 100644 tests/ref/fate/filter-pixfmts-field delete mode 100644 tests/ref/fate/filter-pixfmts-fieldorder delete mode 100644 tests/ref/fate/filter-pixfmts-histeq delete mode 100644 tests/ref/fate/filter-pixfmts-il delete mode 100644 tests/ref/fate/filter-pixfmts-kerndeint delete mode 100644 tests/ref/fate/filter-pixfmts-lut delete mode 100644 tests/ref/fate/filter-pixfmts-rotate delete mode 100644 tests/ref/fate/filter-pixfmts-super2xsai delete mode 100644 tests/ref/fate/filter-pixfmts-swapuv delete mode 100644 tests/ref/fate/filter-pixfmts-tinterlace_merge delete mode 100644 tests/ref/fate/filter-pixfmts-tinterlace_pad delete mode 100644 tests/ref/fate/filter-pp delete mode 100644 tests/ref/fate/filter-pp2 delete mode 100644 tests/ref/fate/filter-pp3 delete mode 100644 tests/ref/fate/filter-pp4 delete mode 100644 tests/ref/fate/filter-pp5 delete mode 100644 tests/ref/fate/filter-pp6 delete mode 100644 tests/ref/fate/filter-select delete mode 100644 tests/ref/fate/filter-separatefields delete mode 100644 tests/ref/fate/filter-setdar delete mode 100644 tests/ref/fate/filter-setsar delete mode 100644 tests/ref/fate/filter-stereo3d-abr-ml delete mode 100644 tests/ref/fate/filter-stereo3d-abr-mr delete mode 100644 tests/ref/fate/filter-stereo3d-al-sbsl delete mode 100644 tests/ref/fate/filter-stereo3d-ar-abl delete mode 100644 tests/ref/fate/filter-stereo3d-sbsl-abl delete mode 100644 tests/ref/fate/filter-stereo3d-sbsl-abr delete mode 100644 tests/ref/fate/filter-stereo3d-sbsl-al delete mode 100644 tests/ref/fate/filter-stereo3d-sbsl-sbsr delete mode 100644 tests/ref/fate/filter-telecine delete mode 100644 tests/ref/fate/filter-thumbnail delete mode 100644 tests/ref/fate/filter-tile delete mode 100644 tests/ref/fate/force_key_frames delete mode 100644 tests/ref/fate/g729-0 delete mode 100644 tests/ref/fate/g729-1 delete mode 100644 tests/ref/fate/gif-color delete mode 100644 tests/ref/fate/gif-demux delete mode 100644 tests/ref/fate/gif-disposal-background delete mode 100644 tests/ref/fate/gif-disposal-restore delete mode 100644 tests/ref/fate/gif-gray delete mode 100644 tests/ref/fate/gifenc-bgr4_byte delete mode 100644 tests/ref/fate/gifenc-bgr8 delete mode 100644 tests/ref/fate/gifenc-gray delete mode 100644 tests/ref/fate/gifenc-pal8 delete mode 100644 tests/ref/fate/gifenc-rgb4_byte delete mode 100644 tests/ref/fate/gifenc-rgb8 delete mode 100644 tests/ref/fate/h264-conformance-frext-hi422fr10_sony_b delete mode 100644 tests/ref/fate/h264-conformance-frext-hi422fr13_sony_b delete mode 100644 tests/ref/fate/h264-conformance-frext-hi422fr1_sony_a delete mode 100644 tests/ref/fate/h264-conformance-frext-hi422fr6_sony_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i1_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i2_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i3_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i4_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i5_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i6_panasonic_a delete mode 100644 tests/ref/fate/h264-conformance-frext-pph422i7_panasonic_a rename tests/ref/fate/{hevc-conformance-DBLK_A_MAIN10_VIXS_3 => hevc-conformance-DBLK_A_MAIN10_VIXS_2} (100%) create mode 100644 tests/ref/fate/hevc-conformance-DBLK_D_VIXS_1 create mode 100644 tests/ref/fate/hevc-conformance-DBLK_E_VIXS_1 create mode 100644 tests/ref/fate/hevc-conformance-DBLK_F_VIXS_1 create mode 100644 tests/ref/fate/hevc-conformance-DBLK_G_VIXS_1 delete mode 100644 tests/ref/fate/hevc-conformance-DELTAQP_A_BRCM_4 create mode 100644 tests/ref/fate/hevc-conformance-ENTP_A_LG_2 delete mode 100644 tests/ref/fate/hevc-conformance-ENTP_A_Qualcomm_1 create mode 100644 tests/ref/fate/hevc-conformance-ENTP_B_LG_2 delete mode 100644 tests/ref/fate/hevc-conformance-ENTP_B_Qualcomm_1 create mode 100644 tests/ref/fate/hevc-conformance-ENTP_C_LG_3 delete mode 100644 tests/ref/fate/hevc-conformance-ENTP_C_Qualcomm_1 delete mode 100644 tests/ref/fate/hevc-conformance-FILLER_A_Sony_1 delete mode 100644 tests/ref/fate/hevc-conformance-HRD_A_Fujitsu_2 delete mode 100644 tests/ref/fate/hevc-conformance-INITQP_A_Sony_1 delete mode 100644 tests/ref/fate/hevc-conformance-INITQP_B_Sony_1 create mode 100644 tests/ref/fate/hevc-conformance-IPRED_C_Mitsubishi_2 delete mode 100644 tests/ref/fate/hevc-conformance-IPRED_C_Mitsubishi_3 delete mode 100644 tests/ref/fate/hevc-conformance-NoOutPrior_A_Qualcomm_1 delete mode 100644 tests/ref/fate/hevc-conformance-NoOutPrior_B_Qualcomm_1 delete mode 100644 tests/ref/fate/hevc-conformance-OPFLAG_A_Qualcomm_1 delete mode 100644 tests/ref/fate/hevc-conformance-OPFLAG_B_Qualcomm_1 delete mode 100644 tests/ref/fate/hevc-conformance-OPFLAG_C_Qualcomm_1 delete mode 100644 tests/ref/fate/jv-demux delete mode 100644 tests/ref/fate/lagarith-red delete mode 100644 tests/ref/fate/lossless-tak delete mode 100644 tests/ref/fate/lossless-tta-encrypted delete mode 100644 tests/ref/fate/mapchan-6ch-extract-2 delete mode 100644 tests/ref/fate/mapchan-6ch-extract-2-downmix-mono delete mode 100644 tests/ref/fate/mapchan-silent-mono delete mode 100644 tests/ref/fate/mkv delete mode 100644 tests/ref/fate/mlv-demux delete mode 100644 tests/ref/fate/murmur3 delete mode 100644 tests/ref/fate/mxpeg delete mode 100644 tests/ref/fate/nistsphere-demux delete mode 100644 tests/ref/fate/oggvp8-demux delete mode 100644 tests/ref/fate/paf-demux delete mode 100644 tests/ref/fate/pmp-demux delete mode 100644 tests/ref/fate/prores-alpha_skip delete mode 100644 tests/ref/fate/prores-transparency delete mode 100644 tests/ref/fate/prores-transparency_skip delete mode 100644 tests/ref/fate/random_seed delete mode 100644 tests/ref/fate/redspark-demux delete mode 100644 tests/ref/fate/ripemd delete mode 100644 tests/ref/fate/rsd-demux delete mode 100644 tests/ref/fate/sha512 delete mode 100644 tests/ref/fate/smjpeg delete mode 100644 tests/ref/fate/smvjpeg delete mode 100644 tests/ref/fate/sub-aqtitle delete mode 100644 tests/ref/fate/sub-charenc delete mode 100644 tests/ref/fate/sub-jacosub delete mode 100644 tests/ref/fate/sub-microdvd delete mode 100644 tests/ref/fate/sub-microdvd-remux delete mode 100644 tests/ref/fate/sub-movtext delete mode 100644 tests/ref/fate/sub-movtextenc delete mode 100644 tests/ref/fate/sub-mpl2 delete mode 100644 tests/ref/fate/sub-mpsub delete mode 100644 tests/ref/fate/sub-mpsub-frames delete mode 100644 tests/ref/fate/sub-pjs delete mode 100644 tests/ref/fate/sub-realtext delete mode 100644 tests/ref/fate/sub-sami delete mode 100644 tests/ref/fate/sub-subripenc delete mode 100644 tests/ref/fate/sub-subviewer delete mode 100644 tests/ref/fate/sub-subviewer1 delete mode 100644 tests/ref/fate/sub-vplayer delete mode 100644 tests/ref/fate/sub-webvtt delete mode 100644 tests/ref/fate/sub-webvttenc delete mode 100644 tests/ref/fate/sub2video delete mode 100644 tests/ref/fate/unknown_layout-ac3 delete mode 100644 tests/ref/fate/unknown_layout-pcm delete mode 100644 tests/ref/fate/vcr2 delete mode 100644 tests/ref/fate/vp6a-skip_alpha delete mode 100644 tests/ref/fate/vp8-alpha delete mode 100644 tests/ref/fate/wmv8-x8intra delete mode 100644 tests/ref/fate/xface delete mode 100644 tests/ref/lavf-fate/latm delete mode 100644 tests/ref/lavf-fate/mp3 delete mode 100644 tests/ref/lavf-fate/ogg_vp3 delete mode 100644 tests/ref/lavf/ast delete mode 100644 tests/ref/lavf/caf delete mode 100644 tests/ref/lavf/flm delete mode 100644 tests/ref/lavf/ircam delete mode 100644 tests/ref/lavf/ismv delete mode 100644 tests/ref/lavf/smjpeg delete mode 100644 tests/ref/lavf/w64 delete mode 100644 tests/ref/lavf/wtv delete mode 100644 tests/ref/lavf/xbm delete mode 100644 tests/ref/seek/lavf-wtv delete mode 100644 tests/ref/seek/vsynth2-snow delete mode 100644 tests/ref/seek/vsynth2-snow-ll delete mode 100644 tests/ref/vsynth/vsynth1-amv delete mode 100644 tests/ref/vsynth/vsynth1-avui delete mode 100644 tests/ref/vsynth/vsynth1-dnxhd_1080i delete mode 100644 tests/ref/vsynth/vsynth1-dv_411 delete mode 100644 tests/ref/vsynth/vsynth1-ffv1.0 delete mode 100644 tests/ref/vsynth/vsynth1-ffvhuff420p12 delete mode 100644 tests/ref/vsynth/vsynth1-ffvhuff422p10left delete mode 100644 tests/ref/vsynth/vsynth1-ffvhuff444 delete mode 100644 tests/ref/vsynth/vsynth1-ffvhuff444p16 delete mode 100644 tests/ref/vsynth/vsynth1-flashsv2 delete mode 100644 tests/ref/vsynth/vsynth1-h261-trellis delete mode 100644 tests/ref/vsynth/vsynth1-jpeg2000 delete mode 100644 tests/ref/vsynth/vsynth1-jpeg2000-97 delete mode 100644 tests/ref/vsynth/vsynth1-mjpeg-422 delete mode 100644 tests/ref/vsynth/vsynth1-mjpeg-444 delete mode 100644 tests/ref/vsynth/vsynth1-mpng delete mode 100644 tests/ref/vsynth/vsynth1-msvideo1 delete mode 100644 tests/ref/vsynth/vsynth1-prores_ks delete mode 100644 tests/ref/vsynth/vsynth1-qtrlegray delete mode 100644 tests/ref/vsynth/vsynth1-r210 delete mode 100644 tests/ref/vsynth/vsynth1-snow delete mode 100644 tests/ref/vsynth/vsynth1-snow-hpel delete mode 100644 tests/ref/vsynth/vsynth1-snow-ll delete mode 100644 tests/ref/vsynth/vsynth1-v308 delete mode 100644 tests/ref/vsynth/vsynth1-v408 delete mode 100644 tests/ref/vsynth/vsynth1-y41p delete mode 100644 tests/ref/vsynth/vsynth1-yuv4 delete mode 100644 tests/ref/vsynth/vsynth1-zlib delete mode 100644 tests/ref/vsynth/vsynth1-zmbv delete mode 100644 tests/ref/vsynth/vsynth2-amv delete mode 100644 tests/ref/vsynth/vsynth2-avui delete mode 100644 tests/ref/vsynth/vsynth2-dnxhd_1080i delete mode 100644 tests/ref/vsynth/vsynth2-dv_411 delete mode 100644 tests/ref/vsynth/vsynth2-ffv1.0 delete mode 100644 tests/ref/vsynth/vsynth2-ffvhuff420p12 delete mode 100644 tests/ref/vsynth/vsynth2-ffvhuff422p10left delete mode 100644 tests/ref/vsynth/vsynth2-ffvhuff444 delete mode 100644 tests/ref/vsynth/vsynth2-ffvhuff444p16 delete mode 100644 tests/ref/vsynth/vsynth2-flashsv2 delete mode 100644 tests/ref/vsynth/vsynth2-h261-trellis delete mode 100644 tests/ref/vsynth/vsynth2-jpeg2000 delete mode 100644 tests/ref/vsynth/vsynth2-jpeg2000-97 delete mode 100644 tests/ref/vsynth/vsynth2-mjpeg-422 delete mode 100644 tests/ref/vsynth/vsynth2-mjpeg-444 delete mode 100644 tests/ref/vsynth/vsynth2-mpng delete mode 100644 tests/ref/vsynth/vsynth2-msvideo1 delete mode 100644 tests/ref/vsynth/vsynth2-prores_ks delete mode 100644 tests/ref/vsynth/vsynth2-qtrlegray delete mode 100644 tests/ref/vsynth/vsynth2-r210 delete mode 100644 tests/ref/vsynth/vsynth2-snow delete mode 100644 tests/ref/vsynth/vsynth2-snow-hpel delete mode 100644 tests/ref/vsynth/vsynth2-snow-ll delete mode 100644 tests/ref/vsynth/vsynth2-v308 delete mode 100644 tests/ref/vsynth/vsynth2-v408 delete mode 100644 tests/ref/vsynth/vsynth2-y41p delete mode 100644 tests/ref/vsynth/vsynth2-yuv4 delete mode 100644 tests/ref/vsynth/vsynth2-zlib delete mode 100644 tests/ref/vsynth/vsynth2-zmbv delete mode 100644 tests/ref/vsynth1/cljr delete mode 100644 tests/ref/vsynth1/yuv delete mode 100644 tests/ref/vsynth2/cljr delete mode 100644 tests/ref/vsynth2/huffyuv delete mode 100644 tests/ref/vsynth2/yuv delete mode 100644 tests/test.ffmeta delete mode 100644 tests/tiny_ssim.c delete mode 100755 tools/bisect-create delete mode 100644 tools/bookmarklets.html delete mode 100644 tools/build_libstagefright delete mode 100755 tools/clean-diff delete mode 100644 tools/crypto_bench.c delete mode 100755 tools/dvd2concat delete mode 100644 tools/enum_options.c delete mode 100644 tools/ffescape.c delete mode 100644 tools/ffeval.c delete mode 100644 tools/ffhash.c delete mode 100644 tools/fourcc2pixfmt.c delete mode 100755 tools/gen-rc delete mode 100755 tools/make_chlayout_test delete mode 100755 tools/missing_codec_desc delete mode 100755 tools/normalize.py delete mode 100755 tools/plotframes delete mode 100644 tools/seek_print.c delete mode 100644 tools/uncoded_frame.c delete mode 100755 tools/unwrap-diff delete mode 100644 tools/yuvcmp.c delete mode 100644 tools/zmqsend.c delete mode 100755 tools/zmqshell.py diff --git a/.gitignore b/.gitignore index 16c9c620fb..07ba48598a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *.d *.def *.dll -*.dylib *.exe *.exp *.gcda @@ -18,67 +17,44 @@ *.ver *-example *-test -*_g /.config /.version -/ffmpeg -/ffplay -/ffprobe -/ffserver +/avconv +/avplay +/avprobe +/avserver /config.* /coverage.info +/version.h /doc/*.1 -/doc/*.3 /doc/*.html /doc/*.pod -/doc/config.texi /doc/avoptions_codec.texi /doc/avoptions_format.texi /doc/doxy/html/ -/doc/examples/avio_reading -/doc/examples/decoding_encoding -/doc/examples/demuxing_decoding +/doc/examples/avcodec /doc/examples/filter_audio -/doc/examples/filtering_audio -/doc/examples/filtering_video /doc/examples/metadata -/doc/examples/muxing -/doc/examples/pc-uninstalled -/doc/examples/remuxing -/doc/examples/resampling_audio -/doc/examples/scaling_video +/doc/examples/output /doc/examples/transcode_aac -/doc/fate.txt /doc/print_options /lcov/ /libavcodec/*_tablegen /libavcodec/*_tables.c /libavcodec/*_tables.h /libavutil/avconfig.h -/libavutil/ffversion.h /tests/audiogen /tests/base64 /tests/data/ /tests/rotozoom /tests/tiny_psnr -/tests/tiny_ssim /tests/videogen /tests/vsynth1/ /tools/aviocat -/tools/ffbisect -/tools/bisect.need -/tools/crypto_bench /tools/cws2fws -/tools/fourcc2pixfmt -/tools/ffescape -/tools/ffeval -/tools/ffhash /tools/graph2dot /tools/ismindex /tools/pktdumper /tools/probetest /tools/qt-faststart /tools/trasher -/tools/seek_print -/tools/uncoded_frame -/tools/zmqsend diff --git a/CREDITS b/CREDITS index e29f0b853c..4a537786f0 100644 --- a/CREDITS +++ b/CREDITS @@ -1,6 +1,55 @@ -See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to -get the names of people who have contributed to FFmpeg. +This file contains the names of some of the people who have contributed to +Libav/FFmpeg. The names are sorted alphabetically by last name. As this file is +currently quite outdated and git serves as a much better tool for determining +authorship, it remains here for historical reasons only. -To check the log, you can type the command "git log" in the FFmpeg -source directory, or browse the online repository at -http://source.ffmpeg.org. +DĂ©nes Balatoni +Michel Bardiaux +Fabrice Bellard +Patrice Bensoussan +Alex Beregszaszi +BERO +Thilo Borgmann +Mario Brito +Ronald Bultje +Alex Converse +Maarten Daniels +Reimar Doeffinger +Tim Ferguson +Brian Foley +Arpad Gereoffy +Philip Gladstone +Vladimir Gneushev +Roine Gustafsson +David Hammerton +Wolfgang Hesseler +Marc Hoffman +Falk Hueffner +AurĂ©lien Jacobs +Steven Johnson +Zdenek Kabelac +Robin Kay +Todd Kirby +Nick Kurshev +Benjamin Larsson +LoĂ¯c Le Loarer +Daniel Maas +Mike Melanson +Loren Merritt +Jeff Muizelaar +Michael Niedermayer +François Revol +Peter Ross +MĂ¥ns RullgĂ¥rd +Stefano Sabatini +Roman Shaposhnik +Oded Shimon +Dieter Shirley +Konstantin Shishkov +Juan J. Sierralta +Ewald Snel +Sascha Sommer +Leon van Stuivenberg +Roberto Togni +Lionel Ulmer +Reynaldo Verdejo diff --git a/Changelog b/Changelog index 3d416c4d2f..f157f7d55d 100644 --- a/Changelog +++ b/Changelog @@ -2,276 +2,141 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version : -- AC3 fixed-point decoding +- libx265 encoder - shuffleplanes filter -- subfile protocol -- Phantom Cine demuxer - replaygain data export -- VP7 video decoder - Alias PIX image encoder and decoder -- Improvments to the BRender PIX image decoder -- Improvments to the XBM decoder -- QTKit input device -- improvments to OpenEXR image decoder +- BRender PIX image decoder +- Amazing Studio PAF playback support +- XBM decoder +- bmp standalone parser +- OpenEXR image decoder +- support encoding and decoding 4-channel SGI images - support decoding 16-bit RLE SGI images -- GDI screen grabbing for Windows -- alternative rendition support for HTTP Live Streaming -- AVFoundation input device -- Direct Stream Digital (DSD) decoder -- Magic Lantern Video (MLV) demuxer +- VP7 video decoder +- LucasArts SMUSH SANM video decoder +- LucasArts SMUSH VIMA audio decoder (ADPCM) +- LucasArts SMUSH demuxer +- MP2 encoding via TwoLAME +- asettb filter +- Silicon Graphics RLE 8-bit video decoder +- Silicon Graphics Motion Video Compressor 1 & 2 decoder +- Silicon Graphics Movie demuxer - On2 AVC (Audio for Video) decoder -- support for decoding through DXVA2 in ffmpeg +- support for decoding through DXVA2 in avconv - libbs2b-based stereo-to-binaural audio filter -- libx264 reference frames count limiting depending on level - native Opus decoder - display matrix export and rotation api -- WebVTT encoder -version 2.2: - -- HNM version 4 demuxer and video decoder -- Live HDS muxer -- setsar/setdar filters now support variables in ratio expressions -- elbg filter -- string validation in ffprobe -- support for decoding through VDPAU in ffmpeg (the -hwaccel option) -- complete Voxware MetaSound decoder -- remove mp3_header_compress bitstream filter -- Windows resource files for shared libraries -- aeval filter -- stereoscopic 3d metadata handling -- WebP encoding via libwebp -- ATRAC3+ decoder -- VP8 in Ogg demuxing -- side & metadata support in NUT -- framepack filter -- XYZ12 rawvideo support in NUT -- Exif metadata support in WebP decoder -- OpenGL device -- Use metadata_header_padding to control padding in ID3 tags (currently used in - MP3, AIFF, and OMA files), FLAC header, and the AVI "junk" block. -- Mirillis FIC video decoder -- Support DNx444 -- libx265 encoder -- dejudder filter -- Autodetect VDA like all other hardware accelerations - - -version 2.1: - -- aecho filter -- perspective filter ported from libmpcodecs -- ffprobe -show_programs option -- compand filter +version 10: +- av_strnstr +- support ID3v2 tags in ASF files +- reference-counting for AVFrame and AVPacket data +- avconv now fails when input options are used for output file + or vice versa +- avconv options -filter_script and -filter_complex_script, which allow a + filtergraph description to be read from a file +- uniform options syntax across all filters +- interlace filter +- JPEG 2000 decoder +- asetpts filter (same as setpts, but for audio) +- trim and atrim filters +- avconv -t and -ss (output-only) options are now sample-accurate when + transcoding audio +- Matroska muxer can now put the index at the beginning of the file. +- avconv -deinterlace option removed, the yadif filter should be used instead +- Apple Intermediate Codec decoder +- Escape 130 video decoder +- support for slice multithreading in libavfilter +- VC-1 interlaced B-frame support +- support for WavPack muxing (raw and in Matroska) +- Go2Webinar decoder +- WavPack encoding through libwavpack +- Added the -n parameter to avconv - RTMP seek support -- when transcoding with ffmpeg (i.e. not streamcopying), -ss is now accurate +- when transcoding with avconv (i.e. not streamcopying), -ss is now accurate even when used as an input option. Previous behavior can be restored with the -noaccurate_seek option. -- ffmpeg -t option can now be used for inputs, to limit the duration of +- avconv -t option can now be used for inputs, to limit the duration of data read from an input file -- incomplete Voxware MetaSound decoder -- read EXIF metadata from JPEG -- DVB teletext decoder -- phase filter ported from libmpcodecs -- w3fdif filter -- Opus support in Matroska -- FFV1 version 1.3 is stable and no longer experimental -- FFV1: YUVA(444,422,420) 9, 10 and 16 bit support -- changed DTS stream id in lavf mpeg ps muxer from 0x8a to 0x88, to be - more consistent with other muxers. -- adelay filter -- pullup filter ported from libmpcodecs -- ffprobe -read_intervals option -- Lossless and alpha support for WebP decoder +- Voxware MetaSound decoder +- WebP decoder - Error Resilient AAC syntax (ER AAC LC) decoding - Low Delay AAC (ER AAC LD) decoding - mux chapters in ASF files -- SFTP protocol (via libssh) -- libx264: add ability to encode in YUVJ422P and YUVJ444P -- Fraps: use BT.709 colorspace by default for yuv, as reference fraps decoder does -- make decoding alpha optional for prores, ffv1 and vp6 by setting - the skip_alpha flag. -- ladspa wrapper filter -- native VP9 decoder -- dpx parser -- max_error_rate parameter in ffmpeg -- PulseAudio output device -- ReplayGain scanner +- Opus in Ogg demuxing - Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support) -- Linux framebuffer output device +- F4V muxer +- HNM version 4 demuxer and video decoder - HEVC decoder - raw HEVC, HEVC in MOV/MP4, HEVC in Matroska, HEVC in MPEG-TS demuxing -- mergeplanes filter +- remove avplay -vismv option, which has not worked for a long time +- Live HDS muxer +- setsar/setdar filters now support variables in ratio expressions +- dar variable in the scale filter now returns the actual DAR (i.e. a * sar) +- VP9 decoder +- support for decoding through VDPAU in avconv (the -hwaccel option) +- remove mp3_header_(de)compress bitstream filters +- stereoscopic 3d metadata handling +- png standalone parser +- WebP encoding via libwebp +- ATRAC3+ decoder +- framepack filter +- Mirillis FIC video decoder +- Support DNx444 +- compand audio filter -version 2.0: - -- curves filter -- reference-counting for AVFrame and AVPacket data -- ffmpeg now fails when input options are used for output file - or vice versa -- support for Monkey's Audio versions from 3.93 -- perms and aperms filters -- audio filtering support in ffplay -- 10% faster aac encoding on x86 and MIPS -- sine audio filter source -- WebP demuxing and decoding support -- ffmpeg options -filter_script and -filter_complex_script, which allow a - filtergraph description to be read from a file -- OpenCL support -- audio phaser filter -- separatefields filter -- libquvi demuxer -- uniform options syntax across all filters -- telecine filter -- interlace filter -- smptehdbars source -- inverse telecine filters (fieldmatch and decimate) -- colorbalance filter -- colorchannelmixer filter -- The matroska demuxer can now output proper verbatim ASS packets. It will - become the default at the next libavformat major bump. -- decent native animated GIF encoding -- asetrate filter -- interleave filter -- timeline editing with filters -- vidstabdetect and vidstabtransform filters for video stabilization using - the vid.stab library -- astats filter -- trim and atrim filters -- ffmpeg -t and -ss (output-only) options are now sample-accurate when - transcoding audio -- Matroska muxer can now put the index at the beginning of the file. -- extractplanes filter -- avectorscope filter -- ADPCM DTK decoder -- ADP demuxer -- RSD demuxer -- RedSpark demuxer -- ADPCM IMA Radical decoder -- zmq filters -- DCT denoiser filter (dctdnoiz) -- Wavelet denoiser filter ported from libmpcodecs as owdenoise (formerly "ow") -- Apple Intermediate Codec decoder -- Escape 130 video decoder -- FTP protocol support -- V4L2 output device -- 3D LUT filter (lut3d) -- SMPTE 302M audio encoder -- support for slice multithreading in libavfilter -- Hald CLUT support (generation and filtering) -- VC-1 interlaced B-frame support -- support for WavPack muxing (raw and in Matroska) -- XVideo output device -- vignette filter -- True Audio (TTA) encoder -- Go2Webinar decoder -- mcdeint filter ported from libmpcodecs -- sab filter ported from libmpcodecs -- ffprobe -show_chapters option -- WavPack encoding through libwavpack -- rotate filter -- spp filter ported from libmpcodecs -- libgme support -- psnr filter - - -version 1.2: - +version 9: +- av_basename and av_dirname +- adobe and limelight publisher authentication in RTMP - VDPAU hardware acceleration through normal hwaccel - SRTP support -- Error diffusion dither in Swscale -- Chained Ogg support -- Theora Midstream reconfiguration support -- EVRC decoder -- audio fade filter -- filtering audio with unknown channel layout -- allpass, bass, bandpass, bandreject, biquad, equalizer, highpass, lowpass - and treble audio filter -- improved showspectrum filter, with multichannel support and sox-like colors -- histogram filter -- tee muxer -- il filter ported from libmpcodecs -- support ID3v2 tags in ASF files -- encrypted TTA stream decoding support -- RF64 support in WAV muxer -- noise filter ported from libmpcodecs -- Subtitles character encoding conversion -- blend filter -- stereo3d filter ported from libmpcodecs -version 1.1: - -- stream disposition information printing in ffprobe -- filter for loudness analysis following EBU R128 -- Opus encoder using libopus -- ffprobe -select_streams option -- Pinnacle TARGA CineWave YUV16 decoder -- TAK demuxer, decoder and parser -- DTS-HD demuxer -- remove -same_quant, it hasn't worked for years -- FFM2 support -- X-Face image encoder and decoder +version 9_beta3: +- ashowinfo audio filter - 24-bit FLAC encoding +- audio volume filter +- deprecated the avconv -vol option. the volume filter is to be used instead. - multi-channel ALAC encoding up to 7.1 +- TAK demuxer, parser, and decoder +- adaptive frame-level multithreading for H.264 + + +version 9_beta2: - metadata (INFO tag) support in WAV muxer -- subtitles raw text decoder - support for building DLLs using MSVC -- LVF demuxer -- ffescape tool -- metadata (info chunk) support in CAF muxer -- field filter ported from libmpcodecs -- AVR demuxer -- geq filter ported from libmpcodecs -- remove ffserver daemon mode -- AST muxer/demuxer -- new expansion syntax for drawtext -- BRender PIX image decoder -- ffprobe -show_entries option -- ffprobe -sections option -- ADPCM IMA Dialogic decoder -- BRSTM demuxer -- animated GIF decoder and demuxer -- PVF demuxer -- subtitles filter -- IRCAM muxer/demuxer -- Paris Audio File demuxer -- Virtual concatenation demuxer -- VobSub demuxer -- JSON captions for TED talks decoding support -- SOX Resampler support in libswresample -- aselect filter -- SGI RLE 8-bit / Silicon Graphics RLE 8-bit video decoder -- Silicon Graphics Motion Video Compressor 1 & 2 decoder -- Silicon Graphics Movie demuxer -- apad filter -- Resolution & pixel format change support with multithreading for H.264 -- documentation split into per-component manuals -- pp (postproc) filter ported from MPlayer -- NIST Sphere demuxer -- MPL2, VPlayer, MPlayer, AQTitle, PJS and SubViewer v1 subtitles demuxers and decoders -- Sony Wave64 muxer -- adobe and limelight publisher authentication in RTMP -- data: URI scheme +- remove avserver daemon mode - support building on the Plan 9 operating system -- kerndeint filter ported from MPlayer -- histeq filter ported from VirtualDub -- Megalux Frame demuxer -- 012v decoder -- Improved AVC Intra decoding support +- ffv1: support version 1.3 -version 1.0: +version 9_beta1: -- INI and flat output in ffprobe -- Scene detection in libavfilter +- XWD encoder and decoder +- Support for fragmentation in the mov/mp4 muxer +- ISMV (Smooth Streaming) muxer +- CDXL demuxer and decoder +- Apple ProRes encoder +- Sun Rasterfile Encoder +- remove libpostproc +- ID3v2 attached pictures reading and writing +- WMA Lossless decoder +- XBM encoder +- RealAudio Lossless decoder +- ZeroCodec decoder +- drop support for avconv without libavfilter +- add libavresample audio conversion library +- audio filters support in libavfilter and avconv +- add fps filter +- audio split filter +- audio mix filter +- avprobe output is now standard INI or JSON. The old format can still + be used with -of old. - 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 @@ -284,146 +149,44 @@ version 1.0: - Microsoft Expression Encoder Screen decoder - RTMPS protocol support - RTMPTS protocol support +- JPEG 2000 encoding support through OpenJPEG +- G.723.1 demuxer and decoder - RTMPE protocol support - RTMPTE protocol support -- showwaves and showspectrum filter -- LucasArts SMUSH SANM playback support -- LucasArts SMUSH VIMA audio decoder (ADPCM) -- LucasArts SMUSH demuxer -- 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 +- avconv -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 -- smartblur filter ported from MPlayer -- CPiA decoder -- decimate filter ported from MPlayer - RTP depacketization of JPEG - Smooth Streaming live segmenter muxer -- F4V muxer -- sendcmd and asendcmd filters -- WebVTT demuxer and decoder (simple tags supported) - RTP packetization of JPEG -- faststart option in the MOV/MP4 muxer +- Opus decoder and encoder using libopus +- remove -same_quant, it hasn't worked for years - support for building with MSVC -version 0.11: +version 0.8: -- 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 -- ffv1: support (draft) version 1.3 - - -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 -- Timecode extraction in DV and MOV -- thumbnail video filter -- XML output in ffprobe -- asplit audio filter -- tinterlace video filter -- astreamsync audio filter -- amerge audio filter -- ISMV (Smooth Streaming) muxer - GSM audio parser - SMJPEG muxer -- XWD encoder and decoder + + +version 0.8_beta2: + - 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 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 +- Deprecate libpostproc. If desired, the switch --enable-postproc will + enable it but it may be removed in a later Libav release. - 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 -- support encoding and decoding 4-channel SGI images -version 0.9: +version 0.8_beta1: -- openal input device added -- boxblur filter added - BWF muxer - Flash Screen Video 2 decoder -- lavfi input device added -- added avconv, which is almost the same for now, except +- ffplay/ffprobe/ffserver renamed to avplay/avprobe/avserver +- ffmpeg deprecated, added avconv, which is almost the same for now, except for a few incompatible changes in the options, which will hopefully make them easier to use. The changes are: * The options placement is now strictly enforced! While in theory the @@ -493,40 +256,23 @@ easier to use. The changes are: * -vframes/-aframes/-dframes options are now aliases to the new -frames option. * -vtag/-atag/-stag options are now aliases to the new -tag option. - XMV demuxer -- LOAS demuxer -- ashowinfo filter added - Windows Media Image decoder -- amovie source added - LATM muxer/demuxer -- Speex encoder via libspeex -- JSON output in ffprobe -- WTV muxer -- Optional C++ Support (needed for libstagefright) -- H.264 Decoding on Android via Stagefright -- Prores decoder -- BIN/XBIN/ADF/IDF text file decoder -- aconvert audio filter added -- audio support to lavfi input device added +- showinfo filter +- split filter - libcdio-paranoia input device for audio CD grabbing +- select filter - Apple ProRes decoder - CELT in Ogg demuxing -- G.723.1 demuxer and decoder -- libmodplug support (--enable-libmodplug) - VC-1 interlaced decoding -- libutvideo wrapper (--enable-libutvideo) -- aevalsrc audio source added +- lut, lutrgb, and lutyuv filters +- boxblur filter - Ut Video decoder - Speex encoding via libspeex - 4:2:2 H.264 decoding support - 4:2:2 and 4:4:4 H.264 encoding with libx264 - Pulseaudio input device -- Prores encoder -- Video Decoder Acceleration (VDA) HWAccel module. - replacement Indeo 3 decoder -- new ffmpeg option: -map_channel -- volume audio filter added -- earwax audio filter added -- libv4l2 support (--enable-libv4l2) - TLS/SSL and HTTPS protocol support - AVOptions API rewritten and documented - most of CODEC_FLAG2_*, some CODEC_FLAG_* and many codec-specific fields in @@ -536,27 +282,44 @@ easier to use. The changes are: - Discworld II BMV decoding support - VBLE Decoder - OS X Video Decoder Acceleration (VDA) support -- compact and csv output in ffprobe -- pan audio filter -- IFF Amiga Continuous Bitmap (ACBM) decoder -- ass filter - CRI ADX audio format muxer and demuxer - Playstation Portable PMP format demuxer -- Microsoft Windows ICO demuxer -- life source - PCM format support in OMA demuxer - CLJR encoder -- new option: -report - Dxtory capture format decoder -- cellauto source +- v410 QuickTime uncompressed 4:4:4 10-bit encoder and decoder +- OpenMG Audio muxer - Simple segmenting muxer - Indeo 4 decoder - SMJPEG demuxer -version 0.8: +version 0.7: + +- E-AC-3 audio encoder +- ac3enc: add channel coupling support +- floating-point sample format support for (E-)AC-3, DCA, AAC, Vorbis decoders +- H.264/MPEG frame-level multithreading +- av_metadata_* functions renamed to av_dict_* and moved to libavutil +- 4:4:4 H.264 decoding support +- 10-bit H.264 optimizations for x86 +- bump libswscale for recently reported ABI break + + +version 0.7_beta2: + +- VP8 frame-level multithreading +- NEON optimizations for VP8 +- removed a lot of deprecated API cruft +- FFT and IMDCT optimizations for AVX (Sandy Bridge) processors +- DPX image encoder +- SMPTE 302M AES3 audio decoder +- ffmpeg no longer quits after the 'q' key is pressed; use 'ctrl+c' instead +- 9bit and 10bit per sample support in the H.264 decoder + + +version 0.7_beta1: -- many many things we forgot because we rather write code than changelogs - WebM support in Matroska de/muxer - low overhead Ogg muxing - MMS-TCP support @@ -564,7 +327,6 @@ version 0.8: - Demuxer for On2's IVF format - Pictor/PC Paint decoder - HE-AAC v2 decoder -- HE-AAC v2 encoding with libaacplus - libfaad2 wrapper removed - DTS-ES extension (XCh) decoding support - native VP8 decoder @@ -576,7 +338,6 @@ version 0.8: - RTP depacketization of QDM2 - ANSI/ASCII art playback system - Lego Mindstorms RSO de/muxer -- libavcore added (and subsequently removed) - SubRip subtitle file muxer and demuxer - Chinese AVS encoding via libxavs - ffprobe -show_packets option added @@ -623,7 +384,7 @@ version 0.8: - replace the ocv_smooth filter with a more generic ocv filter - Windows Televison (WTV) demuxer - FFmpeg metadata format muxer and demuxer -- SubRip (srt) subtitle encoder and decoder +- SubRip (srt) subtitle decoder - floating-point AC-3 encoder added - Lagarith decoder - ffmpeg -copytb option added @@ -636,46 +397,11 @@ version 0.8: - sndio support for playback and record - Linux framebuffer input device added - Chronomaster DFA decoder -- DPX image encoder -- MicroDVD subtitle file muxer and demuxer -- Playstation Portable PMP format demuxer -- fieldorder video filter added +- Mobotix MxPEG decoder - AAC encoding via libvo-aacenc - AMR-WB encoding via libvo-amrwbenc - xWMA demuxer -- Mobotix MxPEG decoder -- VP8 frame-multithreading -- NEON optimizations for VP8 -- Lots of deprecated API cruft removed -- fft and imdct optimizations for AVX (Sandy Bridge) processors -- showinfo filter added -- SMPTE 302M AES3 audio decoder -- Apple Core Audio Format muxer -- 9bit and 10bit per sample support in the H.264 decoder -- 9bit and 10bit FFV1 encoding / decoding -- split filter added -- select filter added -- sdl output device added -- libmpcodecs video filter support (3 times as many filters than before) -- mpeg2 aspect ratio dection fixed -- libxvid aspect pickiness fixed -- Frame multithreaded decoding -- E-AC-3 audio encoder -- ac3enc: add channel coupling support -- floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders. -- H264/MPEG frame-level multi-threading -- All av_metadata_* functions renamed to av_dict_* and moved to libavutil -- 4:4:4 H.264 decoding support -- 10-bit H.264 optimizations for x86 -- lut, lutrgb, and lutyuv filters added -- buffersink libavfilter sink added -- Bump libswscale for recently reported ABI break -- New J2K encoder (via OpenJPEG) - - -version 0.7: - -- all the changes for 0.8, but keeping API/ABI compatibility with the 0.6 release +- fieldorder video filter added version 0.6: @@ -916,7 +642,6 @@ version 0.5: - Gopher client support - MXF D-10 muxer - generic metadata API -- flash ScreenVideo2 encoder version 0.4.9-pre1: @@ -1119,7 +844,7 @@ version 0.4.5: - MPEG-4 vol header fixes (Jonathan Marsden ) - ARM optimizations (Lionel Ulmer ). - Windows porting of file converter -- added MJPEG raw format (input/output) +- added MJPEG raw format (input/ouput) - added JPEG image format support (input/output) diff --git a/INSTALL b/INSTALL index 9549346302..ac5dc5dbb6 100644 --- a/INSTALL +++ b/INSTALL @@ -2,14 +2,17 @@ 1) Type './configure' to create the configuration. A list of configure options is printed by running 'configure --help'. -'configure' can be launched from a directory different from the FFmpeg +'configure' can be launched from a directory different from the Libav sources to build the objects out of tree. To do this, use an absolute -path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'. +path when launching 'configure', e.g. '/libavdir/libav/configure'. -2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required. +2) Then type 'make' to build Libav. GNU Make 3.81 or later is required. 3) Type 'make install' to install all binaries and libraries you built. NOTICE - Non system dependencies (e.g. libx264, libvpx) are disabled by default. + + - The default cflags include -g, if you want lean libraries you can either + pass --disable-debug or strip the debug symbols at a later time. diff --git a/LICENSE b/LICENSE index 1f757aa782..fb2917830c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,53 +1,26 @@ -FFmpeg: +Libav: +====== -Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 +Most files in Libav 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 files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to -FFmpeg. +Libav. -Some optional parts of FFmpeg are licensed under the GNU General Public License +Some optional parts of Libav are licensed under the GNU General Public License version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of these parts are used by default, you have to explicitly pass --enable-gpl to -configure to activate them. In this case, FFmpeg's license changes to GPL v2+. +configure to activate them. In this case, Libav's license changes to GPL v2+. -Specifically, the GPL parts of FFmpeg are +Specifically, the GPL parts of Libav 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: - - f_ebur128.c - vf_blackframe.c - vf_boxblur.c - - vf_colormatrix.c - vf_cropdetect.c - - vf_decimate.c - vf_delogo.c - - vf_geq.c - - vf_histeq.c - vf_hqdn3d.c - - vf_kerndeint.c - - vf_mcdeint.c - - vf_mp.c - - vf_owdenoise.c - - vf_perspective.c - - vf_phase.c - - vf_pp.c - - vf_pullup.c - - vf_sab.c - - vf_smartblur.c - - vf_spp.c - - vf_stereo3d.c - - vf_super2xsai.c - - vf_tinterlace.c - - vsrc_mptestsrc.c 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 @@ -67,37 +40,26 @@ There are a handful of files under other licensing terms, namely: external libraries ================== -FFmpeg can be combined with a number of external libraries, which sometimes +Libav can be combined with a number of external libraries, which sometimes affect the licensing of binaries resulting from the combination. compatible libraries -------------------- -The following libraries are under GPL: - - frei0r - - libcdio - - libutvideo - - libvidstab - - libx264 - - libx265 - - libxavs - - libxvid -When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by +The libcdio, libx264, libx265, libxavs and libxvid libraries are under GPL. When +combining them with Libav, Libav 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 +version 3 of those licenses. So to combine these libraries with Libav, 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. +The Fraunhofer AAC library, FAAC and OpenSSL are under licenses incompatible +with all (L)GPL versions. Thus, unfortunately, since both licenses cannot be +satisfied simultaneously, binaries resulting from the combination of Libav +with these libraries are nonfree und unredistributable. If you wish to enable +any of these libraries nonetheless, pass --enable-nonfree to configure. diff --git a/MAINTAINERS b/MAINTAINERS deleted file mode 100644 index edfc24a0e8..0000000000 --- a/MAINTAINERS +++ /dev/null @@ -1,566 +0,0 @@ -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 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 and related discussions. - - -Project Leader -============== - -Michael Niedermayer - final design decisions - - -Applications -============ - -ffmpeg: - ffmpeg.c Michael Niedermayer - -ffplay: - ffplay.c Marton Balint - -ffprobe: - ffprobe.c Stefano Sabatini - -ffserver: - ffserver.c Reynaldo H. Verdejo Pinochet - -Commandline utility code: - cmdutils.c, cmdutils.h Michael Niedermayer - -QuickTime faststart: - tools/qt-faststart.c Baptiste Coudurier - - -Miscellaneous Areas -=================== - -documentation Stefano Sabatini, Mike Melanson, Timothy Gu -build system (configure,Makefiles) Diego Biurrun, Mans Rullgard -project server ĂrpĂ¡d Gereöffy, Michael Niedermayer, Reimar Döffinger, Alexander Strasser -presets Robert Swain -metadata subsystem Aurelien Jacobs -release management Michael Niedermayer - - -Communication -============= - -website Robert Swain -Trac bug tracker Alexander Strasser, Michael Niedermayer, Carl Eugen Hoyos, Lou Logan -mailinglists Michael Niedermayer, Baptiste Coudurier, Lou Logan -Google+ Paul B Mahol, Michael Niedermayer, Alexander Strasser -Twitter Lou Logan -Launchpad Timothy Gu - - -libavutil -========= - -External Interfaces: - libavutil/avutil.h Michael Niedermayer -Internal Interfaces: - libavutil/common.h Michael Niedermayer - -Other: - bprint Nicolas George - bswap.h - des Reimar Doeffinger - dynarray.h Nicolas George - eval.c, eval.h Michael Niedermayer - float_dsp Loren Merritt - hash Reimar Doeffinger - intfloat* Michael Niedermayer - integer.c, integer.h Michael Niedermayer - lzo Reimar Doeffinger - mathematics.c, mathematics.h Michael Niedermayer - mem.c, mem.h Michael Niedermayer - opencl.c, opencl.h Wei Gao - opt.c, opt.h Michael Niedermayer - rational.c, rational.h Michael Niedermayer - rc4 Reimar Doeffinger - ripemd.c, ripemd.h James Almer - timecode ClĂ©ment BÅ“sch - - -libavcodec -========== - -Generic Parts: - External Interfaces: - avcodec.h Michael Niedermayer - utility code: - utils.c Michael Niedermayer - audio and video frame extraction: - parser.c Michael Niedermayer - bitstream reading: - 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: - rangecoder.c, rangecoder.h Michael Niedermayer - lzw.* Michael Niedermayer - floating point AAN DCT: - faandct.c, faandct.h Michael Niedermayer - Golomb coding: - golomb.c, golomb.h Michael Niedermayer - LPC: - lpc.c, lpc.h Justin Ruggles - motion estimation: - motion* Michael Niedermayer - rate control: - ratecontrol.c Michael Niedermayer - libxvid_rc.c Michael Niedermayer - simple IDCT: - simple_idct.c, simple_idct.h Michael Niedermayer - postprocessing: - libpostproc/* Michael Niedermayer - table generation: - tableprint.c, tableprint.h Reimar Doeffinger - fixed point FFT: - fft* Zeljko Lukac - -Codecs: - 4xm.c Michael Niedermayer - 8bps.c Roberto Togni - 8svx.c Jaikrishnan Menon - aasc.c Kostya Shishkov - ac3* Justin Ruggles - alacenc.c Jaikrishnan Menon - alsdec.c Thilo Borgmann - apedec.c Kostya Shishkov - ass* Aurelien Jacobs - asv* Michael Niedermayer - atrac3* Benjamin Larsson - atrac3plus* Maxim Poliakovski - bgmc.c, bgmc.h Thilo Borgmann - bink.c Kostya Shishkov - binkaudio.c Peter Ross - bmp.c Mans Rullgard, Kostya Shishkov - cavs* Stefan Gehrer - cdxl.c Paul B Mahol - celp_filters.* Vitor Sessak - cinepak.c Roberto Togni - cinepakenc.c Rl / Aetey G.T. AB - 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 - dnxhd* Baptiste Coudurier - dpcm.c Mike Melanson - dv.c Roman Shaposhnik - dxa.c Kostya Shishkov - eacmv*, eaidct*, eat* Peter Ross - exif.c, exif.h Thilo Borgmann - ffv1* Michael Niedermayer - ffwavesynth.c Nicolas George - fic.c Derek Buitenhuis - flac* Justin Ruggles - flashsv* Benjamin Larsson - flicvideo.c Mike Melanson - g722.c Martin Storsjo - g726.c Roman Shaposhnik - gifdec.c Baptiste Coudurier - h261* Michael Niedermayer - h263* Michael Niedermayer - h264* Loren Merritt, Michael Niedermayer - huffyuv.c Michael Niedermayer - idcinvideo.c Mike Melanson - imc* Benjamin Larsson - indeo2* Kostya Shishkov - indeo5* Kostya Shishkov - interplayvideo.c Mike Melanson - ivi* Kostya Shishkov - jacosub* ClĂ©ment BÅ“sch - jpeg2000* Nicolas Bertrand - jpeg_ls.c Kostya Shishkov - jvdec.c Peter Ross - kmvc.c Kostya Shishkov - lcl*.c Roberto Togni, Reimar Doeffinger - libcelt_dec.c Nicolas George - libdirac* David Conrad - libgsm.c Michel Bardiaux - libopenjpeg.c Jaikrishnan Menon - libopenjpegenc.c Michael Bradshaw - libschroedinger* David Conrad - libspeexdec.c Justin Ruggles - libtheoraenc.c David Conrad - libutvideo* Derek Buitenhuis - libvorbis.c David Conrad - libvpx* James Zern - libx264.c Mans Rullgard, Jason Garrett-Glaser - libx265.c Derek Buitenhuis - libxavs.c Stefan Gehrer - libzvbi-teletextdec.c Marton Balint - loco.c Kostya Shishkov - lzo.h, lzo.c Reimar Doeffinger - mdec.c Michael Niedermayer - mimic.c Ramiro Polla - mjpeg*.c Michael Niedermayer - mlp* Ramiro Polla - mmvideo.c Peter Ross - mpc* Kostya Shishkov - mpeg12.c, mpeg12data.h Michael Niedermayer - mpegvideo.c, mpegvideo.h Michael Niedermayer - mqc* Nicolas Bertrand - msmpeg4.c, msmpeg4data.h Michael Niedermayer - msrle.c Mike Melanson - msvideo1.c Mike Melanson - nellymoserdec.c Benjamin Larsson - nuv.c Reimar Doeffinger - paf.* Paul B Mahol - pcx.c Ivo van Poorten - pgssubdec.c Reimar Doeffinger - ptx.c Ivo van Poorten - qcelp* Reynaldo H. Verdejo Pinochet - qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson - qdrw.c Kostya Shishkov - qpeg.c Kostya Shishkov - qtrle.c Mike Melanson - ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni - resample2.c Michael Niedermayer - rl2.c Sascha Sommer - rpza.c Roberto Togni - rtjpeg.c, rtjpeg.h Reimar Doeffinger - rv10.c Michael Niedermayer - rv3* Kostya Shishkov - rv4* Kostya Shishkov - s3tc* Ivo van Poorten - smacker.c Kostya Shishkov - smc.c Mike Melanson - smvjpegdec.c Ash Hughes - snow* Michael Niedermayer, Loren Merritt - sonic.c Alex Beregszaszi - srt* Aurelien Jacobs - sunrast.c Ivo van Poorten - svq3.c Michael Niedermayer - tak* Paul B Mahol - targa.c Kostya Shishkov - tiff.c Kostya Shishkov - truemotion1* Mike Melanson - truemotion2* Kostya Shishkov - truespeech.c Kostya Shishkov - tscc.c Kostya Shishkov - tta.c Alex Beregszaszi, Jaikrishnan Menon - ttaenc.c Paul B Mahol - txd.c Ivo van Poorten - ulti* Kostya Shishkov - v410*.c Derek Buitenhuis - vb.c Kostya Shishkov - vble.c Derek Buitenhuis - vc1* Kostya Shishkov - vcr1.c Michael Niedermayer - vda_h264_dec.c Xidorn Quan - vima.c Paul B Mahol - vmnc.c Kostya Shishkov - vorbis_dec.c Denes Balatoni, David Conrad - vorbis_enc.c Oded Shimon - vp3* Mike Melanson - vp5 Aurelien Jacobs - vp6 Aurelien Jacobs - vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje - vp9 Ronald Bultje, ClĂ©ment BÅ“sch - vqavideo.c Mike Melanson - wavpack.c Kostya Shishkov - wmaprodec.c Sascha Sommer - wmavoice.c Ronald S. Bultje - wmv2.c Michael Niedermayer - wnv1.c Kostya Shishkov - xan.c Mike Melanson - xbm* Paul B Mahol - xface Stefano Sabatini - xl.c Kostya Shishkov - xvmc.c Ivan Kalvachev - xwd* Paul B Mahol - zerocodec.c Derek Buitenhuis - zmbv* Kostya Shishkov - -Hardware acceleration: - crystalhd.c Philip Langdale - dxva2* Laurent Aimar - libstagefright.cpp Mohamed Naufal - vaapi* Gwenole Beauchesne - vda* Sebastien Zwickert - vdpau* Carl Eugen Hoyos - - -libavdevice -=========== - External Interface: - libavdevice/avdevice.h - - - avfoundation.m Thilo Borgmann - dshow.c Roger Pack (CC rogerdpack@gmail.com) - fbdev_enc.c Lukasz Marek - gdigrab.c Roger Pack (CC rogerdpack@gmail.com) - iec61883.c Georg Lippitsch - lavfi Stefano Sabatini - libdc1394.c Roman Shaposhnik - opengl_enc.c Lukasz Marek - pulse_audio_enc.c Lukasz Marek - qtkit.m Thilo Borgmann - sdl Stefano Sabatini - v4l2.c Luca Abeni - vfwcap.c Ramiro Polla - xv.c Lukasz Marek - -libavfilter -=========== - -Generic parts: - graphdump.c Nicolas George - -Filters: - af_adelay.c Paul B Mahol - af_aecho.c Paul B Mahol - af_afade.c Paul B Mahol - af_amerge.c Nicolas George - af_aphaser.c Paul B Mahol - af_aresample.c Michael Niedermayer - af_astats.c Paul B Mahol - af_astreamsync.c Nicolas George - af_atempo.c Pavel Koshevoy - af_biquads.c Paul B Mahol - af_compand.c Paul B Mahol - af_ladspa.c Paul B Mahol - af_pan.c Nicolas George - avf_avectorscope.c Paul B Mahol - vf_blend.c Paul B Mahol - vf_colorbalance.c Paul B Mahol - vf_dejudder.c Nicholas Robbins - vf_delogo.c Jean Delvare (CC ) - vf_drawbox.c/drawgrid Andrey Utkin - vf_extractplanes.c Paul B Mahol - vf_histogram.c Paul B Mahol - vf_il.c Paul B Mahol - vf_mergeplanes.c Paul B Mahol - vf_psnr.c Paul B Mahol - vf_scale.c Michael Niedermayer - vf_separatefields.c Paul B Mahol - vf_stereo3d.c Paul B Mahol - vf_telecine.c Paul B Mahol - vf_yadif.c Michael Niedermayer - -Sources: - vsrc_mandelbrot.c Michael Niedermayer - -libavformat -=========== - -Generic parts: - External Interface: - libavformat/avformat.h Michael Niedermayer - Utility Code: - libavformat/utils.c Michael Niedermayer - - -Muxers/Demuxers: - 4xm.c Mike Melanson - adtsenc.c Robert Swain - afc.c Paul B Mahol - aiffdec.c Baptiste Coudurier, Matthieu Bouron - aiffenc.c Baptiste Coudurier, Matthieu Bouron - ape.c Kostya Shishkov - ass* Aurelien Jacobs - astdec.c Paul B Mahol - astenc.c James Almer - avi* Michael Niedermayer - avisynth.c AvxSynth Team (avxsynth.testing at gmail dot com) - avr.c Paul B Mahol - bink.c Peter Ross - brstm.c Paul B Mahol - caf* Peter Ross - cdxl.c Paul B Mahol - crc.c Michael Niedermayer - daud.c Reimar Doeffinger - dtshddec.c Paul B Mahol - dv.c Roman Shaposhnik - dxa.c Kostya Shishkov - electronicarts.c Peter Ross - epafdec.c Paul B Mahol - ffm* Baptiste Coudurier - flac* Justin Ruggles - flic.c Mike Melanson - flvdec.c, flvenc.c Michael Niedermayer - gxf.c Reimar Doeffinger - gxfenc.c Baptiste Coudurier - hls.c Anssi Hannula - idcin.c Mike Melanson - idroqdec.c Mike Melanson - iff.c Jaikrishnan Menon - img2*.c Michael Niedermayer - ipmovie.c Mike Melanson - ircam* Paul B Mahol - iss.c Stefan Gehrer - jacosub* ClĂ©ment BÅ“sch - jvdec.c Peter Ross - libmodplug.c ClĂ©ment BÅ“sch - libnut.c Oded Shimon - lmlm4.c Ivo van Poorten - lvfdec.c Paul B Mahol - lxfdec.c Tomas Härdin - matroska.c Aurelien Jacobs - matroskadec.c Aurelien Jacobs - matroskaenc.c David Conrad - metadata* Aurelien Jacobs - mgsts.c Paul B Mahol - microdvd* Aurelien Jacobs - mm.c Peter Ross - mov.c Michael Niedermayer, Baptiste Coudurier - movenc.c Baptiste Coudurier, Matthieu Bouron - mpc.c Kostya Shishkov - mpeg.c Michael Niedermayer - mpegenc.c Michael Niedermayer - mpegts.c Marton Balint - mpegtsenc.c Baptiste Coudurier - msnwc_tcp.c Ramiro Polla - mtv.c Reynaldo H. Verdejo Pinochet - mxf* Baptiste Coudurier - mxfdec.c Tomas Härdin - nistspheredec.c Paul B Mahol - nsvdec.c Francois Revol - nut* Michael Niedermayer - nuv.c Reimar Doeffinger - oggdec.c, oggdec.h David Conrad - oggenc.c Baptiste Coudurier - oggparse*.c David Conrad - oma.c Maxim Poliakovski - paf.c Paul B Mahol - psxstr.c Mike Melanson - pva.c Ivo van Poorten - pvfdec.c Paul B Mahol - r3d.c Baptiste Coudurier - raw.c Michael Niedermayer - rdt.c Ronald S. Bultje - rl2.c Sascha Sommer - rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov - rtmp* Kostya Shishkov - rtp.c, rtpenc.c Martin Storsjo - 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 - smacker.c Kostya Shishkov - smjpeg* Paul B Mahol - spdif* Anssi Hannula - srtdec.c Aurelien Jacobs - swf.c Baptiste Coudurier - takdec.c Paul B Mahol - tta.c Alex Beregszaszi - txd.c Ivo van Poorten - voc.c Aurelien Jacobs - wav.c Michael Niedermayer - wc3movie.c Mike Melanson - webm dash (matroskaenc.c) Vignesh Venkatasubramanian - webvtt* Matthew J Heaney - westwood.c Mike Melanson - wtv.c Peter Ross - wv.c Kostya Shishkov - wvenc.c Paul B Mahol - -Protocols: - bluray.c Petri Hintukainen - ftp.c Lukasz Marek - http.c Ronald S. Bultje - libssh.c Lukasz Marek - mms*.c Ronald S. Bultje - udp.c Luca Abeni - - -libswresample -============= - -Generic parts: - audioconvert.c Michael Niedermayer - dither.c Michael Niedermayer - rematrix*.c Michael Niedermayer - swresample*.c Michael Niedermayer - -Resamplers: - resample*.c Michael Niedermayer - soxr_resample.c Rob Sykes - - -Operating systems / CPU architectures -===================================== - -Alpha Mans Rullgard, Falk Hueffner -ARM Mans Rullgard -AVR32 Mans Rullgard -MIPS Mans Rullgard, Nedeljko Babic -Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier -Amiga / PowerPC Colin Ward -Linux / PowerPC Luca Barbato -Windows MinGW Alex Beregszaszi, Ramiro Polla -Windows Cygwin Victor Paesa -Windows MSVC Matthew Oliver -Windows ICL Matthew Oliver -ADI/Blackfin DSP Marc Hoffman -Sparc Roman Shaposhnik -x86 Michael Niedermayer - - -Releases -======== - -2.2 Michael Niedermayer -2.1 Michael Niedermayer -1.2 Michael Niedermayer - -If you want to maintain an older release, please contact us - - -GnuPG Fingerprints of maintainers and contributors -================================================== - -Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F -Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB -Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB -Ash Hughes 694D 43D2 D180 C7C7 6421 ABD3 A641 D0B7 623D 6029 -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 -FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8 -Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4 -Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368 -Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A -Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF -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 -Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4 -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 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F -Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863 -Tomas Härdin A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551 -Wei Gao 4269 7741 857A 0E60 9EC5 08D2 4744 4EFA 62C1 87B9 diff --git a/Makefile b/Makefile index 86b3508425..71c068ca0e 100644 --- a/Makefile +++ b/Makefile @@ -1,41 +1,86 @@ -MAIN_MAKEFILE=1 include config.mak vpath %.c $(SRC_PATH) -vpath %.cpp $(SRC_PATH) vpath %.h $(SRC_PATH) -vpath %.m $(SRC_PATH) vpath %.S $(SRC_PATH) vpath %.asm $(SRC_PATH) -vpath %.rc $(SRC_PATH) vpath %.v $(SRC_PATH) vpath %.texi $(SRC_PATH) -vpath %/fate_config.sh.template $(SRC_PATH) -AVPROGS-$(CONFIG_FFMPEG) += ffmpeg -AVPROGS-$(CONFIG_FFPLAY) += ffplay -AVPROGS-$(CONFIG_FFPROBE) += ffprobe -AVPROGS-$(CONFIG_FFSERVER) += ffserver +ifndef V +Q = @ +ECHO = printf "$(1)\t%s\n" $(2) +BRIEF = CC HOSTCC HOSTLD AS YASM AR LD +SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM STRIP +MSG = $@ +M = @$(call ECHO,$(TAG),$@); +$(foreach VAR,$(BRIEF), \ + $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) +$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) +$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_PATH)/%=%)); $(INSTALL)) +endif -AVPROGS := $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF)) -INSTPROGS = $(AVPROGS-yes:%=%$(PROGSSUF)$(EXESUF)) +ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil swscale + +IFLAGS := -I. -I$(SRC_PATH) +CPPFLAGS := $(IFLAGS) $(CPPFLAGS) +CFLAGS += $(ECFLAGS) +CCFLAGS = $(CPPFLAGS) $(CFLAGS) +ASFLAGS := $(CPPFLAGS) $(ASFLAGS) +YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm +HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) +LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS) + +define COMPILE + $(call $(1)DEP,$(1)) + $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $< +endef + +COMPILE_C = $(call COMPILE,CC) +COMPILE_S = $(call COMPILE,AS) +COMPILE_HOSTC = $(call COMPILE,HOSTCC) + +%.o: %.c + $(COMPILE_C) + +%.o: %.S + $(COMPILE_S) + +%_host.o: %.c + $(COMPILE_HOSTC) + +%.i: %.c + $(CC) $(CCFLAGS) $(CC_E) $< + +%.h.c: + $(Q)echo '#include "$*.h"' >$@ + +%.ver: %.v + $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ + +%.c %.h: TAG = GEN + +AVPROGS-$(CONFIG_AVCONV) += avconv +AVPROGS-$(CONFIG_AVPLAY) += avplay +AVPROGS-$(CONFIG_AVPROBE) += avprobe +AVPROGS-$(CONFIG_AVSERVER) += avserver + +AVPROGS := $(AVPROGS-yes:%=%$(EXESUF)) PROGS += $(AVPROGS) -AVBASENAMES = ffmpeg ffplay ffprobe ffserver -ALLAVPROGS = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF)) -ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF)) +AVBASENAMES = avconv avplay avprobe avserver +ALLAVPROGS = $(AVBASENAMES:%=%$(EXESUF)) $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog) += cmdutils.o)) -$(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_opencl.o)) -OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o -OBJS-ffmpeg-$(HAVE_VDPAU_X11) += ffmpeg_vdpau.o -OBJS-ffmpeg-$(HAVE_DXVA2_LIB) += ffmpeg_dxva2.o -OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_vda.o +OBJS-avconv += avconv_opt.o avconv_filter.o +OBJS-avconv-$(HAVE_VDPAU_X11) += avconv_vdpau.o +OBJS-avconv-$(HAVE_DXVA2_LIB) += avconv_dxva2.o +OBJS-avconv-$(CONFIG_VDA) += avconv_vda.o -TESTTOOLS = audiogen videogen rotozoom tiny_psnr tiny_ssim base64 +TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options -TOOLS = qt-faststart trasher uncoded_frame +TOOLS = qt-faststart trasher TOOLS-$(CONFIG_ZLIB) += cws2fws # $(FFLIBS-yes) needs to be in linking order @@ -44,14 +89,11 @@ FFLIBS-$(CONFIG_AVFILTER) += avfilter FFLIBS-$(CONFIG_AVFORMAT) += avformat FFLIBS-$(CONFIG_AVCODEC) += avcodec FFLIBS-$(CONFIG_AVRESAMPLE) += avresample -FFLIBS-$(CONFIG_POSTPROC) += postproc -FFLIBS-$(CONFIG_SWRESAMPLE) += swresample 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 $(SRC_PATH)/doc/examples/README +DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.avpreset) SKIPHEADERS = cmdutils_common_opts.h compat/w32pthreads.h @@ -66,8 +108,6 @@ $(TOOLS): %$(EXESUF): %.o $(EXEOBJS) $(LD) $(LDFLAGS) $(LD_O) $^ $(ELIBS) tools/cws2fws$(EXESUF): ELIBS = $(ZLIB) -tools/uncoded_frame$(EXESUF): $(FF_DEP_LIBS) -tools/uncoded_frame$(EXESUF): ELIBS = $(FF_EXTRALIBS) config.h: .config .config: $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) @@ -79,8 +119,7 @@ SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ HEADERS ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ ARMV5TE-OBJS ARMV6-OBJS ARMV8-OBJS VFP-OBJS NEON-OBJS \ ALTIVEC-OBJS MMX-OBJS YASM-OBJS \ - MIPSFPU-OBJS MIPSDSPR2-OBJS MIPSDSPR1-OBJS MIPS32R2-OBJS \ - OBJS SLIBOBJS HOSTOBJS TESTOBJS + OBJS HOSTOBJS TESTOBJS define RESET $(1) := @@ -101,22 +140,16 @@ include $(SRC_PATH)/doc/Makefile define DOPROG OBJS-$(1) += $(1).o $(EXEOBJS) $(OBJS-$(1)-yes) -$(1)$(PROGSSUF)_g$(EXESUF): $$(OBJS-$(1)) +$(1)$(EXESUF): $$(OBJS-$(1)) $$(OBJS-$(1)): CFLAGS += $(CFLAGS-$(1)) -$(1)$(PROGSSUF)_g$(EXESUF): LDFLAGS += $(LDFLAGS-$(1)) -$(1)$(PROGSSUF)_g$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1)) +$(1)$(EXESUF): LDFLAGS += $(LDFLAGS-$(1)) +$(1)$(EXESUF): FF_EXTRALIBS += $(LIBS-$(1)) -include $$(OBJS-$(1):.o=.d) endef -$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(PROGSSUF)$(EXESUF)=)))) +$(foreach P,$(PROGS),$(eval $(call DOPROG,$(P:$(EXESUF)=)))) -ffprobe.o cmdutils.o : libavutil/ffversion.h - -$(PROGS): %$(PROGSSUF)$(EXESUF): %$(PROGSSUF)_g$(EXESUF) - $(CP) $< $@ - $(STRIP) $@ - -%$(PROGSSUF)_g$(EXESUF): %.o $(FF_DEP_LIBS) +$(PROGS): %$(EXESUF): %.o $(FF_DEP_LIBS) $(LD) $(LDFLAGS) $(LD_O) $(OBJS-$*) $(FF_EXTRALIBS) OBJDIRS += tools @@ -129,8 +162,8 @@ GIT_LOG = $(SRC_PATH)/.git/logs/HEAD .version: $(wildcard $(GIT_LOG)) $(VERSION_SH) config.mak .version: M=@ -libavutil/ffversion.h .version: - $(M)$(VERSION_SH) $(SRC_PATH) libavutil/ffversion.h $(EXTRA_VERSION) +version.h .version: + $(M)$(VERSION_SH) $(SRC_PATH) version.h $(EXTRA_VERSION) $(Q)touch .version # force version.sh to run whenever version might have changed @@ -149,12 +182,11 @@ install-progs-$(CONFIG_SHARED): install-libs install-progs: install-progs-yes $(AVPROGS) $(Q)mkdir -p "$(BINDIR)" - $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)" + $(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)" -install-data: $(DATA_FILES) $(EXAMPLES_FILES) - $(Q)mkdir -p "$(DATADIR)/examples" +install-data: $(DATA_FILES) + $(Q)mkdir -p "$(DATADIR)" $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)" - $(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples" uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data @@ -165,20 +197,19 @@ uninstall-data: $(RM) -r "$(DATADIR)" clean:: - $(RM) $(ALLAVPROGS) $(ALLAVPROGS_G) + $(RM) $(ALLAVPROGS) $(RM) $(CLEANSUFFIXES) $(RM) $(CLEANSUFFIXES:%=tools/%) - $(RM) -r coverage-html $(RM) -rf coverage.info lcov distclean:: $(RM) $(DISTCLEANSUFFIXES) - $(RM) config.* .config libavutil/avconfig.h .version version.h libavutil/ffversion.h libavcodec/codec_names.h + $(RM) config.* .config libavutil/avconfig.h .version version.h config: - $(SRC_PATH)/configure $(value FFMPEG_CONFIGURATION) + $(SRC_PATH)/configure $(value LIBAV_CONFIGURATION) -check: all alltools examples testprogs fate +check: all alltools checkheaders examples testprogs fate include $(SRC_PATH)/tests/Makefile @@ -193,5 +224,5 @@ $(sort $(OBJDIRS)): # so this saves some time on slow systems. .SUFFIXES: -.PHONY: all all-yes alltools check *clean config install* +.PHONY: all all-yes alltools check *clean config examples install* .PHONY: testprogs uninstall* diff --git a/README b/README index ae007bcccf..afef671611 100644 --- a/README +++ b/README @@ -1,18 +1,12 @@ -FFmpeg README -------------- +Libav README +------------ 1) Documentation ---------------- -* Read the documentation in the doc/ directory in git. - You can also view it online at http://ffmpeg.org/documentation.html +* Read the documentation in the doc/ directory. 2) Licensing ------------ * See the LICENSE file. - -3) Build and Install --------------------- - -* See the INSTALL file. diff --git a/RELEASE b/RELEASE index bd5ee42fcc..086e7dc11f 100644 --- a/RELEASE +++ b/RELEASE @@ -1 +1 @@ -2.2.git +11_alpha1 diff --git a/arch.mak b/arch.mak index 0e866d8628..4bfc883ffa 100644 --- a/arch.mak +++ b/arch.mak @@ -4,11 +4,6 @@ OBJS-$(HAVE_ARMV8) += $(ARMV8-OBJS) $(ARMV8-OBJS-yes) OBJS-$(HAVE_VFP) += $(VFP-OBJS) $(VFP-OBJS-yes) OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-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_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes) diff --git a/avconv.c b/avconv.c new file mode 100644 index 0000000000..2cee09bc22 --- /dev/null +++ b/avconv.c @@ -0,0 +1,2633 @@ +/* + * avconv main + * Copyright (c) 2000-2011 The libav developers. + * + * 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 + */ + +#include "config.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libavformat/avformat.h" +#include "libavdevice/avdevice.h" +#include "libswscale/swscale.h" +#include "libavresample/avresample.h" +#include "libavutil/opt.h" +#include "libavutil/channel_layout.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" +#include "libavutil/fifo.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/dict.h" +#include "libavutil/mathematics.h" +#include "libavutil/pixdesc.h" +#include "libavutil/avstring.h" +#include "libavutil/libm.h" +#include "libavutil/imgutils.h" +#include "libavutil/time.h" +#include "libavformat/os_support.h" + +# include "libavfilter/avfilter.h" +# include "libavfilter/buffersrc.h" +# include "libavfilter/buffersink.h" + +#if HAVE_SYS_RESOURCE_H +#include +#include +#include +#elif HAVE_GETPROCESSTIMES +#include +#endif +#if HAVE_GETPROCESSMEMORYINFO +#include +#include +#endif + +#if HAVE_SYS_SELECT_H +#include +#endif + +#if HAVE_PTHREADS +#include +#endif + +#include + +#include "avconv.h" +#include "cmdutils.h" + +#include "libavutil/avassert.h" + +const char program_name[] = "avconv"; +const int program_birth_year = 2000; + +static FILE *vstats_file; + +static int nb_frames_drop = 0; + + + +#if HAVE_PTHREADS +/* signal to input threads that they should exit; set by the main thread */ +static int transcoding_finished; +#endif + +#define DEFAULT_PASS_LOGFILENAME_PREFIX "av2pass" + +InputStream **input_streams = NULL; +int nb_input_streams = 0; +InputFile **input_files = NULL; +int nb_input_files = 0; + +OutputStream **output_streams = NULL; +int nb_output_streams = 0; +OutputFile **output_files = NULL; +int nb_output_files = 0; + +FilterGraph **filtergraphs; +int nb_filtergraphs; + +static void term_exit(void) +{ + av_log(NULL, AV_LOG_QUIET, ""); +} + +static volatile int received_sigterm = 0; +static volatile int received_nb_signals = 0; + +static void +sigterm_handler(int sig) +{ + received_sigterm = sig; + received_nb_signals++; + term_exit(); +} + +static void term_init(void) +{ + signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */ + signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ +#ifdef SIGXCPU + signal(SIGXCPU, sigterm_handler); +#endif +} + +static int decode_interrupt_cb(void *ctx) +{ + return received_nb_signals > 1; +} + +const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; + +static void avconv_cleanup(int ret) +{ + int i, j; + + for (i = 0; i < nb_filtergraphs; i++) { + FilterGraph *fg = filtergraphs[i]; + avfilter_graph_free(&fg->graph); + for (j = 0; j < fg->nb_inputs; j++) { + av_freep(&fg->inputs[j]->name); + av_freep(&fg->inputs[j]); + } + av_freep(&fg->inputs); + for (j = 0; j < fg->nb_outputs; j++) { + av_freep(&fg->outputs[j]->name); + av_freep(&fg->outputs[j]); + } + av_freep(&fg->outputs); + av_freep(&fg->graph_desc); + + av_freep(&filtergraphs[i]); + } + av_freep(&filtergraphs); + + /* close files */ + for (i = 0; i < nb_output_files; i++) { + OutputFile *of = output_files[i]; + AVFormatContext *s = of->ctx; + if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb) + avio_close(s->pb); + avformat_free_context(s); + av_dict_free(&of->opts); + + av_freep(&output_files[i]); + } + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + AVBitStreamFilterContext *bsfc = ost->bitstream_filters; + while (bsfc) { + AVBitStreamFilterContext *next = bsfc->next; + av_bitstream_filter_close(bsfc); + bsfc = next; + } + ost->bitstream_filters = NULL; + av_frame_free(&ost->filtered_frame); + + av_parser_close(ost->parser); + + av_freep(&ost->forced_keyframes); + av_freep(&ost->avfilter); + av_freep(&ost->logfile_prefix); + + av_freep(&output_streams[i]); + } + for (i = 0; i < nb_input_files; i++) { + avformat_close_input(&input_files[i]->ctx); + av_freep(&input_files[i]); + } + for (i = 0; i < nb_input_streams; i++) { + InputStream *ist = input_streams[i]; + + av_frame_free(&ist->decoded_frame); + av_frame_free(&ist->filter_frame); + av_dict_free(&ist->decoder_opts); + av_freep(&ist->filters); + av_freep(&ist->hwaccel_device); + + av_freep(&input_streams[i]); + } + + if (vstats_file) + fclose(vstats_file); + av_free(vstats_filename); + + av_freep(&input_streams); + av_freep(&input_files); + av_freep(&output_streams); + av_freep(&output_files); + + uninit_opts(); + + avformat_network_deinit(); + + if (received_sigterm) { + av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n", + (int) received_sigterm); + exit (255); + } +} + +void assert_avoptions(AVDictionary *m) +{ + AVDictionaryEntry *t; + if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { + av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); + exit_program(1); + } +} + +static void abort_codec_experimental(AVCodec *c, int encoder) +{ + const char *codec_string = encoder ? "encoder" : "decoder"; + AVCodec *codec; + av_log(NULL, AV_LOG_FATAL, "%s '%s' is experimental and might produce bad " + "results.\nAdd '-strict experimental' if you want to use it.\n", + codec_string, c->name); + codec = encoder ? avcodec_find_encoder(c->id) : avcodec_find_decoder(c->id); + if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) + av_log(NULL, AV_LOG_FATAL, "Or use the non experimental %s '%s'.\n", + codec_string, codec->name); + exit_program(1); +} + +/* + * Update the requested input sample format based on the output sample format. + * This is currently only used to request float output from decoders which + * support multiple sample formats, one of which is AV_SAMPLE_FMT_FLT. + * Ideally this will be removed in the future when decoders do not do format + * conversion and only output in their native format. + */ +static void update_sample_fmt(AVCodecContext *dec, AVCodec *dec_codec, + AVCodecContext *enc) +{ + /* if sample formats match or a decoder sample format has already been + requested, just return */ + if (enc->sample_fmt == dec->sample_fmt || + dec->request_sample_fmt > AV_SAMPLE_FMT_NONE) + return; + + /* if decoder supports more than one output format */ + if (dec_codec && dec_codec->sample_fmts && + dec_codec->sample_fmts[0] != AV_SAMPLE_FMT_NONE && + dec_codec->sample_fmts[1] != AV_SAMPLE_FMT_NONE) { + const enum AVSampleFormat *p; + int min_dec = INT_MAX, min_inc = INT_MAX; + enum AVSampleFormat dec_fmt = AV_SAMPLE_FMT_NONE; + enum AVSampleFormat inc_fmt = AV_SAMPLE_FMT_NONE; + + /* find a matching sample format in the encoder */ + for (p = dec_codec->sample_fmts; *p != AV_SAMPLE_FMT_NONE; p++) { + if (*p == enc->sample_fmt) { + dec->request_sample_fmt = *p; + return; + } else { + enum AVSampleFormat dfmt = av_get_packed_sample_fmt(*p); + enum AVSampleFormat efmt = av_get_packed_sample_fmt(enc->sample_fmt); + int fmt_diff = 32 * abs(dfmt - efmt); + if (av_sample_fmt_is_planar(*p) != + av_sample_fmt_is_planar(enc->sample_fmt)) + fmt_diff++; + if (dfmt == efmt) { + min_inc = fmt_diff; + inc_fmt = *p; + } else if (dfmt > efmt) { + if (fmt_diff < min_inc) { + min_inc = fmt_diff; + inc_fmt = *p; + } + } else { + if (fmt_diff < min_dec) { + min_dec = fmt_diff; + dec_fmt = *p; + } + } + } + } + + /* if none match, provide the one that matches quality closest */ + dec->request_sample_fmt = min_inc != INT_MAX ? inc_fmt : dec_fmt; + } +} + +static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) +{ + AVBitStreamFilterContext *bsfc = ost->bitstream_filters; + AVCodecContext *avctx = ost->st->codec; + int ret; + + /* + * Audio encoders may split the packets -- #frames in != #packets out. + * But there is no reordering, so we can limit the number of output packets + * by simply dropping them here. + * Counting encoded video frames needs to be done separately because of + * reordering, see do_video_out() + */ + if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) { + if (ost->frame_number >= ost->max_frames) { + av_free_packet(pkt); + return; + } + ost->frame_number++; + } + + while (bsfc) { + AVPacket new_pkt = *pkt; + int a = av_bitstream_filter_filter(bsfc, avctx, NULL, + &new_pkt.data, &new_pkt.size, + pkt->data, pkt->size, + pkt->flags & AV_PKT_FLAG_KEY); + if (a > 0) { + av_free_packet(pkt); + new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, + av_buffer_default_free, NULL, 0); + if (!new_pkt.buf) + exit_program(1); + } else if (a < 0) { + av_log(NULL, AV_LOG_ERROR, "%s failed for stream %d, codec %s", + bsfc->filter->name, pkt->stream_index, + avctx->codec ? avctx->codec->name : "copy"); + print_error("", a); + if (exit_on_error) + exit_program(1); + } + *pkt = new_pkt; + + bsfc = bsfc->next; + } + + if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS) && + ost->last_mux_dts != AV_NOPTS_VALUE && + pkt->dts < ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT)) { + av_log(NULL, AV_LOG_WARNING, "Non-monotonous DTS in output stream " + "%d:%d; previous: %"PRId64", current: %"PRId64"; ", + ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); + if (exit_on_error) { + av_log(NULL, AV_LOG_FATAL, "aborting.\n"); + exit_program(1); + } + av_log(NULL, AV_LOG_WARNING, "changing to %"PRId64". This may result " + "in incorrect timestamps in the output file.\n", + ost->last_mux_dts + 1); + pkt->dts = ost->last_mux_dts + 1; + if (pkt->pts != AV_NOPTS_VALUE) + pkt->pts = FFMAX(pkt->pts, pkt->dts); + } + ost->last_mux_dts = pkt->dts; + + ost->data_size += pkt->size; + ost->packets_written++; + + pkt->stream_index = ost->index; + ret = av_interleaved_write_frame(s, pkt); + if (ret < 0) { + print_error("av_interleaved_write_frame()", ret); + exit_program(1); + } +} + +static int check_recording_time(OutputStream *ost) +{ + OutputFile *of = output_files[ost->file_index]; + + if (of->recording_time != INT64_MAX && + av_compare_ts(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, of->recording_time, + AV_TIME_BASE_Q) >= 0) { + ost->finished = 1; + return 0; + } + return 1; +} + +static void do_audio_out(AVFormatContext *s, OutputStream *ost, + AVFrame *frame) +{ + AVCodecContext *enc = ost->st->codec; + AVPacket pkt; + int got_packet = 0; + + av_init_packet(&pkt); + pkt.data = NULL; + pkt.size = 0; + + if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) + frame->pts = ost->sync_opts; + ost->sync_opts = frame->pts + frame->nb_samples; + + ost->samples_encoded += frame->nb_samples; + ost->frames_encoded++; + + if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { + av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n"); + exit_program(1); + } + + if (got_packet) { + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); + if (pkt.dts != AV_NOPTS_VALUE) + pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); + if (pkt.duration > 0) + pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); + + write_frame(s, &pkt, ost); + } +} + +static void do_subtitle_out(AVFormatContext *s, + OutputStream *ost, + InputStream *ist, + AVSubtitle *sub, + int64_t pts) +{ + static uint8_t *subtitle_out = NULL; + int subtitle_out_max_size = 1024 * 1024; + int subtitle_out_size, nb, i; + AVCodecContext *enc; + AVPacket pkt; + + if (pts == AV_NOPTS_VALUE) { + av_log(NULL, AV_LOG_ERROR, "Subtitle packets must have a pts\n"); + if (exit_on_error) + exit_program(1); + return; + } + + enc = ost->st->codec; + + if (!subtitle_out) { + subtitle_out = av_malloc(subtitle_out_max_size); + } + + /* Note: DVB subtitle need one packet to draw them and one other + packet to clear them */ + /* XXX: signal it in the codec context ? */ + if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) + nb = 2; + else + nb = 1; + + for (i = 0; i < nb; i++) { + ost->sync_opts = av_rescale_q(pts, ist->st->time_base, enc->time_base); + if (!check_recording_time(ost)) + return; + + sub->pts = av_rescale_q(pts, ist->st->time_base, AV_TIME_BASE_Q); + // start_display_time is required to be 0 + sub->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q); + sub->end_display_time -= sub->start_display_time; + sub->start_display_time = 0; + + ost->frames_encoded++; + + subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out, + subtitle_out_max_size, sub); + if (subtitle_out_size < 0) { + av_log(NULL, AV_LOG_FATAL, "Subtitle encoding failed\n"); + exit_program(1); + } + + av_init_packet(&pkt); + pkt.data = subtitle_out; + pkt.size = subtitle_out_size; + pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base); + if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { + /* XXX: the pts correction is handled here. Maybe handling + it in the codec would be better */ + if (i == 0) + pkt.pts += 90 * sub->start_display_time; + else + pkt.pts += 90 * sub->end_display_time; + } + write_frame(s, &pkt, ost); + } +} + +static void do_video_out(AVFormatContext *s, + OutputStream *ost, + AVFrame *in_picture, + int *frame_size) +{ + int ret, format_video_sync; + AVPacket pkt; + AVCodecContext *enc = ost->st->codec; + + *frame_size = 0; + + format_video_sync = video_sync_method; + if (format_video_sync == VSYNC_AUTO) + format_video_sync = (s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : + (s->oformat->flags & AVFMT_VARIABLE_FPS) ? VSYNC_VFR : VSYNC_CFR; + if (format_video_sync != VSYNC_PASSTHROUGH && + ost->frame_number && + in_picture->pts != AV_NOPTS_VALUE && + in_picture->pts < ost->sync_opts) { + nb_frames_drop++; + av_log(NULL, AV_LOG_WARNING, + "*** dropping frame %d from stream %d at ts %"PRId64"\n", + ost->frame_number, ost->st->index, in_picture->pts); + return; + } + + if (in_picture->pts == AV_NOPTS_VALUE) + in_picture->pts = ost->sync_opts; + ost->sync_opts = in_picture->pts; + + + if (!ost->frame_number) + ost->first_pts = in_picture->pts; + + av_init_packet(&pkt); + pkt.data = NULL; + pkt.size = 0; + + if (ost->frame_number >= ost->max_frames) + return; + + if (s->oformat->flags & AVFMT_RAWPICTURE && + enc->codec->id == AV_CODEC_ID_RAWVIDEO) { + /* raw pictures are written as AVPicture structure to + avoid any copies. We support temporarily the older + method. */ + enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; + enc->coded_frame->top_field_first = in_picture->top_field_first; + pkt.data = (uint8_t *)in_picture; + pkt.size = sizeof(AVPicture); + pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); + pkt.flags |= AV_PKT_FLAG_KEY; + + write_frame(s, &pkt, ost); + } else { + int got_packet; + + if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME) && + ost->top_field_first >= 0) + in_picture->top_field_first = !!ost->top_field_first; + + in_picture->quality = ost->st->codec->global_quality; + if (!enc->me_threshold) + in_picture->pict_type = 0; + if (ost->forced_kf_index < ost->forced_kf_count && + in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { + in_picture->pict_type = AV_PICTURE_TYPE_I; + ost->forced_kf_index++; + } + + ost->frames_encoded++; + + ret = avcodec_encode_video2(enc, &pkt, in_picture, &got_packet); + if (ret < 0) { + av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); + exit_program(1); + } + + if (got_packet) { + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); + if (pkt.dts != AV_NOPTS_VALUE) + pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); + + write_frame(s, &pkt, ost); + *frame_size = pkt.size; + + /* if two pass, output log */ + if (ost->logfile && enc->stats_out) { + fprintf(ost->logfile, "%s", enc->stats_out); + } + } + } + ost->sync_opts++; + /* + * For video, number of frames in == number of packets out. + * But there may be reordering, so we can't throw away frames on encoder + * flush, we need to limit them here, before they go into encoder. + */ + ost->frame_number++; +} + +static double psnr(double d) +{ + return -10.0 * log(d) / log(10.0); +} + +static void do_video_stats(OutputStream *ost, int frame_size) +{ + AVCodecContext *enc; + int frame_number; + double ti1, bitrate, avg_bitrate; + + /* this is executed just the first time do_video_stats is called */ + if (!vstats_file) { + vstats_file = fopen(vstats_filename, "w"); + if (!vstats_file) { + perror("fopen"); + exit_program(1); + } + } + + enc = ost->st->codec; + if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { + frame_number = ost->frame_number; + fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); + if (enc->flags&CODEC_FLAG_PSNR) + fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); + + fprintf(vstats_file,"f_size= %6d ", frame_size); + /* compute pts value */ + ti1 = ost->sync_opts * av_q2d(enc->time_base); + if (ti1 < 0.01) + ti1 = 0.01; + + bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; + avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; + fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", + (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); + fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); + } +} + +/* + * Read one frame for lavfi output for ost and encode it. + */ +static int poll_filter(OutputStream *ost) +{ + OutputFile *of = output_files[ost->file_index]; + AVFrame *filtered_frame = NULL; + int frame_size, ret; + + if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) { + return AVERROR(ENOMEM); + } + filtered_frame = ost->filtered_frame; + + if (ost->enc->type == AVMEDIA_TYPE_AUDIO && + !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) + ret = av_buffersink_get_samples(ost->filter->filter, filtered_frame, + ost->st->codec->frame_size); + else + ret = av_buffersink_get_frame(ost->filter->filter, filtered_frame); + + if (ret < 0) + return ret; + + if (filtered_frame->pts != AV_NOPTS_VALUE) { + int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; + filtered_frame->pts = av_rescale_q(filtered_frame->pts, + ost->filter->filter->inputs[0]->time_base, + ost->st->codec->time_base) - + av_rescale_q(start_time, + AV_TIME_BASE_Q, + ost->st->codec->time_base); + } + + switch (ost->filter->filter->inputs[0]->type) { + case AVMEDIA_TYPE_VIDEO: + if (!ost->frame_aspect_ratio) + ost->st->codec->sample_aspect_ratio = filtered_frame->sample_aspect_ratio; + + do_video_out(of->ctx, ost, filtered_frame, &frame_size); + if (vstats_filename && frame_size) + do_video_stats(ost, frame_size); + break; + case AVMEDIA_TYPE_AUDIO: + do_audio_out(of->ctx, ost, filtered_frame); + break; + default: + // TODO support subtitle filters + av_assert0(0); + } + + av_frame_unref(filtered_frame); + + return 0; +} + +/* + * Read as many frames from possible from lavfi and encode them. + * + * Always read from the active stream with the lowest timestamp. If no frames + * are available for it then return EAGAIN and wait for more input. This way we + * can use lavfi sources that generate unlimited amount of frames without memory + * usage exploding. + */ +static int poll_filters(void) +{ + int i, j, ret = 0; + + while (ret >= 0 && !received_sigterm) { + OutputStream *ost = NULL; + int64_t min_pts = INT64_MAX; + + /* choose output stream with the lowest timestamp */ + for (i = 0; i < nb_output_streams; i++) { + int64_t pts = output_streams[i]->sync_opts; + + if (!output_streams[i]->filter || output_streams[i]->finished) + continue; + + pts = av_rescale_q(pts, output_streams[i]->st->codec->time_base, + AV_TIME_BASE_Q); + if (pts < min_pts) { + min_pts = pts; + ost = output_streams[i]; + } + } + + if (!ost) + break; + + ret = poll_filter(ost); + + if (ret == AVERROR_EOF) { + OutputFile *of = output_files[ost->file_index]; + + ost->finished = 1; + + if (of->shortest) { + for (j = 0; j < of->ctx->nb_streams; j++) + output_streams[of->ost_index + j]->finished = 1; + } + + ret = 0; + } else if (ret == AVERROR(EAGAIN)) + return 0; + } + + return ret; +} + +static void print_final_stats(int64_t total_size) +{ + uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; + uint64_t data_size = 0; + float percent = -1.0; + int i, j; + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + switch (ost->st->codec->codec_type) { + case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; + case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; + default: other_size += ost->data_size; break; + } + extra_size += ost->st->codec->extradata_size; + data_size += ost->data_size; + } + + if (data_size && total_size >= data_size) + percent = 100.0 * (total_size - data_size) / data_size; + + av_log(NULL, AV_LOG_INFO, "\n"); + av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", + video_size / 1024.0, + audio_size / 1024.0, + other_size / 1024.0, + extra_size / 1024.0); + if (percent >= 0.0) + av_log(NULL, AV_LOG_INFO, "%f%%", percent); + else + av_log(NULL, AV_LOG_INFO, "unknown"); + av_log(NULL, AV_LOG_INFO, "\n"); + + /* print verbose per-stream stats */ + for (i = 0; i < nb_input_files; i++) { + InputFile *f = input_files[i]; + uint64_t total_packets = 0, total_size = 0; + + av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n", + i, f->ctx->filename); + + for (j = 0; j < f->nb_streams; j++) { + InputStream *ist = input_streams[f->ist_index + j]; + enum AVMediaType type = ist->st->codec->codec_type; + + total_size += ist->data_size; + total_packets += ist->nb_packets; + + av_log(NULL, AV_LOG_VERBOSE, " Input stream #%d:%d (%s): ", + i, j, media_type_string(type)); + av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets read (%"PRIu64" bytes); ", + ist->nb_packets, ist->data_size); + + if (ist->decoding_needed) { + av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames decoded", + ist->frames_decoded); + if (type == AVMEDIA_TYPE_AUDIO) + av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ist->samples_decoded); + av_log(NULL, AV_LOG_VERBOSE, "; "); + } + + av_log(NULL, AV_LOG_VERBOSE, "\n"); + } + + av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) demuxed\n", + total_packets, total_size); + } + + for (i = 0; i < nb_output_files; i++) { + OutputFile *of = output_files[i]; + uint64_t total_packets = 0, total_size = 0; + + av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n", + i, of->ctx->filename); + + for (j = 0; j < of->ctx->nb_streams; j++) { + OutputStream *ost = output_streams[of->ost_index + j]; + enum AVMediaType type = ost->st->codec->codec_type; + + total_size += ost->data_size; + total_packets += ost->packets_written; + + av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ", + i, j, media_type_string(type)); + if (ost->encoding_needed) { + av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded", + ost->frames_encoded); + if (type == AVMEDIA_TYPE_AUDIO) + av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ost->samples_encoded); + av_log(NULL, AV_LOG_VERBOSE, "; "); + } + + av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets muxed (%"PRIu64" bytes); ", + ost->packets_written, ost->data_size); + + av_log(NULL, AV_LOG_VERBOSE, "\n"); + } + + av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) muxed\n", + total_packets, total_size); + } +} + +static void print_report(int is_last_report, int64_t timer_start) +{ + char buf[1024]; + OutputStream *ost; + AVFormatContext *oc; + int64_t total_size; + AVCodecContext *enc; + int frame_number, vid, i; + double bitrate, ti1, pts; + static int64_t last_time = -1; + static int qp_histogram[52]; + + if (!print_stats && !is_last_report) + return; + + if (!is_last_report) { + int64_t cur_time; + /* display the report every 0.5 seconds */ + cur_time = av_gettime(); + if (last_time == -1) { + last_time = cur_time; + return; + } + if ((cur_time - last_time) < 500000) + return; + last_time = cur_time; + } + + + oc = output_files[0]->ctx; + + total_size = avio_size(oc->pb); + if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too + total_size = avio_tell(oc->pb); + if (total_size < 0) { + char errbuf[128]; + av_strerror(total_size, errbuf, sizeof(errbuf)); + av_log(NULL, AV_LOG_VERBOSE, "Bitrate not available, " + "avio_tell() failed: %s\n", errbuf); + total_size = 0; + } + + buf[0] = '\0'; + ti1 = 1e10; + vid = 0; + for (i = 0; i < nb_output_streams; i++) { + float q = -1; + ost = output_streams[i]; + enc = ost->st->codec; + if (!ost->stream_copy && enc->coded_frame) + q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; + if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); + } + if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { + float t = (av_gettime() - timer_start) / 1000000.0; + + frame_number = ost->frame_number; + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3d q=%3.1f ", + frame_number, (t > 1) ? (int)(frame_number / t + 0.5) : 0, q); + if (is_last_report) + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); + if (qp_hist) { + int j; + int qp = lrintf(q); + if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) + qp_histogram[qp]++; + for (j = 0; j < 32; j++) + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); + } + if (enc->flags&CODEC_FLAG_PSNR) { + int j; + double error, error_sum = 0; + double scale, scale_sum = 0; + char type[3] = { 'Y','U','V' }; + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); + for (j = 0; j < 3; j++) { + if (is_last_report) { + error = enc->error[j]; + scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; + } else { + error = enc->coded_frame->error[j]; + scale = enc->width * enc->height * 255.0 * 255.0; + } + if (j) + scale /= 4; + error_sum += error; + scale_sum += scale; + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], psnr(error / scale)); + } + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); + } + vid = 1; + } + /* compute min output value */ + pts = (double)ost->last_mux_dts * av_q2d(ost->st->time_base); + if ((pts < ti1) && (pts > 0)) + ti1 = pts; + } + if (ti1 < 0.01) + ti1 = 0.01; + + bitrate = (double)(total_size * 8) / ti1 / 1000.0; + + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "size=%8.0fkB time=%0.2f bitrate=%6.1fkbits/s", + (double)total_size / 1024, ti1, bitrate); + + if (nb_frames_drop) + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " drop=%d", + nb_frames_drop); + + av_log(NULL, AV_LOG_INFO, "%s \r", buf); + + fflush(stderr); + + if (is_last_report) + print_final_stats(total_size); + +} + +static void flush_encoders(void) +{ + int i, ret; + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + AVCodecContext *enc = ost->st->codec; + AVFormatContext *os = output_files[ost->file_index]->ctx; + int stop_encoding = 0; + + if (!ost->encoding_needed) + continue; + + if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) + continue; + if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO) + continue; + + for (;;) { + int (*encode)(AVCodecContext*, AVPacket*, const AVFrame*, int*) = NULL; + const char *desc; + + switch (ost->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + encode = avcodec_encode_audio2; + desc = "Audio"; + break; + case AVMEDIA_TYPE_VIDEO: + encode = avcodec_encode_video2; + desc = "Video"; + break; + default: + stop_encoding = 1; + } + + if (encode) { + AVPacket pkt; + int got_packet; + av_init_packet(&pkt); + pkt.data = NULL; + pkt.size = 0; + + ret = encode(enc, &pkt, NULL, &got_packet); + if (ret < 0) { + av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc); + exit_program(1); + } + if (ost->logfile && enc->stats_out) { + fprintf(ost->logfile, "%s", enc->stats_out); + } + if (!got_packet) { + stop_encoding = 1; + break; + } + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); + if (pkt.dts != AV_NOPTS_VALUE) + pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); + if (pkt.duration > 0) + pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); + write_frame(os, &pkt, ost); + } + + if (stop_encoding) + break; + } + } +} + +/* + * Check whether a packet from ist should be written into ost at this time + */ +static int check_output_constraints(InputStream *ist, OutputStream *ost) +{ + OutputFile *of = output_files[ost->file_index]; + int ist_index = input_files[ist->file_index]->ist_index + ist->st->index; + + if (ost->source_index != ist_index) + return 0; + + if (of->start_time != AV_NOPTS_VALUE && ist->last_dts < of->start_time) + return 0; + + return 1; +} + +static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt) +{ + OutputFile *of = output_files[ost->file_index]; + InputFile *f = input_files [ist->file_index]; + int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; + int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base); + AVPacket opkt; + + av_init_packet(&opkt); + + if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && + !ost->copy_initial_nonkeyframes) + return; + + if (of->recording_time != INT64_MAX && + ist->last_dts >= of->recording_time + start_time) { + ost->finished = 1; + return; + } + + if (f->recording_time != INT64_MAX) { + start_time = f->ctx->start_time; + if (f->start_time != AV_NOPTS_VALUE) + start_time += f->start_time; + if (ist->last_dts >= f->recording_time + start_time) { + ost->finished = 1; + return; + } + } + + /* force the input stream PTS */ + if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + ost->sync_opts++; + + if (pkt->pts != AV_NOPTS_VALUE) + opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; + else + opkt.pts = AV_NOPTS_VALUE; + + if (pkt->dts == AV_NOPTS_VALUE) + opkt.dts = av_rescale_q(ist->last_dts, AV_TIME_BASE_Q, ost->st->time_base); + else + opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); + opkt.dts -= ost_tb_start_time; + + opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); + opkt.flags = pkt->flags; + + // FIXME remove the following 2 lines they shall be replaced by the bitstream filters + if ( ost->st->codec->codec_id != AV_CODEC_ID_H264 + && ost->st->codec->codec_id != AV_CODEC_ID_MPEG1VIDEO + && ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO + && ost->st->codec->codec_id != AV_CODEC_ID_VC1 + ) { + if (av_parser_change(ost->parser, ost->st->codec, + &opkt.data, &opkt.size, + pkt->data, pkt->size, + pkt->flags & AV_PKT_FLAG_KEY)) { + opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0); + if (!opkt.buf) + exit_program(1); + } + } else { + opkt.data = pkt->data; + opkt.size = pkt->size; + } + + write_frame(of->ctx, &opkt, ost); +} + +int guess_input_channel_layout(InputStream *ist) +{ + AVCodecContext *dec = ist->st->codec; + + if (!dec->channel_layout) { + char layout_name[256]; + + dec->channel_layout = av_get_default_channel_layout(dec->channels); + if (!dec->channel_layout) + return 0; + av_get_channel_layout_string(layout_name, sizeof(layout_name), + dec->channels, dec->channel_layout); + av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " + "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); + } + return 1; +} + +static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) +{ + AVFrame *decoded_frame, *f; + AVCodecContext *avctx = ist->st->codec; + int i, ret, err = 0, resample_changed; + + if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) + return AVERROR(ENOMEM); + if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) + return AVERROR(ENOMEM); + decoded_frame = ist->decoded_frame; + + ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); + if (!*got_output || ret < 0) { + if (!pkt->size) { + for (i = 0; i < ist->nb_filters; i++) + av_buffersrc_add_frame(ist->filters[i]->filter, NULL); + } + return ret; + } + + ist->samples_decoded += decoded_frame->nb_samples; + ist->frames_decoded++; + + /* if the decoder provides a pts, use it instead of the last packet pts. + the decoder could be delaying output by a packet or more. */ + if (decoded_frame->pts != AV_NOPTS_VALUE) + ist->next_dts = decoded_frame->pts; + else if (pkt->pts != AV_NOPTS_VALUE) + decoded_frame->pts = pkt->pts; + pkt->pts = AV_NOPTS_VALUE; + + resample_changed = ist->resample_sample_fmt != decoded_frame->format || + ist->resample_channels != avctx->channels || + ist->resample_channel_layout != decoded_frame->channel_layout || + ist->resample_sample_rate != decoded_frame->sample_rate; + if (resample_changed) { + char layout1[64], layout2[64]; + + if (!guess_input_channel_layout(ist)) { + av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " + "layout for Input Stream #%d.%d\n", ist->file_index, + ist->st->index); + exit_program(1); + } + decoded_frame->channel_layout = avctx->channel_layout; + + av_get_channel_layout_string(layout1, sizeof(layout1), ist->resample_channels, + ist->resample_channel_layout); + av_get_channel_layout_string(layout2, sizeof(layout2), avctx->channels, + decoded_frame->channel_layout); + + av_log(NULL, AV_LOG_INFO, + "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n", + ist->file_index, ist->st->index, + ist->resample_sample_rate, av_get_sample_fmt_name(ist->resample_sample_fmt), + ist->resample_channels, layout1, + decoded_frame->sample_rate, av_get_sample_fmt_name(decoded_frame->format), + avctx->channels, layout2); + + ist->resample_sample_fmt = decoded_frame->format; + ist->resample_sample_rate = decoded_frame->sample_rate; + ist->resample_channel_layout = decoded_frame->channel_layout; + ist->resample_channels = avctx->channels; + + for (i = 0; i < nb_filtergraphs; i++) + if (ist_in_filtergraph(filtergraphs[i], ist) && + configure_filtergraph(filtergraphs[i]) < 0) { + av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n"); + exit_program(1); + } + } + + if (decoded_frame->pts != AV_NOPTS_VALUE) + decoded_frame->pts = av_rescale_q(decoded_frame->pts, + ist->st->time_base, + (AVRational){1, ist->st->codec->sample_rate}); + for (i = 0; i < ist->nb_filters; i++) { + if (i < ist->nb_filters - 1) { + f = ist->filter_frame; + err = av_frame_ref(f, decoded_frame); + if (err < 0) + break; + } else + f = decoded_frame; + + err = av_buffersrc_add_frame(ist->filters[i]->filter, f); + if (err < 0) + break; + } + + av_frame_unref(ist->filter_frame); + av_frame_unref(decoded_frame); + return err < 0 ? err : ret; +} + +static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) +{ + AVFrame *decoded_frame, *f; + int i, ret = 0, err = 0, resample_changed; + + if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) + return AVERROR(ENOMEM); + if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) + return AVERROR(ENOMEM); + decoded_frame = ist->decoded_frame; + + ret = avcodec_decode_video2(ist->st->codec, + decoded_frame, got_output, pkt); + if (!*got_output || ret < 0) { + if (!pkt->size) { + for (i = 0; i < ist->nb_filters; i++) + av_buffersrc_add_frame(ist->filters[i]->filter, NULL); + } + return ret; + } + + ist->frames_decoded++; + + if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) { + err = ist->hwaccel_retrieve_data(ist->st->codec, decoded_frame); + if (err < 0) + goto fail; + } + ist->hwaccel_retrieved_pix_fmt = decoded_frame->format; + + decoded_frame->pts = guess_correct_pts(&ist->pts_ctx, decoded_frame->pkt_pts, + decoded_frame->pkt_dts); + pkt->size = 0; + + if (ist->st->sample_aspect_ratio.num) + decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + + resample_changed = ist->resample_width != decoded_frame->width || + ist->resample_height != decoded_frame->height || + ist->resample_pix_fmt != decoded_frame->format; + if (resample_changed) { + av_log(NULL, AV_LOG_INFO, + "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", + ist->file_index, ist->st->index, + ist->resample_width, ist->resample_height, av_get_pix_fmt_name(ist->resample_pix_fmt), + decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format)); + + ret = poll_filters(); + if (ret < 0 && (ret != AVERROR_EOF && ret != AVERROR(EAGAIN))) + av_log(NULL, AV_LOG_ERROR, "Error while filtering.\n"); + + ist->resample_width = decoded_frame->width; + ist->resample_height = decoded_frame->height; + ist->resample_pix_fmt = decoded_frame->format; + + for (i = 0; i < nb_filtergraphs; i++) + if (ist_in_filtergraph(filtergraphs[i], ist) && + configure_filtergraph(filtergraphs[i]) < 0) { + av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n"); + exit_program(1); + } + } + + for (i = 0; i < ist->nb_filters; i++) { + if (i < ist->nb_filters - 1) { + f = ist->filter_frame; + err = av_frame_ref(f, decoded_frame); + if (err < 0) + break; + } else + f = decoded_frame; + + err = av_buffersrc_add_frame(ist->filters[i]->filter, f); + if (err < 0) + break; + } + +fail: + av_frame_unref(ist->filter_frame); + av_frame_unref(decoded_frame); + return err < 0 ? err : ret; +} + +static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) +{ + AVSubtitle subtitle; + int i, ret = avcodec_decode_subtitle2(ist->st->codec, + &subtitle, got_output, pkt); + if (ret < 0) + return ret; + if (!*got_output) + return ret; + + ist->frames_decoded++; + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + + if (!check_output_constraints(ist, ost) || !ost->encoding_needed) + continue; + + do_subtitle_out(output_files[ost->file_index]->ctx, ost, ist, &subtitle, pkt->pts); + } + + avsubtitle_free(&subtitle); + return ret; +} + +/* pkt = NULL means EOF (needed to flush decoder buffers) */ +static int output_packet(InputStream *ist, const AVPacket *pkt) +{ + int i; + int got_output; + AVPacket avpkt; + + if (ist->next_dts == AV_NOPTS_VALUE) + ist->next_dts = ist->last_dts; + + if (pkt == NULL) { + /* EOF handling */ + av_init_packet(&avpkt); + avpkt.data = NULL; + avpkt.size = 0; + goto handle_eof; + } else { + avpkt = *pkt; + } + + if (pkt->dts != AV_NOPTS_VALUE) + ist->next_dts = ist->last_dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); + + // while we have more to decode or while the decoder did output something on EOF + while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { + int ret = 0; + handle_eof: + + ist->last_dts = ist->next_dts; + + if (avpkt.size && avpkt.size != pkt->size && + !(ist->dec->capabilities & CODEC_CAP_SUBFRAMES)) { + av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING, + "Multiple frames in a packet from stream %d\n", pkt->stream_index); + ist->showed_multi_packet_warning = 1; + } + + switch (ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ret = decode_audio (ist, &avpkt, &got_output); + break; + case AVMEDIA_TYPE_VIDEO: + ret = decode_video (ist, &avpkt, &got_output); + if (avpkt.duration) + ist->next_dts += av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); + else if (ist->st->avg_frame_rate.num) + ist->next_dts += av_rescale_q(1, av_inv_q(ist->st->avg_frame_rate), + AV_TIME_BASE_Q); + else if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : + ist->st->codec->ticks_per_frame; + ist->next_dts += av_rescale_q(ticks, ist->st->codec->time_base, AV_TIME_BASE_Q); + } + break; + case AVMEDIA_TYPE_SUBTITLE: + ret = transcode_subtitles(ist, &avpkt, &got_output); + break; + default: + return -1; + } + + if (ret < 0) + return ret; + // touch data and size only if not EOF + if (pkt) { + avpkt.data += ret; + avpkt.size -= ret; + } + if (!got_output) { + continue; + } + } + + /* handle stream copy */ + if (!ist->decoding_needed) { + ist->last_dts = ist->next_dts; + switch (ist->st->codec->codec_type) { + case AVMEDIA_TYPE_AUDIO: + ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / + ist->st->codec->sample_rate; + break; + case AVMEDIA_TYPE_VIDEO: + if (ist->st->codec->time_base.num != 0) { + int ticks = ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; + ist->next_dts += ((int64_t)AV_TIME_BASE * + ist->st->codec->time_base.num * ticks) / + ist->st->codec->time_base.den; + } + break; + } + } + for (i = 0; pkt && i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + + if (!check_output_constraints(ist, ost) || ost->encoding_needed) + continue; + + do_streamcopy(ist, ost, pkt); + } + + return 0; +} + +static void print_sdp(void) +{ + char sdp[16384]; + int i; + AVFormatContext **avc = av_malloc(sizeof(*avc) * nb_output_files); + + if (!avc) + exit_program(1); + for (i = 0; i < nb_output_files; i++) + avc[i] = output_files[i]->ctx; + + av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp)); + printf("SDP:\n%s\n", sdp); + fflush(stdout); + av_freep(&avc); +} + +static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt) +{ + int i; + for (i = 0; hwaccels[i].name; i++) + if (hwaccels[i].pix_fmt == pix_fmt) + return &hwaccels[i]; + return NULL; +} + +static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) +{ + InputStream *ist = s->opaque; + const enum AVPixelFormat *p; + int ret; + + for (p = pix_fmts; *p != -1; p++) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); + const HWAccel *hwaccel; + + if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) + break; + + hwaccel = get_hwaccel(*p); + if (!hwaccel || + (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || + (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) + continue; + + ret = hwaccel->init(s); + if (ret < 0) { + if (ist->hwaccel_id == hwaccel->id) { + av_log(NULL, AV_LOG_FATAL, + "%s hwaccel requested for input stream #%d:%d, " + "but cannot be initialized.\n", hwaccel->name, + ist->file_index, ist->st->index); + exit_program(1); + } + continue; + } + ist->active_hwaccel_id = hwaccel->id; + ist->hwaccel_pix_fmt = *p; + break; + } + + return *p; +} + +static int get_buffer(AVCodecContext *s, AVFrame *frame, int flags) +{ + InputStream *ist = s->opaque; + + if (ist->hwaccel_get_buffer && frame->format == ist->hwaccel_pix_fmt) + return ist->hwaccel_get_buffer(s, frame, flags); + + return avcodec_default_get_buffer2(s, frame, flags); +} + +static int init_input_stream(int ist_index, char *error, int error_len) +{ + int i, ret; + InputStream *ist = input_streams[ist_index]; + if (ist->decoding_needed) { + AVCodec *codec = ist->dec; + if (!codec) { + snprintf(error, error_len, "Decoder (codec id %d) not found for input stream #%d:%d", + ist->st->codec->codec_id, ist->file_index, ist->st->index); + return AVERROR(EINVAL); + } + + /* update requested sample format for the decoder based on the + corresponding encoder sample format */ + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + if (ost->source_index == ist_index) { + update_sample_fmt(ist->st->codec, codec, ost->st->codec); + break; + } + } + + ist->st->codec->opaque = ist; + ist->st->codec->get_format = get_format; + ist->st->codec->get_buffer2 = get_buffer; + ist->st->codec->thread_safe_callbacks = 1; + + av_opt_set_int(ist->st->codec, "refcounted_frames", 1, 0); + + if (!av_dict_get(ist->decoder_opts, "threads", NULL, 0)) + av_dict_set(&ist->decoder_opts, "threads", "auto", 0); + if ((ret = avcodec_open2(ist->st->codec, codec, &ist->decoder_opts)) < 0) { + char errbuf[128]; + if (ret == AVERROR_EXPERIMENTAL) + abort_codec_experimental(codec, 0); + + av_strerror(ret, errbuf, sizeof(errbuf)); + + snprintf(error, error_len, + "Error while opening decoder for input stream " + "#%d:%d : %s", + ist->file_index, ist->st->index, errbuf); + return ret; + } + assert_avoptions(ist->decoder_opts); + } + + ist->last_dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; + ist->next_dts = AV_NOPTS_VALUE; + init_pts_correction(&ist->pts_ctx); + + return 0; +} + +static InputStream *get_input_stream(OutputStream *ost) +{ + if (ost->source_index >= 0) + return input_streams[ost->source_index]; + + if (ost->filter) { + FilterGraph *fg = ost->filter->graph; + int i; + + for (i = 0; i < fg->nb_inputs; i++) + if (fg->inputs[i]->ist->st->codec->codec_type == ost->st->codec->codec_type) + return fg->inputs[i]->ist; + } + + return NULL; +} + +static void parse_forced_key_frames(char *kf, OutputStream *ost, + AVCodecContext *avctx) +{ + char *p; + int n = 1, i; + int64_t t; + + for (p = kf; *p; p++) + if (*p == ',') + n++; + ost->forced_kf_count = n; + ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n); + if (!ost->forced_kf_pts) { + av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); + exit_program(1); + } + + p = kf; + for (i = 0; i < n; i++) { + char *next = strchr(p, ','); + + if (next) + *next++ = 0; + + t = parse_time_or_die("force_key_frames", p, 1); + ost->forced_kf_pts[i] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); + + p = next; + } +} + +static void set_encoder_id(OutputFile *of, OutputStream *ost) +{ + AVDictionaryEntry *e; + + uint8_t *encoder_string; + int encoder_string_len; + int format_flags = 0; + + e = av_dict_get(of->opts, "fflags", NULL, 0); + if (e) { + const AVOption *o = av_opt_find(of->ctx, "fflags", NULL, 0, 0); + if (!o) + return; + av_opt_eval_flags(of->ctx, o, e->value, &format_flags); + } + + encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(ost->enc->name) + 2; + encoder_string = av_mallocz(encoder_string_len); + if (!encoder_string) + exit_program(1); + + if (!(format_flags & AVFMT_FLAG_BITEXACT)) + av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len); + av_strlcat(encoder_string, ost->enc->name, encoder_string_len); + av_dict_set(&ost->st->metadata, "encoder", encoder_string, + AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE); +} + +static int transcode_init(void) +{ + int ret = 0, i, j, k; + AVFormatContext *oc; + OutputStream *ost; + InputStream *ist; + char error[1024]; + int want_sdp = 1; + + /* init framerate emulation */ + for (i = 0; i < nb_input_files; i++) { + InputFile *ifile = input_files[i]; + if (ifile->rate_emu) + for (j = 0; j < ifile->nb_streams; j++) + input_streams[j + ifile->ist_index]->start = av_gettime(); + } + + /* output stream init */ + for (i = 0; i < nb_output_files; i++) { + oc = output_files[i]->ctx; + if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) { + av_dump_format(oc, i, oc->filename, 1); + av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i); + return AVERROR(EINVAL); + } + } + + /* init complex filtergraphs */ + for (i = 0; i < nb_filtergraphs; i++) + if ((ret = avfilter_graph_config(filtergraphs[i]->graph, NULL)) < 0) + return ret; + + /* for each output stream, we compute the right encoding parameters */ + for (i = 0; i < nb_output_streams; i++) { + AVCodecContext *enc_ctx; + AVCodecContext *dec_ctx = NULL; + ost = output_streams[i]; + oc = output_files[ost->file_index]->ctx; + ist = get_input_stream(ost); + + if (ost->attachment_filename) + continue; + + enc_ctx = ost->st->codec; + + if (ist) { + dec_ctx = ist->st->codec; + + ost->st->disposition = ist->st->disposition; + enc_ctx->bits_per_raw_sample = dec_ctx->bits_per_raw_sample; + enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; + } + + if (ost->stream_copy) { + AVRational sar; + uint64_t extra_size; + + av_assert0(ist && !ost->filter); + + extra_size = (uint64_t)dec_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; + + if (extra_size > INT_MAX) { + return AVERROR(EINVAL); + } + + /* if stream_copy is selected, no need to decode or encode */ + enc_ctx->codec_id = dec_ctx->codec_id; + enc_ctx->codec_type = dec_ctx->codec_type; + + if (!enc_ctx->codec_tag) { + if (!oc->oformat->codec_tag || + av_codec_get_id (oc->oformat->codec_tag, dec_ctx->codec_tag) == enc_ctx->codec_id || + av_codec_get_tag(oc->oformat->codec_tag, dec_ctx->codec_id) <= 0) + enc_ctx->codec_tag = dec_ctx->codec_tag; + } + + enc_ctx->bit_rate = dec_ctx->bit_rate; + enc_ctx->rc_max_rate = dec_ctx->rc_max_rate; + enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size; + enc_ctx->field_order = dec_ctx->field_order; + enc_ctx->extradata = av_mallocz(extra_size); + if (!enc_ctx->extradata) { + return AVERROR(ENOMEM); + } + memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size); + enc_ctx->extradata_size = dec_ctx->extradata_size; + if (!copy_tb) { + enc_ctx->time_base = dec_ctx->time_base; + enc_ctx->time_base.num *= dec_ctx->ticks_per_frame; + av_reduce(&enc_ctx->time_base.num, &enc_ctx->time_base.den, + enc_ctx->time_base.num, enc_ctx->time_base.den, INT_MAX); + } else + enc_ctx->time_base = ist->st->time_base; + + ost->parser = av_parser_init(enc_ctx->codec_id); + + switch (enc_ctx->codec_type) { + case AVMEDIA_TYPE_AUDIO: + if (audio_volume != 256) { + av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); + exit_program(1); + } + enc_ctx->channel_layout = dec_ctx->channel_layout; + enc_ctx->sample_rate = dec_ctx->sample_rate; + enc_ctx->channels = dec_ctx->channels; + enc_ctx->frame_size = dec_ctx->frame_size; + enc_ctx->audio_service_type = dec_ctx->audio_service_type; + enc_ctx->block_align = dec_ctx->block_align; + break; + case AVMEDIA_TYPE_VIDEO: + enc_ctx->pix_fmt = dec_ctx->pix_fmt; + enc_ctx->width = dec_ctx->width; + enc_ctx->height = dec_ctx->height; + enc_ctx->has_b_frames = dec_ctx->has_b_frames; + if (ost->frame_aspect_ratio) + sar = av_d2q(ost->frame_aspect_ratio * enc_ctx->height / enc_ctx->width, 255); + else if (ist->st->sample_aspect_ratio.num) + sar = ist->st->sample_aspect_ratio; + else + sar = dec_ctx->sample_aspect_ratio; + ost->st->sample_aspect_ratio = enc_ctx->sample_aspect_ratio = sar; + break; + case AVMEDIA_TYPE_SUBTITLE: + enc_ctx->width = dec_ctx->width; + enc_ctx->height = dec_ctx->height; + break; + case AVMEDIA_TYPE_DATA: + case AVMEDIA_TYPE_ATTACHMENT: + break; + default: + abort(); + } + } else { + if (!ost->enc) { + /* should only happen when a default codec is not present. */ + snprintf(error, sizeof(error), "Automatic encoder selection " + "failed for output stream #%d:%d. Default encoder for " + "format %s is probably disabled. Please choose an " + "encoder manually.\n", ost->file_index, ost->index, + oc->oformat->name); + ret = AVERROR(EINVAL); + goto dump_format; + } + + if (ist) + ist->decoding_needed = 1; + ost->encoding_needed = 1; + + set_encoder_id(output_files[ost->file_index], ost); + + /* + * We want CFR output if and only if one of those is true: + * 1) user specified output framerate with -r + * 2) user specified -vsync cfr + * 3) output format is CFR and the user didn't force vsync to + * something else than CFR + * + * in such a case, set ost->frame_rate + */ + if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO && + !ost->frame_rate.num && ist && + (video_sync_method == VSYNC_CFR || + (video_sync_method == VSYNC_AUTO && + !(oc->oformat->flags & (AVFMT_NOTIMESTAMPS | AVFMT_VARIABLE_FPS))))) { + if (ist->framerate.num) + ost->frame_rate = ist->framerate; + else if (ist->st->avg_frame_rate.num) + ost->frame_rate = ist->st->avg_frame_rate; + else { + av_log(NULL, AV_LOG_WARNING, "Constant framerate requested " + "for the output stream #%d:%d, but no information " + "about the input framerate is available. Falling " + "back to a default value of 25fps. Use the -r option " + "if you want a different framerate.\n", + ost->file_index, ost->index); + ost->frame_rate = (AVRational){ 25, 1 }; + } + + if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { + int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); + ost->frame_rate = ost->enc->supported_framerates[idx]; + } + } + + if (!ost->filter && + (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || + enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO)) { + FilterGraph *fg; + fg = init_simple_filtergraph(ist, ost); + if (configure_filtergraph(fg)) { + av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); + exit_program(1); + } + } + + switch (enc_ctx->codec_type) { + case AVMEDIA_TYPE_AUDIO: + enc_ctx->sample_fmt = ost->filter->filter->inputs[0]->format; + enc_ctx->sample_rate = ost->filter->filter->inputs[0]->sample_rate; + enc_ctx->channel_layout = ost->filter->filter->inputs[0]->channel_layout; + enc_ctx->channels = av_get_channel_layout_nb_channels(enc_ctx->channel_layout); + enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate }; + break; + case AVMEDIA_TYPE_VIDEO: + enc_ctx->time_base = ost->filter->filter->inputs[0]->time_base; + + enc_ctx->width = ost->filter->filter->inputs[0]->w; + enc_ctx->height = ost->filter->filter->inputs[0]->h; + enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio = + ost->frame_aspect_ratio ? // overridden by the -aspect cli option + av_d2q(ost->frame_aspect_ratio * enc_ctx->height/enc_ctx->width, 255) : + ost->filter->filter->inputs[0]->sample_aspect_ratio; + enc_ctx->pix_fmt = ost->filter->filter->inputs[0]->format; + + ost->st->avg_frame_rate = ost->frame_rate; + + if (dec_ctx && + (enc_ctx->width != dec_ctx->width || + enc_ctx->height != dec_ctx->height || + enc_ctx->pix_fmt != dec_ctx->pix_fmt)) { + enc_ctx->bits_per_raw_sample = 0; + } + + if (ost->forced_keyframes) + parse_forced_key_frames(ost->forced_keyframes, ost, + ost->st->codec); + break; + case AVMEDIA_TYPE_SUBTITLE: + enc_ctx->time_base = (AVRational){1, 1000}; + break; + default: + abort(); + break; + } + /* two pass mode */ + if ((enc_ctx->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { + char logfilename[1024]; + FILE *f; + + snprintf(logfilename, sizeof(logfilename), "%s-%d.log", + ost->logfile_prefix ? ost->logfile_prefix : + DEFAULT_PASS_LOGFILENAME_PREFIX, + i); + if (!strcmp(ost->enc->name, "libx264")) { + av_dict_set(&ost->encoder_opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); + } else { + if (enc_ctx->flags & CODEC_FLAG_PASS1) { + f = fopen(logfilename, "wb"); + if (!f) { + av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", + logfilename, strerror(errno)); + exit_program(1); + } + ost->logfile = f; + } else { + char *logbuffer; + size_t logbuffer_size; + if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { + av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n", + logfilename); + exit_program(1); + } + enc_ctx->stats_in = logbuffer; + } + } + } + } + } + + /* open each encoder */ + for (i = 0; i < nb_output_streams; i++) { + ost = output_streams[i]; + if (ost->encoding_needed) { + AVCodec *codec = ost->enc; + AVCodecContext *dec = NULL; + + if ((ist = get_input_stream(ost))) + dec = ist->st->codec; + if (dec && dec->subtitle_header) { + ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size); + if (!ost->st->codec->subtitle_header) { + ret = AVERROR(ENOMEM); + goto dump_format; + } + memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size); + ost->st->codec->subtitle_header_size = dec->subtitle_header_size; + } + if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) + av_dict_set(&ost->encoder_opts, "threads", "auto", 0); + if ((ret = avcodec_open2(ost->st->codec, codec, &ost->encoder_opts)) < 0) { + if (ret == AVERROR_EXPERIMENTAL) + abort_codec_experimental(codec, 1); + snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height", + ost->file_index, ost->index); + goto dump_format; + } + assert_avoptions(ost->encoder_opts); + if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000) + av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low." + "It takes bits/s as argument, not kbits/s\n"); + } else { + av_opt_set_dict(ost->st->codec, &ost->encoder_opts); + } + } + + /* init input streams */ + for (i = 0; i < nb_input_streams; i++) + if ((ret = init_input_stream(i, error, sizeof(error))) < 0) + goto dump_format; + + /* discard unused programs */ + for (i = 0; i < nb_input_files; i++) { + InputFile *ifile = input_files[i]; + for (j = 0; j < ifile->ctx->nb_programs; j++) { + AVProgram *p = ifile->ctx->programs[j]; + int discard = AVDISCARD_ALL; + + for (k = 0; k < p->nb_stream_indexes; k++) + if (!input_streams[ifile->ist_index + p->stream_index[k]]->discard) { + discard = AVDISCARD_DEFAULT; + break; + } + p->discard = discard; + } + } + + /* open files and write file headers */ + for (i = 0; i < nb_output_files; i++) { + oc = output_files[i]->ctx; + oc->interrupt_callback = int_cb; + if ((ret = avformat_write_header(oc, &output_files[i]->opts)) < 0) { + char errbuf[128]; + av_strerror(ret, errbuf, sizeof(errbuf)); + snprintf(error, sizeof(error), + "Could not write header for output file #%d " + "(incorrect codec parameters ?): %s", + i, errbuf); + ret = AVERROR(EINVAL); + goto dump_format; + } + assert_avoptions(output_files[i]->opts); + if (strcmp(oc->oformat->name, "rtp")) { + want_sdp = 0; + } + } + + dump_format: + /* dump the file output parameters - cannot be done before in case + of stream copy */ + for (i = 0; i < nb_output_files; i++) { + av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1); + } + + /* dump the stream mapping */ + av_log(NULL, AV_LOG_INFO, "Stream mapping:\n"); + for (i = 0; i < nb_input_streams; i++) { + ist = input_streams[i]; + + for (j = 0; j < ist->nb_filters; j++) { + if (ist->filters[j]->graph->graph_desc) { + av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s", + ist->file_index, ist->st->index, ist->dec ? ist->dec->name : "?", + ist->filters[j]->name); + if (nb_filtergraphs > 1) + av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index); + av_log(NULL, AV_LOG_INFO, "\n"); + } + } + } + + for (i = 0; i < nb_output_streams; i++) { + ost = output_streams[i]; + + if (ost->attachment_filename) { + /* an attached file */ + av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n", + ost->attachment_filename, ost->file_index, ost->index); + continue; + } + + if (ost->filter && ost->filter->graph->graph_desc) { + /* output from a complex graph */ + av_log(NULL, AV_LOG_INFO, " %s", ost->filter->name); + if (nb_filtergraphs > 1) + av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index); + + av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index, + ost->index, ost->enc ? ost->enc->name : "?"); + continue; + } + + av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d", + input_streams[ost->source_index]->file_index, + input_streams[ost->source_index]->st->index, + ost->file_index, + ost->index); + if (ost->sync_ist != input_streams[ost->source_index]) + av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]", + ost->sync_ist->file_index, + ost->sync_ist->st->index); + if (ost->stream_copy) + av_log(NULL, AV_LOG_INFO, " (copy)"); + else + av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index]->dec ? + input_streams[ost->source_index]->dec->name : "?", + ost->enc ? ost->enc->name : "?"); + av_log(NULL, AV_LOG_INFO, "\n"); + } + + if (ret) { + av_log(NULL, AV_LOG_ERROR, "%s\n", error); + return ret; + } + + if (want_sdp) { + print_sdp(); + } + + return 0; +} + +/* Return 1 if there remain streams where more output is wanted, 0 otherwise. */ +static int need_output(void) +{ + int i; + + for (i = 0; i < nb_output_streams; i++) { + OutputStream *ost = output_streams[i]; + OutputFile *of = output_files[ost->file_index]; + AVFormatContext *os = output_files[ost->file_index]->ctx; + + if (ost->finished || + (os->pb && avio_tell(os->pb) >= of->limit_filesize)) + continue; + if (ost->frame_number >= ost->max_frames) { + int j; + for (j = 0; j < of->ctx->nb_streams; j++) + output_streams[of->ost_index + j]->finished = 1; + continue; + } + + return 1; + } + + return 0; +} + +static InputFile *select_input_file(void) +{ + InputFile *ifile = NULL; + int64_t ipts_min = INT64_MAX; + int i; + + for (i = 0; i < nb_input_streams; i++) { + InputStream *ist = input_streams[i]; + int64_t ipts = ist->last_dts; + + if (ist->discard || input_files[ist->file_index]->eagain) + continue; + if (!input_files[ist->file_index]->eof_reached) { + if (ipts < ipts_min) { + ipts_min = ipts; + ifile = input_files[ist->file_index]; + } + } + } + + return ifile; +} + +#if HAVE_PTHREADS +static void *input_thread(void *arg) +{ + InputFile *f = arg; + int ret = 0; + + while (!transcoding_finished && ret >= 0) { + AVPacket pkt; + ret = av_read_frame(f->ctx, &pkt); + + if (ret == AVERROR(EAGAIN)) { + av_usleep(10000); + ret = 0; + continue; + } else if (ret < 0) + break; + + pthread_mutex_lock(&f->fifo_lock); + while (!av_fifo_space(f->fifo)) + pthread_cond_wait(&f->fifo_cond, &f->fifo_lock); + + av_dup_packet(&pkt); + av_fifo_generic_write(f->fifo, &pkt, sizeof(pkt), NULL); + + pthread_mutex_unlock(&f->fifo_lock); + } + + f->finished = 1; + return NULL; +} + +static void free_input_threads(void) +{ + int i; + + if (nb_input_files == 1) + return; + + transcoding_finished = 1; + + for (i = 0; i < nb_input_files; i++) { + InputFile *f = input_files[i]; + AVPacket pkt; + + if (!f->fifo || f->joined) + continue; + + pthread_mutex_lock(&f->fifo_lock); + while (av_fifo_size(f->fifo)) { + av_fifo_generic_read(f->fifo, &pkt, sizeof(pkt), NULL); + av_free_packet(&pkt); + } + pthread_cond_signal(&f->fifo_cond); + pthread_mutex_unlock(&f->fifo_lock); + + pthread_join(f->thread, NULL); + f->joined = 1; + + while (av_fifo_size(f->fifo)) { + av_fifo_generic_read(f->fifo, &pkt, sizeof(pkt), NULL); + av_free_packet(&pkt); + } + av_fifo_free(f->fifo); + } +} + +static int init_input_threads(void) +{ + int i, ret; + + if (nb_input_files == 1) + return 0; + + for (i = 0; i < nb_input_files; i++) { + InputFile *f = input_files[i]; + + if (!(f->fifo = av_fifo_alloc(8*sizeof(AVPacket)))) + return AVERROR(ENOMEM); + + pthread_mutex_init(&f->fifo_lock, NULL); + pthread_cond_init (&f->fifo_cond, NULL); + + if ((ret = pthread_create(&f->thread, NULL, input_thread, f))) + return AVERROR(ret); + } + return 0; +} + +static int get_input_packet_mt(InputFile *f, AVPacket *pkt) +{ + int ret = 0; + + pthread_mutex_lock(&f->fifo_lock); + + if (av_fifo_size(f->fifo)) { + av_fifo_generic_read(f->fifo, pkt, sizeof(*pkt), NULL); + pthread_cond_signal(&f->fifo_cond); + } else { + if (f->finished) + ret = AVERROR_EOF; + else + ret = AVERROR(EAGAIN); + } + + pthread_mutex_unlock(&f->fifo_lock); + + return ret; +} +#endif + +static int get_input_packet(InputFile *f, AVPacket *pkt) +{ + if (f->rate_emu) { + int i; + for (i = 0; i < f->nb_streams; i++) { + InputStream *ist = input_streams[f->ist_index + i]; + int64_t pts = av_rescale(ist->last_dts, 1000000, AV_TIME_BASE); + int64_t now = av_gettime() - ist->start; + if (pts > now) + return AVERROR(EAGAIN); + } + } + +#if HAVE_PTHREADS + if (nb_input_files > 1) + return get_input_packet_mt(f, pkt); +#endif + return av_read_frame(f->ctx, pkt); +} + +static int got_eagain(void) +{ + int i; + for (i = 0; i < nb_input_files; i++) + if (input_files[i]->eagain) + return 1; + return 0; +} + +static void reset_eagain(void) +{ + int i; + for (i = 0; i < nb_input_files; i++) + input_files[i]->eagain = 0; +} + +/* + * Read one packet from an input file and send it for + * - decoding -> lavfi (audio/video) + * - decoding -> encoding -> muxing (subtitles) + * - muxing (streamcopy) + * + * Return + * - 0 -- one packet was read and processed + * - AVERROR(EAGAIN) -- no packets were available for selected file, + * this function should be called again + * - AVERROR_EOF -- this function should not be called again + */ +static int process_input(void) +{ + InputFile *ifile; + AVFormatContext *is; + InputStream *ist; + AVPacket pkt; + int ret, i, j; + + /* select the stream that we must read now */ + ifile = select_input_file(); + /* if none, if is finished */ + if (!ifile) { + if (got_eagain()) { + reset_eagain(); + av_usleep(10000); + return AVERROR(EAGAIN); + } + av_log(NULL, AV_LOG_VERBOSE, "No more inputs to read from.\n"); + return AVERROR_EOF; + } + + is = ifile->ctx; + ret = get_input_packet(ifile, &pkt); + + if (ret == AVERROR(EAGAIN)) { + ifile->eagain = 1; + return ret; + } + if (ret < 0) { + if (ret != AVERROR_EOF) { + print_error(is->filename, ret); + if (exit_on_error) + exit_program(1); + } + ifile->eof_reached = 1; + + for (i = 0; i < ifile->nb_streams; i++) { + ist = input_streams[ifile->ist_index + i]; + if (ist->decoding_needed) + output_packet(ist, NULL); + + /* mark all outputs that don't go through lavfi as finished */ + for (j = 0; j < nb_output_streams; j++) { + OutputStream *ost = output_streams[j]; + + if (ost->source_index == ifile->ist_index + i && + (ost->stream_copy || ost->enc->type == AVMEDIA_TYPE_SUBTITLE)) + ost->finished= 1; + } + } + + return AVERROR(EAGAIN); + } + + reset_eagain(); + + if (do_pkt_dump) { + av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, + is->streams[pkt.stream_index]); + } + /* the following test is needed in case new streams appear + dynamically in stream : we ignore them */ + if (pkt.stream_index >= ifile->nb_streams) + goto discard_packet; + + ist = input_streams[ifile->ist_index + pkt.stream_index]; + + ist->data_size += pkt.size; + ist->nb_packets++; + + if (ist->discard) + goto discard_packet; + + /* add the stream-global side data to the first packet */ + if (ist->nb_packets == 1) + for (i = 0; i < ist->st->nb_side_data; i++) { + AVPacketSideData *src_sd = &ist->st->side_data[i]; + uint8_t *dst_data; + + if (av_packet_get_side_data(&pkt, src_sd->type, NULL)) + continue; + + dst_data = av_packet_new_side_data(&pkt, src_sd->type, src_sd->size); + if (!dst_data) + exit_program(1); + + memcpy(dst_data, src_sd->data, src_sd->size); + } + + if (pkt.dts != AV_NOPTS_VALUE) + pkt.dts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts += av_rescale_q(ifile->ts_offset, AV_TIME_BASE_Q, ist->st->time_base); + + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts *= ist->ts_scale; + if (pkt.dts != AV_NOPTS_VALUE) + pkt.dts *= ist->ts_scale; + + if (pkt.dts != AV_NOPTS_VALUE && ist->next_dts != AV_NOPTS_VALUE && + (is->iformat->flags & AVFMT_TS_DISCONT)) { + int64_t pkt_dts = av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); + int64_t delta = pkt_dts - ist->next_dts; + + if ((FFABS(delta) > 1LL * dts_delta_threshold * AV_TIME_BASE || pkt_dts + 1 < ist->last_dts) && !copy_ts) { + ifile->ts_offset -= delta; + av_log(NULL, AV_LOG_DEBUG, + "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", + delta, ifile->ts_offset); + pkt.dts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); + if (pkt.pts != AV_NOPTS_VALUE) + pkt.pts -= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); + } + } + + ret = output_packet(ist, &pkt); + if (ret < 0) { + av_log(NULL, AV_LOG_ERROR, "Error while decoding stream #%d:%d\n", + ist->file_index, ist->st->index); + if (exit_on_error) + exit_program(1); + } + +discard_packet: + av_free_packet(&pkt); + + return 0; +} + +/* + * The following code is the main loop of the file converter + */ +static int transcode(void) +{ + int ret, i, need_input = 1; + AVFormatContext *os; + OutputStream *ost; + InputStream *ist; + int64_t timer_start; + + ret = transcode_init(); + if (ret < 0) + goto fail; + + av_log(NULL, AV_LOG_INFO, "Press ctrl-c to stop encoding\n"); + term_init(); + + timer_start = av_gettime(); + +#if HAVE_PTHREADS + if ((ret = init_input_threads()) < 0) + goto fail; +#endif + + while (!received_sigterm) { + /* check if there's any stream where output is still needed */ + if (!need_output()) { + av_log(NULL, AV_LOG_VERBOSE, "No more output streams to write to, finishing.\n"); + break; + } + + /* read and process one input packet if needed */ + if (need_input) { + ret = process_input(); + if (ret == AVERROR_EOF) + need_input = 0; + } + + ret = poll_filters(); + if (ret < 0) { + if (ret == AVERROR_EOF || ret == AVERROR(EAGAIN)) + continue; + + av_log(NULL, AV_LOG_ERROR, "Error while filtering.\n"); + break; + } + + /* dump report by using the output first video and audio streams */ + print_report(0, timer_start); + } +#if HAVE_PTHREADS + free_input_threads(); +#endif + + /* at the end of stream, we must flush the decoder buffers */ + for (i = 0; i < nb_input_streams; i++) { + ist = input_streams[i]; + if (!input_files[ist->file_index]->eof_reached && ist->decoding_needed) { + output_packet(ist, NULL); + } + } + poll_filters(); + flush_encoders(); + + term_exit(); + + /* write the trailer if needed and close file */ + for (i = 0; i < nb_output_files; i++) { + os = output_files[i]->ctx; + av_write_trailer(os); + } + + /* dump report by using the first video and audio streams */ + print_report(1, timer_start); + + /* close each encoder */ + for (i = 0; i < nb_output_streams; i++) { + ost = output_streams[i]; + if (ost->encoding_needed) { + av_freep(&ost->st->codec->stats_in); + avcodec_close(ost->st->codec); + } + } + + /* close each decoder */ + for (i = 0; i < nb_input_streams; i++) { + ist = input_streams[i]; + if (ist->decoding_needed) { + avcodec_close(ist->st->codec); + if (ist->hwaccel_uninit) + ist->hwaccel_uninit(ist->st->codec); + } + } + + /* finished ! */ + ret = 0; + + fail: +#if HAVE_PTHREADS + free_input_threads(); +#endif + + if (output_streams) { + for (i = 0; i < nb_output_streams; i++) { + ost = output_streams[i]; + if (ost) { + if (ost->stream_copy) + av_freep(&ost->st->codec->extradata); + if (ost->logfile) { + fclose(ost->logfile); + ost->logfile = NULL; + } + av_freep(&ost->st->codec->subtitle_header); + av_free(ost->forced_kf_pts); + av_dict_free(&ost->encoder_opts); + av_dict_free(&ost->resample_opts); + } + } + } + return ret; +} + +static int64_t getutime(void) +{ +#if HAVE_GETRUSAGE + struct rusage rusage; + + getrusage(RUSAGE_SELF, &rusage); + return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec; +#elif HAVE_GETPROCESSTIMES + HANDLE proc; + FILETIME c, e, k, u; + proc = GetCurrentProcess(); + GetProcessTimes(proc, &c, &e, &k, &u); + return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10; +#else + return av_gettime(); +#endif +} + +static int64_t getmaxrss(void) +{ +#if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS + struct rusage rusage; + getrusage(RUSAGE_SELF, &rusage); + return (int64_t)rusage.ru_maxrss * 1024; +#elif HAVE_GETPROCESSMEMORYINFO + HANDLE proc; + PROCESS_MEMORY_COUNTERS memcounters; + proc = GetCurrentProcess(); + memcounters.cb = sizeof(memcounters); + GetProcessMemoryInfo(proc, &memcounters, sizeof(memcounters)); + return memcounters.PeakPagefileUsage; +#else + return 0; +#endif +} + +int main(int argc, char **argv) +{ + int ret; + int64_t ti; + + register_exit(avconv_cleanup); + + av_log_set_flags(AV_LOG_SKIP_REPEATED); + parse_loglevel(argc, argv, options); + + avcodec_register_all(); +#if CONFIG_AVDEVICE + avdevice_register_all(); +#endif + avfilter_register_all(); + av_register_all(); + avformat_network_init(); + + show_banner(); + + /* parse options and open all input/output files */ + ret = avconv_parse_options(argc, argv); + if (ret < 0) + exit_program(1); + + if (nb_output_files <= 0 && nb_input_files == 0) { + show_usage(); + av_log(NULL, AV_LOG_WARNING, "Use -h to get full help or, even better, run 'man %s'\n", program_name); + exit_program(1); + } + + /* file converter / grab */ + if (nb_output_files <= 0) { + fprintf(stderr, "At least one output file must be specified\n"); + exit_program(1); + } + + ti = getutime(); + if (transcode() < 0) + exit_program(1); + ti = getutime() - ti; + if (do_benchmark) { + int maxrss = getmaxrss() / 1024; + printf("bench: utime=%0.3fs maxrss=%ikB\n", ti / 1000000.0, maxrss); + } + + exit_program(0); + return 0; +} diff --git a/ffmpeg.h b/avconv.h similarity index 71% rename from ffmpeg.h rename to avconv.h index 3783e2cc50..56ce9f01ff 100644 --- a/ffmpeg.h +++ b/avconv.h @@ -1,29 +1,28 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef FFMPEG_H -#define FFMPEG_H +#ifndef AVCONV_H +#define AVCONV_H #include "config.h" #include #include -#include #if HAVE_PTHREADS #include @@ -40,22 +39,14 @@ #include "libavutil/avutil.h" #include "libavutil/dict.h" -#include "libavutil/eval.h" #include "libavutil/fifo.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#include "libavutil/threadmessage.h" - -#include "libswresample/swresample.h" #define VSYNC_AUTO -1 #define VSYNC_PASSTHROUGH 0 #define VSYNC_CFR 1 #define VSYNC_VFR 2 -#define VSYNC_VSCFR 0xfe -#define VSYNC_DROP 0xff - -#define MAX_STREAMS 1024 /* arbitrary sanity check value */ enum HWAccelID { HWACCEL_NONE = 0, @@ -82,10 +73,12 @@ typedef struct StreamMap { char *linklabel; /* name of an output link, for mapping lavfi outputs */ } StreamMap; -typedef struct { - int file_idx, stream_idx, channel_idx; // input - int ofile_idx, ostream_idx; // output -} AudioChannelMap; +/* select an input file for an output file */ +typedef struct MetadataMap { + int file; // file index + char type; // type of metadata to copy -- (g)lobal, (s)tream, (c)hapter or (p)rogram + int index; // stream/chapter/program number +} MetadataMap; typedef struct OptionsContext { OptionGroup *g; @@ -124,8 +117,9 @@ typedef struct OptionsContext { /* output options */ StreamMap *stream_maps; int nb_stream_maps; - AudioChannelMap *audio_channel_maps; /* one info entry per -map_channel */ - int nb_audio_channel_maps; /* number of (valid) -map_channel settings */ + /* first item specifies output metadata, second is input */ + MetadataMap (*meta_data_maps)[2]; + int nb_meta_data_maps; int metadata_global_manual; int metadata_streams_manual; int metadata_chapters_manual; @@ -135,7 +129,6 @@ typedef struct OptionsContext { int chapters_input_file; int64_t recording_time; - int64_t stop_time; uint64_t limit_filesize; float mux_preload; float mux_max_delay; @@ -174,8 +167,6 @@ typedef struct OptionsContext { int nb_intra_matrices; SpecifierOpt *inter_matrices; int nb_inter_matrices; - SpecifierOpt *chroma_intra_matrices; - int nb_chroma_intra_matrices; SpecifierOpt *top_field_first; int nb_top_field_first; SpecifierOpt *metadata_map; @@ -184,26 +175,14 @@ typedef struct OptionsContext { int nb_presets; SpecifierOpt *copy_initial_nonkeyframes; int nb_copy_initial_nonkeyframes; - SpecifierOpt *copy_prior_start; - int nb_copy_prior_start; SpecifierOpt *filters; int nb_filters; SpecifierOpt *filter_scripts; int nb_filter_scripts; - SpecifierOpt *reinit_filters; - int nb_reinit_filters; - SpecifierOpt *fix_sub_duration; - int nb_fix_sub_duration; - SpecifierOpt *canvas_sizes; - int nb_canvas_sizes; SpecifierOpt *pass; int nb_pass; SpecifierOpt *passlogfiles; int nb_passlogfiles; - SpecifierOpt *guess_layout_max; - int nb_guess_layout_max; - SpecifierOpt *apad; - int nb_apad; } OptionsContext; typedef struct InputFilter { @@ -228,7 +207,6 @@ typedef struct FilterGraph { const char *graph_desc; AVFilterGraph *graph; - int reconfiguration; InputFilter **inputs; int nb_inputs; @@ -247,23 +225,15 @@ typedef struct InputStream { int64_t start; /* time when read started */ /* predicted dts of the next packet read for this stream or (when there are - * several frames in a packet) of the next frame in current packet (in AV_TIME_BASE units) */ + * several frames in a packet) of the next frame in current packet */ int64_t next_dts; - int64_t dts; ///< dts of the last packet read for this stream (in AV_TIME_BASE units) - - int64_t next_pts; ///< synthetic pts for the next decode frame (in AV_TIME_BASE units) - int64_t pts; ///< current pts of the decoded frame (in AV_TIME_BASE units) - int wrap_correction_done; - - int64_t filter_in_rescale_delta_last; - + /* dts of the last packet read for this stream */ + int64_t last_dts; + PtsCorrectionContext pts_ctx; double ts_scale; - int saw_first_ts; int showed_multi_packet_warning; AVDictionary *decoder_opts; AVRational framerate; /* framerate forced with -r */ - int top_field_first; - int guess_layout_max; int resample_height; int resample_width; @@ -274,29 +244,11 @@ typedef struct InputStream { int resample_channels; uint64_t resample_channel_layout; - int fix_sub_duration; - struct { /* previous decoded subtitle and related variables */ - int got_output; - int ret; - AVSubtitle subtitle; - } prev_sub; - - struct sub2video { - int64_t last_pts; - int64_t end_pts; - AVFrame *frame; - int w, h; - } sub2video; - - int dr1; - /* decoded data from this stream goes into all those filters * currently video and audio only */ InputFilter **filters; int nb_filters; - int reinit_filters; - /* hwaccel options */ enum HWAccelID hwaccel_id; char *hwaccel_device; @@ -324,42 +276,25 @@ typedef struct InputFile { AVFormatContext *ctx; int eof_reached; /* true if eof reached */ int eagain; /* true if last read attempt returned EAGAIN */ - int ist_index; /* index of first stream in input_streams */ - int64_t input_ts_offset; + int ist_index; /* index of first stream in ist_table */ int64_t ts_offset; - int64_t last_ts; int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */ int64_t recording_time; - int nb_streams; /* number of stream that ffmpeg is aware of; may be different + int nb_streams; /* number of stream that avconv is aware of; may be different from ctx.nb_streams if new streams appear during av_read_frame() */ - int nb_streams_warn; /* number of streams that the user was warned of */ int rate_emu; int accurate_seek; #if HAVE_PTHREADS - AVThreadMessageQueue *in_thread_queue; pthread_t thread; /* thread reading from this file */ - int non_blocking; /* reading packets from the thread should not block */ + int finished; /* the thread has exited */ int joined; /* the thread has been joined */ + pthread_mutex_t fifo_lock; /* lock for access to fifo */ + pthread_cond_t fifo_cond; /* the main thread will signal on this cond after reading from fifo */ + AVFifoBuffer *fifo; /* demuxed packets are stored here; freed by the main thread */ #endif } InputFile; -enum forced_keyframes_const { - FKF_N, - FKF_N_FORCED, - FKF_PREV_FORCED_N, - FKF_PREV_FORCED_T, - FKF_T, - FKF_NB -}; - -extern const char *const forced_keyframes_const_names[]; - -typedef enum { - ENCODER_FINISHED = 1, - MUXER_FINISHED = 2, -} OSTFinished ; - typedef struct OutputStream { int file_index; /* file index */ int index; /* stream index in the output file */ @@ -369,6 +304,7 @@ typedef struct OutputStream { int frame_number; /* input pts and corresponding output pts for A/V sync */ + // double sync_ipts; /* dts from the AVPacket of the demuxer in second units */ struct InputStream *sync_ist; /* input stream to sync against */ int64_t sync_opts; /* output frame counter, could be changed to some true timestamp */ // FIXME look at frame_number /* pts of the first frame encoded for this stream, used for limiting @@ -386,41 +322,29 @@ typedef struct OutputStream { int force_fps; int top_field_first; - AVRational frame_aspect_ratio; + float frame_aspect_ratio; /* forced key frames */ int64_t *forced_kf_pts; int forced_kf_count; int forced_kf_index; char *forced_keyframes; - AVExpr *forced_keyframes_pexpr; - double forced_keyframes_expr_const_values[FKF_NB]; - - /* audio only */ - int audio_channels_map[SWR_CH_MAX]; /* list of the channels id to pick from the source stream */ - int audio_channels_mapped; /* number of channels in audio_channels_map */ char *logfile_prefix; FILE *logfile; OutputFilter *filter; char *avfilter; - char *filters; ///< filtergraph associated to the -filter option - char *filters_script; ///< filtergraph script associated to the -filter_script option int64_t sws_flags; AVDictionary *encoder_opts; - AVDictionary *swr_opts; AVDictionary *resample_opts; - char *apad; - OSTFinished finished; /* no more packets should be written for this stream */ - int unavailable; /* true if the steram is unavailable (possibly temporarily) */ + int finished; /* no more packets should be written for this stream */ int stream_copy; const char *attachment_filename; int copy_initial_nonkeyframes; - int copy_prior_start; - int keep_pix_fmt; + enum AVPixelFormat pix_fmts[2]; AVCodecParserContext *parser; @@ -438,9 +362,9 @@ typedef struct OutputFile { AVFormatContext *ctx; AVDictionary *opts; int ost_index; /* index of the first stream in output_streams */ - int64_t recording_time; ///< desired length of the resulting file in microseconds == AV_TIME_BASE units - int64_t start_time; ///< start time in microseconds == AV_TIME_BASE units - uint64_t limit_filesize; /* filesize limit expressed in bytes */ + int64_t recording_time; /* desired length of the resulting file in microseconds */ + int64_t start_time; /* start time in microseconds */ + uint64_t limit_filesize; int shortest; } OutputFile; @@ -462,37 +386,27 @@ extern char *vstats_filename; extern float audio_drift_threshold; extern float dts_delta_threshold; -extern float dts_error_threshold; extern int audio_volume; extern int audio_sync_method; extern int video_sync_method; extern int do_benchmark; -extern int do_benchmark_all; extern int do_deinterlace; extern int do_hex_dump; extern int do_pkt_dump; extern int copy_ts; extern int copy_tb; -extern int debug_ts; extern int exit_on_error; extern int print_stats; extern int qp_hist; -extern int stdin_interaction; -extern int frame_bits_per_raw_sample; -extern AVIOContext *progress_avio; -extern float max_error_rate; extern const AVIOInterruptCB int_cb; extern const OptionDef options[]; + extern const HWAccel hwaccels[]; - -void term_init(void); -void term_exit(void); - -void reset_options(OptionsContext *o, int is_input); +void reset_options(OptionsContext *o); void show_usage(void); void opt_output_file(void *optctx, const char *filename); @@ -501,18 +415,15 @@ void assert_avoptions(AVDictionary *m); int guess_input_channel_layout(InputStream *ist); -enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target); -void choose_sample_fmt(AVStream *st, AVCodec *codec); - int configure_filtergraph(FilterGraph *fg); int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out); int ist_in_filtergraph(FilterGraph *fg, InputStream *ist); FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost); -int ffmpeg_parse_options(int argc, char **argv); +int avconv_parse_options(int argc, char **argv); int vdpau_init(AVCodecContext *s); int dxva2_init(AVCodecContext *s); int vda_init(AVCodecContext *s); -#endif /* FFMPEG_H */ +#endif /* AVCONV_H */ diff --git a/ffmpeg_dxva2.c b/avconv_dxva2.c similarity index 98% rename from ffmpeg_dxva2.c rename to avconv_dxva2.c index 3c91d26f38..4457a21fb0 100644 --- a/ffmpeg_dxva2.c +++ b/avconv_dxva2.c @@ -1,18 +1,18 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -30,7 +30,7 @@ #include #include -#include "ffmpeg.h" +#include "avconv.h" #include "libavcodec/dxva2.h" @@ -121,10 +121,9 @@ static void dxva2_destroy_decoder(AVCodecContext *s) { InputStream *ist = s->opaque; DXVA2Context *ctx = ist->hwaccel_ctx; - int i; if (ctx->surfaces) { - for (i = 0; i < ctx->num_surfaces; i++) { + for (int i = 0; i < ctx->num_surfaces; i++) { if (ctx->surfaces[i]) IDirect3DSurface9_Release(ctx->surfaces[i]); } diff --git a/ffmpeg_filter.c b/avconv_filter.c similarity index 57% rename from ffmpeg_filter.c rename to avconv_filter.c index 6fd170baea..892db00f47 100644 --- a/ffmpeg_filter.c +++ b/avconv_filter.c @@ -1,149 +1,39 @@ /* - * ffmpeg filter configuration + * avconv filter configuration * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include -#include "ffmpeg.h" +#include "avconv.h" #include "libavfilter/avfilter.h" -#include "libavfilter/buffersink.h" #include "libavresample/avresample.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" -#include "libavutil/bprint.h" #include "libavutil/channel_layout.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "libavutil/pixfmt.h" -#include "libavutil/imgutils.h" #include "libavutil/samplefmt.h" -enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodec *codec, enum AVPixelFormat target) -{ - if (codec && codec->pix_fmts) { - const enum AVPixelFormat *p = codec->pix_fmts; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(target); - int has_alpha = desc ? desc->nb_components % 2 == 0 : 0; - enum AVPixelFormat best= AV_PIX_FMT_NONE; - static const enum AVPixelFormat mjpeg_formats[] = - { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE }; - static const enum AVPixelFormat ljpeg_formats[] = - { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; - - if (st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { - if (st->codec->codec_id == AV_CODEC_ID_MJPEG) { - p = mjpeg_formats; - } else if (st->codec->codec_id == AV_CODEC_ID_LJPEG) { - p =ljpeg_formats; - } - } - for (; *p != AV_PIX_FMT_NONE; p++) { - best= avcodec_find_best_pix_fmt_of_2(best, *p, target, has_alpha, NULL); - if (*p == target) - break; - } - if (*p == AV_PIX_FMT_NONE) { - if (target != AV_PIX_FMT_NONE) - av_log(NULL, AV_LOG_WARNING, - "Incompatible pixel format '%s' for codec '%s', auto-selecting format '%s'\n", - av_get_pix_fmt_name(target), - codec->name, - av_get_pix_fmt_name(best)); - return best; - } - } - return target; -} - -void choose_sample_fmt(AVStream *st, AVCodec *codec) -{ - if (codec && codec->sample_fmts) { - const enum AVSampleFormat *p = codec->sample_fmts; - for (; *p != -1; p++) { - if (*p == st->codec->sample_fmt) - break; - } - if (*p == -1) { - if((codec->capabilities & CODEC_CAP_LOSSLESS) && av_get_sample_fmt_name(st->codec->sample_fmt) > av_get_sample_fmt_name(codec->sample_fmts[0])) - av_log(NULL, AV_LOG_ERROR, "Conversion will not be lossless.\n"); - if(av_get_sample_fmt_name(st->codec->sample_fmt)) - av_log(NULL, AV_LOG_WARNING, - "Incompatible sample format '%s' for codec '%s', auto-selecting format '%s'\n", - av_get_sample_fmt_name(st->codec->sample_fmt), - codec->name, - av_get_sample_fmt_name(codec->sample_fmts[0])); - st->codec->sample_fmt = codec->sample_fmts[0]; - } - } -} - -static char *choose_pix_fmts(OutputStream *ost) -{ - AVDictionaryEntry *strict_dict = av_dict_get(ost->encoder_opts, "strict", NULL, 0); - if (strict_dict) - // used by choose_pixel_fmt() and below - av_opt_set(ost->st->codec, "strict", strict_dict->value, 0); - - if (ost->keep_pix_fmt) { - if (ost->filter) - avfilter_graph_set_auto_convert(ost->filter->graph->graph, - AVFILTER_AUTO_CONVERT_NONE); - if (ost->st->codec->pix_fmt == AV_PIX_FMT_NONE) - return NULL; - return av_strdup(av_get_pix_fmt_name(ost->st->codec->pix_fmt)); - } - if (ost->st->codec->pix_fmt != AV_PIX_FMT_NONE) { - return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt))); - } else if (ost->enc && ost->enc->pix_fmts) { - const enum AVPixelFormat *p; - AVIOContext *s = NULL; - uint8_t *ret; - int len; - - if (avio_open_dyn_buf(&s) < 0) - exit_program(1); - - p = ost->enc->pix_fmts; - if (ost->st->codec->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL) { - if (ost->st->codec->codec_id == AV_CODEC_ID_MJPEG) { - p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE }; - } else if (ost->st->codec->codec_id == AV_CODEC_ID_LJPEG) { - p = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUV420P, - AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P, AV_PIX_FMT_BGRA, AV_PIX_FMT_NONE }; - } - } - - for (; *p != AV_PIX_FMT_NONE; p++) { - const char *name = av_get_pix_fmt_name(*p); - avio_printf(s, "%s|", name); - } - len = avio_close_dyn_buf(s, &ret); - ret[len - 1] = 0; - return ret; - } else - return NULL; -} - /* Define a function for building a string containing a list of * allowed formats. */ #define DEF_CHOOSE_FORMAT(type, var, supported_list, none, get_name) \ @@ -159,7 +49,7 @@ static char *choose_ ## var ## s(OutputStream *ost) \ int len; \ \ if (avio_open_dyn_buf(&s) < 0) \ - exit_program(1); \ + exit(1); \ \ for (p = ost->enc->supported_list; *p != none; p++) { \ get_name(*p); \ @@ -172,8 +62,8 @@ static char *choose_ ## var ## s(OutputStream *ost) \ return NULL; \ } -// DEF_CHOOSE_FORMAT(enum AVPixelFormat, pix_fmt, pix_fmts, AV_PIX_FMT_NONE, -// GET_PIX_FMT_NAME) +DEF_CHOOSE_FORMAT(enum AVPixelFormat, pix_fmt, pix_fmts, AV_PIX_FMT_NONE, + GET_PIX_FMT_NAME) DEF_CHOOSE_FORMAT(enum AVSampleFormat, sample_fmt, sample_fmts, AV_SAMPLE_FMT_NONE, GET_SAMPLE_FMT_NAME) @@ -189,12 +79,12 @@ FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost) FilterGraph *fg = av_mallocz(sizeof(*fg)); if (!fg) - exit_program(1); + exit(1); fg->index = nb_filtergraphs; GROW_ARRAY(fg->outputs, fg->nb_outputs); if (!(fg->outputs[0] = av_mallocz(sizeof(*fg->outputs[0])))) - exit_program(1); + exit(1); fg->outputs[0]->ost = ost; fg->outputs[0]->graph = fg; @@ -202,7 +92,7 @@ FilterGraph *init_simple_filtergraph(InputStream *ist, OutputStream *ost) GROW_ARRAY(fg->inputs, fg->nb_inputs); if (!(fg->inputs[0] = av_mallocz(sizeof(*fg->inputs[0])))) - exit_program(1); + exit(1); fg->inputs[0]->ist = ist; fg->inputs[0]->graph = fg; @@ -225,7 +115,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) { av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported " "currently.\n"); - exit_program(1); + exit(1); } if (in->name) { @@ -235,17 +125,14 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) int file_idx = strtol(in->name, &p, 0); if (file_idx < 0 || file_idx >= nb_input_files) { - av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtergraph description %s.\n", + av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtegraph description %s.\n", file_idx, fg->graph_desc); - exit_program(1); + exit(1); } s = input_files[file_idx]->ctx; for (i = 0; i < s->nb_streams; i++) { - enum AVMediaType stream_type = s->streams[i]->codec->codec_type; - if (stream_type != type && - !(stream_type == AVMEDIA_TYPE_SUBTITLE && - type == AVMEDIA_TYPE_VIDEO /* sub2video hack */)) + if (s->streams[i]->codec->codec_type != type) continue; if (check_stream_specifier(s, s->streams[i], *p == ':' ? p + 1 : p) == 1) { st = s->streams[i]; @@ -255,7 +142,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) if (!st) { av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s " "matches no streams.\n", p, fg->graph_desc); - exit_program(1); + exit(1); } ist = input_streams[input_files[file_idx]->ist_index + st->index]; } else { @@ -269,18 +156,18 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for " "unlabeled input pad %d on filter %s\n", in->pad_idx, in->filter_ctx->name); - exit_program(1); + exit(1); } } av_assert0(ist); ist->discard = 0; - ist->decoding_needed++; + ist->decoding_needed = 1; ist->st->discard = AVDISCARD_NONE; GROW_ARRAY(fg->inputs, fg->nb_inputs); if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0])))) - exit_program(1); + exit(1); fg->inputs[fg->nb_inputs - 1]->ist = ist; fg->inputs[fg->nb_inputs - 1]->graph = fg; @@ -314,11 +201,11 @@ static int insert_trim(int64_t start_time, int64_t duration, return AVERROR(ENOMEM); if (duration != INT64_MAX) { - ret = av_opt_set_int(ctx, "durationi", duration, + ret = av_opt_set_double(ctx, "duration", (double)duration / 1e6, AV_OPT_SEARCH_CHILDREN); } if (ret >= 0 && start_time != AV_NOPTS_VALUE) { - ret = av_opt_set_int(ctx, "starti", start_time, + ret = av_opt_set_double(ctx, "start", (double)start_time / 1e6, AV_OPT_SEARCH_CHILDREN); } if (ret < 0) { @@ -354,7 +241,6 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("buffersink"), name, NULL, NULL, fg->graph); - if (ret < 0) return ret; @@ -382,21 +268,20 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterContext *filter; snprintf(name, sizeof(name), "pixel format for output stream %d:%d", ost->file_index, ost->index); - ret = avfilter_graph_create_filter(&filter, + if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("format"), "format", pix_fmts, NULL, - fg->graph); - av_freep(&pix_fmts); - if (ret < 0) + fg->graph)) < 0) return ret; if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0) return ret; last_filter = filter; pad_idx = 0; + av_freep(&pix_fmts); } - if (ost->frame_rate.num && 0) { + if (ost->frame_rate.num) { AVFilterContext *fps; char args[255]; @@ -441,47 +326,13 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, char name[255]; int ret; + snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index); ret = avfilter_graph_create_filter(&ofilter->filter, avfilter_get_by_name("abuffersink"), name, NULL, NULL, fg->graph); if (ret < 0) return ret; - if ((ret = av_opt_set_int(ofilter->filter, "all_channel_counts", 1, AV_OPT_SEARCH_CHILDREN)) < 0) - return ret; - -#define AUTO_INSERT_FILTER(opt_name, filter_name, arg) do { \ - AVFilterContext *filt_ctx; \ - \ - av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \ - "similarly to -af " filter_name "=%s.\n", arg); \ - \ - ret = avfilter_graph_create_filter(&filt_ctx, \ - avfilter_get_by_name(filter_name), \ - filter_name, arg, NULL, fg->graph); \ - if (ret < 0) \ - return ret; \ - \ - ret = avfilter_link(last_filter, pad_idx, filt_ctx, 0); \ - if (ret < 0) \ - return ret; \ - \ - last_filter = filt_ctx; \ - pad_idx = 0; \ -} while (0) - if (ost->audio_channels_mapped) { - int i; - AVBPrint pan_buf; - av_bprint_init(&pan_buf, 256, 8192); - av_bprintf(&pan_buf, "0x%"PRIx64, - av_get_default_channel_layout(ost->audio_channels_mapped)); - for (i = 0; i < ost->audio_channels_mapped; i++) - if (ost->audio_channels_map[i] != -1) - av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]); - - AUTO_INSERT_FILTER("-map_channel", "pan", pan_buf.str); - av_bprint_finalize(&pan_buf, NULL); - } if (codec->channels && !codec->channel_layout) codec->channel_layout = av_get_default_channel_layout(codec->channels); @@ -492,17 +343,18 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, if (sample_fmts || sample_rates || channel_layouts) { AVFilterContext *format; char args[256]; - args[0] = 0; + int len = 0; if (sample_fmts) - av_strlcatf(args, sizeof(args), "sample_fmts=%s:", + len += snprintf(args + len, sizeof(args) - len, "sample_fmts=%s:", sample_fmts); if (sample_rates) - av_strlcatf(args, sizeof(args), "sample_rates=%s:", + len += snprintf(args + len, sizeof(args) - len, "sample_rates=%s:", sample_rates); if (channel_layouts) - av_strlcatf(args, sizeof(args), "channel_layouts=%s:", + len += snprintf(args + len, sizeof(args) - len, "channel_layouts=%s:", channel_layouts); + args[len - 1] = 0; av_freep(&sample_fmts); av_freep(&sample_rates); @@ -524,27 +376,6 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, pad_idx = 0; } - if (audio_volume != 256 && 0) { - char args[256]; - - snprintf(args, sizeof(args), "%f", audio_volume / 256.); - AUTO_INSERT_FILTER("-vol", "volume", args); - } - - if (ost->apad && of->shortest) { - char args[256]; - int i; - - for (i=0; ictx->nb_streams; i++) - if (of->ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) - break; - - if (ictx->nb_streams) { - snprintf(args, sizeof(args), "%s", ost->apad); - AUTO_INSERT_FILTER("-apad", "apad", args); - } - } - snprintf(name, sizeof(name), "trim for output stream %d:%d", ost->file_index, ost->index); ret = insert_trim(of->start_time, of->recording_time, @@ -566,7 +397,7 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, AVIOContext *pb; \ \ if (avio_open_dyn_buf(&pb) < 0) \ - exit_program(1); \ + exit(1); \ \ avio_printf(pb, "%s", ctx->filter->name); \ if (nb_pads > 1) \ @@ -587,42 +418,6 @@ int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOu } } -static int sub2video_prepare(InputStream *ist) -{ - AVFormatContext *avf = input_files[ist->file_index]->ctx; - int i, w, h; - - /* Compute the size of the canvas for the subtitles stream. - If the subtitles codec has set a size, use it. Otherwise use the - maximum dimensions of the video streams in the same file. */ - w = ist->st->codec->width; - h = ist->st->codec->height; - if (!(w && h)) { - for (i = 0; i < avf->nb_streams; i++) { - if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - w = FFMAX(w, avf->streams[i]->codec->width); - h = FFMAX(h, avf->streams[i]->codec->height); - } - } - if (!(w && h)) { - w = FFMAX(w, 720); - h = FFMAX(h, 576); - } - av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h); - } - ist->sub2video.w = ist->st->codec->width = ist->resample_width = w; - ist->sub2video.h = ist->st->codec->height = ist->resample_height = h; - - /* rectangles are AV_PIX_FMT_PAL8, but we have no guarantee that the - palettes for all rectangles are identical or compatible */ - ist->resample_pix_fmt = ist->st->codec->pix_fmt = AV_PIX_FMT_RGB32; - - ist->sub2video.frame = av_frame_alloc(); - if (!ist->sub2video.frame) - return AVERROR(ENOMEM); - return 0; -} - static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { @@ -632,46 +427,22 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, InputFile *f = input_files[ist->file_index]; AVRational tb = ist->framerate.num ? av_inv_q(ist->framerate) : ist->st->time_base; - AVRational fr = ist->framerate; AVRational sar; - AVBPrint args; - char name[255]; + char args[255], name[255]; int ret, pad_idx = 0; - if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - av_log(NULL, AV_LOG_ERROR, "Cannot connect video filter to audio input\n"); - return AVERROR(EINVAL); - } - - if (!fr.num) - fr = av_guess_frame_rate(input_files[ist->file_index]->ctx, ist->st, NULL); - - if (ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { - ret = sub2video_prepare(ist); - if (ret < 0) - return ret; - } - sar = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio; - if(!sar.den) - sar = (AVRational){0,1}; - av_bprint_init(&args, 0, 1); - av_bprintf(&args, - "video_size=%dx%d:pix_fmt=%d:time_base=%d/%d:" - "pixel_aspect=%d/%d:sws_param=flags=%d", ist->resample_width, - ist->resample_height, - ist->hwaccel_retrieve_data ? ist->hwaccel_retrieved_pix_fmt : ist->resample_pix_fmt, - tb.num, tb.den, sar.num, sar.den, - SWS_BILINEAR + ((ist->st->codec->flags&CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0)); - if (fr.num && fr.den) - av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den); + snprintf(args, sizeof(args), "%d:%d:%d:%d:%d:%d:%d", ist->st->codec->width, + ist->st->codec->height, + ist->hwaccel_retrieve_data ? ist->hwaccel_retrieved_pix_fmt : ist->st->codec->pix_fmt, + tb.num, tb.den, sar.num, sar.den); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&ifilter->filter, buffer_filt, name, - args.str, NULL, fg->graph)) < 0) + args, NULL, fg->graph)) < 0) return ret; last_filter = ifilter->filter; @@ -692,23 +463,6 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter, last_filter = setpts; } - if (do_deinterlace) { - AVFilterContext *yadif; - - snprintf(name, sizeof(name), "deinterlace input from stream %d:%d", - ist->file_index, ist->st->index); - if ((ret = avfilter_graph_create_filter(&yadif, - avfilter_get_by_name("yadif"), - name, "", NULL, - fg->graph)) < 0) - return ret; - - if ((ret = avfilter_link(last_filter, 0, yadif, 0)) < 0) - return ret; - - last_filter = yadif; - } - snprintf(name, sizeof(name), "trim for input stream %d:%d", ist->file_index, ist->st->index); ret = insert_trim(((f->start_time == AV_NOPTS_VALUE) || !f->accurate_seek) ? @@ -728,87 +482,72 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, const AVFilter *abuffer_filt = avfilter_get_by_name("abuffer"); InputStream *ist = ifilter->ist; InputFile *f = input_files[ist->file_index]; - AVBPrint args; - char name[255]; + char args[255], name[255]; int ret, pad_idx = 0; - if (ist->st->codec->codec_type != AVMEDIA_TYPE_AUDIO) { - av_log(NULL, AV_LOG_ERROR, "Cannot connect audio filter to non audio input\n"); - return AVERROR(EINVAL); - } - - av_bprint_init(&args, 0, AV_BPRINT_SIZE_AUTOMATIC); - av_bprintf(&args, "time_base=%d/%d:sample_rate=%d:sample_fmt=%s", + snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s" + ":channel_layout=0x%"PRIx64, 1, ist->st->codec->sample_rate, ist->st->codec->sample_rate, - av_get_sample_fmt_name(ist->st->codec->sample_fmt)); - if (ist->st->codec->channel_layout) - av_bprintf(&args, ":channel_layout=0x%"PRIx64, - ist->st->codec->channel_layout); - else - av_bprintf(&args, ":channels=%d", ist->st->codec->channels); + av_get_sample_fmt_name(ist->st->codec->sample_fmt), + ist->st->codec->channel_layout); snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index, ist->file_index, ist->st->index); if ((ret = avfilter_graph_create_filter(&ifilter->filter, abuffer_filt, - name, args.str, NULL, + name, args, NULL, fg->graph)) < 0) return ret; last_filter = ifilter->filter; -#define AUTO_INSERT_FILTER_INPUT(opt_name, filter_name, arg) do { \ - AVFilterContext *filt_ctx; \ - \ - av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \ - "similarly to -af " filter_name "=%s.\n", arg); \ - \ - snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \ - fg->index, filter_name, ist->file_index, ist->st->index); \ - ret = avfilter_graph_create_filter(&filt_ctx, \ - avfilter_get_by_name(filter_name), \ - name, arg, NULL, fg->graph); \ - if (ret < 0) \ - return ret; \ - \ - ret = avfilter_link(last_filter, 0, filt_ctx, 0); \ - if (ret < 0) \ - return ret; \ - \ - last_filter = filt_ctx; \ -} while (0) - if (audio_sync_method > 0) { - char args[256] = {0}; + AVFilterContext *async; + int len = 0; - av_strlcatf(args, sizeof(args), "async=%d", audio_sync_method); - if (audio_drift_threshold != 0.1) - av_strlcatf(args, sizeof(args), ":min_hard_comp=%f", audio_drift_threshold); - if (!fg->reconfiguration) - av_strlcatf(args, sizeof(args), ":first_pts=0"); - AUTO_INSERT_FILTER_INPUT("-async", "aresample", args); + av_log(NULL, AV_LOG_WARNING, "-async has been deprecated. Used the " + "asyncts audio filter instead.\n"); + + if (audio_sync_method > 1) + len += snprintf(args + len, sizeof(args) - len, "compensate=1:" + "max_comp=%d:", audio_sync_method); + snprintf(args + len, sizeof(args) - len, "min_delta=%f", + audio_drift_threshold); + + snprintf(name, sizeof(name), "graph %d audio sync for input stream %d:%d", + fg->index, ist->file_index, ist->st->index); + ret = avfilter_graph_create_filter(&async, + avfilter_get_by_name("asyncts"), + name, args, NULL, fg->graph); + if (ret < 0) + return ret; + + ret = avfilter_link(last_filter, 0, async, 0); + if (ret < 0) + return ret; + + last_filter = async; } - -// if (ost->audio_channels_mapped) { -// int i; -// AVBPrint pan_buf; -// av_bprint_init(&pan_buf, 256, 8192); -// av_bprintf(&pan_buf, "0x%"PRIx64, -// av_get_default_channel_layout(ost->audio_channels_mapped)); -// for (i = 0; i < ost->audio_channels_mapped; i++) -// if (ost->audio_channels_map[i] != -1) -// av_bprintf(&pan_buf, ":c%d=c%d", i, ost->audio_channels_map[i]); -// AUTO_INSERT_FILTER_INPUT("-map_channel", "pan", pan_buf.str); -// av_bprint_finalize(&pan_buf, NULL); -// } - if (audio_volume != 256) { - char args[256]; + AVFilterContext *volume; av_log(NULL, AV_LOG_WARNING, "-vol has been deprecated. Use the volume " "audio filter instead.\n"); - snprintf(args, sizeof(args), "%f", audio_volume / 256.); - AUTO_INSERT_FILTER_INPUT("-vol", "volume", args); + snprintf(args, sizeof(args), "volume=%f", audio_volume / 256.0); + + snprintf(name, sizeof(name), "graph %d volume for input stream %d:%d", + fg->index, ist->file_index, ist->st->index); + ret = avfilter_graph_create_filter(&volume, + avfilter_get_by_name("volume"), + name, args, NULL, fg->graph); + if (ret < 0) + return ret; + + ret = avfilter_link(last_filter, 0, volume, 0); + if (ret < 0) + return ret; + + last_filter = volume; } snprintf(name, sizeof(name), "trim for input stream %d:%d", @@ -856,15 +595,6 @@ int configure_filtergraph(FilterGraph *fg) snprintf(args, sizeof(args), "flags=0x%X", (unsigned)ost->sws_flags); fg->graph->scale_sws_opts = av_strdup(args); - args[0] = 0; - while ((e = av_dict_get(ost->swr_opts, "", e, - AV_DICT_IGNORE_SUFFIX))) { - av_strlcatf(args, sizeof(args), "%s=%s:", e->key, e->value); - } - if (strlen(args)) - args[strlen(args)-1] = 0; - av_opt_set(fg->graph, "aresample_swr_opts", args, 0); - args[0] = '\0'; while ((e = av_dict_get(fg->outputs[0]->ost->resample_opts, "", e, AV_DICT_IGNORE_SUFFIX))) { @@ -873,10 +603,6 @@ int configure_filtergraph(FilterGraph *fg) if (strlen(args)) args[strlen(args) - 1] = '\0'; fg->graph->resample_lavr_opts = av_strdup(args); - - e = av_dict_get(ost->encoder_opts, "threads", NULL, 0); - if (e) - av_opt_set(fg->graph, "threads", e->value, 0); } if ((ret = avfilter_graph_parse2(fg->graph, graph_desc, &inputs, &outputs)) < 0) @@ -910,7 +636,7 @@ int configure_filtergraph(FilterGraph *fg) for (cur = outputs; cur;) { GROW_ARRAY(fg->outputs, fg->nb_outputs); if (!(fg->outputs[fg->nb_outputs - 1] = av_mallocz(sizeof(*fg->outputs[0])))) - exit_program(1); + exit(1); fg->outputs[fg->nb_outputs - 1]->graph = fg; fg->outputs[fg->nb_outputs - 1]->out_tmp = cur; cur = cur->next; @@ -918,7 +644,6 @@ int configure_filtergraph(FilterGraph *fg) } } - fg->reconfiguration = 1; return 0; } diff --git a/ffmpeg_opt.c b/avconv_opt.c similarity index 69% rename from ffmpeg_opt.c rename to avconv_opt.c index eeacf5828c..12d676054d 100644 --- a/ffmpeg_opt.c +++ b/avconv_opt.c @@ -1,26 +1,26 @@ /* - * ffmpeg option parsing + * avconv option parsing * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include -#include "ffmpeg.h" +#include "avconv.h" #include "cmdutils.h" #include "libavformat/avformat.h" @@ -53,16 +53,6 @@ }\ } -#define MATCH_PER_TYPE_OPT(name, type, outvar, fmtctx, mediatype)\ -{\ - int i;\ - for (i = 0; i < o->nb_ ## name; i++) {\ - char *spec = o->name[i].specifier;\ - if (!strcmp(spec, mediatype))\ - outvar = o->name[i].u.type;\ - }\ -} - const HWAccel hwaccels[] = { #if HAVE_VDPAU_X11 { "vdpau", vdpau_init, HWACCEL_VDPAU, AV_PIX_FMT_VDPAU }, @@ -80,35 +70,25 @@ char *vstats_filename; float audio_drift_threshold = 0.1; float dts_delta_threshold = 10; -float dts_error_threshold = 3600*30; int audio_volume = 256; int audio_sync_method = 0; int video_sync_method = VSYNC_AUTO; -int do_deinterlace = 0; int do_benchmark = 0; -int do_benchmark_all = 0; int do_hex_dump = 0; int do_pkt_dump = 0; int copy_ts = 0; -int copy_tb = -1; -int debug_ts = 0; +int copy_tb = 1; int exit_on_error = 0; -int print_stats = -1; +int print_stats = 1; int qp_hist = 0; -int stdin_interaction = 1; -int frame_bits_per_raw_sample = 0; -float max_error_rate = 2.0/3; - -static int intra_only = 0; static int file_overwrite = 0; -static int no_file_overwrite = 0; +static int file_skip = 0; static int video_discard = 0; static int intra_dc_precision = 8; -static int do_psnr = 0; +static int using_stdin = 0; static int input_sync; -static int override_ffserver = 0; static void uninit_options(OptionsContext *o) { @@ -137,16 +117,14 @@ static void uninit_options(OptionsContext *o) for (i = 0; i < o->nb_stream_maps; i++) av_freep(&o->stream_maps[i].linklabel); av_freep(&o->stream_maps); - av_freep(&o->audio_channel_maps); + av_freep(&o->meta_data_maps); av_freep(&o->streamid_map); - av_freep(&o->attachments); } static void init_options(OptionsContext *o) { memset(o, 0, sizeof(*o)); - o->stop_time = INT64_MAX; o->mux_max_delay = 0.7; o->start_time = AV_NOPTS_VALUE; o->recording_time = INT64_MAX; @@ -173,25 +151,28 @@ static AVDictionary *strip_specifiers(AVDictionary *dict) return ret; } -static int opt_sameq(void *optctx, const char *opt, const char *arg) +static double parse_frame_aspect_ratio(const char *arg) { - av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. " - "If you are looking for an option to preserve the quality (which is not " - "what -%s was for), use -qscale 0 or an equivalent quality factor option.\n", - opt, opt); - return AVERROR(EINVAL); -} + int x = 0, y = 0; + double ar = 0; + const char *p; + char *end; -static int opt_video_channel(void *optctx, const char *opt, const char *arg) -{ - av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -channel.\n"); - return opt_default(optctx, "channel", arg); -} + p = strchr(arg, ':'); + if (p) { + x = strtol(arg, &end, 10); + if (end == p) + y = strtol(end + 1, &end, 10); + if (x > 0 && y > 0) + ar = (double)x / (double)y; + } else + ar = strtod(arg, NULL); -static int opt_video_standard(void *optctx, const char *opt, const char *arg) -{ - av_log(NULL, AV_LOG_WARNING, "This option is deprecated, use -standard.\n"); - return opt_default(optctx, "standard", arg); + if (!ar) { + av_log(NULL, AV_LOG_FATAL, "Incorrect aspect ratio specification.\n"); + exit_program(1); + } + return ar; } static int opt_audio_codec(void *optctx, const char *opt, const char *arg) @@ -223,7 +204,7 @@ static int opt_map(void *optctx, const char *opt, const char *arg) OptionsContext *o = optctx; StreamMap *m = NULL; int i, negative = 0, file_idx; - int sync_file_idx = -1, sync_stream_idx = 0; + int sync_file_idx = -1, sync_stream_idx; char *p, *sync; char *map; @@ -321,65 +302,6 @@ static int opt_attach(void *optctx, const char *opt, const char *arg) return 0; } -static int opt_map_channel(void *optctx, const char *opt, const char *arg) -{ - OptionsContext *o = optctx; - int n; - AVStream *st; - AudioChannelMap *m; - - GROW_ARRAY(o->audio_channel_maps, o->nb_audio_channel_maps); - m = &o->audio_channel_maps[o->nb_audio_channel_maps - 1]; - - /* muted channel syntax */ - n = sscanf(arg, "%d:%d.%d", &m->channel_idx, &m->ofile_idx, &m->ostream_idx); - if ((n == 1 || n == 3) && m->channel_idx == -1) { - m->file_idx = m->stream_idx = -1; - if (n == 1) - m->ofile_idx = m->ostream_idx = -1; - return 0; - } - - /* normal syntax */ - n = sscanf(arg, "%d.%d.%d:%d.%d", - &m->file_idx, &m->stream_idx, &m->channel_idx, - &m->ofile_idx, &m->ostream_idx); - - if (n != 3 && n != 5) { - av_log(NULL, AV_LOG_FATAL, "Syntax error, mapchan usage: " - "[file.stream.channel|-1][:syncfile:syncstream]\n"); - exit_program(1); - } - - if (n != 5) // only file.stream.channel specified - m->ofile_idx = m->ostream_idx = -1; - - /* check input */ - if (m->file_idx < 0 || m->file_idx >= nb_input_files) { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file index: %d\n", - m->file_idx); - exit_program(1); - } - if (m->stream_idx < 0 || - m->stream_idx >= input_files[m->file_idx]->nb_streams) { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid input file stream index #%d.%d\n", - m->file_idx, m->stream_idx); - exit_program(1); - } - st = input_files[m->file_idx]->ctx->streams[m->stream_idx]; - if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) { - av_log(NULL, AV_LOG_FATAL, "mapchan: stream #%d.%d is not an audio stream.\n", - m->file_idx, m->stream_idx); - exit_program(1); - } - if (m->channel_idx < 0 || m->channel_idx >= st->codec->channels) { - av_log(NULL, AV_LOG_FATAL, "mapchan: invalid audio channel #%d.%d.%d\n", - m->file_idx, m->stream_idx, m->channel_idx); - exit_program(1); - } - return 0; -} - /** * Parse a metadata specifier passed as 'arg' parameter. * @param arg metadata string to parse @@ -417,7 +339,7 @@ static void parse_meta_type(char *arg, char *type, int *index, const char **stre static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFormatContext *ic, OptionsContext *o) { AVDictionary **meta_in = NULL; - AVDictionary **meta_out = NULL; + AVDictionary **meta_out; int i, ret = 0; char type_in, type_out; const char *istream_spec = NULL, *ostream_spec = NULL; @@ -426,16 +348,6 @@ static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFor parse_meta_type(inspec, &type_in, &idx_in, &istream_spec); parse_meta_type(outspec, &type_out, &idx_out, &ostream_spec); - if (!ic) { - if (type_out == 'g' || !*outspec) - o->metadata_global_manual = 1; - if (type_out == 's' || !*outspec) - o->metadata_streams_manual = 1; - if (type_out == 'c' || !*outspec) - o->metadata_chapters_manual = 1; - return 0; - } - if (type_in == 'g' || type_out == 'g') o->metadata_global_manual = 1; if (type_in == 's' || type_out == 's') @@ -504,20 +416,6 @@ static int copy_metadata(char *outspec, char *inspec, AVFormatContext *oc, AVFor return 0; } -static int opt_recording_timestamp(void *optctx, const char *opt, const char *arg) -{ - OptionsContext *o = optctx; - char buf[128]; - int64_t recording_timestamp = parse_time_or_die(opt, arg, 0) / 1E6; - struct tm time = *gmtime((time_t*)&recording_timestamp); - strftime(buf, sizeof(buf), "creation_time=%FT%T%z", &time); - parse_option(o, "metadata", buf, options); - - av_log(NULL, AV_LOG_WARNING, "%s is deprecated, set the 'creation_time' metadata " - "tag instead.\n", opt); - return 0; -} - static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) { const AVCodecDescriptor *desc; @@ -599,19 +497,8 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) ist->dec = choose_decoder(o, ic, st); ist->decoder_opts = filter_codec_opts(o->g->codec_opts, ist->st->codec->codec_id, ic, st, ist->dec); - ist->reinit_filters = -1; - MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st); - - ist->filter_in_rescale_delta_last = AV_NOPTS_VALUE; - switch (dec->codec_type) { case AVMEDIA_TYPE_VIDEO: - if(!ist->dec) - ist->dec = avcodec_find_decoder(dec->codec_id); - if (av_codec_get_lowres(dec)) { - dec->flags |= CODEC_FLAG_EMU_EDGE; - } - ist->resample_height = dec->height; ist->resample_width = dec->width; ist->resample_pix_fmt = dec->pix_fmt; @@ -624,9 +511,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) exit_program(1); } - ist->top_field_first = -1; - MATCH_PER_STREAM_OPT(top_field_first, i, ist->top_field_first, ic, st); - MATCH_PER_STREAM_OPT(hwaccels, str, hwaccel, ic, st); if (hwaccel) { if (!strcmp(hwaccel, "none")) @@ -664,8 +548,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) break; case AVMEDIA_TYPE_AUDIO: - ist->guess_layout_max = INT_MAX; - MATCH_PER_STREAM_OPT(guess_layout_max, i, ist->guess_layout_max, ic, st); guess_input_channel_layout(ist); ist->resample_sample_fmt = dec->sample_fmt; @@ -675,19 +557,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) break; case AVMEDIA_TYPE_DATA: - case AVMEDIA_TYPE_SUBTITLE: { - char *canvas_size = NULL; - if(!ist->dec) - ist->dec = avcodec_find_decoder(dec->codec_id); - MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st); - MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st); - if (canvas_size && - av_parse_video_size(&dec->width, &dec->height, canvas_size) < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid canvas size: %s.\n", canvas_size); - exit_program(1); - } - break; - } + case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_ATTACHMENT: case AVMEDIA_TYPE_UNKNOWN: break; @@ -699,27 +569,25 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic) static void assert_file_overwrite(const char *filename) { - if (file_overwrite && no_file_overwrite) { + if (file_overwrite && file_skip) { fprintf(stderr, "Error, both -y and -n supplied. Exiting.\n"); exit_program(1); } - if (!file_overwrite) { - const char *proto_name = avio_find_protocol_name(filename); - if (proto_name && !strcmp(proto_name, "file") && avio_check(filename, 0) == 0) { - if (stdin_interaction && !no_file_overwrite) { + if (!file_overwrite && + (strchr(filename, ':') == NULL || filename[1] == ':' || + av_strstart(filename, "file:", NULL))) { + if (avio_check(filename, 0) == 0) { + if (!using_stdin && !file_skip) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); - term_exit(); - signal(SIGINT, SIG_DFL); if (!read_yesno()) { - av_log(NULL, AV_LOG_FATAL, "Not overwriting - exiting\n"); + fprintf(stderr, "Not overwriting - exiting\n"); exit_program(1); } - term_init(); } else { - av_log(NULL, AV_LOG_FATAL, "File '%s' already exists. Exiting.\n", filename); + fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); exit_program(1); } } @@ -770,9 +638,6 @@ static int open_input_file(OptionsContext *o, const char *filename) AVDictionary *unused_opts = NULL; AVDictionaryEntry *e = NULL; int orig_nb_streams; // number of streams before avformat_find_stream_info - char * video_codec_name = NULL; - char * audio_codec_name = NULL; - char *subtitle_codec_name = NULL; if (o->format) { if (!(file_iformat = av_find_input_format(o->format))) { @@ -784,8 +649,8 @@ static int open_input_file(OptionsContext *o, const char *filename) if (!strcmp(filename, "-")) filename = "pipe:"; - stdin_interaction &= strncmp(filename, "pipe:", 5) && - strcmp(filename, "/dev/stdin"); + using_stdin |= !strncmp(filename, "pipe:", 5) || + !strcmp(filename, "/dev/stdin"); /* get default parameters from command line */ ic = avformat_alloc_context(); @@ -825,28 +690,10 @@ static int open_input_file(OptionsContext *o, const char *filename) if (o->nb_frame_pix_fmts) av_dict_set(&o->g->format_opts, "pixel_format", o->frame_pix_fmts[o->nb_frame_pix_fmts - 1].u.str, 0); - MATCH_PER_TYPE_OPT(codec_names, str, video_codec_name, ic, "v"); - MATCH_PER_TYPE_OPT(codec_names, str, audio_codec_name, ic, "a"); - MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, ic, "s"); - - ic->video_codec_id = video_codec_name ? - find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0)->id : AV_CODEC_ID_NONE; - ic->audio_codec_id = audio_codec_name ? - find_codec_or_die(audio_codec_name , AVMEDIA_TYPE_AUDIO , 0)->id : AV_CODEC_ID_NONE; - ic->subtitle_codec_id= subtitle_codec_name ? - find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)->id : AV_CODEC_ID_NONE; - - if (video_codec_name) - av_format_set_video_codec (ic, find_codec_or_die(video_codec_name , AVMEDIA_TYPE_VIDEO , 0)); - if (audio_codec_name) - av_format_set_audio_codec (ic, find_codec_or_die(audio_codec_name , AVMEDIA_TYPE_AUDIO , 0)); - if (subtitle_codec_name) - av_format_set_subtitle_codec(ic, find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0)); - ic->flags |= AVFMT_FLAG_NONBLOCK; ic->interrupt_callback = int_cb; - /* open the input file with generic avformat function */ + /* open the input file with generic libav function */ err = avformat_open_input(&ic, filename, file_iformat, &o->g->format_opts); if (err < 0) { print_error(filename, err); @@ -878,7 +725,7 @@ static int open_input_file(OptionsContext *o, const char *filename) /* if seeking requested, we execute it */ if (o->start_time != AV_NOPTS_VALUE) { - ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, timestamp, 0); + ret = av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD); if (ret < 0) { av_log(NULL, AV_LOG_WARNING, "%s: could not seek to position %0.3f\n", filename, (double)timestamp / AV_TIME_BASE); @@ -901,7 +748,6 @@ static int open_input_file(OptionsContext *o, const char *filename) f->ist_index = nb_input_streams - ic->nb_streams; f->start_time = o->start_time; f->recording_time = o->recording_time; - f->input_ts_offset = o->input_ts_offset; f->ts_offset = o->input_ts_offset - (copy_ts ? 0 : timestamp); f->nb_streams = ic->nb_streams; f->rate_emu = o->rate_emu; @@ -921,13 +767,8 @@ static int open_input_file(OptionsContext *o, const char *filename) const AVClass *class = avcodec_get_class(); const AVOption *option = av_opt_find(&class, e->key, NULL, 0, AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); - const AVClass *fclass = avformat_get_class(); - const AVOption *foption = av_opt_find(&fclass, e->key, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ); - if (!option || foption) + if (!option) continue; - - if (!(option->flags & AV_OPT_FLAG_DECODING_PARAM)) { av_log(NULL, AV_LOG_ERROR, "Codec AVOption %s (%s) specified for " "input file #%d (%s) is not a decoding option.\n", e->key, @@ -1025,7 +866,7 @@ static void choose_encoder(OptionsContext *o, AVFormatContext *s, OutputStream * } } -static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type, int source_index) +static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); @@ -1033,7 +874,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; - int i; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); @@ -1092,16 +932,6 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e ost->max_frames = INT64_MAX; MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); - for (i = 0; inb_max_frames; i++) { - char *p = o->max_frames[i].specifier; - if (!*p && type != AVMEDIA_TYPE_VIDEO) { - av_log(NULL, AV_LOG_WARNING, "Applying unspecific -frames to non video streams, maybe you meant -vframes ?\n"); - break; - } - } - - ost->copy_prior_start = -1; - MATCH_PER_STREAM_OPT(copy_prior_start, i, ost->copy_prior_start, oc ,st); MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { @@ -1139,18 +969,9 @@ static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, e av_opt_get_int(o->g->sws_opts, "sws_flags", 0, &ost->sws_flags); - av_dict_copy(&ost->swr_opts, o->g->swr_opts, 0); - if (ost->enc && av_get_exact_bits_per_sample(ost->enc->id) == 24) - av_dict_set(&ost->swr_opts, "output_sample_bits", "24", 0); - av_dict_copy(&ost->resample_opts, o->g->resample_opts, 0); - ost->source_index = source_index; - if (source_index >= 0) { - ost->sync_ist = input_streams[source_index]; - input_streams[source_index]->discard = 0; - input_streams[source_index]->st->discard = AVDISCARD_NONE; - } + ost->pix_fmts[0] = ost->pix_fmts[1] = AV_PIX_FMT_NONE; ost->last_mux_dts = AV_NOPTS_VALUE; return ost; @@ -1206,97 +1027,68 @@ static char *get_ost_filters(OptionsContext *o, AVFormatContext *oc, OutputStream *ost) { AVStream *st = ost->st; + char *filter = NULL, *filter_script = NULL; - if (ost->filters_script && ost->filters) { + MATCH_PER_STREAM_OPT(filter_scripts, str, filter_script, oc, st); + MATCH_PER_STREAM_OPT(filters, str, filter, oc, st); + + if (filter_script && filter) { av_log(NULL, AV_LOG_ERROR, "Both -filter and -filter_script set for " "output stream #%d:%d.\n", nb_output_files, st->index); exit_program(1); } - if (ost->filters_script) - return read_file(ost->filters_script); - else if (ost->filters) - return av_strdup(ost->filters); + if (filter_script) + return read_file(filter_script); + else if (filter) + return av_strdup(filter); return av_strdup(st->codec->codec_type == AVMEDIA_TYPE_VIDEO ? "null" : "anull"); } -static void check_streamcopy_filters(OptionsContext *o, AVFormatContext *oc, - const OutputStream *ost, enum AVMediaType type) -{ - if (ost->filters_script || ost->filters) { - av_log(NULL, AV_LOG_ERROR, - "%s '%s' was defined for %s output stream %d:%d but codec copy was selected.\n" - "Filtering and streamcopy cannot be used together.\n", - ost->filters ? "Filtergraph" : "Filtergraph script", - ost->filters ? ost->filters : ost->filters_script, - av_get_media_type_string(type), ost->file_index, ost->index); - exit_program(1); - } -} - -static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index) +static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) { AVStream *st; OutputStream *ost; AVCodecContext *video_enc; - char *frame_rate = NULL, *frame_aspect_ratio = NULL; + char *frame_aspect_ratio = NULL; - ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); + ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO); st = ost->st; video_enc = st->codec; - MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); - if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); - exit_program(1); - } - MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st); - if (frame_aspect_ratio) { - AVRational q; - if (av_parse_ratio(&q, frame_aspect_ratio, 255, 0, NULL) < 0 || - q.num <= 0 || q.den <= 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid aspect ratio: %s\n", frame_aspect_ratio); - exit_program(1); - } - ost->frame_aspect_ratio = q; - } - - MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st); - MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); + if (frame_aspect_ratio) + ost->frame_aspect_ratio = parse_frame_aspect_ratio(frame_aspect_ratio); if (!ost->stream_copy) { const char *p = NULL; - char *frame_size = NULL; + char *frame_rate = NULL, *frame_size = NULL; char *frame_pix_fmt = NULL; char *intra_matrix = NULL, *inter_matrix = NULL; - char *chroma_intra_matrix = NULL; int do_pass = 0; int i; + MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); + if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { + av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); + exit_program(1); + } + MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st); if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) { av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size); exit_program(1); } - video_enc->bits_per_raw_sample = frame_bits_per_raw_sample; MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st); - if (frame_pix_fmt && *frame_pix_fmt == '+') { - ost->keep_pix_fmt = 1; - if (!*++frame_pix_fmt) - frame_pix_fmt = NULL; - } if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == AV_PIX_FMT_NONE) { av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt); exit_program(1); } st->sample_aspect_ratio = video_enc->sample_aspect_ratio; - if (intra_only) - video_enc->gop_size = 0; MATCH_PER_STREAM_OPT(intra_matrices, str, intra_matrix, oc, st); if (intra_matrix) { if (!(video_enc->intra_matrix = av_mallocz(sizeof(*video_enc->intra_matrix) * 64))) { @@ -1305,16 +1097,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in } parse_matrix_coeffs(video_enc->intra_matrix, intra_matrix); } - MATCH_PER_STREAM_OPT(chroma_intra_matrices, str, chroma_intra_matrix, oc, st); - if (chroma_intra_matrix) { - uint16_t *p = av_mallocz(sizeof(*video_enc->chroma_intra_matrix) * 64); - if (!p) { - av_log(NULL, AV_LOG_FATAL, "Could not allocate memory for intra matrix.\n"); - exit_program(1); - } - av_codec_set_chroma_intra_matrix(video_enc, p); - parse_matrix_coeffs(p, chroma_intra_matrix); - } MATCH_PER_STREAM_OPT(inter_matrices, str, inter_matrix, oc, st); if (inter_matrix) { if (!(video_enc->inter_matrix = av_mallocz(sizeof(*video_enc->inter_matrix) * 64))) { @@ -1332,7 +1114,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in av_log(NULL, AV_LOG_FATAL, "error parsing rc_override\n"); exit_program(1); } - /* FIXME realloc failure */ video_enc->rc_override = av_realloc(video_enc->rc_override, sizeof(RcOverride) * (i + 1)); @@ -1352,19 +1133,13 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in video_enc->rc_override_count = i; video_enc->intra_dc_precision = intra_dc_precision - 8; - if (do_psnr) - video_enc->flags|= CODEC_FLAG_PSNR; - /* two pass mode */ MATCH_PER_STREAM_OPT(pass, i, do_pass, oc, st); if (do_pass) { - if (do_pass & 1) { + if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; - av_dict_set(&ost->encoder_opts, "flags", "+pass1", AV_DICT_APPEND); - } - if (do_pass & 2) { + } else { video_enc->flags |= CODEC_FLAG_PASS2; - av_dict_set(&ost->encoder_opts, "flags", "+pass2", AV_DICT_APPEND); } } @@ -1390,28 +1165,21 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc ,st); } - if (ost->stream_copy) - check_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_VIDEO); - return ost; } -static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index) +static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc) { - int n; AVStream *st; OutputStream *ost; AVCodecContext *audio_enc; - ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index); + ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO); st = ost->st; audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; - MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st); - MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st); - if (!ost->stream_copy) { char *sample_fmt = NULL; @@ -1426,52 +1194,19 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, in MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); - MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); - ost->apad = av_strdup(ost->apad); - ost->avfilter = get_ost_filters(o, oc, ost); if (!ost->avfilter) exit_program(1); - - /* check for channel mapping for this audio stream */ - for (n = 0; n < o->nb_audio_channel_maps; n++) { - AudioChannelMap *map = &o->audio_channel_maps[n]; - if ((map->ofile_idx == -1 || ost->file_index == map->ofile_idx) && - (map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) { - InputStream *ist; - - if (map->channel_idx == -1) { - ist = NULL; - } else if (ost->source_index < 0) { - av_log(NULL, AV_LOG_FATAL, "Cannot determine input stream for channel mapping %d.%d\n", - ost->file_index, ost->st->index); - continue; - } else { - ist = input_streams[ost->source_index]; - } - - if (!ist || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) { - if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map)) - ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx; - else - av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n", - ost->file_index, ost->st->index); - } - } - } } - if (ost->stream_copy) - check_streamcopy_filters(o, oc, ost, AVMEDIA_TYPE_AUDIO); - return ost; } -static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int source_index) +static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc) { OutputStream *ost; - ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA, source_index); + ost = new_output_stream(o, oc, AVMEDIA_TYPE_DATA); if (!ost->stream_copy) { av_log(NULL, AV_LOG_FATAL, "Data stream encoding not supported yet (only streamcopy)\n"); exit_program(1); @@ -1480,38 +1215,26 @@ static OutputStream *new_data_stream(OptionsContext *o, AVFormatContext *oc, int return ost; } -static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc, int source_index) +static OutputStream *new_attachment_stream(OptionsContext *o, AVFormatContext *oc) { - OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT, source_index); + OutputStream *ost = new_output_stream(o, oc, AVMEDIA_TYPE_ATTACHMENT); ost->stream_copy = 1; ost->finished = 1; return ost; } -static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc, int source_index) +static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc) { AVStream *st; OutputStream *ost; AVCodecContext *subtitle_enc; - ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE, source_index); + ost = new_output_stream(o, oc, AVMEDIA_TYPE_SUBTITLE); st = ost->st; subtitle_enc = st->codec; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; - MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc, st); - - if (!ost->stream_copy) { - char *frame_size = NULL; - - MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st); - if (frame_size && av_parse_video_size(&subtitle_enc->width, &subtitle_enc->height, frame_size) < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size); - exit_program(1); - } - } - return ost; } @@ -1532,7 +1255,7 @@ static int opt_streamid(void *optctx, const char *opt, const char *arg) exit_program(1); } *p++ = '\0'; - idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); + idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; @@ -1545,7 +1268,7 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) AVChapter **tmp; int i; - tmp = av_realloc_f(os->chapters, is->nb_chapters + os->nb_chapters, sizeof(*os->chapters)); + tmp = av_realloc(os->chapters, sizeof(*os->chapters) * (is->nb_chapters + os->nb_chapters)); if (!tmp) return AVERROR(ENOMEM); os->chapters = tmp; @@ -1581,46 +1304,6 @@ static int copy_chapters(InputFile *ifile, OutputFile *ofile, int copy_metadata) return 0; } -static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const char *filename) -{ - int i, err; - AVFormatContext *ic = avformat_alloc_context(); - - ic->interrupt_callback = int_cb; - err = avformat_open_input(&ic, filename, NULL, NULL); - if (err < 0) - return err; - /* copy stream format */ - for(i=0;inb_streams;i++) { - AVStream *st; - OutputStream *ost; - AVCodec *codec; - AVCodecContext *avctx; - - codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id); - ost = new_output_stream(o, s, codec->type, -1); - st = ost->st; - avctx = st->codec; - ost->enc = codec; - - // FIXME: a more elegant solution is needed - memcpy(st, ic->streams[i], sizeof(AVStream)); - st->cur_dts = 0; - st->info = av_malloc(sizeof(*st->info)); - memcpy(st->info, ic->streams[i]->info, sizeof(*st->info)); - st->codec= avctx; - avcodec_copy_context(st->codec, ic->streams[i]->codec); - - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && !ost->stream_copy) - choose_sample_fmt(st, codec); - else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && !ost->stream_copy) - choose_pixel_fmt(st, codec, st->codec->pix_fmt); - } - - avformat_close_input(&ic); - return err; -} - static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, AVFormatContext *oc) { @@ -1628,8 +1311,8 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, switch (avfilter_pad_get_type(ofilter->out_tmp->filter_ctx->output_pads, ofilter->out_tmp->pad_idx)) { - case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc, -1); break; - case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc, -1); break; + case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; + case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; default: av_log(NULL, AV_LOG_FATAL, "Only video and audio filters are supported " "currently.\n"); @@ -1648,18 +1331,6 @@ static void init_output_filter(OutputFilter *ofilter, OptionsContext *o, exit_program(1); } - if (ost->avfilter && (ost->filters || ost->filters_script)) { - const char *opt = ost->filters ? "-vf/-af/-filter" : "-filter_script"; - av_log(NULL, AV_LOG_ERROR, - "%s '%s' was specified through the %s option " - "for output stream %d:%d, which is fed from a complex filtergraph.\n" - "%s and -filter_complex cannot be used together for the same stream.\n", - ost->filters ? "Filtergraph" : "Filtergraph script", - ost->filters ? ost->filters : ost->filters_script, - opt, ost->file_index, ost->index, opt); - exit_program(1); - } - if (configure_output_filter(ofilter->graph, ofilter, ofilter->out_tmp) < 0) { av_log(NULL, AV_LOG_FATAL, "Error configuring filter.\n"); exit_program(1); @@ -1694,21 +1365,6 @@ static int open_output_file(OptionsContext *o, const char *filename) exit_program(1); } - if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) { - o->stop_time = INT64_MAX; - av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; using -t.\n"); - } - - if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) { - int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : o->start_time; - if (o->stop_time <= start_time) { - av_log(NULL, AV_LOG_WARNING, "-to value smaller than -ss; ignoring -to.\n"); - o->stop_time = INT64_MAX; - } else { - o->recording_time = o->stop_time - start_time; - } - } - GROW_ARRAY(output_files, nb_output_files); of = av_mallocz(sizeof(*of)); if (!of) @@ -1725,18 +1381,33 @@ static int open_output_file(OptionsContext *o, const char *filename) if (!strcmp(filename, "-")) filename = "pipe:"; - err = avformat_alloc_output_context2(&oc, NULL, o->format, filename); + oc = avformat_alloc_context(); if (!oc) { - print_error(filename, err); + print_error(filename, AVERROR(ENOMEM)); exit_program(1); } - of->ctx = oc; if (o->recording_time != INT64_MAX) oc->duration = o->recording_time; - file_oformat= oc->oformat; + if (o->format) { + file_oformat = av_guess_format(o->format, NULL, NULL); + if (!file_oformat) { + av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); + exit_program(1); + } + } else { + file_oformat = av_guess_format(NULL, filename, NULL); + if (!file_oformat) { + av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n", + filename); + exit_program(1); + } + } + + oc->oformat = file_oformat; oc->interrupt_callback = int_cb; + av_strlcpy(oc->filename, filename, sizeof(oc->filename)); /* create streams for all unlabeled output pads */ for (i = 0; i < nb_filtergraphs; i++) { @@ -1757,69 +1428,29 @@ static int open_output_file(OptionsContext *o, const char *filename) } } - /* ffserver seeking with date=... needs a date reference */ - if (!strcmp(file_oformat->name, "ffm") && - av_strstart(filename, "http:", NULL)) { - int err = parse_option(o, "metadata", "creation_time=now", options); - if (err < 0) { - print_error(filename, err); - exit_program(1); - } - } - - if (!strcmp(file_oformat->name, "ffm") && !override_ffserver && - av_strstart(filename, "http:", NULL)) { - int j; - /* special case for files sent to ffserver: we get the stream - parameters from ffserver */ - int err = read_ffserver_streams(o, oc, filename); - if (err < 0) { - print_error(filename, err); - exit_program(1); - } - for(j = nb_output_streams - oc->nb_streams; j < nb_output_streams; j++) { - ost = output_streams[j]; - for (i = 0; i < nb_input_streams; i++) { - ist = input_streams[i]; - if(ist->st->codec->codec_type == ost->st->codec->codec_type){ - ost->sync_ist= ist; - ost->source_index= i; - if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) ost->avfilter = av_strdup("anull"); - if(ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) ost->avfilter = av_strdup("null"); - ist->discard = 0; - ist->st->discard = AVDISCARD_NONE; - break; - } - } - if(!ost->sync_ist){ - av_log(NULL, AV_LOG_FATAL, "Missing %s stream which is required by this ffm\n", av_get_media_type_string(ost->st->codec->codec_type)); - exit_program(1); - } - } - } else if (!o->nb_stream_maps) { - char *subtitle_codec_name = NULL; + if (!o->nb_stream_maps) { /* pick the "best" stream of each type */ +#define NEW_STREAM(type, index)\ + if (index >= 0) {\ + ost = new_ ## type ## _stream(o, oc);\ + ost->source_index = index;\ + ost->sync_ist = input_streams[index];\ + input_streams[index]->discard = 0;\ + input_streams[index]->st->discard = AVDISCARD_NONE;\ + } /* video: highest resolution */ if (!o->video_disable && oc->oformat->video_codec != AV_CODEC_ID_NONE) { int area = 0, idx = -1; - int qcr = avformat_query_codec(oc->oformat, oc->oformat->video_codec, 0); for (i = 0; i < nb_input_streams; i++) { - int new_area; ist = input_streams[i]; - new_area = ist->st->codec->width * ist->st->codec->height; - if((qcr!=MKTAG('A', 'P', 'I', 'C')) && (ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) - new_area = 1; if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && - new_area > area) { - if((qcr==MKTAG('A', 'P', 'I', 'C')) && !(ist->st->disposition & AV_DISPOSITION_ATTACHED_PIC)) - continue; - area = new_area; + ist->st->codec->width * ist->st->codec->height > area) { + area = ist->st->codec->width * ist->st->codec->height; idx = i; } } - if (idx >= 0) - new_video_stream(o, oc, idx); + NEW_STREAM(video, idx); } /* audio: most channels */ @@ -1833,16 +1464,14 @@ static int open_output_file(OptionsContext *o, const char *filename) idx = i; } } - if (idx >= 0) - new_audio_stream(o, oc, idx); + NEW_STREAM(audio, idx); } /* subtitles: pick first */ - MATCH_PER_TYPE_OPT(codec_names, str, subtitle_codec_name, oc, "s"); - if (!o->subtitle_disable && (avcodec_find_encoder(oc->oformat->subtitle_codec) || subtitle_codec_name)) { + if (!o->subtitle_disable && oc->oformat->subtitle_codec != AV_CODEC_ID_NONE) { for (i = 0; i < nb_input_streams; i++) if (input_streams[i]->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { - new_subtitle_stream(o, oc, i); + NEW_STREAM(subtitle, i); break; } } @@ -1872,34 +1501,29 @@ static int open_output_file(OptionsContext *o, const char *filename) loop_end: if (!ofilter) { av_log(NULL, AV_LOG_FATAL, "Output with label '%s' does not exist " - "in any defined filter graph, or was already used elsewhere.\n", map->linklabel); + "in any defined filter graph.\n", map->linklabel); exit_program(1); } init_output_filter(ofilter, o, oc); } else { - int src_idx = input_files[map->file_index]->ist_index + map->stream_index; - ist = input_streams[input_files[map->file_index]->ist_index + map->stream_index]; - if(o->subtitle_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) - continue; - if(o-> audio_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - continue; - if(o-> video_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - continue; - if(o-> data_disable && ist->st->codec->codec_type == AVMEDIA_TYPE_DATA) - continue; - switch (ist->st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: ost = new_video_stream (o, oc, src_idx); break; - case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream (o, oc, src_idx); break; - case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream (o, oc, src_idx); break; - case AVMEDIA_TYPE_DATA: ost = new_data_stream (o, oc, src_idx); break; - case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc, src_idx); break; + case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; + case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; + case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break; + case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break; + case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break; default: av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", map->file_index, map->stream_index); exit_program(1); } + + ost->source_index = input_files[map->file_index]->ist_index + map->stream_index; + ost->sync_ist = input_streams[input_files[map->sync_file_index]->ist_index + + map->sync_stream_index]; + ist->discard = 0; + ist->st->discard = AVDISCARD_NONE; } } } @@ -1928,10 +1552,10 @@ loop_end: } avio_read(pb, attachment, len); - ost = new_attachment_stream(o, oc, -1); + ost = new_attachment_stream(o, oc); ost->stream_copy = 0; + ost->source_index = -1; ost->attachment_filename = o->attachments[i]; - ost->finished = 1; ost->st->codec->extradata = attachment; ost->st->codec->extradata_size = len; @@ -1940,17 +1564,6 @@ loop_end: avio_close(pb); } - for (i = nb_output_streams - oc->nb_streams; i < nb_output_streams; i++) { //for all streams of this output file - AVDictionaryEntry *e; - ost = output_streams[i]; - - if ((ost->stream_copy || ost->attachment_filename) - && (e = av_dict_get(o->g->codec_opts, "flags", NULL, AV_DICT_IGNORE_SUFFIX)) - && (!e->key[5] || check_stream_specifier(oc, ost->st, e->key+6))) - if (av_opt_set(ost->st->codec, "flags", e->value, 0) < 0) - exit_program(1); - } - /* check if all codec options have been used */ unused_opts = strip_specifiers(o->g->codec_opts); for (i = of->ost_index; i < nb_output_streams; i++) { @@ -1975,10 +1588,6 @@ loop_end: exit_program(1); } - // gop_timecode is injected by generic code but not always used - if (!strcmp(e->key, "gop_timecode")) - continue; - av_log(NULL, AV_LOG_WARNING, "Codec AVOption %s (%s) specified for " "output file #%d (%s) has not been used for any stream. The most " "likely reason is either wrong type (e.g. a video option with " @@ -2007,8 +1616,7 @@ loop_end: print_error(filename, err); exit_program(1); } - } else if (strcmp(oc->oformat->name, "image2")==0 && !av_filename_number_test(filename)) - assert_file_overwrite(filename); + } if (o->mux_preload) { uint8_t buf[64]; @@ -2016,6 +1624,7 @@ loop_end: av_dict_set(&of->opts, "preload", buf, 0); } oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE); + oc->flags |= AVFMT_FLAG_NONBLOCK; /* copy metadata */ for (i = 0; i < o->nb_metadata_map; i++) { @@ -2052,13 +1661,9 @@ loop_end: !o->metadata_chapters_manual); /* copy global metadata by default */ - if (!o->metadata_global_manual && nb_input_files){ + if (!o->metadata_global_manual && nb_input_files) av_dict_copy(&oc->metadata, input_files[0]->ctx->metadata, AV_DICT_DONT_OVERWRITE); - if(o->recording_time != INT64_MAX) - av_dict_set(&oc->metadata, "duration", NULL, 0); - av_dict_set(&oc->metadata, "creation_time", NULL, 0); - } if (!o->metadata_streams_manual) for (i = of->ost_index; i < nb_output_streams; i++) { InputStream *ist; @@ -2066,8 +1671,6 @@ loop_end: continue; ist = input_streams[output_streams[i]->source_index]; av_dict_copy(&output_streams[i]->st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); - if (!output_streams[i]->stream_copy) - av_dict_set(&output_streams[i]->st->metadata, "encoder", NULL, 0); } /* process manually set metadata */ @@ -2075,7 +1678,7 @@ loop_end: AVDictionary **m; char type, *val; const char *stream_spec; - int index = 0, j, ret = 0; + int index = 0, j, ret; val = strchr(o->metadata[i].u.str, '='); if (!val) { @@ -2172,19 +1775,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options); parse_option(o, "r", frame_rates[norm], options); - av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - av_dict_set(&o->g->codec_opts, "b:v", "1150000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "maxrate", "1150000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "minrate", "1150000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "bufsize", "327680", AV_DICT_DONT_OVERWRITE); // 40*1024*8; + opt_default(NULL, "b", "1150000"); + opt_default(NULL, "maxrate", "1150000"); + opt_default(NULL, "minrate", "1150000"); + opt_default(NULL, "bufsize", "327680"); // 40*1024*8; - av_dict_set(&o->g->codec_opts, "b:a", "224000", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "b:a", "224000"); parse_option(o, "ar", "44100", options); parse_option(o, "ac", "2", options); - av_dict_set(&o->g->format_opts, "packetsize", "2324", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->format_opts, "muxrate", "1411200", AV_DICT_DONT_OVERWRITE); // 2352 * 75 * 8; + opt_default(NULL, "packetsize", "2324"); + opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8; /* We have to offset the PTS, so that it is consistent with the SCR. SCR starts at 36000, but the first two packs contain only padding @@ -2200,19 +1803,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options); parse_option(o, "r", frame_rates[norm], options); - parse_option(o, "pix_fmt", "yuv420p", options); - av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - av_dict_set(&o->g->codec_opts, "b:v", "2040000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "maxrate", "2516000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "minrate", "0", AV_DICT_DONT_OVERWRITE); // 1145000; - av_dict_set(&o->g->codec_opts, "bufsize", "1835008", AV_DICT_DONT_OVERWRITE); // 224*1024*8; - av_dict_set(&o->g->codec_opts, "scan_offset", "1", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "b", "2040000"); + opt_default(NULL, "maxrate", "2516000"); + opt_default(NULL, "minrate", "0"); // 1145000; + opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; + opt_default(NULL, "flags", "+scan_offset"); - av_dict_set(&o->g->codec_opts, "b:a", "224000", AV_DICT_DONT_OVERWRITE); + + opt_default(NULL, "b:a", "224000"); parse_option(o, "ar", "44100", options); - av_dict_set(&o->g->format_opts, "packetsize", "2324", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "packetsize", "2324"); } else if (!strcmp(arg, "dvd")) { @@ -2222,18 +1825,17 @@ static int opt_target(void *optctx, const char *opt, const char *arg) parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); parse_option(o, "r", frame_rates[norm], options); - parse_option(o, "pix_fmt", "yuv420p", options); - av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "g", norm == PAL ? "15" : "18"); - av_dict_set(&o->g->codec_opts, "b:v", "6000000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "maxrate", "9000000", AV_DICT_DONT_OVERWRITE); - av_dict_set(&o->g->codec_opts, "minrate", "0", AV_DICT_DONT_OVERWRITE); // 1500000; - av_dict_set(&o->g->codec_opts, "bufsize", "1835008", AV_DICT_DONT_OVERWRITE); // 224*1024*8; + opt_default(NULL, "b", "6000000"); + opt_default(NULL, "maxrate", "9000000"); + opt_default(NULL, "minrate", "0"); // 1500000; + opt_default(NULL, "bufsize", "1835008"); // 224*1024*8; - av_dict_set(&o->g->format_opts, "packetsize", "2048", AV_DICT_DONT_OVERWRITE); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. - av_dict_set(&o->g->format_opts, "muxrate", "10080000", AV_DICT_DONT_OVERWRITE); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 + opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack. + opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8 - av_dict_set(&o->g->codec_opts, "b:a", "448000", AV_DICT_DONT_OVERWRITE); + opt_default(NULL, "b:a", "448000"); parse_option(o, "ar", "48000", options); } else if (!strncmp(arg, "dv", 2)) { @@ -2291,120 +1893,22 @@ static int opt_data_frames(void *optctx, const char *opt, const char *arg) return parse_option(o, "frames:d", arg, options); } -static int opt_default_new(OptionsContext *o, const char *opt, const char *arg) -{ - int ret; - AVDictionary *cbak = codec_opts; - AVDictionary *fbak = format_opts; - codec_opts = NULL; - format_opts = NULL; - - ret = opt_default(NULL, opt, arg); - - av_dict_copy(&o->g->codec_opts , codec_opts, 0); - av_dict_copy(&o->g->format_opts, format_opts, 0); - av_dict_free(&codec_opts); - av_dict_free(&format_opts); - codec_opts = cbak; - format_opts = fbak; - - return ret; -} - -static int opt_preset(void *optctx, const char *opt, const char *arg) +static int opt_video_tag(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; - FILE *f=NULL; - char filename[1000], line[1000], tmp_line[1000]; - const char *codec_name = NULL; - - tmp_line[0] = *opt; - tmp_line[1] = 0; - MATCH_PER_TYPE_OPT(codec_names, str, codec_name, NULL, tmp_line); - - if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { - if(!strncmp(arg, "libx264-lossless", strlen("libx264-lossless"))){ - av_log(NULL, AV_LOG_FATAL, "Please use -preset -qp 0\n"); - }else - av_log(NULL, AV_LOG_FATAL, "File for preset '%s' not found\n", arg); - exit_program(1); - } - - while (fgets(line, sizeof(line), f)) { - char *key = tmp_line, *value, *endptr; - - if (strcspn(line, "#\n\r") == 0) - continue; - av_strlcpy(tmp_line, line, sizeof(tmp_line)); - if (!av_strtok(key, "=", &value) || - !av_strtok(value, "\r\n", &endptr)) { - av_log(NULL, AV_LOG_FATAL, "%s: Invalid syntax: '%s'\n", filename, line); - exit_program(1); - } - av_log(NULL, AV_LOG_DEBUG, "ffpreset[%s]: set '%s' = '%s'\n", filename, key, value); - - if (!strcmp(key, "acodec")) opt_audio_codec (o, key, value); - else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value); - else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value); - else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value); - else if (opt_default_new(o, key, value) < 0) { - av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", - filename, line, key, value); - exit_program(1); - } - } - - fclose(f); - - return 0; + return parse_option(o, "tag:v", arg, options); } -static int opt_old2new(void *optctx, const char *opt, const char *arg) +static int opt_audio_tag(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; - char *s = av_asprintf("%s:%c", opt + 1, *opt); - int ret = parse_option(o, s, arg, options); - av_free(s); - return ret; + return parse_option(o, "tag:a", arg, options); } -static int opt_bitrate(void *optctx, const char *opt, const char *arg) +static int opt_subtitle_tag(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; - if(!strcmp(opt, "b")){ - av_log(NULL, AV_LOG_WARNING, "Please use -b:a or -b:v, -b is ambiguous\n"); - av_dict_set(&o->g->codec_opts, "b:v", arg, 0); - return 0; - } - av_dict_set(&o->g->codec_opts, opt, arg, 0); - return 0; -} - -static int opt_qscale(void *optctx, const char *opt, const char *arg) -{ - OptionsContext *o = optctx; - char *s; - int ret; - if(!strcmp(opt, "qscale")){ - av_log(NULL, AV_LOG_WARNING, "Please use -q:a or -q:v, -qscale is ambiguous\n"); - return parse_option(o, "q:v", arg, options); - } - s = av_asprintf("q%s", opt + 6); - ret = parse_option(o, s, arg, options); - av_free(s); - return ret; -} - -static int opt_profile(void *optctx, const char *opt, const char *arg) -{ - OptionsContext *o = optctx; - if(!strcmp(opt, "profile")){ - av_log(NULL, AV_LOG_WARNING, "Please use -profile:a or -profile:v, -profile is ambiguous\n"); - av_dict_set(&o->g->codec_opts, "profile:v", arg, 0); - return 0; - } - av_dict_set(&o->g->codec_opts, opt, arg, 0); - return 0; + return parse_option(o, "tag:s", arg, options); } static int opt_video_filters(void *optctx, const char *opt, const char *arg) @@ -2424,24 +1928,12 @@ static int opt_vsync(void *optctx, const char *opt, const char *arg) if (!av_strcasecmp(arg, "cfr")) video_sync_method = VSYNC_CFR; else if (!av_strcasecmp(arg, "vfr")) video_sync_method = VSYNC_VFR; else if (!av_strcasecmp(arg, "passthrough")) video_sync_method = VSYNC_PASSTHROUGH; - else if (!av_strcasecmp(arg, "drop")) video_sync_method = VSYNC_DROP; if (video_sync_method == VSYNC_AUTO) video_sync_method = parse_number_or_die("vsync", arg, OPT_INT, VSYNC_AUTO, VSYNC_VFR); return 0; } -static int opt_timecode(void *optctx, const char *opt, const char *arg) -{ - OptionsContext *o = optctx; - char *tcr = av_asprintf("timecode=%s", arg); - int ret = parse_option(o, "metadata:g", tcr, options); - if (ret >= 0) - ret = av_dict_set(&o->g->codec_opts, "gop_timecode", arg, 0); - av_free(tcr); - return 0; -} - static int opt_channel_layout(void *optctx, const char *opt, const char *arg) { OptionsContext *o = optctx; @@ -2457,7 +1949,7 @@ static int opt_channel_layout(void *optctx, const char *opt, const char *arg) return AVERROR(EINVAL); } snprintf(layout_str, sizeof(layout_str), "%"PRIu64, layout); - ret = opt_default_new(o, opt, layout_str); + ret = opt_default(NULL, opt, layout_str); if (ret < 0) return ret; @@ -2570,19 +2062,16 @@ void show_help_default(const char *opt, const char *arg) int flags = AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_ENCODING_PARAM; show_help_children(avcodec_get_class(), flags); show_help_children(avformat_get_class(), flags); -#if CONFIG_SWSCALE show_help_children(sws_get_class(), flags); -#endif - show_help_children(swr_get_class(), AV_OPT_FLAG_AUDIO_PARAM); - show_help_children(avfilter_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_FILTERING_PARAM); + show_help_children(avfilter_get_class(), AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM); } } void show_usage(void) { - av_log(NULL, AV_LOG_INFO, "Hyper fast Audio and Video encoder\n"); - av_log(NULL, AV_LOG_INFO, "usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name); - av_log(NULL, AV_LOG_INFO, "\n"); + printf("Hyper fast Audio and Video encoder\n"); + printf("usage: %s [options] [[infile options] -i infile]... {[outfile options] outfile}...\n", program_name); + printf("\n"); } enum OptGroup { @@ -2628,7 +2117,7 @@ static int open_files(OptionGroupList *l, const char *inout, return 0; } -int ffmpeg_parse_options(int argc, char **argv) +int avconv_parse_options(int argc, char **argv) { OptionParseContext octx; uint8_t error[128]; @@ -2674,23 +2163,6 @@ fail: return ret; } -static int opt_progress(void *optctx, const char *opt, const char *arg) -{ - AVIOContext *avio = NULL; - int ret; - - if (!strcmp(arg, "-")) - arg = "pipe:"; - ret = avio_open2(&avio, arg, AVIO_FLAG_WRITE, &int_cb, NULL); - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Failed to open progress URL \"%s\": %s\n", - arg, av_err2str(ret)); - return ret; - } - progress_avio = avio; - return 0; -} - #define OFFSET(x) offsetof(OptionsContext, x) const OptionDef options[] = { /* main options */ @@ -2700,7 +2172,7 @@ const OptionDef options[] = { "force format", "fmt" }, { "y", OPT_BOOL, { &file_overwrite }, "overwrite output files" }, - { "n", OPT_BOOL, { &no_file_overwrite }, + { "n", OPT_BOOL, { &file_skip }, "never overwrite output files" }, { "c", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(codec_names) }, @@ -2715,8 +2187,6 @@ const OptionDef options[] = { OPT_OUTPUT, { .func_arg = opt_map }, "set input stream mapping", "[-]input_file_id[:stream_specifier][,sync_file_id[:stream_specifier]]" }, - { "map_channel", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_map_channel }, - "map an audio channel from one stream to another", "file.stream.channel[:syncfile.syncstream]" }, { "map_metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata_map) }, "set metadata information of outfile from infile", @@ -2728,8 +2198,6 @@ const OptionDef options[] = { OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(recording_time) }, "record or transcode \"duration\" seconds of audio/video", "duration" }, - { "to", HAS_ARG | OPT_TIME | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(stop_time) }, - "record or transcode stop time", "time_stop" }, { "fs", HAS_ARG | OPT_INT64 | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(limit_filesize) }, "set the limit file size in bytes", "limit_size" }, { "ss", HAS_ARG | OPT_TIME | OPT_OFFSET | @@ -2744,8 +2212,6 @@ const OptionDef options[] = { { "itsscale", HAS_ARG | OPT_DOUBLE | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(ts_scale) }, "set the input ts scale", "scale" }, - { "timestamp", HAS_ARG | OPT_PERFILE, { .func_arg = opt_recording_timestamp }, - "set the recording timestamp ('now' to set the current time)", "time" }, { "metadata", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(metadata) }, "add metadata", "string=string" }, { "dframes", HAS_ARG | OPT_PERFILE | OPT_EXPERT | @@ -2753,12 +2219,6 @@ const OptionDef options[] = { "set the number of data frames to record", "number" }, { "benchmark", OPT_BOOL | OPT_EXPERT, { &do_benchmark }, "add timings for benchmarking" }, - { "benchmark_all", OPT_BOOL | OPT_EXPERT, { &do_benchmark_all }, - "add timings for each task" }, - { "progress", HAS_ARG | OPT_EXPERT, { .func_arg = opt_progress }, - "write program-readable progress information", "url" }, - { "stdin", OPT_BOOL | OPT_EXPERT, { &stdin_interaction }, - "enable or disable interaction on standard input" }, { "timelimit", HAS_ARG | OPT_EXPERT, { .func_arg = opt_timelimit }, "set max runtime in seconds", "limit" }, { "dump", OPT_BOOL | OPT_EXPERT, { &do_pkt_dump }, @@ -2779,25 +2239,18 @@ const OptionDef options[] = { "audio drift threshold", "threshold" }, { "copyts", OPT_BOOL | OPT_EXPERT, { ©_ts }, "copy timestamps" }, - { "copytb", HAS_ARG | OPT_INT | OPT_EXPERT, { ©_tb }, - "copy input stream time base when stream copying", "mode" }, + { "copytb", OPT_BOOL | OPT_EXPERT, { ©_tb }, + "copy input stream time base when stream copying" }, { "shortest", OPT_BOOL | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(shortest) }, "finish encoding within shortest input" }, - { "apad", OPT_STRING | HAS_ARG | OPT_SPEC | - OPT_OUTPUT, { .off = OFFSET(apad) }, - "audio pad", "" }, { "dts_delta_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_delta_threshold }, "timestamp discontinuity delta threshold", "threshold" }, - { "dts_error_threshold", HAS_ARG | OPT_FLOAT | OPT_EXPERT, { &dts_error_threshold }, - "timestamp error delta threshold", "threshold" }, { "xerror", OPT_BOOL | OPT_EXPERT, { &exit_on_error }, "exit on error", "error" }, { "copyinkf", OPT_BOOL | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_initial_nonkeyframes) }, "copy initial non-keyframes" }, - { "copypriorss", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(copy_prior_start) }, - "copy or discard frames before start time" }, { "frames", OPT_INT64 | HAS_ARG | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(max_frames) }, "set the number of frames to record", "number" }, { "tag", OPT_STRING | HAS_ARG | OPT_SPEC | @@ -2806,21 +2259,15 @@ const OptionDef options[] = { { "q", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) }, "use fixed quality scale (VBR)", "q" }, - { "qscale", HAS_ARG | OPT_EXPERT | OPT_PERFILE | - OPT_OUTPUT, { .func_arg = opt_qscale }, + { "qscale", HAS_ARG | OPT_EXPERT | OPT_DOUBLE | + OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(qscale) }, "use fixed quality scale (VBR)", "q" }, - { "profile", HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_profile }, - "set profile", "profile" }, { "filter", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filters) }, - "set stream filtergraph", "filter_graph" }, + "set stream filterchain", "filter_list" }, { "filter_script", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(filter_scripts) }, "read stream filtergraph description from a file", "filename" }, - { "reinit_filter", HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(reinit_filters) }, - "reinit filtergraph on input parameter changes", "" }, { "filter_complex", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, "create a complex filtergraph", "graph_description" }, - { "lavfi", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex }, - "create a complex filtergraph", "graph_description" }, { "filter_complex_script", HAS_ARG | OPT_EXPERT, { .func_arg = opt_filter_complex_script }, "read complex filtergraph description from a file", "filename" }, { "stats", OPT_BOOL, { &print_stats }, @@ -2831,10 +2278,6 @@ const OptionDef options[] = { { "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(dump_attachment) }, "extract an attachment into a file", "filename" }, - { "debug_ts", OPT_BOOL | OPT_EXPERT, { &debug_ts }, - "print timestamp debugging info" }, - { "max_error_rate", HAS_ARG | OPT_FLOAT, { &max_error_rate }, - "maximum error rate", "ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success." }, /* video options */ { "vframes", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_frames }, @@ -2842,7 +2285,7 @@ const OptionDef options[] = { { "r", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_rates) }, "set frame rate (Hz value, fraction or abbreviation)", "rate" }, - { "s", OPT_VIDEO | HAS_ARG | OPT_SUBTITLE | OPT_STRING | OPT_SPEC | + { "s", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_sizes) }, "set frame size (WxH or abbreviation)", "size" }, { "aspect", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_SPEC | @@ -2851,11 +2294,7 @@ const OptionDef options[] = { { "pix_fmt", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(frame_pix_fmts) }, "set pixel format", "format" }, - { "bits_per_raw_sample", OPT_VIDEO | OPT_INT | HAS_ARG, { &frame_bits_per_raw_sample }, - "set the number of bits per raw sample", "number" }, - { "intra", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &intra_only }, - "deprecated use -g 1" }, - { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(video_disable) }, + { "vn", OPT_VIDEO | OPT_BOOL | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(video_disable) }, "disable video" }, { "vdt", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &video_discard }, "discard threshold", "n" }, @@ -2865,43 +2304,30 @@ const OptionDef options[] = { { "vcodec", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_video_codec }, "force video codec ('copy' to copy stream)", "codec" }, - { "sameq", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_sameq }, - "Removed" }, - { "same_quant", OPT_VIDEO | OPT_EXPERT , { .func_arg = opt_sameq }, - "Removed" }, - { "timecode", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_timecode }, - "set initial TimeCode value.", "hh:mm:ss[:;.]ff" }, { "pass", OPT_VIDEO | HAS_ARG | OPT_SPEC | OPT_INT | OPT_OUTPUT, { .off = OFFSET(pass) }, - "select the pass number (1 to 3)", "n" }, + "select the pass number (1 or 2)", "n" }, { "passlogfile", OPT_VIDEO | HAS_ARG | OPT_STRING | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(passlogfiles) }, "select two pass log file name prefix", "prefix" }, - { "deinterlace", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_deinterlace }, - "this option is deprecated, use the yadif filter instead" }, - { "psnr", OPT_VIDEO | OPT_BOOL | OPT_EXPERT, { &do_psnr }, - "calculate PSNR of compressed frames" }, { "vstats", OPT_VIDEO | OPT_EXPERT , { &opt_vstats }, "dump video coding statistics to file" }, { "vstats_file", OPT_VIDEO | HAS_ARG | OPT_EXPERT , { opt_vstats_file }, "dump video coding statistics to file", "file" }, { "vf", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_video_filters }, - "set video filters", "filter_graph" }, + "video filters", "filter list" }, { "intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(intra_matrices) }, "specify intra matrix coeffs", "matrix" }, { "inter_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(inter_matrices) }, "specify inter matrix coeffs", "matrix" }, - { "chroma_intra_matrix", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_STRING | OPT_SPEC | - OPT_OUTPUT, { .off = OFFSET(chroma_intra_matrices) }, - "specify intra matrix coeffs", "matrix" }, { "top", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_INT| OPT_SPEC | - OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(top_field_first) }, + OPT_OUTPUT, { .off = OFFSET(top_field_first) }, "top=1/bottom=0/auto=-1 field first", "" }, { "dc", OPT_VIDEO | OPT_INT | HAS_ARG | OPT_EXPERT , { &intra_dc_precision }, "intra_dc_precision", "precision" }, { "vtag", OPT_VIDEO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | - OPT_OUTPUT, { .func_arg = opt_old2new }, + OPT_OUTPUT, { .func_arg = opt_video_tag }, "force video tag/fourcc", "fourcc/tag" }, { "qphist", OPT_VIDEO | OPT_BOOL | OPT_EXPERT , { &qp_hist }, "show QP histogram" }, @@ -2914,8 +2340,6 @@ const OptionDef options[] = { { "force_key_frames", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_OUTPUT, { .off = OFFSET(forced_key_frames) }, "force key frames at specified timestamps", "timestamps" }, - { "b", OPT_VIDEO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_bitrate }, - "video bitrate (please use -b:v)", "bitrate" }, { "hwaccel", OPT_VIDEO | OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_SPEC | OPT_INPUT, { .off = OFFSET(hwaccels) }, "use HW accelerated decoding", "hwaccel name" }, @@ -2934,13 +2358,13 @@ const OptionDef options[] = { { "ac", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(audio_channels) }, "set number of audio channels", "channels" }, - { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT,{ .off = OFFSET(audio_disable) }, + { "an", OPT_AUDIO | OPT_BOOL | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(audio_disable) }, "disable audio" }, { "acodec", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_audio_codec }, "force audio codec ('copy' to copy stream)", "codec" }, { "atag", OPT_AUDIO | HAS_ARG | OPT_EXPERT | OPT_PERFILE | - OPT_OUTPUT, { .func_arg = opt_old2new }, + OPT_OUTPUT, { .func_arg = opt_audio_tag }, "force audio tag/fourcc", "fourcc/tag" }, { "vol", OPT_AUDIO | HAS_ARG | OPT_INT, { &audio_volume }, "change audio volume (256=normal)" , "volume" }, @@ -2951,27 +2375,17 @@ const OptionDef options[] = { OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_channel_layout }, "set channel layout", "layout" }, { "af", OPT_AUDIO | HAS_ARG | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_audio_filters }, - "set audio filters", "filter_graph" }, - { "guess_layout_max", OPT_AUDIO | HAS_ARG | OPT_INT | OPT_SPEC | OPT_EXPERT | OPT_INPUT, { .off = OFFSET(guess_layout_max) }, - "set the maximum number of channels to try to guess the channel layout" }, + "audio filters", "filter list" }, /* subtitle options */ - { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(subtitle_disable) }, + { "sn", OPT_SUBTITLE | OPT_BOOL | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(subtitle_disable) }, "disable subtitle" }, { "scodec", OPT_SUBTITLE | HAS_ARG | OPT_PERFILE | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_subtitle_codec }, "force subtitle codec ('copy' to copy stream)", "codec" }, - { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new } + { "stag", OPT_SUBTITLE | HAS_ARG | OPT_EXPERT | OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_subtitle_tag } , "force subtitle tag/fourcc", "fourcc/tag" }, - { "fix_sub_duration", OPT_BOOL | OPT_EXPERT | OPT_SUBTITLE | OPT_SPEC | OPT_INPUT, { .off = OFFSET(fix_sub_duration) }, - "fix subtitles duration" }, - { "canvas_size", OPT_SUBTITLE | HAS_ARG | OPT_STRING | OPT_SPEC | OPT_INPUT, { .off = OFFSET(canvas_sizes) }, - "set canvas size (WxH or abbreviation)", "size" }, /* grab options */ - { "vc", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_channel }, - "deprecated, use -channel", "channel" }, - { "tvstd", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_video_standard }, - "deprecated, use -standard", "standard" }, { "isync", OPT_BOOL | OPT_EXPERT, { &input_sync }, "this option is deprecated and does nothing", "" }, /* muxer options */ @@ -2979,29 +2393,13 @@ const OptionDef options[] = { "set the maximum demux-decode delay", "seconds" }, { "muxpreload", OPT_FLOAT | HAS_ARG | OPT_EXPERT | OPT_OFFSET | OPT_OUTPUT, { .off = OFFSET(mux_preload) }, "set the initial demux-decode delay", "seconds" }, - { "override_ffserver", OPT_BOOL | OPT_EXPERT | OPT_OUTPUT, { &override_ffserver }, - "override the options from ffserver", "" }, { "bsf", HAS_ARG | OPT_STRING | OPT_SPEC | OPT_EXPERT | OPT_OUTPUT, { .off = OFFSET(bitstream_filters) }, "A comma-separated list of bitstream filters", "bitstream_filters" }, - { "absf", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }, - "deprecated", "audio bitstream_filters" }, - { "vbsf", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_old2new }, - "deprecated", "video bitstream_filters" }, - { "apre", HAS_ARG | OPT_AUDIO | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, - "set the audio options to the indicated preset", "preset" }, - { "vpre", OPT_VIDEO | HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, - "set the video options to the indicated preset", "preset" }, - { "spre", HAS_ARG | OPT_SUBTITLE | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, - "set the subtitle options to the indicated preset", "preset" }, - { "fpre", HAS_ARG | OPT_EXPERT| OPT_PERFILE | OPT_OUTPUT, { .func_arg = opt_preset }, - "set options from indicated preset file", "filename" }, /* data codec support */ { "dcodec", HAS_ARG | OPT_DATA | OPT_PERFILE | OPT_EXPERT | OPT_INPUT | OPT_OUTPUT, { .func_arg = opt_data_codec }, "force data codec ('copy' to copy stream)", "codec" }, - { "dn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET | OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(data_disable) }, - "disable data" }, { NULL, }, }; diff --git a/ffmpeg_vda.c b/avconv_vda.c similarity index 93% rename from ffmpeg_vda.c rename to avconv_vda.c index b9f0975f55..40f87c4f76 100644 --- a/ffmpeg_vda.c +++ b/avconv_vda.c @@ -1,18 +1,18 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -20,7 +20,7 @@ #include "libavcodec/vda.h" #include "libavutil/imgutils.h" -#include "ffmpeg.h" +#include "avconv.h" typedef struct VDAContext { AVFrame *tmp_frame; diff --git a/ffmpeg_vdpau.c b/avconv_vdpau.c similarity index 97% rename from ffmpeg_vdpau.c rename to avconv_vdpau.c index fe0930695e..820678e36a 100644 --- a/ffmpeg_vdpau.c +++ b/avconv_vdpau.c @@ -1,18 +1,18 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -23,7 +23,7 @@ #include -#include "ffmpeg.h" +#include "avconv.h" #include "libavcodec/vdpau.h" diff --git a/avplay.c b/avplay.c new file mode 100644 index 0000000000..b70ee54c7b --- /dev/null +++ b/avplay.c @@ -0,0 +1,3001 @@ +/* + * avplay : Simple Media Player based on the Libav libraries + * Copyright (c) 2003 Fabrice Bellard + * + * 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 + */ + +#include "config.h" +#include +#include +#include +#include + +#include "libavutil/avstring.h" +#include "libavutil/colorspace.h" +#include "libavutil/mathematics.h" +#include "libavutil/pixdesc.h" +#include "libavutil/imgutils.h" +#include "libavutil/dict.h" +#include "libavutil/parseutils.h" +#include "libavutil/samplefmt.h" +#include "libavutil/time.h" +#include "libavformat/avformat.h" +#include "libavdevice/avdevice.h" +#include "libswscale/swscale.h" +#include "libavresample/avresample.h" +#include "libavutil/opt.h" +#include "libavcodec/avfft.h" + +#if CONFIG_AVFILTER +# include "libavfilter/avfilter.h" +# include "libavfilter/buffersink.h" +# include "libavfilter/buffersrc.h" +#endif + +#include "cmdutils.h" + +#include +#include + +#ifdef __MINGW32__ +#undef main /* We don't want SDL to override our main() */ +#endif + +#include + +const char program_name[] = "avplay"; +const int program_birth_year = 2003; + +#define MAX_QUEUE_SIZE (15 * 1024 * 1024) +#define MIN_AUDIOQ_SIZE (20 * 16 * 1024) +#define MIN_FRAMES 5 + +/* SDL audio buffer size, in samples. Should be small to have precise + A/V sync as SDL does not have hardware buffer fullness info. */ +#define SDL_AUDIO_BUFFER_SIZE 1024 + +/* no AV sync correction is done if below the AV sync threshold */ +#define AV_SYNC_THRESHOLD 0.01 +/* no AV correction is done if too big error */ +#define AV_NOSYNC_THRESHOLD 10.0 + +#define FRAME_SKIP_FACTOR 0.05 + +/* maximum audio speed change to get correct sync */ +#define SAMPLE_CORRECTION_PERCENT_MAX 10 + +/* we use about AUDIO_DIFF_AVG_NB A-V differences to make the average */ +#define AUDIO_DIFF_AVG_NB 20 + +/* NOTE: the size must be big enough to compensate the hardware audio buffersize size */ +#define SAMPLE_ARRAY_SIZE (2 * 65536) + +static int64_t sws_flags = SWS_BICUBIC; + +typedef struct PacketQueue { + AVPacketList *first_pkt, *last_pkt; + int nb_packets; + int size; + int abort_request; + SDL_mutex *mutex; + SDL_cond *cond; +} PacketQueue; + +#define VIDEO_PICTURE_QUEUE_SIZE 2 +#define SUBPICTURE_QUEUE_SIZE 4 + +typedef struct VideoPicture { + double pts; // presentation timestamp for this picture + double target_clock; // av_gettime() time at which this should be displayed ideally + int64_t pos; // byte position in file + SDL_Overlay *bmp; + int width, height; /* source height & width */ + int allocated; + int reallocate; + enum AVPixelFormat pix_fmt; + + AVRational sar; +} VideoPicture; + +typedef struct SubPicture { + double pts; /* presentation time stamp for this picture */ + AVSubtitle sub; +} SubPicture; + +enum { + AV_SYNC_AUDIO_MASTER, /* default choice */ + AV_SYNC_VIDEO_MASTER, + AV_SYNC_EXTERNAL_CLOCK, /* synchronize to an external clock */ +}; + +typedef struct VideoState { + SDL_Thread *parse_tid; + SDL_Thread *video_tid; + SDL_Thread *refresh_tid; + AVInputFormat *iformat; + int no_background; + int abort_request; + int paused; + int last_paused; + int seek_req; + int seek_flags; + int64_t seek_pos; + int64_t seek_rel; + int read_pause_return; + AVFormatContext *ic; + + int audio_stream; + + int av_sync_type; + double external_clock; /* external clock base */ + int64_t external_clock_time; + + double audio_clock; + double audio_diff_cum; /* used for AV difference average computation */ + double audio_diff_avg_coef; + double audio_diff_threshold; + int audio_diff_avg_count; + AVStream *audio_st; + PacketQueue audioq; + int audio_hw_buf_size; + uint8_t silence_buf[SDL_AUDIO_BUFFER_SIZE]; + uint8_t *audio_buf; + uint8_t *audio_buf1; + unsigned int audio_buf_size; /* in bytes */ + int audio_buf_index; /* in bytes */ + AVPacket audio_pkt_temp; + AVPacket audio_pkt; + enum AVSampleFormat sdl_sample_fmt; + uint64_t sdl_channel_layout; + int sdl_channels; + int sdl_sample_rate; + enum AVSampleFormat resample_sample_fmt; + uint64_t resample_channel_layout; + int resample_sample_rate; + AVAudioResampleContext *avr; + AVFrame *frame; + + int show_audio; /* if true, display audio samples */ + int16_t sample_array[SAMPLE_ARRAY_SIZE]; + int sample_array_index; + int last_i_start; + RDFTContext *rdft; + int rdft_bits; + FFTSample *rdft_data; + int xpos; + + SDL_Thread *subtitle_tid; + int subtitle_stream; + int subtitle_stream_changed; + AVStream *subtitle_st; + PacketQueue subtitleq; + SubPicture subpq[SUBPICTURE_QUEUE_SIZE]; + int subpq_size, subpq_rindex, subpq_windex; + SDL_mutex *subpq_mutex; + SDL_cond *subpq_cond; + + double frame_timer; + double frame_last_pts; + double frame_last_delay; + double video_clock; // pts of last decoded frame / predicted pts of next decoded frame + int video_stream; + AVStream *video_st; + PacketQueue videoq; + double video_current_pts; // current displayed pts (different from video_clock if frame fifos are used) + double video_current_pts_drift; // video_current_pts - time (av_gettime) at which we updated video_current_pts - used to have running video pts + int64_t video_current_pos; // current displayed file pos + VideoPicture pictq[VIDEO_PICTURE_QUEUE_SIZE]; + int pictq_size, pictq_rindex, pictq_windex; + SDL_mutex *pictq_mutex; + SDL_cond *pictq_cond; +#if !CONFIG_AVFILTER + struct SwsContext *img_convert_ctx; +#endif + + // QETimer *video_timer; + char filename[1024]; + int width, height, xleft, ytop; + + PtsCorrectionContext pts_ctx; + +#if CONFIG_AVFILTER + AVFilterContext *in_video_filter; // the first filter in the video chain + AVFilterContext *out_video_filter; // the last filter in the video chain +#endif + + float skip_frames; + float skip_frames_index; + int refresh; +} VideoState; + +/* options specified by the user */ +static AVInputFormat *file_iformat; +static const char *input_filename; +static const char *window_title; +static int fs_screen_width; +static int fs_screen_height; +static int screen_width = 0; +static int screen_height = 0; +static int audio_disable; +static int video_disable; +static int wanted_stream[AVMEDIA_TYPE_NB] = { + [AVMEDIA_TYPE_AUDIO] = -1, + [AVMEDIA_TYPE_VIDEO] = -1, + [AVMEDIA_TYPE_SUBTITLE] = -1, +}; +static int seek_by_bytes = -1; +static int display_disable; +static int show_status = 1; +static int av_sync_type = AV_SYNC_AUDIO_MASTER; +static int64_t start_time = AV_NOPTS_VALUE; +static int64_t duration = AV_NOPTS_VALUE; +static int step = 0; +static int workaround_bugs = 1; +static int fast = 0; +static int genpts = 0; +static int idct = FF_IDCT_AUTO; +static enum AVDiscard skip_frame = AVDISCARD_DEFAULT; +static enum AVDiscard skip_idct = AVDISCARD_DEFAULT; +static enum AVDiscard skip_loop_filter = AVDISCARD_DEFAULT; +static int error_concealment = 3; +static int decoder_reorder_pts = -1; +static int autoexit; +static int exit_on_keydown; +static int exit_on_mousedown; +static int loop = 1; +static int framedrop = 1; +static int infinite_buffer = 0; + +static int rdftspeed = 20; +#if CONFIG_AVFILTER +static char *vfilters = NULL; +#endif + +/* current context */ +static int is_full_screen; +static VideoState *cur_stream; +static int64_t audio_callback_time; + +static AVPacket flush_pkt; + +#define FF_ALLOC_EVENT (SDL_USEREVENT) +#define FF_REFRESH_EVENT (SDL_USEREVENT + 1) +#define FF_QUIT_EVENT (SDL_USEREVENT + 2) + +static SDL_Surface *screen; + +static int packet_queue_put(PacketQueue *q, AVPacket *pkt); + +/* packet queue handling */ +static void packet_queue_init(PacketQueue *q) +{ + memset(q, 0, sizeof(PacketQueue)); + q->mutex = SDL_CreateMutex(); + q->cond = SDL_CreateCond(); + packet_queue_put(q, &flush_pkt); +} + +static void packet_queue_flush(PacketQueue *q) +{ + AVPacketList *pkt, *pkt1; + + SDL_LockMutex(q->mutex); + for (pkt = q->first_pkt; pkt != NULL; pkt = pkt1) { + pkt1 = pkt->next; + av_free_packet(&pkt->pkt); + av_freep(&pkt); + } + q->last_pkt = NULL; + q->first_pkt = NULL; + q->nb_packets = 0; + q->size = 0; + SDL_UnlockMutex(q->mutex); +} + +static void packet_queue_end(PacketQueue *q) +{ + packet_queue_flush(q); + SDL_DestroyMutex(q->mutex); + SDL_DestroyCond(q->cond); +} + +static int packet_queue_put(PacketQueue *q, AVPacket *pkt) +{ + AVPacketList *pkt1; + + /* duplicate the packet */ + if (pkt != &flush_pkt && av_dup_packet(pkt) < 0) + return -1; + + pkt1 = av_malloc(sizeof(AVPacketList)); + if (!pkt1) + return -1; + pkt1->pkt = *pkt; + pkt1->next = NULL; + + + SDL_LockMutex(q->mutex); + + if (!q->last_pkt) + + q->first_pkt = pkt1; + else + q->last_pkt->next = pkt1; + q->last_pkt = pkt1; + q->nb_packets++; + q->size += pkt1->pkt.size + sizeof(*pkt1); + /* XXX: should duplicate packet data in DV case */ + SDL_CondSignal(q->cond); + + SDL_UnlockMutex(q->mutex); + return 0; +} + +static void packet_queue_abort(PacketQueue *q) +{ + SDL_LockMutex(q->mutex); + + q->abort_request = 1; + + SDL_CondSignal(q->cond); + + SDL_UnlockMutex(q->mutex); +} + +/* return < 0 if aborted, 0 if no packet and > 0 if packet. */ +static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) +{ + AVPacketList *pkt1; + int ret; + + SDL_LockMutex(q->mutex); + + for (;;) { + if (q->abort_request) { + ret = -1; + break; + } + + pkt1 = q->first_pkt; + if (pkt1) { + q->first_pkt = pkt1->next; + if (!q->first_pkt) + q->last_pkt = NULL; + q->nb_packets--; + q->size -= pkt1->pkt.size + sizeof(*pkt1); + *pkt = pkt1->pkt; + av_free(pkt1); + ret = 1; + break; + } else if (!block) { + ret = 0; + break; + } else { + SDL_CondWait(q->cond, q->mutex); + } + } + SDL_UnlockMutex(q->mutex); + return ret; +} + +static inline void fill_rectangle(SDL_Surface *screen, + int x, int y, int w, int h, int color) +{ + SDL_Rect rect; + rect.x = x; + rect.y = y; + rect.w = w; + rect.h = h; + SDL_FillRect(screen, &rect, color); +} + +#define ALPHA_BLEND(a, oldp, newp, s)\ +((((oldp << s) * (255 - (a))) + (newp * (a))) / (255 << s)) + +#define RGBA_IN(r, g, b, a, s)\ +{\ + unsigned int v = ((const uint32_t *)(s))[0];\ + a = (v >> 24) & 0xff;\ + r = (v >> 16) & 0xff;\ + g = (v >> 8) & 0xff;\ + b = v & 0xff;\ +} + +#define YUVA_IN(y, u, v, a, s, pal)\ +{\ + unsigned int val = ((const uint32_t *)(pal))[*(const uint8_t*)(s)];\ + a = (val >> 24) & 0xff;\ + y = (val >> 16) & 0xff;\ + u = (val >> 8) & 0xff;\ + v = val & 0xff;\ +} + +#define YUVA_OUT(d, y, u, v, a)\ +{\ + ((uint32_t *)(d))[0] = (a << 24) | (y << 16) | (u << 8) | v;\ +} + + +#define BPP 1 + +static void blend_subrect(AVPicture *dst, const AVSubtitleRect *rect, int imgw, int imgh) +{ + int wrap, wrap3, width2, skip2; + int y, u, v, a, u1, v1, a1, w, h; + uint8_t *lum, *cb, *cr; + const uint8_t *p; + const uint32_t *pal; + int dstx, dsty, dstw, dsth; + + dstw = av_clip(rect->w, 0, imgw); + dsth = av_clip(rect->h, 0, imgh); + dstx = av_clip(rect->x, 0, imgw - dstw); + dsty = av_clip(rect->y, 0, imgh - dsth); + lum = dst->data[0] + dsty * dst->linesize[0]; + cb = dst->data[1] + (dsty >> 1) * dst->linesize[1]; + cr = dst->data[2] + (dsty >> 1) * dst->linesize[2]; + + width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1); + skip2 = dstx >> 1; + wrap = dst->linesize[0]; + wrap3 = rect->pict.linesize[0]; + p = rect->pict.data[0]; + pal = (const uint32_t *)rect->pict.data[1]; /* Now in YCrCb! */ + + if (dsty & 1) { + lum += dstx; + cb += skip2; + cr += skip2; + + if (dstx & 1) { + YUVA_IN(y, u, v, a, p, pal); + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0); + cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0); + cb++; + cr++; + lum++; + p += BPP; + } + for (w = dstw - (dstx & 1); w >= 2; w -= 2) { + YUVA_IN(y, u, v, a, p, pal); + u1 = u; + v1 = v; + a1 = a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + + YUVA_IN(y, u, v, a, p + BPP, pal); + u1 += u; + v1 += v; + a1 += a; + lum[1] = ALPHA_BLEND(a, lum[1], y, 0); + cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1); + cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1); + cb++; + cr++; + p += 2 * BPP; + lum += 2; + } + if (w) { + YUVA_IN(y, u, v, a, p, pal); + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0); + cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0); + p++; + lum++; + } + p += wrap3 - dstw * BPP; + lum += wrap - dstw - dstx; + cb += dst->linesize[1] - width2 - skip2; + cr += dst->linesize[2] - width2 - skip2; + } + for (h = dsth - (dsty & 1); h >= 2; h -= 2) { + lum += dstx; + cb += skip2; + cr += skip2; + + if (dstx & 1) { + YUVA_IN(y, u, v, a, p, pal); + u1 = u; + v1 = v; + a1 = a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + p += wrap3; + lum += wrap; + YUVA_IN(y, u, v, a, p, pal); + u1 += u; + v1 += v; + a1 += a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1); + cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1); + cb++; + cr++; + p += -wrap3 + BPP; + lum += -wrap + 1; + } + for (w = dstw - (dstx & 1); w >= 2; w -= 2) { + YUVA_IN(y, u, v, a, p, pal); + u1 = u; + v1 = v; + a1 = a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + + YUVA_IN(y, u, v, a, p + BPP, pal); + u1 += u; + v1 += v; + a1 += a; + lum[1] = ALPHA_BLEND(a, lum[1], y, 0); + p += wrap3; + lum += wrap; + + YUVA_IN(y, u, v, a, p, pal); + u1 += u; + v1 += v; + a1 += a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + + YUVA_IN(y, u, v, a, p + BPP, pal); + u1 += u; + v1 += v; + a1 += a; + lum[1] = ALPHA_BLEND(a, lum[1], y, 0); + + cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 2); + cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 2); + + cb++; + cr++; + p += -wrap3 + 2 * BPP; + lum += -wrap + 2; + } + if (w) { + YUVA_IN(y, u, v, a, p, pal); + u1 = u; + v1 = v; + a1 = a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + p += wrap3; + lum += wrap; + YUVA_IN(y, u, v, a, p, pal); + u1 += u; + v1 += v; + a1 += a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u1, 1); + cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v1, 1); + cb++; + cr++; + p += -wrap3 + BPP; + lum += -wrap + 1; + } + p += wrap3 + (wrap3 - dstw * BPP); + lum += wrap + (wrap - dstw - dstx); + cb += dst->linesize[1] - width2 - skip2; + cr += dst->linesize[2] - width2 - skip2; + } + /* handle odd height */ + if (h) { + lum += dstx; + cb += skip2; + cr += skip2; + + if (dstx & 1) { + YUVA_IN(y, u, v, a, p, pal); + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0); + cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0); + cb++; + cr++; + lum++; + p += BPP; + } + for (w = dstw - (dstx & 1); w >= 2; w -= 2) { + YUVA_IN(y, u, v, a, p, pal); + u1 = u; + v1 = v; + a1 = a; + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + + YUVA_IN(y, u, v, a, p + BPP, pal); + u1 += u; + v1 += v; + a1 += a; + lum[1] = ALPHA_BLEND(a, lum[1], y, 0); + cb[0] = ALPHA_BLEND(a1 >> 2, cb[0], u, 1); + cr[0] = ALPHA_BLEND(a1 >> 2, cr[0], v, 1); + cb++; + cr++; + p += 2 * BPP; + lum += 2; + } + if (w) { + YUVA_IN(y, u, v, a, p, pal); + lum[0] = ALPHA_BLEND(a, lum[0], y, 0); + cb[0] = ALPHA_BLEND(a >> 2, cb[0], u, 0); + cr[0] = ALPHA_BLEND(a >> 2, cr[0], v, 0); + } + } +} + +static void free_subpicture(SubPicture *sp) +{ + avsubtitle_free(&sp->sub); +} + +static void video_image_display(VideoState *is) +{ + VideoPicture *vp; + SubPicture *sp; + AVPicture pict; + float aspect_ratio; + int width, height, x, y; + SDL_Rect rect; + int i; + + vp = &is->pictq[is->pictq_rindex]; + if (vp->bmp) { +#if CONFIG_AVFILTER + if (!vp->sar.num) + aspect_ratio = 0; + else + aspect_ratio = av_q2d(vp->sar); +#else + + /* XXX: use variable in the frame */ + if (is->video_st->sample_aspect_ratio.num) + aspect_ratio = av_q2d(is->video_st->sample_aspect_ratio); + else if (is->video_st->codec->sample_aspect_ratio.num) + aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio); + else + aspect_ratio = 0; +#endif + if (aspect_ratio <= 0.0) + aspect_ratio = 1.0; + aspect_ratio *= (float)vp->width / (float)vp->height; + + if (is->subtitle_st) + { + if (is->subpq_size > 0) + { + sp = &is->subpq[is->subpq_rindex]; + + if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000)) + { + SDL_LockYUVOverlay (vp->bmp); + + pict.data[0] = vp->bmp->pixels[0]; + pict.data[1] = vp->bmp->pixels[2]; + pict.data[2] = vp->bmp->pixels[1]; + + pict.linesize[0] = vp->bmp->pitches[0]; + pict.linesize[1] = vp->bmp->pitches[2]; + pict.linesize[2] = vp->bmp->pitches[1]; + + for (i = 0; i < sp->sub.num_rects; i++) + blend_subrect(&pict, sp->sub.rects[i], + vp->bmp->w, vp->bmp->h); + + SDL_UnlockYUVOverlay (vp->bmp); + } + } + } + + + /* XXX: we suppose the screen has a 1.0 pixel ratio */ + height = is->height; + width = ((int)rint(height * aspect_ratio)) & ~1; + if (width > is->width) { + width = is->width; + height = ((int)rint(width / aspect_ratio)) & ~1; + } + x = (is->width - width) / 2; + y = (is->height - height) / 2; + is->no_background = 0; + rect.x = is->xleft + x; + rect.y = is->ytop + y; + rect.w = width; + rect.h = height; + SDL_DisplayYUVOverlay(vp->bmp, &rect); + } +} + +/* get the current audio output buffer size, in samples. With SDL, we + cannot have a precise information */ +static int audio_write_get_buf_size(VideoState *is) +{ + return is->audio_buf_size - is->audio_buf_index; +} + +static inline int compute_mod(int a, int b) +{ + a = a % b; + if (a >= 0) + return a; + else + return a + b; +} + +static void video_audio_display(VideoState *s) +{ + int i, i_start, x, y1, y, ys, delay, n, nb_display_channels; + int ch, channels, h, h2, bgcolor, fgcolor; + int16_t time_diff; + int rdft_bits, nb_freq; + + for (rdft_bits = 1; (1 << rdft_bits) < 2 * s->height; rdft_bits++) + ; + nb_freq = 1 << (rdft_bits - 1); + + /* compute display index : center on currently output samples */ + channels = s->sdl_channels; + nb_display_channels = channels; + if (!s->paused) { + int data_used = s->show_audio == 1 ? s->width : (2 * nb_freq); + n = 2 * channels; + delay = audio_write_get_buf_size(s); + delay /= n; + + /* to be more precise, we take into account the time spent since + the last buffer computation */ + if (audio_callback_time) { + time_diff = av_gettime() - audio_callback_time; + delay -= (time_diff * s->sdl_sample_rate) / 1000000; + } + + delay += 2 * data_used; + if (delay < data_used) + delay = data_used; + + i_start= x = compute_mod(s->sample_array_index - delay * channels, SAMPLE_ARRAY_SIZE); + if (s->show_audio == 1) { + h = INT_MIN; + for (i = 0; i < 1000; i += channels) { + int idx = (SAMPLE_ARRAY_SIZE + x - i) % SAMPLE_ARRAY_SIZE; + int a = s->sample_array[idx]; + int b = s->sample_array[(idx + 4 * channels) % SAMPLE_ARRAY_SIZE]; + int c = s->sample_array[(idx + 5 * channels) % SAMPLE_ARRAY_SIZE]; + int d = s->sample_array[(idx + 9 * channels) % SAMPLE_ARRAY_SIZE]; + int score = a - d; + if (h < score && (b ^ c) < 0) { + h = score; + i_start = idx; + } + } + } + + s->last_i_start = i_start; + } else { + i_start = s->last_i_start; + } + + bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); + if (s->show_audio == 1) { + fill_rectangle(screen, + s->xleft, s->ytop, s->width, s->height, + bgcolor); + + fgcolor = SDL_MapRGB(screen->format, 0xff, 0xff, 0xff); + + /* total height for one channel */ + h = s->height / nb_display_channels; + /* graph height / 2 */ + h2 = (h * 9) / 20; + for (ch = 0; ch < nb_display_channels; ch++) { + i = i_start + ch; + y1 = s->ytop + ch * h + (h / 2); /* position of center line */ + for (x = 0; x < s->width; x++) { + y = (s->sample_array[i] * h2) >> 15; + if (y < 0) { + y = -y; + ys = y1 - y; + } else { + ys = y1; + } + fill_rectangle(screen, + s->xleft + x, ys, 1, y, + fgcolor); + i += channels; + if (i >= SAMPLE_ARRAY_SIZE) + i -= SAMPLE_ARRAY_SIZE; + } + } + + fgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0xff); + + for (ch = 1; ch < nb_display_channels; ch++) { + y = s->ytop + ch * h; + fill_rectangle(screen, + s->xleft, y, s->width, 1, + fgcolor); + } + SDL_UpdateRect(screen, s->xleft, s->ytop, s->width, s->height); + } else { + nb_display_channels= FFMIN(nb_display_channels, 2); + if (rdft_bits != s->rdft_bits) { + av_rdft_end(s->rdft); + av_free(s->rdft_data); + s->rdft = av_rdft_init(rdft_bits, DFT_R2C); + s->rdft_bits = rdft_bits; + s->rdft_data = av_malloc(4 * nb_freq * sizeof(*s->rdft_data)); + } + { + FFTSample *data[2]; + for (ch = 0; ch < nb_display_channels; ch++) { + data[ch] = s->rdft_data + 2 * nb_freq * ch; + i = i_start + ch; + for (x = 0; x < 2 * nb_freq; x++) { + double w = (x-nb_freq) * (1.0 / nb_freq); + data[ch][x] = s->sample_array[i] * (1.0 - w * w); + i += channels; + if (i >= SAMPLE_ARRAY_SIZE) + i -= SAMPLE_ARRAY_SIZE; + } + av_rdft_calc(s->rdft, data[ch]); + } + /* Least efficient way to do this, we should of course + * directly access it but it is more than fast enough. */ + for (y = 0; y < s->height; y++) { + double w = 1 / sqrt(nb_freq); + int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1])); + int b = (nb_display_channels == 2 ) ? sqrt(w * sqrt(data[1][2 * y + 0] * data[1][2 * y + 0] + + data[1][2 * y + 1] * data[1][2 * y + 1])) : a; + a = FFMIN(a, 255); + b = FFMIN(b, 255); + fgcolor = SDL_MapRGB(screen->format, a, b, (a + b) / 2); + + fill_rectangle(screen, + s->xpos, s->height-y, 1, 1, + fgcolor); + } + } + SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height); + s->xpos++; + if (s->xpos >= s->width) + s->xpos= s->xleft; + } +} + +static int video_open(VideoState *is) +{ + int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL; + int w,h; + + if (is_full_screen) flags |= SDL_FULLSCREEN; + else flags |= SDL_RESIZABLE; + + if (is_full_screen && fs_screen_width) { + w = fs_screen_width; + h = fs_screen_height; + } else if (!is_full_screen && screen_width) { + w = screen_width; + h = screen_height; +#if CONFIG_AVFILTER + } else if (is->out_video_filter && is->out_video_filter->inputs[0]) { + w = is->out_video_filter->inputs[0]->w; + h = is->out_video_filter->inputs[0]->h; +#else + } else if (is->video_st && is->video_st->codec->width) { + w = is->video_st->codec->width; + h = is->video_st->codec->height; +#endif + } else { + w = 640; + h = 480; + } + if (screen && is->width == screen->w && screen->w == w + && is->height== screen->h && screen->h == h) + return 0; + +#if defined(__APPLE__) && !SDL_VERSION_ATLEAST(1, 2, 14) + /* setting bits_per_pixel = 0 or 32 causes blank video on OS X and older SDL */ + screen = SDL_SetVideoMode(w, h, 24, flags); +#else + screen = SDL_SetVideoMode(w, h, 0, flags); +#endif + if (!screen) { + fprintf(stderr, "SDL: could not set video mode - exiting\n"); + return -1; + } + if (!window_title) + window_title = input_filename; + SDL_WM_SetCaption(window_title, window_title); + + is->width = screen->w; + is->height = screen->h; + + return 0; +} + +/* display the current picture, if any */ +static void video_display(VideoState *is) +{ + if (!screen) + video_open(cur_stream); + if (is->audio_st && is->show_audio) + video_audio_display(is); + else if (is->video_st) + video_image_display(is); +} + +static int refresh_thread(void *opaque) +{ + VideoState *is= opaque; + while (!is->abort_request) { + SDL_Event event; + event.type = FF_REFRESH_EVENT; + event.user.data1 = opaque; + if (!is->refresh) { + is->refresh = 1; + SDL_PushEvent(&event); + } + av_usleep(is->audio_st && is->show_audio ? rdftspeed * 1000 : 5000); // FIXME ideally we should wait the correct time but SDLs event passing is so slow it would be silly + } + return 0; +} + +/* get the current audio clock value */ +static double get_audio_clock(VideoState *is) +{ + double pts; + int hw_buf_size, bytes_per_sec; + pts = is->audio_clock; + hw_buf_size = audio_write_get_buf_size(is); + bytes_per_sec = 0; + if (is->audio_st) { + bytes_per_sec = is->sdl_sample_rate * is->sdl_channels * + av_get_bytes_per_sample(is->sdl_sample_fmt); + } + if (bytes_per_sec) + pts -= (double)hw_buf_size / bytes_per_sec; + return pts; +} + +/* get the current video clock value */ +static double get_video_clock(VideoState *is) +{ + if (is->paused) { + return is->video_current_pts; + } else { + return is->video_current_pts_drift + av_gettime() / 1000000.0; + } +} + +/* get the current external clock value */ +static double get_external_clock(VideoState *is) +{ + int64_t ti; + ti = av_gettime(); + return is->external_clock + ((ti - is->external_clock_time) * 1e-6); +} + +/* get the current master clock value */ +static double get_master_clock(VideoState *is) +{ + double val; + + if (is->av_sync_type == AV_SYNC_VIDEO_MASTER) { + if (is->video_st) + val = get_video_clock(is); + else + val = get_audio_clock(is); + } else if (is->av_sync_type == AV_SYNC_AUDIO_MASTER) { + if (is->audio_st) + val = get_audio_clock(is); + else + val = get_video_clock(is); + } else { + val = get_external_clock(is); + } + return val; +} + +/* seek in the stream */ +static void stream_seek(VideoState *is, int64_t pos, int64_t rel, int seek_by_bytes) +{ + if (!is->seek_req) { + is->seek_pos = pos; + is->seek_rel = rel; + is->seek_flags &= ~AVSEEK_FLAG_BYTE; + if (seek_by_bytes) + is->seek_flags |= AVSEEK_FLAG_BYTE; + is->seek_req = 1; + } +} + +/* pause or resume the video */ +static void stream_pause(VideoState *is) +{ + if (is->paused) { + is->frame_timer += av_gettime() / 1000000.0 + is->video_current_pts_drift - is->video_current_pts; + if (is->read_pause_return != AVERROR(ENOSYS)) { + is->video_current_pts = is->video_current_pts_drift + av_gettime() / 1000000.0; + } + is->video_current_pts_drift = is->video_current_pts - av_gettime() / 1000000.0; + } + is->paused = !is->paused; +} + +static double compute_target_time(double frame_current_pts, VideoState *is) +{ + double delay, sync_threshold, diff; + + /* compute nominal delay */ + delay = frame_current_pts - is->frame_last_pts; + if (delay <= 0 || delay >= 10.0) { + /* if incorrect delay, use previous one */ + delay = is->frame_last_delay; + } else { + is->frame_last_delay = delay; + } + is->frame_last_pts = frame_current_pts; + + /* update delay to follow master synchronisation source */ + if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) || + is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) { + /* if video is slave, we try to correct big delays by + duplicating or deleting a frame */ + diff = get_video_clock(is) - get_master_clock(is); + + /* skip or repeat frame. We take into account the + delay to compute the threshold. I still don't know + if it is the best guess */ + sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay); + if (fabs(diff) < AV_NOSYNC_THRESHOLD) { + if (diff <= -sync_threshold) + delay = 0; + else if (diff >= sync_threshold) + delay = 2 * delay; + } + } + is->frame_timer += delay; + + av_dlog(NULL, "video: delay=%0.3f pts=%0.3f A-V=%f\n", + delay, frame_current_pts, -diff); + + return is->frame_timer; +} + +/* called to display each frame */ +static void video_refresh_timer(void *opaque) +{ + VideoState *is = opaque; + VideoPicture *vp; + + SubPicture *sp, *sp2; + + if (is->video_st) { +retry: + if (is->pictq_size == 0) { + // nothing to do, no picture to display in the que + } else { + double time = av_gettime() / 1000000.0; + double next_target; + /* dequeue the picture */ + vp = &is->pictq[is->pictq_rindex]; + + if (time < vp->target_clock) + return; + /* update current video pts */ + is->video_current_pts = vp->pts; + is->video_current_pts_drift = is->video_current_pts - time; + is->video_current_pos = vp->pos; + if (is->pictq_size > 1) { + VideoPicture *nextvp = &is->pictq[(is->pictq_rindex + 1) % VIDEO_PICTURE_QUEUE_SIZE]; + assert(nextvp->target_clock >= vp->target_clock); + next_target= nextvp->target_clock; + } else { + next_target = vp->target_clock + is->video_clock - vp->pts; // FIXME pass durations cleanly + } + if (framedrop && time > next_target) { + is->skip_frames *= 1.0 + FRAME_SKIP_FACTOR; + if (is->pictq_size > 1 || time > next_target + 0.5) { + /* update queue size and signal for next picture */ + if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) + is->pictq_rindex = 0; + + SDL_LockMutex(is->pictq_mutex); + is->pictq_size--; + SDL_CondSignal(is->pictq_cond); + SDL_UnlockMutex(is->pictq_mutex); + goto retry; + } + } + + if (is->subtitle_st) { + if (is->subtitle_stream_changed) { + SDL_LockMutex(is->subpq_mutex); + + while (is->subpq_size) { + free_subpicture(&is->subpq[is->subpq_rindex]); + + /* update queue size and signal for next picture */ + if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) + is->subpq_rindex = 0; + + is->subpq_size--; + } + is->subtitle_stream_changed = 0; + + SDL_CondSignal(is->subpq_cond); + SDL_UnlockMutex(is->subpq_mutex); + } else { + if (is->subpq_size > 0) { + sp = &is->subpq[is->subpq_rindex]; + + if (is->subpq_size > 1) + sp2 = &is->subpq[(is->subpq_rindex + 1) % SUBPICTURE_QUEUE_SIZE]; + else + sp2 = NULL; + + if ((is->video_current_pts > (sp->pts + ((float) sp->sub.end_display_time / 1000))) + || (sp2 && is->video_current_pts > (sp2->pts + ((float) sp2->sub.start_display_time / 1000)))) + { + free_subpicture(sp); + + /* update queue size and signal for next picture */ + if (++is->subpq_rindex == SUBPICTURE_QUEUE_SIZE) + is->subpq_rindex = 0; + + SDL_LockMutex(is->subpq_mutex); + is->subpq_size--; + SDL_CondSignal(is->subpq_cond); + SDL_UnlockMutex(is->subpq_mutex); + } + } + } + } + + /* display picture */ + if (!display_disable) + video_display(is); + + /* update queue size and signal for next picture */ + if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) + is->pictq_rindex = 0; + + SDL_LockMutex(is->pictq_mutex); + is->pictq_size--; + SDL_CondSignal(is->pictq_cond); + SDL_UnlockMutex(is->pictq_mutex); + } + } else if (is->audio_st) { + /* draw the next audio frame */ + + /* if only audio stream, then display the audio bars (better + than nothing, just to test the implementation */ + + /* display picture */ + if (!display_disable) + video_display(is); + } + if (show_status) { + static int64_t last_time; + int64_t cur_time; + int aqsize, vqsize, sqsize; + double av_diff; + + cur_time = av_gettime(); + if (!last_time || (cur_time - last_time) >= 30000) { + aqsize = 0; + vqsize = 0; + sqsize = 0; + if (is->audio_st) + aqsize = is->audioq.size; + if (is->video_st) + vqsize = is->videoq.size; + if (is->subtitle_st) + sqsize = is->subtitleq.size; + av_diff = 0; + if (is->audio_st && is->video_st) + av_diff = get_audio_clock(is) - get_video_clock(is); + printf("%7.2f A-V:%7.3f s:%3.1f aq=%5dKB vq=%5dKB sq=%5dB f=%"PRId64"/%"PRId64" \r", + get_master_clock(is), av_diff, FFMAX(is->skip_frames - 1, 0), aqsize / 1024, + vqsize / 1024, sqsize, is->pts_ctx.num_faulty_dts, is->pts_ctx.num_faulty_pts); + fflush(stdout); + last_time = cur_time; + } + } +} + +static void stream_close(VideoState *is) +{ + VideoPicture *vp; + int i; + /* XXX: use a special url_shutdown call to abort parse cleanly */ + is->abort_request = 1; + SDL_WaitThread(is->parse_tid, NULL); + SDL_WaitThread(is->refresh_tid, NULL); + + /* free all pictures */ + for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { + vp = &is->pictq[i]; + if (vp->bmp) { + SDL_FreeYUVOverlay(vp->bmp); + vp->bmp = NULL; + } + } + SDL_DestroyMutex(is->pictq_mutex); + SDL_DestroyCond(is->pictq_cond); + SDL_DestroyMutex(is->subpq_mutex); + SDL_DestroyCond(is->subpq_cond); +#if !CONFIG_AVFILTER + if (is->img_convert_ctx) + sws_freeContext(is->img_convert_ctx); +#endif + av_free(is); +} + +static void do_exit(void) +{ + if (cur_stream) { + stream_close(cur_stream); + cur_stream = NULL; + } + uninit_opts(); + avformat_network_deinit(); + if (show_status) + printf("\n"); + SDL_Quit(); + av_log(NULL, AV_LOG_QUIET, ""); + exit(0); +} + +/* allocate a picture (needs to do that in main thread to avoid + potential locking problems */ +static void alloc_picture(void *opaque) +{ + VideoState *is = opaque; + VideoPicture *vp; + + vp = &is->pictq[is->pictq_windex]; + + if (vp->bmp) + SDL_FreeYUVOverlay(vp->bmp); + +#if CONFIG_AVFILTER + vp->width = is->out_video_filter->inputs[0]->w; + vp->height = is->out_video_filter->inputs[0]->h; + vp->pix_fmt = is->out_video_filter->inputs[0]->format; +#else + vp->width = is->video_st->codec->width; + vp->height = is->video_st->codec->height; + vp->pix_fmt = is->video_st->codec->pix_fmt; +#endif + + vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height, + SDL_YV12_OVERLAY, + screen); + if (!vp->bmp || vp->bmp->pitches[0] < vp->width) { + /* SDL allocates a buffer smaller than requested if the video + * overlay hardware is unable to support the requested size. */ + fprintf(stderr, "Error: the video system does not support an image\n" + "size of %dx%d pixels. Try using -vf \"scale=w:h\"\n" + "to reduce the image size.\n", vp->width, vp->height ); + do_exit(); + } + + SDL_LockMutex(is->pictq_mutex); + vp->allocated = 1; + SDL_CondSignal(is->pictq_cond); + SDL_UnlockMutex(is->pictq_mutex); +} + +/* The 'pts' parameter is the dts of the packet / pts of the frame and + * guessed if not known. */ +static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t pos) +{ + VideoPicture *vp; +#if CONFIG_AVFILTER + AVPicture pict_src; +#else + int dst_pix_fmt = AV_PIX_FMT_YUV420P; +#endif + /* wait until we have space to put a new picture */ + SDL_LockMutex(is->pictq_mutex); + + if (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE && !is->refresh) + is->skip_frames = FFMAX(1.0 - FRAME_SKIP_FACTOR, is->skip_frames * (1.0 - FRAME_SKIP_FACTOR)); + + while (is->pictq_size >= VIDEO_PICTURE_QUEUE_SIZE && + !is->videoq.abort_request) { + SDL_CondWait(is->pictq_cond, is->pictq_mutex); + } + SDL_UnlockMutex(is->pictq_mutex); + + if (is->videoq.abort_request) + return -1; + + vp = &is->pictq[is->pictq_windex]; + + /* alloc or resize hardware picture buffer */ + if (!vp->bmp || vp->reallocate || +#if CONFIG_AVFILTER + vp->width != is->out_video_filter->inputs[0]->w || + vp->height != is->out_video_filter->inputs[0]->h) { +#else + vp->width != is->video_st->codec->width || + vp->height != is->video_st->codec->height) { +#endif + SDL_Event event; + + vp->allocated = 0; + vp->reallocate = 0; + + /* the allocation must be done in the main thread to avoid + locking problems */ + event.type = FF_ALLOC_EVENT; + event.user.data1 = is; + SDL_PushEvent(&event); + + /* wait until the picture is allocated */ + SDL_LockMutex(is->pictq_mutex); + while (!vp->allocated && !is->videoq.abort_request) { + SDL_CondWait(is->pictq_cond, is->pictq_mutex); + } + SDL_UnlockMutex(is->pictq_mutex); + + if (is->videoq.abort_request) + return -1; + } + + /* if the frame is not skipped, then display it */ + if (vp->bmp) { + AVPicture pict = { { 0 } }; + + /* get a pointer on the bitmap */ + SDL_LockYUVOverlay (vp->bmp); + + pict.data[0] = vp->bmp->pixels[0]; + pict.data[1] = vp->bmp->pixels[2]; + pict.data[2] = vp->bmp->pixels[1]; + + pict.linesize[0] = vp->bmp->pitches[0]; + pict.linesize[1] = vp->bmp->pitches[2]; + pict.linesize[2] = vp->bmp->pitches[1]; + +#if CONFIG_AVFILTER + pict_src.data[0] = src_frame->data[0]; + pict_src.data[1] = src_frame->data[1]; + pict_src.data[2] = src_frame->data[2]; + + pict_src.linesize[0] = src_frame->linesize[0]; + pict_src.linesize[1] = src_frame->linesize[1]; + pict_src.linesize[2] = src_frame->linesize[2]; + + // FIXME use direct rendering + av_picture_copy(&pict, &pict_src, + vp->pix_fmt, vp->width, vp->height); +#else + av_opt_get_int(sws_opts, "sws_flags", 0, &sws_flags); + is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, + vp->width, vp->height, vp->pix_fmt, vp->width, vp->height, + dst_pix_fmt, sws_flags, NULL, NULL, NULL); + if (is->img_convert_ctx == NULL) { + fprintf(stderr, "Cannot initialize the conversion context\n"); + exit(1); + } + sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize, + 0, vp->height, pict.data, pict.linesize); +#endif + /* update the bitmap content */ + SDL_UnlockYUVOverlay(vp->bmp); + + vp->pts = pts; + vp->pos = pos; + + /* now we can update the picture count */ + if (++is->pictq_windex == VIDEO_PICTURE_QUEUE_SIZE) + is->pictq_windex = 0; + SDL_LockMutex(is->pictq_mutex); + vp->target_clock = compute_target_time(vp->pts, is); + + is->pictq_size++; + SDL_UnlockMutex(is->pictq_mutex); + } + return 0; +} + +/* Compute the exact PTS for the picture if it is omitted in the stream. + * The 'pts1' parameter is the dts of the packet / pts of the frame. */ +static int output_picture2(VideoState *is, AVFrame *src_frame, double pts1, int64_t pos) +{ + double frame_delay, pts; + int ret; + + pts = pts1; + + if (pts != 0) { + /* update video clock with pts, if present */ + is->video_clock = pts; + } else { + pts = is->video_clock; + } + /* update video clock for next frame */ + frame_delay = av_q2d(is->video_st->codec->time_base); + /* for MPEG2, the frame can be repeated, so we update the + clock accordingly */ + frame_delay += src_frame->repeat_pict * (frame_delay * 0.5); + is->video_clock += frame_delay; + + ret = queue_picture(is, src_frame, pts, pos); + av_frame_unref(src_frame); + return ret; +} + +static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacket *pkt) +{ + int got_picture, i; + + if (packet_queue_get(&is->videoq, pkt, 1) < 0) + return -1; + + if (pkt->data == flush_pkt.data) { + avcodec_flush_buffers(is->video_st->codec); + + SDL_LockMutex(is->pictq_mutex); + // Make sure there are no long delay timers (ideally we should just flush the que but thats harder) + for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { + is->pictq[i].target_clock= 0; + } + while (is->pictq_size && !is->videoq.abort_request) { + SDL_CondWait(is->pictq_cond, is->pictq_mutex); + } + is->video_current_pos = -1; + SDL_UnlockMutex(is->pictq_mutex); + + init_pts_correction(&is->pts_ctx); + is->frame_last_pts = AV_NOPTS_VALUE; + is->frame_last_delay = 0; + is->frame_timer = (double)av_gettime() / 1000000.0; + is->skip_frames = 1; + is->skip_frames_index = 0; + return 0; + } + + avcodec_decode_video2(is->video_st->codec, frame, &got_picture, pkt); + + if (got_picture) { + if (decoder_reorder_pts == -1) { + *pts = guess_correct_pts(&is->pts_ctx, frame->pkt_pts, frame->pkt_dts); + } else if (decoder_reorder_pts) { + *pts = frame->pkt_pts; + } else { + *pts = frame->pkt_dts; + } + + if (*pts == AV_NOPTS_VALUE) { + *pts = 0; + } + if (is->video_st->sample_aspect_ratio.num) { + frame->sample_aspect_ratio = is->video_st->sample_aspect_ratio; + } + + is->skip_frames_index += 1; + if (is->skip_frames_index >= is->skip_frames) { + is->skip_frames_index -= FFMAX(is->skip_frames, 1.0); + return 1; + } + av_frame_unref(frame); + } + return 0; +} + +#if CONFIG_AVFILTER +static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) +{ + char sws_flags_str[128]; + char buffersrc_args[256]; + int ret; + AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format; + AVCodecContext *codec = is->video_st->codec; + + snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%"PRId64, sws_flags); + graph->scale_sws_opts = av_strdup(sws_flags_str); + + snprintf(buffersrc_args, sizeof(buffersrc_args), "%d:%d:%d:%d:%d:%d:%d", + codec->width, codec->height, codec->pix_fmt, + is->video_st->time_base.num, is->video_st->time_base.den, + codec->sample_aspect_ratio.num, codec->sample_aspect_ratio.den); + + + if ((ret = avfilter_graph_create_filter(&filt_src, + avfilter_get_by_name("buffer"), + "src", buffersrc_args, NULL, + graph)) < 0) + return ret; + if ((ret = avfilter_graph_create_filter(&filt_out, + avfilter_get_by_name("buffersink"), + "out", NULL, NULL, graph)) < 0) + return ret; + + if ((ret = avfilter_graph_create_filter(&filt_format, + avfilter_get_by_name("format"), + "format", "yuv420p", NULL, graph)) < 0) + return ret; + if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0) + return ret; + + + if (vfilters) { + AVFilterInOut *outputs = avfilter_inout_alloc(); + AVFilterInOut *inputs = avfilter_inout_alloc(); + + outputs->name = av_strdup("in"); + outputs->filter_ctx = filt_src; + outputs->pad_idx = 0; + outputs->next = NULL; + + inputs->name = av_strdup("out"); + inputs->filter_ctx = filt_format; + inputs->pad_idx = 0; + inputs->next = NULL; + + if ((ret = avfilter_graph_parse(graph, vfilters, inputs, outputs, NULL)) < 0) + return ret; + } else { + if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0) + return ret; + } + + if ((ret = avfilter_graph_config(graph, NULL)) < 0) + return ret; + + is->in_video_filter = filt_src; + is->out_video_filter = filt_out; + + return ret; +} + +#endif /* CONFIG_AVFILTER */ + +static int video_thread(void *arg) +{ + AVPacket pkt = { 0 }; + VideoState *is = arg; + AVFrame *frame = av_frame_alloc(); + int64_t pts_int; + double pts; + int ret; + +#if CONFIG_AVFILTER + AVFilterGraph *graph = avfilter_graph_alloc(); + AVFilterContext *filt_out = NULL, *filt_in = NULL; + int last_w = is->video_st->codec->width; + int last_h = is->video_st->codec->height; + + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + goto the_end; + filt_in = is->in_video_filter; + filt_out = is->out_video_filter; +#endif + + for (;;) { +#if CONFIG_AVFILTER + AVRational tb; +#endif + while (is->paused && !is->videoq.abort_request) + SDL_Delay(10); + + av_free_packet(&pkt); + + ret = get_video_frame(is, frame, &pts_int, &pkt); + if (ret < 0) + goto the_end; + + if (!ret) + continue; + +#if CONFIG_AVFILTER + if ( last_w != is->video_st->codec->width + || last_h != is->video_st->codec->height) { + av_dlog(NULL, "Changing size %dx%d -> %dx%d\n", last_w, last_h, + is->video_st->codec->width, is->video_st->codec->height); + avfilter_graph_free(&graph); + graph = avfilter_graph_alloc(); + if ((ret = configure_video_filters(graph, is, vfilters)) < 0) + goto the_end; + filt_in = is->in_video_filter; + filt_out = is->out_video_filter; + last_w = is->video_st->codec->width; + last_h = is->video_st->codec->height; + } + + frame->pts = pts_int; + ret = av_buffersrc_add_frame(filt_in, frame); + if (ret < 0) + goto the_end; + + while (ret >= 0) { + ret = av_buffersink_get_frame(filt_out, frame); + if (ret < 0) { + ret = 0; + break; + } + + pts_int = frame->pts; + tb = filt_out->inputs[0]->time_base; + if (av_cmp_q(tb, is->video_st->time_base)) { + av_unused int64_t pts1 = pts_int; + pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base); + av_dlog(NULL, "video_thread(): " + "tb:%d/%d pts:%"PRId64" -> tb:%d/%d pts:%"PRId64"\n", + tb.num, tb.den, pts1, + is->video_st->time_base.num, is->video_st->time_base.den, pts_int); + } + pts = pts_int * av_q2d(is->video_st->time_base); + ret = output_picture2(is, frame, pts, 0); + } +#else + pts = pts_int * av_q2d(is->video_st->time_base); + ret = output_picture2(is, frame, pts, pkt.pos); +#endif + + if (ret < 0) + goto the_end; + + + if (step) + if (cur_stream) + stream_pause(cur_stream); + } + the_end: +#if CONFIG_AVFILTER + av_freep(&vfilters); + avfilter_graph_free(&graph); +#endif + av_free_packet(&pkt); + av_frame_free(&frame); + return 0; +} + +static int subtitle_thread(void *arg) +{ + VideoState *is = arg; + SubPicture *sp; + AVPacket pkt1, *pkt = &pkt1; + int got_subtitle; + double pts; + int i, j; + int r, g, b, y, u, v, a; + + for (;;) { + while (is->paused && !is->subtitleq.abort_request) { + SDL_Delay(10); + } + if (packet_queue_get(&is->subtitleq, pkt, 1) < 0) + break; + + if (pkt->data == flush_pkt.data) { + avcodec_flush_buffers(is->subtitle_st->codec); + continue; + } + SDL_LockMutex(is->subpq_mutex); + while (is->subpq_size >= SUBPICTURE_QUEUE_SIZE && + !is->subtitleq.abort_request) { + SDL_CondWait(is->subpq_cond, is->subpq_mutex); + } + SDL_UnlockMutex(is->subpq_mutex); + + if (is->subtitleq.abort_request) + return 0; + + sp = &is->subpq[is->subpq_windex]; + + /* NOTE: ipts is the PTS of the _first_ picture beginning in + this packet, if any */ + pts = 0; + if (pkt->pts != AV_NOPTS_VALUE) + pts = av_q2d(is->subtitle_st->time_base) * pkt->pts; + + avcodec_decode_subtitle2(is->subtitle_st->codec, &sp->sub, + &got_subtitle, pkt); + + if (got_subtitle && sp->sub.format == 0) { + sp->pts = pts; + + for (i = 0; i < sp->sub.num_rects; i++) + { + for (j = 0; j < sp->sub.rects[i]->nb_colors; j++) + { + RGBA_IN(r, g, b, a, (uint32_t*)sp->sub.rects[i]->pict.data[1] + j); + y = RGB_TO_Y_CCIR(r, g, b); + u = RGB_TO_U_CCIR(r, g, b, 0); + v = RGB_TO_V_CCIR(r, g, b, 0); + YUVA_OUT((uint32_t*)sp->sub.rects[i]->pict.data[1] + j, y, u, v, a); + } + } + + /* now we can update the picture count */ + if (++is->subpq_windex == SUBPICTURE_QUEUE_SIZE) + is->subpq_windex = 0; + SDL_LockMutex(is->subpq_mutex); + is->subpq_size++; + SDL_UnlockMutex(is->subpq_mutex); + } + av_free_packet(pkt); + } + return 0; +} + +/* copy samples for viewing in editor window */ +static void update_sample_display(VideoState *is, short *samples, int samples_size) +{ + int size, len; + + size = samples_size / sizeof(short); + while (size > 0) { + len = SAMPLE_ARRAY_SIZE - is->sample_array_index; + if (len > size) + len = size; + memcpy(is->sample_array + is->sample_array_index, samples, len * sizeof(short)); + samples += len; + is->sample_array_index += len; + if (is->sample_array_index >= SAMPLE_ARRAY_SIZE) + is->sample_array_index = 0; + size -= len; + } +} + +/* return the new audio buffer size (samples can be added or deleted + to get better sync if video or external master clock) */ +static int synchronize_audio(VideoState *is, short *samples, + int samples_size1, double pts) +{ + int n, samples_size; + double ref_clock; + + n = is->sdl_channels * av_get_bytes_per_sample(is->sdl_sample_fmt); + samples_size = samples_size1; + + /* if not master, then we try to remove or add samples to correct the clock */ + if (((is->av_sync_type == AV_SYNC_VIDEO_MASTER && is->video_st) || + is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) { + double diff, avg_diff; + int wanted_size, min_size, max_size, nb_samples; + + ref_clock = get_master_clock(is); + diff = get_audio_clock(is) - ref_clock; + + if (diff < AV_NOSYNC_THRESHOLD) { + is->audio_diff_cum = diff + is->audio_diff_avg_coef * is->audio_diff_cum; + if (is->audio_diff_avg_count < AUDIO_DIFF_AVG_NB) { + /* not enough measures to have a correct estimate */ + is->audio_diff_avg_count++; + } else { + /* estimate the A-V difference */ + avg_diff = is->audio_diff_cum * (1.0 - is->audio_diff_avg_coef); + + if (fabs(avg_diff) >= is->audio_diff_threshold) { + wanted_size = samples_size + ((int)(diff * is->sdl_sample_rate) * n); + nb_samples = samples_size / n; + + min_size = ((nb_samples * (100 - SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n; + max_size = ((nb_samples * (100 + SAMPLE_CORRECTION_PERCENT_MAX)) / 100) * n; + if (wanted_size < min_size) + wanted_size = min_size; + else if (wanted_size > max_size) + wanted_size = max_size; + + /* add or remove samples to correction the synchro */ + if (wanted_size < samples_size) { + /* remove samples */ + samples_size = wanted_size; + } else if (wanted_size > samples_size) { + uint8_t *samples_end, *q; + int nb; + + /* add samples */ + nb = (samples_size - wanted_size); + samples_end = (uint8_t *)samples + samples_size - n; + q = samples_end + n; + while (nb > 0) { + memcpy(q, samples_end, n); + q += n; + nb -= n; + } + samples_size = wanted_size; + } + } + av_dlog(NULL, "diff=%f adiff=%f sample_diff=%d apts=%0.3f vpts=%0.3f %f\n", + diff, avg_diff, samples_size - samples_size1, + is->audio_clock, is->video_clock, is->audio_diff_threshold); + } + } else { + /* too big difference : may be initial PTS errors, so + reset A-V filter */ + is->audio_diff_avg_count = 0; + is->audio_diff_cum = 0; + } + } + + return samples_size; +} + +/* decode one audio frame and returns its uncompressed size */ +static int audio_decode_frame(VideoState *is, double *pts_ptr) +{ + AVPacket *pkt_temp = &is->audio_pkt_temp; + AVPacket *pkt = &is->audio_pkt; + AVCodecContext *dec = is->audio_st->codec; + int n, len1, data_size, got_frame; + double pts; + int new_packet = 0; + int flush_complete = 0; + + for (;;) { + /* NOTE: the audio packet can contain several frames */ + while (pkt_temp->size > 0 || (!pkt_temp->data && new_packet)) { + int resample_changed, audio_resample; + + if (!is->frame) { + if (!(is->frame = av_frame_alloc())) + return AVERROR(ENOMEM); + } + + if (flush_complete) + break; + new_packet = 0; + len1 = avcodec_decode_audio4(dec, is->frame, &got_frame, pkt_temp); + if (len1 < 0) { + /* if error, we skip the frame */ + pkt_temp->size = 0; + break; + } + + pkt_temp->data += len1; + pkt_temp->size -= len1; + + if (!got_frame) { + /* stop sending empty packets if the decoder is finished */ + if (!pkt_temp->data && dec->codec->capabilities & CODEC_CAP_DELAY) + flush_complete = 1; + continue; + } + data_size = av_samples_get_buffer_size(NULL, dec->channels, + is->frame->nb_samples, + is->frame->format, 1); + + audio_resample = is->frame->format != is->sdl_sample_fmt || + is->frame->channel_layout != is->sdl_channel_layout || + is->frame->sample_rate != is->sdl_sample_rate; + + resample_changed = is->frame->format != is->resample_sample_fmt || + is->frame->channel_layout != is->resample_channel_layout || + is->frame->sample_rate != is->resample_sample_rate; + + if ((!is->avr && audio_resample) || resample_changed) { + int ret; + if (is->avr) + avresample_close(is->avr); + else if (audio_resample) { + is->avr = avresample_alloc_context(); + if (!is->avr) { + fprintf(stderr, "error allocating AVAudioResampleContext\n"); + break; + } + } + if (audio_resample) { + av_opt_set_int(is->avr, "in_channel_layout", is->frame->channel_layout, 0); + av_opt_set_int(is->avr, "in_sample_fmt", is->frame->format, 0); + av_opt_set_int(is->avr, "in_sample_rate", is->frame->sample_rate, 0); + av_opt_set_int(is->avr, "out_channel_layout", is->sdl_channel_layout, 0); + av_opt_set_int(is->avr, "out_sample_fmt", is->sdl_sample_fmt, 0); + av_opt_set_int(is->avr, "out_sample_rate", is->sdl_sample_rate, 0); + + if ((ret = avresample_open(is->avr)) < 0) { + fprintf(stderr, "error initializing libavresample\n"); + break; + } + } + is->resample_sample_fmt = is->frame->format; + is->resample_channel_layout = is->frame->channel_layout; + is->resample_sample_rate = is->frame->sample_rate; + } + + if (audio_resample) { + void *tmp_out; + int out_samples, out_size, out_linesize; + int osize = av_get_bytes_per_sample(is->sdl_sample_fmt); + int nb_samples = is->frame->nb_samples; + + out_size = av_samples_get_buffer_size(&out_linesize, + is->sdl_channels, + nb_samples, + is->sdl_sample_fmt, 0); + tmp_out = av_realloc(is->audio_buf1, out_size); + if (!tmp_out) + return AVERROR(ENOMEM); + is->audio_buf1 = tmp_out; + + out_samples = avresample_convert(is->avr, + &is->audio_buf1, + out_linesize, nb_samples, + is->frame->data, + is->frame->linesize[0], + is->frame->nb_samples); + if (out_samples < 0) { + fprintf(stderr, "avresample_convert() failed\n"); + break; + } + is->audio_buf = is->audio_buf1; + data_size = out_samples * osize * is->sdl_channels; + } else { + is->audio_buf = is->frame->data[0]; + } + + /* if no pts, then compute it */ + pts = is->audio_clock; + *pts_ptr = pts; + n = is->sdl_channels * av_get_bytes_per_sample(is->sdl_sample_fmt); + is->audio_clock += (double)data_size / + (double)(n * is->sdl_sample_rate); +#ifdef DEBUG + { + static double last_clock; + printf("audio: delay=%0.3f clock=%0.3f pts=%0.3f\n", + is->audio_clock - last_clock, + is->audio_clock, pts); + last_clock = is->audio_clock; + } +#endif + return data_size; + } + + /* free the current packet */ + if (pkt->data) + av_free_packet(pkt); + memset(pkt_temp, 0, sizeof(*pkt_temp)); + + if (is->paused || is->audioq.abort_request) { + return -1; + } + + /* read next packet */ + if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0) + return -1; + + if (pkt->data == flush_pkt.data) { + avcodec_flush_buffers(dec); + flush_complete = 0; + } + + *pkt_temp = *pkt; + + /* if update the audio clock with the pts */ + if (pkt->pts != AV_NOPTS_VALUE) { + is->audio_clock = av_q2d(is->audio_st->time_base)*pkt->pts; + } + } +} + +/* prepare a new audio buffer */ +static void sdl_audio_callback(void *opaque, Uint8 *stream, int len) +{ + VideoState *is = opaque; + int audio_size, len1; + double pts; + + audio_callback_time = av_gettime(); + + while (len > 0) { + if (is->audio_buf_index >= is->audio_buf_size) { + audio_size = audio_decode_frame(is, &pts); + if (audio_size < 0) { + /* if error, just output silence */ + is->audio_buf = is->silence_buf; + is->audio_buf_size = sizeof(is->silence_buf); + } else { + if (is->show_audio) + update_sample_display(is, (int16_t *)is->audio_buf, audio_size); + audio_size = synchronize_audio(is, (int16_t *)is->audio_buf, audio_size, + pts); + is->audio_buf_size = audio_size; + } + is->audio_buf_index = 0; + } + len1 = is->audio_buf_size - is->audio_buf_index; + if (len1 > len) + len1 = len; + memcpy(stream, (uint8_t *)is->audio_buf + is->audio_buf_index, len1); + len -= len1; + stream += len1; + is->audio_buf_index += len1; + } +} + +/* open a given stream. Return 0 if OK */ +static int stream_component_open(VideoState *is, int stream_index) +{ + AVFormatContext *ic = is->ic; + AVCodecContext *avctx; + AVCodec *codec; + SDL_AudioSpec wanted_spec, spec; + AVDictionary *opts; + AVDictionaryEntry *t = NULL; + + if (stream_index < 0 || stream_index >= ic->nb_streams) + return -1; + avctx = ic->streams[stream_index]->codec; + + opts = filter_codec_opts(codec_opts, avctx->codec_id, ic, ic->streams[stream_index], NULL); + + codec = avcodec_find_decoder(avctx->codec_id); + avctx->workaround_bugs = workaround_bugs; + avctx->idct_algo = idct; + avctx->skip_frame = skip_frame; + avctx->skip_idct = skip_idct; + avctx->skip_loop_filter = skip_loop_filter; + avctx->error_concealment = error_concealment; + + if (fast) avctx->flags2 |= CODEC_FLAG2_FAST; + + if (!av_dict_get(opts, "threads", NULL, 0)) + av_dict_set(&opts, "threads", "auto", 0); + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) + av_dict_set(&opts, "refcounted_frames", "1", 0); + if (!codec || + avcodec_open2(avctx, codec, &opts) < 0) + return -1; + if ((t = av_dict_get(opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { + av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); + return AVERROR_OPTION_NOT_FOUND; + } + + /* prepare audio output */ + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { + is->sdl_sample_rate = avctx->sample_rate; + + if (!avctx->channel_layout) + avctx->channel_layout = av_get_default_channel_layout(avctx->channels); + if (!avctx->channel_layout) { + fprintf(stderr, "unable to guess channel layout\n"); + return -1; + } + if (avctx->channels == 1) + is->sdl_channel_layout = AV_CH_LAYOUT_MONO; + else + is->sdl_channel_layout = AV_CH_LAYOUT_STEREO; + is->sdl_channels = av_get_channel_layout_nb_channels(is->sdl_channel_layout); + + wanted_spec.format = AUDIO_S16SYS; + wanted_spec.freq = is->sdl_sample_rate; + wanted_spec.channels = is->sdl_channels; + wanted_spec.silence = 0; + wanted_spec.samples = SDL_AUDIO_BUFFER_SIZE; + wanted_spec.callback = sdl_audio_callback; + wanted_spec.userdata = is; + if (SDL_OpenAudio(&wanted_spec, &spec) < 0) { + fprintf(stderr, "SDL_OpenAudio: %s\n", SDL_GetError()); + return -1; + } + is->audio_hw_buf_size = spec.size; + is->sdl_sample_fmt = AV_SAMPLE_FMT_S16; + is->resample_sample_fmt = is->sdl_sample_fmt; + is->resample_channel_layout = avctx->channel_layout; + is->resample_sample_rate = avctx->sample_rate; + } + + ic->streams[stream_index]->discard = AVDISCARD_DEFAULT; + switch (avctx->codec_type) { + case AVMEDIA_TYPE_AUDIO: + is->audio_stream = stream_index; + is->audio_st = ic->streams[stream_index]; + is->audio_buf_size = 0; + is->audio_buf_index = 0; + + /* init averaging filter */ + is->audio_diff_avg_coef = exp(log(0.01) / AUDIO_DIFF_AVG_NB); + is->audio_diff_avg_count = 0; + /* since we do not have a precise anough audio fifo fullness, + we correct audio sync only if larger than this threshold */ + is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / avctx->sample_rate; + + memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); + packet_queue_init(&is->audioq); + SDL_PauseAudio(0); + break; + case AVMEDIA_TYPE_VIDEO: + is->video_stream = stream_index; + is->video_st = ic->streams[stream_index]; + + packet_queue_init(&is->videoq); + is->video_tid = SDL_CreateThread(video_thread, is); + break; + case AVMEDIA_TYPE_SUBTITLE: + is->subtitle_stream = stream_index; + is->subtitle_st = ic->streams[stream_index]; + packet_queue_init(&is->subtitleq); + + is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); + break; + default: + break; + } + return 0; +} + +static void stream_component_close(VideoState *is, int stream_index) +{ + AVFormatContext *ic = is->ic; + AVCodecContext *avctx; + + if (stream_index < 0 || stream_index >= ic->nb_streams) + return; + avctx = ic->streams[stream_index]->codec; + + switch (avctx->codec_type) { + case AVMEDIA_TYPE_AUDIO: + packet_queue_abort(&is->audioq); + + SDL_CloseAudio(); + + packet_queue_end(&is->audioq); + av_free_packet(&is->audio_pkt); + if (is->avr) + avresample_free(&is->avr); + av_freep(&is->audio_buf1); + is->audio_buf = NULL; + av_frame_free(&is->frame); + + if (is->rdft) { + av_rdft_end(is->rdft); + av_freep(&is->rdft_data); + is->rdft = NULL; + is->rdft_bits = 0; + } + break; + case AVMEDIA_TYPE_VIDEO: + packet_queue_abort(&is->videoq); + + /* note: we also signal this mutex to make sure we deblock the + video thread in all cases */ + SDL_LockMutex(is->pictq_mutex); + SDL_CondSignal(is->pictq_cond); + SDL_UnlockMutex(is->pictq_mutex); + + SDL_WaitThread(is->video_tid, NULL); + + packet_queue_end(&is->videoq); + break; + case AVMEDIA_TYPE_SUBTITLE: + packet_queue_abort(&is->subtitleq); + + /* note: we also signal this mutex to make sure we deblock the + video thread in all cases */ + SDL_LockMutex(is->subpq_mutex); + is->subtitle_stream_changed = 1; + + SDL_CondSignal(is->subpq_cond); + SDL_UnlockMutex(is->subpq_mutex); + + SDL_WaitThread(is->subtitle_tid, NULL); + + packet_queue_end(&is->subtitleq); + break; + default: + break; + } + + ic->streams[stream_index]->discard = AVDISCARD_ALL; + avcodec_close(avctx); + switch (avctx->codec_type) { + case AVMEDIA_TYPE_AUDIO: + is->audio_st = NULL; + is->audio_stream = -1; + break; + case AVMEDIA_TYPE_VIDEO: + is->video_st = NULL; + is->video_stream = -1; + break; + case AVMEDIA_TYPE_SUBTITLE: + is->subtitle_st = NULL; + is->subtitle_stream = -1; + break; + default: + break; + } +} + +/* since we have only one decoding thread, we can use a global + variable instead of a thread local variable */ +static VideoState *global_video_state; + +static int decode_interrupt_cb(void *ctx) +{ + return global_video_state && global_video_state->abort_request; +} + +/* this thread gets the stream from the disk or the network */ +static int decode_thread(void *arg) +{ + VideoState *is = arg; + AVFormatContext *ic = NULL; + int err, i, ret; + int st_index[AVMEDIA_TYPE_NB]; + AVPacket pkt1, *pkt = &pkt1; + int eof = 0; + int pkt_in_play_range = 0; + AVDictionaryEntry *t; + AVDictionary **opts; + int orig_nb_streams; + + memset(st_index, -1, sizeof(st_index)); + is->video_stream = -1; + is->audio_stream = -1; + is->subtitle_stream = -1; + + global_video_state = is; + + ic = avformat_alloc_context(); + ic->interrupt_callback.callback = decode_interrupt_cb; + err = avformat_open_input(&ic, is->filename, is->iformat, &format_opts); + if (err < 0) { + print_error(is->filename, err); + ret = -1; + goto fail; + } + if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { + av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); + ret = AVERROR_OPTION_NOT_FOUND; + goto fail; + } + is->ic = ic; + + if (genpts) + ic->flags |= AVFMT_FLAG_GENPTS; + + opts = setup_find_stream_info_opts(ic, codec_opts); + orig_nb_streams = ic->nb_streams; + + err = avformat_find_stream_info(ic, opts); + if (err < 0) { + fprintf(stderr, "%s: could not find codec parameters\n", is->filename); + ret = -1; + goto fail; + } + for (i = 0; i < orig_nb_streams; i++) + av_dict_free(&opts[i]); + av_freep(&opts); + + if (ic->pb) + ic->pb->eof_reached = 0; // FIXME hack, avplay maybe should not use url_feof() to test for the end + + if (seek_by_bytes < 0) + seek_by_bytes = !!(ic->iformat->flags & AVFMT_TS_DISCONT); + + /* if seeking requested, we execute it */ + if (start_time != AV_NOPTS_VALUE) { + int64_t timestamp; + + timestamp = start_time; + /* add the stream start time */ + if (ic->start_time != AV_NOPTS_VALUE) + timestamp += ic->start_time; + ret = avformat_seek_file(ic, -1, INT64_MIN, timestamp, INT64_MAX, 0); + if (ret < 0) { + fprintf(stderr, "%s: could not seek to position %0.3f\n", + is->filename, (double)timestamp / AV_TIME_BASE); + } + } + + for (i = 0; i < ic->nb_streams; i++) + ic->streams[i]->discard = AVDISCARD_ALL; + if (!video_disable) + st_index[AVMEDIA_TYPE_VIDEO] = + av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, + wanted_stream[AVMEDIA_TYPE_VIDEO], -1, NULL, 0); + if (!audio_disable) + st_index[AVMEDIA_TYPE_AUDIO] = + av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, + wanted_stream[AVMEDIA_TYPE_AUDIO], + st_index[AVMEDIA_TYPE_VIDEO], + NULL, 0); + if (!video_disable) + st_index[AVMEDIA_TYPE_SUBTITLE] = + av_find_best_stream(ic, AVMEDIA_TYPE_SUBTITLE, + wanted_stream[AVMEDIA_TYPE_SUBTITLE], + (st_index[AVMEDIA_TYPE_AUDIO] >= 0 ? + st_index[AVMEDIA_TYPE_AUDIO] : + st_index[AVMEDIA_TYPE_VIDEO]), + NULL, 0); + if (show_status) { + av_dump_format(ic, 0, is->filename, 0); + } + + /* open the streams */ + if (st_index[AVMEDIA_TYPE_AUDIO] >= 0) { + stream_component_open(is, st_index[AVMEDIA_TYPE_AUDIO]); + } + + ret = -1; + if (st_index[AVMEDIA_TYPE_VIDEO] >= 0) { + ret = stream_component_open(is, st_index[AVMEDIA_TYPE_VIDEO]); + } + is->refresh_tid = SDL_CreateThread(refresh_thread, is); + if (ret < 0) { + if (!display_disable) + is->show_audio = 2; + } + + if (st_index[AVMEDIA_TYPE_SUBTITLE] >= 0) { + stream_component_open(is, st_index[AVMEDIA_TYPE_SUBTITLE]); + } + + if (is->video_stream < 0 && is->audio_stream < 0) { + fprintf(stderr, "%s: could not open codecs\n", is->filename); + ret = -1; + goto fail; + } + + for (;;) { + if (is->abort_request) + break; + if (is->paused != is->last_paused) { + is->last_paused = is->paused; + if (is->paused) + is->read_pause_return = av_read_pause(ic); + else + av_read_play(ic); + } +#if CONFIG_RTSP_DEMUXER + if (is->paused && !strcmp(ic->iformat->name, "rtsp")) { + /* wait 10 ms to avoid trying to get another packet */ + /* XXX: horrible */ + SDL_Delay(10); + continue; + } +#endif + if (is->seek_req) { + int64_t seek_target = is->seek_pos; + int64_t seek_min = is->seek_rel > 0 ? seek_target - is->seek_rel + 2: INT64_MIN; + int64_t seek_max = is->seek_rel < 0 ? seek_target - is->seek_rel - 2: INT64_MAX; +// FIXME the +-2 is due to rounding being not done in the correct direction in generation +// of the seek_pos/seek_rel variables + + ret = avformat_seek_file(is->ic, -1, seek_min, seek_target, seek_max, is->seek_flags); + if (ret < 0) { + fprintf(stderr, "%s: error while seeking\n", is->ic->filename); + } else { + if (is->audio_stream >= 0) { + packet_queue_flush(&is->audioq); + packet_queue_put(&is->audioq, &flush_pkt); + } + if (is->subtitle_stream >= 0) { + packet_queue_flush(&is->subtitleq); + packet_queue_put(&is->subtitleq, &flush_pkt); + } + if (is->video_stream >= 0) { + packet_queue_flush(&is->videoq); + packet_queue_put(&is->videoq, &flush_pkt); + } + } + is->seek_req = 0; + eof = 0; + } + + /* if the queue are full, no need to read more */ + if (!infinite_buffer && + (is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE + || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream < 0) + && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0) + && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0)))) { + /* wait 10 ms */ + SDL_Delay(10); + continue; + } + if (eof) { + if (is->video_stream >= 0) { + av_init_packet(pkt); + pkt->data = NULL; + pkt->size = 0; + pkt->stream_index = is->video_stream; + packet_queue_put(&is->videoq, pkt); + } + if (is->audio_stream >= 0 && + is->audio_st->codec->codec->capabilities & CODEC_CAP_DELAY) { + av_init_packet(pkt); + pkt->data = NULL; + pkt->size = 0; + pkt->stream_index = is->audio_stream; + packet_queue_put(&is->audioq, pkt); + } + SDL_Delay(10); + if (is->audioq.size + is->videoq.size + is->subtitleq.size == 0) { + if (loop != 1 && (!loop || --loop)) { + stream_seek(cur_stream, start_time != AV_NOPTS_VALUE ? start_time : 0, 0, 0); + } else if (autoexit) { + ret = AVERROR_EOF; + goto fail; + } + } + continue; + } + ret = av_read_frame(ic, pkt); + if (ret < 0) { + if (ret == AVERROR_EOF || (ic->pb && ic->pb->eof_reached)) + eof = 1; + if (ic->pb && ic->pb->error) + break; + SDL_Delay(100); /* wait for user event */ + continue; + } + /* check if packet is in play range specified by user, then queue, otherwise discard */ + pkt_in_play_range = duration == AV_NOPTS_VALUE || + (pkt->pts - ic->streams[pkt->stream_index]->start_time) * + av_q2d(ic->streams[pkt->stream_index]->time_base) - + (double)(start_time != AV_NOPTS_VALUE ? start_time : 0) / 1000000 + <= ((double)duration / 1000000); + if (pkt->stream_index == is->audio_stream && pkt_in_play_range) { + packet_queue_put(&is->audioq, pkt); + } else if (pkt->stream_index == is->video_stream && pkt_in_play_range) { + packet_queue_put(&is->videoq, pkt); + } else if (pkt->stream_index == is->subtitle_stream && pkt_in_play_range) { + packet_queue_put(&is->subtitleq, pkt); + } else { + av_free_packet(pkt); + } + } + /* wait until the end */ + while (!is->abort_request) { + SDL_Delay(100); + } + + ret = 0; + fail: + /* disable interrupting */ + global_video_state = NULL; + + /* close each stream */ + if (is->audio_stream >= 0) + stream_component_close(is, is->audio_stream); + if (is->video_stream >= 0) + stream_component_close(is, is->video_stream); + if (is->subtitle_stream >= 0) + stream_component_close(is, is->subtitle_stream); + if (is->ic) { + avformat_close_input(&is->ic); + } + + if (ret != 0) { + SDL_Event event; + + event.type = FF_QUIT_EVENT; + event.user.data1 = is; + SDL_PushEvent(&event); + } + return 0; +} + +static VideoState *stream_open(const char *filename, AVInputFormat *iformat) +{ + VideoState *is; + + is = av_mallocz(sizeof(VideoState)); + if (!is) + return NULL; + av_strlcpy(is->filename, filename, sizeof(is->filename)); + is->iformat = iformat; + is->ytop = 0; + is->xleft = 0; + + /* start video display */ + is->pictq_mutex = SDL_CreateMutex(); + is->pictq_cond = SDL_CreateCond(); + + is->subpq_mutex = SDL_CreateMutex(); + is->subpq_cond = SDL_CreateCond(); + + is->av_sync_type = av_sync_type; + is->parse_tid = SDL_CreateThread(decode_thread, is); + if (!is->parse_tid) { + av_free(is); + return NULL; + } + return is; +} + +static void stream_cycle_channel(VideoState *is, int codec_type) +{ + AVFormatContext *ic = is->ic; + int start_index, stream_index; + AVStream *st; + + if (codec_type == AVMEDIA_TYPE_VIDEO) + start_index = is->video_stream; + else if (codec_type == AVMEDIA_TYPE_AUDIO) + start_index = is->audio_stream; + else + start_index = is->subtitle_stream; + if (start_index < (codec_type == AVMEDIA_TYPE_SUBTITLE ? -1 : 0)) + return; + stream_index = start_index; + for (;;) { + if (++stream_index >= is->ic->nb_streams) + { + if (codec_type == AVMEDIA_TYPE_SUBTITLE) + { + stream_index = -1; + goto the_end; + } else + stream_index = 0; + } + if (stream_index == start_index) + return; + st = ic->streams[stream_index]; + if (st->codec->codec_type == codec_type) { + /* check that parameters are OK */ + switch (codec_type) { + case AVMEDIA_TYPE_AUDIO: + if (st->codec->sample_rate != 0 && + st->codec->channels != 0) + goto the_end; + break; + case AVMEDIA_TYPE_VIDEO: + case AVMEDIA_TYPE_SUBTITLE: + goto the_end; + default: + break; + } + } + } + the_end: + stream_component_close(is, start_index); + stream_component_open(is, stream_index); +} + + +static void toggle_full_screen(void) +{ +#if defined(__APPLE__) && SDL_VERSION_ATLEAST(1, 2, 14) + /* OS X needs to empty the picture_queue */ + int i; + for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) + cur_stream->pictq[i].reallocate = 1; +#endif + is_full_screen = !is_full_screen; + video_open(cur_stream); +} + +static void toggle_pause(void) +{ + if (cur_stream) + stream_pause(cur_stream); + step = 0; +} + +static void step_to_next_frame(void) +{ + if (cur_stream) { + /* if the stream is paused unpause it, then step */ + if (cur_stream->paused) + stream_pause(cur_stream); + } + step = 1; +} + +static void toggle_audio_display(void) +{ + if (cur_stream) { + int bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); + cur_stream->show_audio = (cur_stream->show_audio + 1) % 3; + fill_rectangle(screen, + cur_stream->xleft, cur_stream->ytop, cur_stream->width, cur_stream->height, + bgcolor); + SDL_UpdateRect(screen, cur_stream->xleft, cur_stream->ytop, cur_stream->width, cur_stream->height); + } +} + +static void seek_chapter(VideoState *is, int incr) +{ + int64_t pos = get_master_clock(is) * AV_TIME_BASE; + int i; + + if (!is->ic->nb_chapters) + return; + + /* find the current chapter */ + for (i = 0; i < is->ic->nb_chapters; i++) { + AVChapter *ch = is->ic->chapters[i]; + if (av_compare_ts(pos, AV_TIME_BASE_Q, ch->start, ch->time_base) < 0) { + i--; + break; + } + } + + i += incr; + i = FFMAX(i, 0); + if (i >= is->ic->nb_chapters) + return; + + av_log(NULL, AV_LOG_VERBOSE, "Seeking to chapter %d.\n", i); + stream_seek(is, av_rescale_q(is->ic->chapters[i]->start, is->ic->chapters[i]->time_base, + AV_TIME_BASE_Q), 0, 0); +} + +/* handle an event sent by the GUI */ +static void event_loop(void) +{ + SDL_Event event; + double incr, pos, frac; + + for (;;) { + double x; + SDL_WaitEvent(&event); + switch (event.type) { + case SDL_KEYDOWN: + if (exit_on_keydown) { + do_exit(); + break; + } + switch (event.key.keysym.sym) { + case SDLK_ESCAPE: + case SDLK_q: + do_exit(); + break; + case SDLK_f: + toggle_full_screen(); + break; + case SDLK_p: + case SDLK_SPACE: + toggle_pause(); + break; + case SDLK_s: // S: Step to next frame + step_to_next_frame(); + break; + case SDLK_a: + if (cur_stream) + stream_cycle_channel(cur_stream, AVMEDIA_TYPE_AUDIO); + break; + case SDLK_v: + if (cur_stream) + stream_cycle_channel(cur_stream, AVMEDIA_TYPE_VIDEO); + break; + case SDLK_t: + if (cur_stream) + stream_cycle_channel(cur_stream, AVMEDIA_TYPE_SUBTITLE); + break; + case SDLK_w: + toggle_audio_display(); + break; + case SDLK_PAGEUP: + seek_chapter(cur_stream, 1); + break; + case SDLK_PAGEDOWN: + seek_chapter(cur_stream, -1); + break; + case SDLK_LEFT: + incr = -10.0; + goto do_seek; + case SDLK_RIGHT: + incr = 10.0; + goto do_seek; + case SDLK_UP: + incr = 60.0; + goto do_seek; + case SDLK_DOWN: + incr = -60.0; + do_seek: + if (cur_stream) { + if (seek_by_bytes) { + if (cur_stream->video_stream >= 0 && cur_stream->video_current_pos >= 0) { + pos = cur_stream->video_current_pos; + } else if (cur_stream->audio_stream >= 0 && cur_stream->audio_pkt.pos >= 0) { + pos = cur_stream->audio_pkt.pos; + } else + pos = avio_tell(cur_stream->ic->pb); + if (cur_stream->ic->bit_rate) + incr *= cur_stream->ic->bit_rate / 8.0; + else + incr *= 180000.0; + pos += incr; + stream_seek(cur_stream, pos, incr, 1); + } else { + pos = get_master_clock(cur_stream); + pos += incr; + stream_seek(cur_stream, (int64_t)(pos * AV_TIME_BASE), (int64_t)(incr * AV_TIME_BASE), 0); + } + } + break; + default: + break; + } + break; + case SDL_MOUSEBUTTONDOWN: + if (exit_on_mousedown) { + do_exit(); + break; + } + case SDL_MOUSEMOTION: + if (event.type == SDL_MOUSEBUTTONDOWN) { + x = event.button.x; + } else { + if (event.motion.state != SDL_PRESSED) + break; + x = event.motion.x; + } + if (cur_stream) { + if (seek_by_bytes || cur_stream->ic->duration <= 0) { + uint64_t size = avio_size(cur_stream->ic->pb); + stream_seek(cur_stream, size*x/cur_stream->width, 0, 1); + } else { + int64_t ts; + int ns, hh, mm, ss; + int tns, thh, tmm, tss; + tns = cur_stream->ic->duration / 1000000LL; + thh = tns / 3600; + tmm = (tns % 3600) / 60; + tss = (tns % 60); + frac = x / cur_stream->width; + ns = frac * tns; + hh = ns / 3600; + mm = (ns % 3600) / 60; + ss = (ns % 60); + fprintf(stderr, "Seek to %2.0f%% (%2d:%02d:%02d) of total duration (%2d:%02d:%02d) \n", frac*100, + hh, mm, ss, thh, tmm, tss); + ts = frac * cur_stream->ic->duration; + if (cur_stream->ic->start_time != AV_NOPTS_VALUE) + ts += cur_stream->ic->start_time; + stream_seek(cur_stream, ts, 0, 0); + } + } + break; + case SDL_VIDEORESIZE: + if (cur_stream) { + screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, + SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); + screen_width = cur_stream->width = event.resize.w; + screen_height = cur_stream->height = event.resize.h; + } + break; + case SDL_QUIT: + case FF_QUIT_EVENT: + do_exit(); + break; + case FF_ALLOC_EVENT: + video_open(event.user.data1); + alloc_picture(event.user.data1); + break; + case FF_REFRESH_EVENT: + video_refresh_timer(event.user.data1); + cur_stream->refresh = 0; + break; + default: + break; + } + } +} + +static int opt_frame_size(void *optctx, const char *opt, const char *arg) +{ + av_log(NULL, AV_LOG_ERROR, + "Option '%s' has been removed, use private format options instead\n", opt); + return AVERROR(EINVAL); +} + +static int opt_width(void *optctx, const char *opt, const char *arg) +{ + screen_width = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX); + return 0; +} + +static int opt_height(void *optctx, const char *opt, const char *arg) +{ + screen_height = parse_number_or_die(opt, arg, OPT_INT64, 1, INT_MAX); + return 0; +} + +static int opt_format(void *optctx, const char *opt, const char *arg) +{ + file_iformat = av_find_input_format(arg); + if (!file_iformat) { + fprintf(stderr, "Unknown input format: %s\n", arg); + return AVERROR(EINVAL); + } + return 0; +} + +static int opt_frame_pix_fmt(void *optctx, const char *opt, const char *arg) +{ + av_log(NULL, AV_LOG_ERROR, + "Option '%s' has been removed, use private format options instead\n", opt); + return AVERROR(EINVAL); +} + +static int opt_sync(void *optctx, const char *opt, const char *arg) +{ + if (!strcmp(arg, "audio")) + av_sync_type = AV_SYNC_AUDIO_MASTER; + else if (!strcmp(arg, "video")) + av_sync_type = AV_SYNC_VIDEO_MASTER; + else if (!strcmp(arg, "ext")) + av_sync_type = AV_SYNC_EXTERNAL_CLOCK; + else { + fprintf(stderr, "Unknown value for %s: %s\n", opt, arg); + exit(1); + } + return 0; +} + +static int opt_seek(void *optctx, const char *opt, const char *arg) +{ + start_time = parse_time_or_die(opt, arg, 1); + return 0; +} + +static int opt_duration(void *optctx, const char *opt, const char *arg) +{ + duration = parse_time_or_die(opt, arg, 1); + return 0; +} + +static const OptionDef options[] = { +#include "cmdutils_common_opts.h" + { "x", HAS_ARG, { .func_arg = opt_width }, "force displayed width", "width" }, + { "y", HAS_ARG, { .func_arg = opt_height }, "force displayed height", "height" }, + { "s", HAS_ARG | OPT_VIDEO, { .func_arg = opt_frame_size }, "set frame size (WxH or abbreviation)", "size" }, + { "fs", OPT_BOOL, { &is_full_screen }, "force full screen" }, + { "an", OPT_BOOL, { &audio_disable }, "disable audio" }, + { "vn", OPT_BOOL, { &video_disable }, "disable video" }, + { "ast", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_AUDIO] }, "select desired audio stream", "stream_number" }, + { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_VIDEO] }, "select desired video stream", "stream_number" }, + { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, { &wanted_stream[AVMEDIA_TYPE_SUBTITLE] }, "select desired subtitle stream", "stream_number" }, + { "ss", HAS_ARG, { .func_arg = opt_seek }, "seek to a given position in seconds", "pos" }, + { "t", HAS_ARG, { .func_arg = opt_duration }, "play \"duration\" seconds of audio/video", "duration" }, + { "bytes", OPT_INT | HAS_ARG, { &seek_by_bytes }, "seek by bytes 0=off 1=on -1=auto", "val" }, + { "nodisp", OPT_BOOL, { &display_disable }, "disable graphical display" }, + { "f", HAS_ARG, { .func_arg = opt_format }, "force format", "fmt" }, + { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, { .func_arg = opt_frame_pix_fmt }, "set pixel format", "format" }, + { "stats", OPT_BOOL | OPT_EXPERT, { &show_status }, "show status", "" }, + { "bug", OPT_INT | HAS_ARG | OPT_EXPERT, { &workaround_bugs }, "workaround bugs", "" }, + { "fast", OPT_BOOL | OPT_EXPERT, { &fast }, "non spec compliant optimizations", "" }, + { "genpts", OPT_BOOL | OPT_EXPERT, { &genpts }, "generate pts", "" }, + { "drp", OPT_INT | HAS_ARG | OPT_EXPERT, { &decoder_reorder_pts }, "let decoder reorder pts 0=off 1=on -1=auto", ""}, + { "skiploop", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_loop_filter }, "", "" }, + { "skipframe", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_frame }, "", "" }, + { "skipidct", OPT_INT | HAS_ARG | OPT_EXPERT, { &skip_idct }, "", "" }, + { "idct", OPT_INT | HAS_ARG | OPT_EXPERT, { &idct }, "set idct algo", "algo" }, + { "ec", OPT_INT | HAS_ARG | OPT_EXPERT, { &error_concealment }, "set error concealment options", "bit_mask" }, + { "sync", HAS_ARG | OPT_EXPERT, { .func_arg = opt_sync }, "set audio-video sync. type (type=audio/video/ext)", "type" }, + { "autoexit", OPT_BOOL | OPT_EXPERT, { &autoexit }, "exit at the end", "" }, + { "exitonkeydown", OPT_BOOL | OPT_EXPERT, { &exit_on_keydown }, "exit on key down", "" }, + { "exitonmousedown", OPT_BOOL | OPT_EXPERT, { &exit_on_mousedown }, "exit on mouse down", "" }, + { "loop", OPT_INT | HAS_ARG | OPT_EXPERT, { &loop }, "set number of times the playback shall be looped", "loop count" }, + { "framedrop", OPT_BOOL | OPT_EXPERT, { &framedrop }, "drop frames when cpu is too slow", "" }, + { "infbuf", OPT_BOOL | OPT_EXPERT, { &infinite_buffer }, "don't limit the input buffer size (useful with realtime streams)", "" }, + { "window_title", OPT_STRING | HAS_ARG, { &window_title }, "set window title", "window title" }, +#if CONFIG_AVFILTER + { "vf", OPT_STRING | HAS_ARG, { &vfilters }, "video filters", "filter list" }, +#endif + { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, { &rdftspeed }, "rdft speed", "msecs" }, + { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, { opt_default }, "generic catch all option", "" }, + { "i", 0, { NULL }, "avconv compatibility dummy option", ""}, + { NULL, }, +}; + +static void show_usage(void) +{ + printf("Simple media player\n"); + printf("usage: %s [options] input_file\n", program_name); + printf("\n"); +} + +void show_help_default(const char *opt, const char *arg) +{ + av_log_set_callback(log_callback_help); + show_usage(); + show_help_options(options, "Main options:", 0, OPT_EXPERT, 0); + show_help_options(options, "Advanced options:", OPT_EXPERT, 0, 0); + printf("\n"); + show_help_children(avcodec_get_class(), AV_OPT_FLAG_DECODING_PARAM); + show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); +#if !CONFIG_AVFILTER + show_help_children(sws_get_class(), AV_OPT_FLAG_ENCODING_PARAM); +#endif + printf("\nWhile playing:\n" + "q, ESC quit\n" + "f toggle full screen\n" + "p, SPC pause\n" + "a cycle audio channel\n" + "v cycle video channel\n" + "t cycle subtitle channel\n" + "w show audio waves\n" + "s activate frame-step mode\n" + "left/right seek backward/forward 10 seconds\n" + "down/up seek backward/forward 1 minute\n" + "mouse click seek to percentage in file corresponding to fraction of width\n" + ); +} + +static void opt_input_file(void *optctx, const char *filename) +{ + if (input_filename) { + fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", + filename, input_filename); + exit(1); + } + if (!strcmp(filename, "-")) + filename = "pipe:"; + input_filename = filename; +} + +/* Called from the main */ +int main(int argc, char **argv) +{ + int flags; + + av_log_set_flags(AV_LOG_SKIP_REPEATED); + parse_loglevel(argc, argv, options); + + /* register all codecs, demux and protocols */ + avcodec_register_all(); +#if CONFIG_AVDEVICE + avdevice_register_all(); +#endif +#if CONFIG_AVFILTER + avfilter_register_all(); +#endif + av_register_all(); + avformat_network_init(); + + init_opts(); + + show_banner(); + + parse_options(NULL, argc, argv, options, opt_input_file); + + if (!input_filename) { + show_usage(); + fprintf(stderr, "An input file must be specified\n"); + fprintf(stderr, "Use -h to get full help or, even better, run 'man %s'\n", program_name); + exit(1); + } + + if (display_disable) { + video_disable = 1; + } + flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; +#if !defined(__MINGW32__) && !defined(__APPLE__) + flags |= SDL_INIT_EVENTTHREAD; /* Not supported on Windows or Mac OS X */ +#endif + if (SDL_Init (flags)) { + fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError()); + exit(1); + } + + if (!display_disable) { + const SDL_VideoInfo *vi = SDL_GetVideoInfo(); + fs_screen_width = vi->current_w; + fs_screen_height = vi->current_h; + } + + SDL_EventState(SDL_ACTIVEEVENT, SDL_IGNORE); + SDL_EventState(SDL_SYSWMEVENT, SDL_IGNORE); + SDL_EventState(SDL_USEREVENT, SDL_IGNORE); + + av_init_packet(&flush_pkt); + flush_pkt.data = (uint8_t *)&flush_pkt; + + cur_stream = stream_open(input_filename, file_iformat); + + event_loop(); + + /* never returns */ + + return 0; +} diff --git a/avprobe.c b/avprobe.c new file mode 100644 index 0000000000..c7b3d39cb2 --- /dev/null +++ b/avprobe.c @@ -0,0 +1,969 @@ +/* + * avprobe : Simple Media Prober based on the Libav libraries + * Copyright (c) 2007-2010 Stefano Sabatini + * + * 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 + */ + +#include "config.h" + +#include "libavformat/avformat.h" +#include "libavcodec/avcodec.h" +#include "libavutil/avstring.h" +#include "libavutil/opt.h" +#include "libavutil/pixdesc.h" +#include "libavutil/dict.h" +#include "libavutil/libm.h" +#include "libavdevice/avdevice.h" +#include "cmdutils.h" + +const char program_name[] = "avprobe"; +const int program_birth_year = 2007; + +static int do_show_format = 0; +static AVDictionary *fmt_entries_to_show = NULL; +static int nb_fmt_entries_to_show; +static int do_show_packets = 0; +static int do_show_streams = 0; + +static int show_value_unit = 0; +static int use_value_prefix = 0; +static int use_byte_value_binary_prefix = 0; +static int use_value_sexagesimal_format = 0; + +/* globals */ +static const OptionDef *options; + +/* AVprobe context */ +static const char *input_filename; +static AVInputFormat *iformat = NULL; + +static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" }; +static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" }; + +static const char unit_second_str[] = "s" ; +static const char unit_hertz_str[] = "Hz" ; +static const char unit_byte_str[] = "byte" ; +static const char unit_bit_per_second_str[] = "bit/s"; + +static void avprobe_cleanup(int ret) +{ + av_dict_free(&fmt_entries_to_show); +} + +/* + * The output is structured in array and objects that might contain items + * Array could require the objects within to not be named. + * Object could require the items within to be named. + * + * For flat representation the name of each section is saved on prefix so it + * can be rendered in order to represent nested structures (e.g. array of + * objects for the packets list). + * + * Within an array each element can need an unique identifier or an index. + * + * Nesting level is accounted separately. + */ + +typedef enum { + ARRAY, + OBJECT +} PrintElementType; + +typedef struct { + const char *name; + PrintElementType type; + int64_t index; + int64_t nb_elems; +} PrintElement; + +typedef struct { + PrintElement *prefix; + int level; + void (*print_header)(void); + void (*print_footer)(void); + + void (*print_array_header) (const char *name); + void (*print_array_footer) (const char *name); + void (*print_object_header)(const char *name); + void (*print_object_footer)(const char *name); + + void (*print_integer) (const char *key, int64_t value); + void (*print_string) (const char *key, const char *value); +} PrintContext; + +static AVIOContext *probe_out = NULL; +static PrintContext octx; +#define AVP_INDENT() avio_printf(probe_out, "%*c", octx.level * 2, ' ') + +/* + * Default format, INI + * + * - all key and values are utf8 + * - '.' is the subgroup separator + * - newlines and the following characters are escaped + * - '\' is the escape character + * - '#' is the comment + * - '=' is the key/value separators + * - ':' is not used but usually parsed as key/value separator + */ + +static void ini_print_header(void) +{ + avio_printf(probe_out, "# avprobe output\n\n"); +} +static void ini_print_footer(void) +{ + avio_w8(probe_out, '\n'); +} + +static void ini_escape_print(const char *s) +{ + int i = 0; + char c = 0; + + while (c = s[i++]) { + switch (c) { + case '\r': avio_printf(probe_out, "%s", "\\r"); break; + case '\n': avio_printf(probe_out, "%s", "\\n"); break; + case '\f': avio_printf(probe_out, "%s", "\\f"); break; + case '\b': avio_printf(probe_out, "%s", "\\b"); break; + case '\t': avio_printf(probe_out, "%s", "\\t"); break; + case '\\': + case '#' : + case '=' : + case ':' : avio_w8(probe_out, '\\'); + default: + if ((unsigned char)c < 32) + avio_printf(probe_out, "\\x00%02x", c & 0xff); + else + avio_w8(probe_out, c); + break; + } + } +} + +static void ini_print_array_header(const char *name) +{ + if (octx.prefix[octx.level -1].nb_elems) + avio_printf(probe_out, "\n"); +} + +static void ini_print_object_header(const char *name) +{ + int i; + PrintElement *el = octx.prefix + octx.level -1; + + if (el->nb_elems) + avio_printf(probe_out, "\n"); + + avio_printf(probe_out, "["); + + for (i = 1; i < octx.level; i++) { + el = octx.prefix + i; + avio_printf(probe_out, "%s.", el->name); + if (el->index >= 0) + avio_printf(probe_out, "%"PRId64".", el->index); + } + + avio_printf(probe_out, "%s", name); + if (el && el->type == ARRAY) + avio_printf(probe_out, ".%"PRId64"", el->nb_elems); + avio_printf(probe_out, "]\n"); +} + +static void ini_print_integer(const char *key, int64_t value) +{ + ini_escape_print(key); + avio_printf(probe_out, "=%"PRId64"\n", value); +} + + +static void ini_print_string(const char *key, const char *value) +{ + ini_escape_print(key); + avio_printf(probe_out, "="); + ini_escape_print(value); + avio_w8(probe_out, '\n'); +} + +/* + * Alternate format, JSON + */ + +static void json_print_header(void) +{ + avio_printf(probe_out, "{"); +} +static void json_print_footer(void) +{ + avio_printf(probe_out, "}\n"); +} + +static void json_print_array_header(const char *name) +{ + if (octx.prefix[octx.level -1].nb_elems) + avio_printf(probe_out, ",\n"); + AVP_INDENT(); + avio_printf(probe_out, "\"%s\" : ", name); + avio_printf(probe_out, "[\n"); +} + +static void json_print_array_footer(const char *name) +{ + avio_printf(probe_out, "\n"); + AVP_INDENT(); + avio_printf(probe_out, "]"); +} + +static void json_print_object_header(const char *name) +{ + if (octx.prefix[octx.level -1].nb_elems) + avio_printf(probe_out, ",\n"); + AVP_INDENT(); + if (octx.prefix[octx.level -1].type == OBJECT) + avio_printf(probe_out, "\"%s\" : ", name); + avio_printf(probe_out, "{\n"); +} + +static void json_print_object_footer(const char *name) +{ + avio_printf(probe_out, "\n"); + AVP_INDENT(); + avio_printf(probe_out, "}"); +} + +static void json_print_integer(const char *key, int64_t value) +{ + if (octx.prefix[octx.level -1].nb_elems) + avio_printf(probe_out, ",\n"); + AVP_INDENT(); + avio_printf(probe_out, "\"%s\" : %"PRId64"", key, value); +} + +static void json_escape_print(const char *s) +{ + int i = 0; + char c = 0; + + while (c = s[i++]) { + switch (c) { + case '\r': avio_printf(probe_out, "%s", "\\r"); break; + case '\n': avio_printf(probe_out, "%s", "\\n"); break; + case '\f': avio_printf(probe_out, "%s", "\\f"); break; + case '\b': avio_printf(probe_out, "%s", "\\b"); break; + case '\t': avio_printf(probe_out, "%s", "\\t"); break; + case '\\': + case '"' : avio_w8(probe_out, '\\'); + default: + if ((unsigned char)c < 32) + avio_printf(probe_out, "\\u00%02x", c & 0xff); + else + avio_w8(probe_out, c); + break; + } + } +} + +static void json_print_string(const char *key, const char *value) +{ + if (octx.prefix[octx.level -1].nb_elems) + avio_printf(probe_out, ",\n"); + AVP_INDENT(); + avio_w8(probe_out, '\"'); + json_escape_print(key); + avio_printf(probe_out, "\" : \""); + json_escape_print(value); + avio_w8(probe_out, '\"'); +} + +/* + * old-style pseudo-INI + */ +static void old_print_object_header(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = av_toupper(*p); + p++; + } + + avio_printf(probe_out, "[%s]\n", str); + av_freep(&str); +} + +static void old_print_object_footer(const char *name) +{ + char *str, *p; + + if (!strcmp(name, "tags")) + return; + + str = p = av_strdup(name); + while (*p) { + *p = av_toupper(*p); + p++; + } + + avio_printf(probe_out, "[/%s]\n", str); + av_freep(&str); +} + +static void old_print_string(const char *key, const char *value) +{ + if (!strcmp(octx.prefix[octx.level - 1].name, "tags")) + avio_printf(probe_out, "TAG:"); + ini_print_string(key, value); +} + +/* + * Simple Formatter for single entries. + */ + +static void show_format_entry_integer(const char *key, int64_t value) +{ + if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) { + if (nb_fmt_entries_to_show > 1) + avio_printf(probe_out, "%s=", key); + avio_printf(probe_out, "%"PRId64"\n", value); + } +} + +static void show_format_entry_string(const char *key, const char *value) +{ + if (key && av_dict_get(fmt_entries_to_show, key, NULL, 0)) { + if (nb_fmt_entries_to_show > 1) + avio_printf(probe_out, "%s=", key); + avio_printf(probe_out, "%s\n", value); + } +} + +static void probe_group_enter(const char *name, int type) +{ + int64_t count = -1; + + octx.prefix = + av_realloc(octx.prefix, sizeof(PrintElement) * (octx.level + 1)); + + if (!octx.prefix || !name) { + fprintf(stderr, "Out of memory\n"); + exit_program(1); + } + + if (octx.level) { + PrintElement *parent = octx.prefix + octx.level -1; + if (parent->type == ARRAY) + count = parent->nb_elems; + parent->nb_elems++; + } + + octx.prefix[octx.level++] = (PrintElement){name, type, count, 0}; +} + +static void probe_group_leave(void) +{ + --octx.level; +} + +static void probe_header(void) +{ + if (octx.print_header) + octx.print_header(); + probe_group_enter("root", OBJECT); +} + +static void probe_footer(void) +{ + if (octx.print_footer) + octx.print_footer(); + probe_group_leave(); +} + + +static void probe_array_header(const char *name) +{ + if (octx.print_array_header) + octx.print_array_header(name); + + probe_group_enter(name, ARRAY); +} + +static void probe_array_footer(const char *name) +{ + probe_group_leave(); + if (octx.print_array_footer) + octx.print_array_footer(name); +} + +static void probe_object_header(const char *name) +{ + if (octx.print_object_header) + octx.print_object_header(name); + + probe_group_enter(name, OBJECT); +} + +static void probe_object_footer(const char *name) +{ + probe_group_leave(); + if (octx.print_object_footer) + octx.print_object_footer(name); +} + +static void probe_int(const char *key, int64_t value) +{ + octx.print_integer(key, value); + octx.prefix[octx.level -1].nb_elems++; +} + +static void probe_str(const char *key, const char *value) +{ + octx.print_string(key, value); + octx.prefix[octx.level -1].nb_elems++; +} + +static void probe_dict(AVDictionary *dict, const char *name) +{ + AVDictionaryEntry *entry = NULL; + if (!dict) + return; + probe_object_header(name); + while ((entry = av_dict_get(dict, "", entry, AV_DICT_IGNORE_SUFFIX))) { + probe_str(entry->key, entry->value); + } + probe_object_footer(name); +} + +static char *value_string(char *buf, int buf_size, double val, const char *unit) +{ + if (unit == unit_second_str && use_value_sexagesimal_format) { + double secs; + int hours, mins; + secs = val; + mins = (int)secs / 60; + secs = secs - mins * 60; + hours = mins / 60; + mins %= 60; + snprintf(buf, buf_size, "%d:%02d:%09.6f", hours, mins, secs); + } else if (use_value_prefix) { + const char *prefix_string; + int index; + + if (unit == unit_byte_str && use_byte_value_binary_prefix) { + index = (int) log2(val) / 10; + index = av_clip(index, 0, FF_ARRAY_ELEMS(binary_unit_prefixes) - 1); + val /= pow(2, index * 10); + prefix_string = binary_unit_prefixes[index]; + } else { + index = (int) (log10(val)) / 3; + index = av_clip(index, 0, FF_ARRAY_ELEMS(decimal_unit_prefixes) - 1); + val /= pow(10, index * 3); + prefix_string = decimal_unit_prefixes[index]; + } + snprintf(buf, buf_size, "%.*f%s%s", + index ? 3 : 0, val, + prefix_string, + show_value_unit ? unit : ""); + } else { + snprintf(buf, buf_size, "%f%s", val, show_value_unit ? unit : ""); + } + + return buf; +} + +static char *time_value_string(char *buf, int buf_size, int64_t val, + const AVRational *time_base) +{ + if (val == AV_NOPTS_VALUE) { + snprintf(buf, buf_size, "N/A"); + } else { + value_string(buf, buf_size, val * av_q2d(*time_base), unit_second_str); + } + + return buf; +} + +static char *ts_value_string(char *buf, int buf_size, int64_t ts) +{ + if (ts == AV_NOPTS_VALUE) { + snprintf(buf, buf_size, "N/A"); + } else { + snprintf(buf, buf_size, "%"PRId64, ts); + } + + return buf; +} + +static char *rational_string(char *buf, int buf_size, const char *sep, + const AVRational *rat) +{ + snprintf(buf, buf_size, "%d%s%d", rat->num, sep, rat->den); + return buf; +} + +static char *tag_string(char *buf, int buf_size, int tag) +{ + snprintf(buf, buf_size, "0x%04x", tag); + return buf; +} + +static void show_packet(AVFormatContext *fmt_ctx, AVPacket *pkt) +{ + char val_str[128]; + AVStream *st = fmt_ctx->streams[pkt->stream_index]; + + probe_object_header("packet"); + probe_str("codec_type", media_type_string(st->codec->codec_type)); + probe_int("stream_index", pkt->stream_index); + probe_str("pts", ts_value_string(val_str, sizeof(val_str), pkt->pts)); + probe_str("pts_time", time_value_string(val_str, sizeof(val_str), + pkt->pts, &st->time_base)); + probe_str("dts", ts_value_string(val_str, sizeof(val_str), pkt->dts)); + probe_str("dts_time", time_value_string(val_str, sizeof(val_str), + pkt->dts, &st->time_base)); + probe_str("duration", ts_value_string(val_str, sizeof(val_str), + pkt->duration)); + probe_str("duration_time", time_value_string(val_str, sizeof(val_str), + pkt->duration, + &st->time_base)); + probe_str("size", value_string(val_str, sizeof(val_str), + pkt->size, unit_byte_str)); + probe_int("pos", pkt->pos); + probe_str("flags", pkt->flags & AV_PKT_FLAG_KEY ? "K" : "_"); + probe_object_footer("packet"); +} + +static void show_packets(AVFormatContext *fmt_ctx) +{ + AVPacket pkt; + + av_init_packet(&pkt); + probe_array_header("packets"); + while (!av_read_frame(fmt_ctx, &pkt)) + show_packet(fmt_ctx, &pkt); + probe_array_footer("packets"); +} + +static void show_stream(AVFormatContext *fmt_ctx, int stream_idx) +{ + AVStream *stream = fmt_ctx->streams[stream_idx]; + AVCodecContext *dec_ctx; + const AVCodec *dec; + const char *profile; + char val_str[128]; + AVRational display_aspect_ratio, *sar = NULL; + const AVPixFmtDescriptor *desc; + + probe_object_header("stream"); + + probe_int("index", stream->index); + + if ((dec_ctx = stream->codec)) { + if ((dec = dec_ctx->codec)) { + probe_str("codec_name", dec->name); + probe_str("codec_long_name", dec->long_name); + } else { + probe_str("codec_name", "unknown"); + } + + probe_str("codec_type", media_type_string(dec_ctx->codec_type)); + probe_str("codec_time_base", + rational_string(val_str, sizeof(val_str), + "/", &dec_ctx->time_base)); + + /* print AVI/FourCC tag */ + av_get_codec_tag_string(val_str, sizeof(val_str), dec_ctx->codec_tag); + probe_str("codec_tag_string", val_str); + probe_str("codec_tag", tag_string(val_str, sizeof(val_str), + dec_ctx->codec_tag)); + + /* print profile, if there is one */ + if (dec && (profile = av_get_profile_name(dec, dec_ctx->profile))) + probe_str("profile", profile); + + switch (dec_ctx->codec_type) { + case AVMEDIA_TYPE_VIDEO: + probe_int("width", dec_ctx->width); + probe_int("height", dec_ctx->height); + probe_int("has_b_frames", dec_ctx->has_b_frames); + if (dec_ctx->sample_aspect_ratio.num) + sar = &dec_ctx->sample_aspect_ratio; + else if (stream->sample_aspect_ratio.num) + sar = &stream->sample_aspect_ratio; + + if (sar) { + probe_str("sample_aspect_ratio", + rational_string(val_str, sizeof(val_str), ":", sar)); + av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, + dec_ctx->width * sar->num, dec_ctx->height * sar->den, + 1024*1024); + probe_str("display_aspect_ratio", + rational_string(val_str, sizeof(val_str), ":", + &display_aspect_ratio)); + } + desc = av_pix_fmt_desc_get(dec_ctx->pix_fmt); + probe_str("pix_fmt", desc ? desc->name : "unknown"); + probe_int("level", dec_ctx->level); + break; + + case AVMEDIA_TYPE_AUDIO: + probe_str("sample_rate", + value_string(val_str, sizeof(val_str), + dec_ctx->sample_rate, + unit_hertz_str)); + probe_int("channels", dec_ctx->channels); + probe_int("bits_per_sample", + av_get_bits_per_sample(dec_ctx->codec_id)); + break; + } + } else { + probe_str("codec_type", "unknown"); + } + + if (fmt_ctx->iformat->flags & AVFMT_SHOW_IDS) + probe_int("id", stream->id); + probe_str("avg_frame_rate", + rational_string(val_str, sizeof(val_str), "/", + &stream->avg_frame_rate)); + if (dec_ctx->bit_rate) + probe_str("bit_rate", + value_string(val_str, sizeof(val_str), + dec_ctx->bit_rate, unit_bit_per_second_str)); + probe_str("time_base", + rational_string(val_str, sizeof(val_str), "/", + &stream->time_base)); + probe_str("start_time", + time_value_string(val_str, sizeof(val_str), + stream->start_time, &stream->time_base)); + probe_str("duration", + time_value_string(val_str, sizeof(val_str), + stream->duration, &stream->time_base)); + if (stream->nb_frames) + probe_int("nb_frames", stream->nb_frames); + + probe_dict(stream->metadata, "tags"); + + probe_object_footer("stream"); +} + +static void show_format(AVFormatContext *fmt_ctx) +{ + char val_str[128]; + int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; + + probe_object_header("format"); + probe_str("filename", fmt_ctx->filename); + probe_int("nb_streams", fmt_ctx->nb_streams); + probe_str("format_name", fmt_ctx->iformat->name); + probe_str("format_long_name", fmt_ctx->iformat->long_name); + probe_str("start_time", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->start_time, &AV_TIME_BASE_Q)); + probe_str("duration", + time_value_string(val_str, sizeof(val_str), + fmt_ctx->duration, &AV_TIME_BASE_Q)); + probe_str("size", + size >= 0 ? value_string(val_str, sizeof(val_str), + size, unit_byte_str) + : "unknown"); + probe_str("bit_rate", + value_string(val_str, sizeof(val_str), + fmt_ctx->bit_rate, unit_bit_per_second_str)); + + probe_dict(fmt_ctx->metadata, "tags"); + + probe_object_footer("format"); +} + +static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename) +{ + int err, i; + AVFormatContext *fmt_ctx = NULL; + AVDictionaryEntry *t; + + if ((err = avformat_open_input(&fmt_ctx, filename, + iformat, &format_opts)) < 0) { + print_error(filename, err); + return err; + } + if ((t = av_dict_get(format_opts, "", NULL, AV_DICT_IGNORE_SUFFIX))) { + av_log(NULL, AV_LOG_ERROR, "Option %s not found.\n", t->key); + return AVERROR_OPTION_NOT_FOUND; + } + + + /* fill the streams in the format context */ + if ((err = avformat_find_stream_info(fmt_ctx, NULL)) < 0) { + print_error(filename, err); + return err; + } + + av_dump_format(fmt_ctx, 0, filename, 0); + + /* bind a decoder to each input stream */ + for (i = 0; i < fmt_ctx->nb_streams; i++) { + AVStream *stream = fmt_ctx->streams[i]; + AVCodec *codec; + + if (stream->codec->codec_id == AV_CODEC_ID_PROBE) { + fprintf(stderr, "Failed to probe codec for input stream %d\n", + stream->index); + } else if (!(codec = avcodec_find_decoder(stream->codec->codec_id))) { + fprintf(stderr, + "Unsupported codec with id %d for input stream %d\n", + stream->codec->codec_id, stream->index); + } else if (avcodec_open2(stream->codec, codec, NULL) < 0) { + fprintf(stderr, "Error while opening codec for input stream %d\n", + stream->index); + } + } + + *fmt_ctx_ptr = fmt_ctx; + return 0; +} + +static void close_input_file(AVFormatContext **ctx_ptr) +{ + int i; + AVFormatContext *fmt_ctx = *ctx_ptr; + + /* close decoder for each stream */ + for (i = 0; i < fmt_ctx->nb_streams; i++) { + AVStream *stream = fmt_ctx->streams[i]; + + avcodec_close(stream->codec); + } + avformat_close_input(ctx_ptr); +} + +static int probe_file(const char *filename) +{ + AVFormatContext *fmt_ctx; + int ret, i; + + if ((ret = open_input_file(&fmt_ctx, filename))) + return ret; + + if (do_show_format) + show_format(fmt_ctx); + + if (do_show_streams) { + probe_array_header("streams"); + for (i = 0; i < fmt_ctx->nb_streams; i++) + show_stream(fmt_ctx, i); + probe_array_footer("streams"); + } + + if (do_show_packets) + show_packets(fmt_ctx); + + close_input_file(&fmt_ctx); + return 0; +} + +static void show_usage(void) +{ + printf("Simple multimedia streams analyzer\n"); + printf("usage: %s [OPTIONS] [INPUT_FILE]\n", program_name); + printf("\n"); +} + +static int opt_format(void *optctx, const char *opt, const char *arg) +{ + iformat = av_find_input_format(arg); + if (!iformat) { + fprintf(stderr, "Unknown input format: %s\n", arg); + return AVERROR(EINVAL); + } + return 0; +} + +static int opt_output_format(void *optctx, const char *opt, const char *arg) +{ + + if (!strcmp(arg, "json")) { + octx.print_header = json_print_header; + octx.print_footer = json_print_footer; + octx.print_array_header = json_print_array_header; + octx.print_array_footer = json_print_array_footer; + octx.print_object_header = json_print_object_header; + octx.print_object_footer = json_print_object_footer; + + octx.print_integer = json_print_integer; + octx.print_string = json_print_string; + } else if (!strcmp(arg, "ini")) { + octx.print_header = ini_print_header; + octx.print_footer = ini_print_footer; + octx.print_array_header = ini_print_array_header; + octx.print_object_header = ini_print_object_header; + + octx.print_integer = ini_print_integer; + octx.print_string = ini_print_string; + } else if (!strcmp(arg, "old")) { + octx.print_header = NULL; + octx.print_object_header = old_print_object_header; + octx.print_object_footer = old_print_object_footer; + + octx.print_string = old_print_string; + } else { + av_log(NULL, AV_LOG_ERROR, "Unsupported formatter %s\n", arg); + return AVERROR(EINVAL); + } + return 0; +} + +static int opt_show_format_entry(void *optctx, const char *opt, const char *arg) +{ + do_show_format = 1; + nb_fmt_entries_to_show++; + octx.print_header = NULL; + octx.print_footer = NULL; + octx.print_array_header = NULL; + octx.print_array_footer = NULL; + octx.print_object_header = NULL; + octx.print_object_footer = NULL; + + octx.print_integer = show_format_entry_integer; + octx.print_string = show_format_entry_string; + av_dict_set(&fmt_entries_to_show, arg, "", 0); + return 0; +} + +static void opt_input_file(void *optctx, const char *arg) +{ + if (input_filename) { + fprintf(stderr, + "Argument '%s' provided as input filename, but '%s' was already specified.\n", + arg, input_filename); + exit_program(1); + } + if (!strcmp(arg, "-")) + arg = "pipe:"; + input_filename = arg; +} + +void show_help_default(const char *opt, const char *arg) +{ + av_log_set_callback(log_callback_help); + show_usage(); + show_help_options(options, "Main options:", 0, 0, 0); + printf("\n"); + show_help_children(avformat_get_class(), AV_OPT_FLAG_DECODING_PARAM); +} + +static int opt_pretty(void *optctx, const char *opt, const char *arg) +{ + show_value_unit = 1; + use_value_prefix = 1; + use_byte_value_binary_prefix = 1; + use_value_sexagesimal_format = 1; + return 0; +} + +static const OptionDef real_options[] = { +#include "cmdutils_common_opts.h" + { "f", HAS_ARG, {.func_arg = opt_format}, "force format", "format" }, + { "of", HAS_ARG, {.func_arg = opt_output_format}, "output the document either as ini or json", "output_format" }, + { "unit", OPT_BOOL, {&show_value_unit}, + "show unit of the displayed values" }, + { "prefix", OPT_BOOL, {&use_value_prefix}, + "use SI prefixes for the displayed values" }, + { "byte_binary_prefix", OPT_BOOL, {&use_byte_value_binary_prefix}, + "use binary prefixes for byte units" }, + { "sexagesimal", OPT_BOOL, {&use_value_sexagesimal_format}, + "use sexagesimal format HOURS:MM:SS.MICROSECONDS for time units" }, + { "pretty", 0, {.func_arg = opt_pretty}, + "prettify the format of displayed values, make it more human readable" }, + { "show_format", OPT_BOOL, {&do_show_format} , "show format/container info" }, + { "show_format_entry", HAS_ARG, {.func_arg = opt_show_format_entry}, + "show a particular entry from the format/container info", "entry" }, + { "show_packets", OPT_BOOL, {&do_show_packets}, "show packets info" }, + { "show_streams", OPT_BOOL, {&do_show_streams}, "show streams info" }, + { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {.func_arg = opt_default}, + "generic catch all option", "" }, + { NULL, }, +}; + +static int probe_buf_write(void *opaque, uint8_t *buf, int buf_size) +{ + printf("%.*s", buf_size, buf); + return 0; +} + +#define AVP_BUFFSIZE 4096 + +int main(int argc, char **argv) +{ + int ret; + uint8_t *buffer = av_malloc(AVP_BUFFSIZE); + + if (!buffer) + exit(1); + + register_exit(avprobe_cleanup); + + options = real_options; + parse_loglevel(argc, argv, options); + av_register_all(); + avformat_network_init(); + init_opts(); +#if CONFIG_AVDEVICE + avdevice_register_all(); +#endif + + show_banner(); + + octx.print_header = ini_print_header; + octx.print_footer = ini_print_footer; + + octx.print_array_header = ini_print_array_header; + octx.print_object_header = ini_print_object_header; + + octx.print_integer = ini_print_integer; + octx.print_string = ini_print_string; + + parse_options(NULL, argc, argv, options, opt_input_file); + + if (!input_filename) { + show_usage(); + fprintf(stderr, "You have to specify one input file.\n"); + fprintf(stderr, + "Use -h to get full help or, even better, run 'man %s'.\n", + program_name); + exit_program(1); + } + + probe_out = avio_alloc_context(buffer, AVP_BUFFSIZE, 1, NULL, NULL, + probe_buf_write, NULL); + if (!probe_out) + exit_program(1); + + probe_header(); + ret = probe_file(input_filename); + probe_footer(); + avio_flush(probe_out); + avio_close(probe_out); + + avformat_network_deinit(); + + return ret; +} diff --git a/ffserver.c b/avserver.c similarity index 88% rename from ffserver.c rename to avserver.c index a6ab458de6..56bcda9d4d 100644 --- a/ffserver.c +++ b/avserver.c @@ -1,28 +1,24 @@ /* + * Multiple format streaming server * Copyright (c) 2000, 2001, 2002 Fabrice Bellard * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * @file - * multiple format streaming server based on the FFmpeg libraries - */ - #include "config.h" #if !HAVE_CLOSESOCKET #define closesocket close @@ -31,25 +27,22 @@ #include #include #include "libavformat/avformat.h" -// FIXME those are internal headers, ffserver _really_ shouldn't use them +// FIXME those are internal headers, avserver _really_ shouldn't use them #include "libavformat/ffm.h" #include "libavformat/network.h" #include "libavformat/os_support.h" #include "libavformat/rtpdec.h" #include "libavformat/rtpproto.h" #include "libavformat/rtsp.h" -#include "libavformat/rtspcodes.h" #include "libavformat/avio_internal.h" #include "libavformat/internal.h" #include "libavformat/url.h" -#include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/lfg.h" #include "libavutil/dict.h" #include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" -#include "libavutil/pixdesc.h" #include "libavutil/random_seed.h" #include "libavutil/parseutils.h" #include "libavutil/opt.h" @@ -69,7 +62,7 @@ #include "cmdutils.h" -const char program_name[] = "ffserver"; +const char program_name[] = "avserver"; const int program_birth_year = 2000; static const OptionDef options[]; @@ -210,28 +203,31 @@ typedef struct IPAddressACL { struct in_addr last; } IPAddressACL; -/* description of each stream of the ffserver.conf file */ +/* description of each stream of the avserver.conf file */ typedef struct FFStream { enum StreamType stream_type; char filename[1024]; /* stream filename */ struct FFStream *feed; /* feed we are using (can be null if coming from file) */ AVDictionary *in_opts; /* input parameters */ - AVDictionary *metadata; /* metadata to set on the stream */ AVInputFormat *ifmt; /* if non NULL, force input format */ AVOutputFormat *fmt; IPAddressACL *acl; char dynamic_acl[1024]; int nb_streams; - int prebuffer; /* Number of milliseconds early to start */ + int prebuffer; /* Number of millseconds early to start */ int64_t max_time; /* Number of milliseconds to run */ int send_on_key; AVStream *streams[MAX_STREAMS]; int feed_streams[MAX_STREAMS]; /* index of streams in the feed */ char feed_filename[1024]; /* file name of the feed storage, or input file name for a stream */ - pid_t pid; /* Of ffmpeg process */ - time_t pid_start; /* Of ffmpeg process */ + char author[512]; + char title[512]; + char copyright[512]; + char comment[512]; + pid_t pid; /* of avconv process */ + time_t pid_start; /* of avconv process */ char **child_argv; struct FFStream *next; unsigned bandwidth; /* bandwidth, in kbits/s */ @@ -288,7 +284,8 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url); static void rtsp_cmd_options(HTTPContext *c, const char *url); static void rtsp_cmd_setup(HTTPContext *c, const char *url, RTSPMessageHeader *h); static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h); -static void rtsp_cmd_interrupt(HTTPContext *c, const char *url, RTSPMessageHeader *h, int pause_only); +static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h); +static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h); /* SDP handling */ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, @@ -306,7 +303,7 @@ static const char *my_program_name; static const char *config_filename; -static int ffserver_debug; +static int avserver_debug; static int no_launch; static int need_to_start_children; @@ -324,20 +321,11 @@ static AVLFG random_state; static FILE *logfile = NULL; -static void htmlstrip(char *s) { - while (s && *s) { - s += strspn(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. "); - if (*s) - *s++ = '?'; - } -} - static int64_t ffm_read_write_index(int fd) { uint8_t buf[8]; - if (lseek(fd, 8, SEEK_SET) < 0) - return AVERROR(EIO); + lseek(fd, 8, SEEK_SET); if (read(fd, buf, 8) != 8) return AVERROR(EIO); return AV_RB64(buf); @@ -350,8 +338,7 @@ static int ffm_write_write_index(int fd, int64_t pos) for(i=0;i<8;i++) buf[i] = (pos >> (56 - i * 8)) & 0xff; - if (lseek(fd, 8, SEEK_SET) < 0) - return AVERROR(EIO); + lseek(fd, 8, SEEK_SET); if (write(fd, buf, 8) != 8) return AVERROR(EIO); return 8; @@ -365,7 +352,7 @@ static void ffm_set_write_index(AVFormatContext *s, int64_t pos, ffm->file_size = file_size; } -/* FIXME: make ffserver work with IPv6 */ +/* FIXME: make avserver work with IPv6 */ /* resolve host with also IP address parsing */ static int resolve_host(struct in_addr *sin_addr, const char *hostname) { @@ -400,14 +387,14 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname) return 0; } -static char *ctime1(char *buf2, int buf_size) +static char *ctime1(char *buf2) { time_t ti; char *p; ti = time(NULL); p = ctime(&ti); - av_strlcpy(buf2, p, buf_size); + strcpy(buf2, p); p = buf2 + strlen(p) - 1; if (*p == '\n') *p = '\0'; @@ -420,7 +407,7 @@ static void http_vlog(const char *fmt, va_list vargs) if (logfile) { if (print_prefix) { char buf[32]; - ctime1(buf, sizeof(buf)); + ctime1(buf); fprintf(logfile, "%s ", buf); } print_prefix = strstr(fmt, "\n") != NULL; @@ -506,15 +493,14 @@ static void start_children(FFStream *feed) char *slash; int i; - /* replace "ffserver" with "ffmpeg" in the path of current - * program. Ignore user provided path */ av_strlcpy(pathname, my_program_name, sizeof(pathname)); + slash = strrchr(pathname, '/'); if (!slash) slash = pathname; else slash++; - strcpy(slash, "ffmpeg"); + strcpy(slash, "avconv"); http_log("Launch command line: "); http_log("%s ", pathname); @@ -525,7 +511,7 @@ static void start_children(FFStream *feed) for (i = 3; i < 256; i++) close(i); - if (!ffserver_debug) { + if (!avserver_debug) { if (!freopen("/dev/null", "r", stdin)) http_log("failed to redirect STDIN to /dev/null\n;"); if (!freopen("/dev/null", "w", stdout)) @@ -556,8 +542,7 @@ static int socket_open_listen(struct sockaddr_in *my_addr) } tmp = 1; - if (setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp))) - av_log(NULL, AV_LOG_WARNING, "setsockopt SO_REUSEADDR failed\n"); + setsockopt(server_fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp)); my_addr->sin_family = AF_INET; if (bind (server_fd, (struct sockaddr *) my_addr, sizeof (*my_addr)) < 0) { @@ -573,9 +558,7 @@ static int socket_open_listen(struct sockaddr_in *my_addr) closesocket(server_fd); return -1; } - - if (ff_socket_nonblock(server_fd, 1) < 0) - av_log(NULL, AV_LOG_WARNING, "ff_socket_nonblock failed\n"); + ff_socket_nonblock(server_fd, 1); return server_fd; } @@ -586,17 +569,15 @@ static void start_multicast(void) FFStream *stream; char session_id[32]; HTTPContext *rtp_c; - struct sockaddr_in dest_addr = {0}; + struct sockaddr_in dest_addr; int default_port, stream_index; default_port = 6000; for(stream = first_stream; stream != NULL; stream = stream->next) { if (stream->is_multicast) { - unsigned random0 = av_lfg_get(&random_state); - unsigned random1 = av_lfg_get(&random_state); /* open the RTP connection */ snprintf(session_id, sizeof(session_id), "%08x%08x", - random0, random1); + av_lfg_get(&random_state), av_lfg_get(&random_state)); /* choose a port if none given */ if (stream->multicast_port == 0) { @@ -631,16 +612,17 @@ static void start_multicast(void) } } + /* change state to send data */ rtp_c->state = HTTPSTATE_SEND_DATA; } } } -/* main loop of the HTTP server */ +/* main loop of the http server */ static int http_server(void) { int server_fd = 0, rtsp_server_fd = 0; - int ret, delay; + int ret, delay, delay1; struct pollfd *poll_table, *poll_entry; HTTPContext *c, *c_next; @@ -651,28 +633,22 @@ static int http_server(void) if (my_http_addr.sin_port) { server_fd = socket_open_listen(&my_http_addr); - if (server_fd < 0) { - av_free(poll_table); + if (server_fd < 0) return -1; - } } if (my_rtsp_addr.sin_port) { rtsp_server_fd = socket_open_listen(&my_rtsp_addr); - if (rtsp_server_fd < 0) { - av_free(poll_table); - closesocket(server_fd); + if (rtsp_server_fd < 0) return -1; - } } if (!rtsp_server_fd && !server_fd) { http_log("HTTP and RTSP disabled.\n"); - av_free(poll_table); return -1; } - http_log("FFserver started.\n"); + http_log("AVserver started.\n"); start_children(first_feed); @@ -710,19 +686,18 @@ static int http_server(void) case HTTPSTATE_SEND_DATA: case HTTPSTATE_SEND_DATA_TRAILER: if (!c->is_packetized) { - /* for TCP, we output as much as we can - * (may need to put a limit) */ + /* for TCP, we output as much as we can (may need to put a limit) */ c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLOUT; poll_entry++; } else { - /* when ffserver is doing the timing, we work by - looking at which packet needs to be sent every + /* when avserver is doing the timing, we work by + looking at which packet need to be sent every 10 ms */ - /* one tick wait XXX: 10 ms assumed */ - if (delay > 10) - delay = 10; + delay1 = 10; /* one tick wait XXX: 10 ms assumed */ + if (delay1 < delay) + delay = delay1; } break; case HTTPSTATE_WAIT_REQUEST: @@ -747,10 +722,8 @@ static int http_server(void) do { ret = poll(poll_table, poll_entry - poll_table, delay); if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) && - ff_neterrno() != AVERROR(EINTR)) { - av_free(poll_table); + ff_neterrno() != AVERROR(EINTR)) return -1; - } } while (ret < 0); cur_time = av_gettime() / 1000; @@ -764,8 +737,8 @@ static int http_server(void) for(c = first_http_ctx; c != NULL; c = c_next) { c_next = c->next; if (handle_connection(c) < 0) { - log_connection(c); /* close and free the connection */ + log_connection(c); close_connection(c); } } @@ -802,19 +775,17 @@ static void start_wait_request(HTTPContext *c, int is_rtsp) static void http_send_too_busy_reply(int fd) { - char buffer[400]; + char buffer[300]; int len = snprintf(buffer, sizeof(buffer), "HTTP/1.0 503 Server too busy\r\n" "Content-type: text/html\r\n" "\r\n" "Too busy\r\n" "

The server is too busy to serve your request at this time.

\r\n" - "

The number of current connections is %u, and this exceeds the limit of %u.

\r\n" + "

The number of current connections is %d, and this exceeds the limit of %d.

\r\n" "\r\n", nb_connections, nb_max_connections); - av_assert0(len < sizeof(buffer)); - if (send(fd, buffer, len, 0) < len) - av_log(NULL, AV_LOG_WARNING, "Could not send too-busy reply, send() failed\n"); + send(fd, buffer, len, 0); } @@ -832,8 +803,7 @@ static void new_connection(int server_fd, int is_rtsp) http_log("error during accept %s\n", strerror(errno)); return; } - if (ff_socket_nonblock(fd, 1) < 0) - av_log(NULL, AV_LOG_WARNING, "ff_socket_nonblock failed\n"); + ff_socket_nonblock(fd, 1); if (nb_connections >= nb_max_connections) { http_send_too_busy_reply(fd); @@ -939,8 +909,6 @@ static void close_connection(HTTPContext *c) for(i=0; inb_streams; i++) av_free(ctx->streams[i]); - av_freep(&ctx->streams); - av_freep(&ctx->priv_data); if (c->stream && !c->post && c->stream->stream_type == STREAM_TYPE_LIVE) current_bandwidth -= c->stream->bandwidth; @@ -1016,7 +984,9 @@ static int handle_connection(HTTPContext *c) if (len < 0) { if (ff_neterrno() != AVERROR(EAGAIN) && ff_neterrno() != AVERROR(EINTR)) { - goto close_connection; + /* error : close connection */ + av_freep(&c->pb_buffer); + return -1; } } else { c->buffer_ptr += len; @@ -1028,8 +998,7 @@ static int handle_connection(HTTPContext *c) /* if error, exit */ if (c->http_error) return -1; - /* all the buffer was sent : synchronize to the incoming - * stream */ + /* all the buffer was sent : synchronize to the incoming stream */ c->state = HTTPSTATE_SEND_DATA_HEADER; c->buffer_ptr = c->buffer_end = c->buffer; } @@ -1040,7 +1009,7 @@ static int handle_connection(HTTPContext *c) case HTTPSTATE_SEND_DATA_HEADER: case HTTPSTATE_SEND_DATA_TRAILER: /* for packetized output, we consider we can always write (the - input streams set the speed). It may be better to verify + input streams sets the speed). It may be better to verify that we do not rely too much on the kernel queues */ if (!c->is_packetized) { if (c->poll_entry->revents & (POLLERR | POLLHUP)) @@ -1074,8 +1043,10 @@ static int handle_connection(HTTPContext *c) break; case RTSPSTATE_SEND_REPLY: - if (c->poll_entry->revents & (POLLERR | POLLHUP)) - goto close_connection; + if (c->poll_entry->revents & (POLLERR | POLLHUP)) { + av_freep(&c->pb_buffer); + return -1; + } /* no need to write if no events */ if (!(c->poll_entry->revents & POLLOUT)) return 0; @@ -1083,7 +1054,9 @@ static int handle_connection(HTTPContext *c) if (len < 0) { if (ff_neterrno() != AVERROR(EAGAIN) && ff_neterrno() != AVERROR(EINTR)) { - goto close_connection; + /* error : close connection */ + av_freep(&c->pb_buffer); + return -1; } } else { c->buffer_ptr += len; @@ -1128,10 +1101,6 @@ static int handle_connection(HTTPContext *c) return -1; } return 0; - -close_connection: - av_freep(&c->pb_buffer); - return -1; } static int extract_rates(char *rates, int ratelen, const char *request) @@ -1338,7 +1307,7 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac get_arg(arg, sizeof(arg), &p); if (resolve_host(&acl.first, arg) != 0) { - fprintf(stderr, "%s:%d: ACL refers to invalid host or IP address '%s'\n", + fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else @@ -1348,7 +1317,7 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac if (arg[0]) { if (resolve_host(&acl.last, arg) != 0) { - fprintf(stderr, "%s:%d: ACL refers to invalid host or IP address '%s'\n", + fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } @@ -1378,8 +1347,7 @@ static void parse_acl_row(FFStream *stream, FFStream* feed, IPAddressACL *ext_ac naclp = &(*naclp)->next; *naclp = nacl; - } else - av_free(nacl); + } } } @@ -1471,7 +1439,7 @@ static int validate_acl(FFStream *stream, HTTPContext *c) } /* compute the real filename of a file by matching it without its - extensions to all the stream's filenames */ + extensions to all the stream filenames */ static void compute_real_filename(char *filename, int max_size) { char file1[1024]; @@ -1505,7 +1473,7 @@ enum RedirType { REDIR_SDP, }; -/* parse HTTP request and prepare header */ +/* parse http request and prepare header */ static int http_parse_request(HTTPContext *c) { const char *p; @@ -1542,7 +1510,7 @@ static int http_parse_request(HTTPContext *c) av_strlcpy(c->protocol, protocol, sizeof(c->protocol)); - if (ffserver_debug) + if (avserver_debug) http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url); /* find the filename and the optional info string in the request */ @@ -1611,7 +1579,7 @@ static int http_parse_request(HTTPContext *c) if (stream->stream_type == STREAM_TYPE_REDIRECT) { c->http_error = 301; q = c->buffer; - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 301 Moved\r\n" "Location: %s\r\n" "Content-type: text/html\r\n" @@ -1619,7 +1587,6 @@ static int http_parse_request(HTTPContext *c) "Moved\r\n" "You should be redirected.\r\n" "\r\n", stream->feed_filename, stream->feed_filename); - q += strlen(q); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; @@ -1650,7 +1617,7 @@ static int http_parse_request(HTTPContext *c) if (c->post == 0 && max_bandwidth < current_bandwidth) { c->http_error = 503; q = c->buffer; - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 503 Server too busy\r\n" "Content-type: text/html\r\n" "\r\n" @@ -1659,7 +1626,6 @@ static int http_parse_request(HTTPContext *c) "

The bandwidth being served (including your stream) is %"PRIu64"kbit/sec, " "and this exceeds the limit of %"PRIu64"kbit/sec.

\r\n" "\r\n", current_bandwidth, max_bandwidth); - q += strlen(q); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; @@ -1702,33 +1668,30 @@ static int http_parse_request(HTTPContext *c) q = c->buffer; switch(redir_type) { case REDIR_ASX: - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 200 ASX Follows\r\n" "Content-type: video/x-ms-asf\r\n" "\r\n" "\r\n" - //"\r\n" + //"\r\n" "\r\n" "\r\n", hostbuf, filename, info); - q += strlen(q); break; case REDIR_RAM: - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 200 RAM Follows\r\n" "Content-type: audio/x-pn-realaudio\r\n" "\r\n" - "# Autogenerated by ffserver\r\n" + "# Autogenerated by avserver\r\n" "http://%s/%s%s\r\n", hostbuf, filename, info); - q += strlen(q); break; case REDIR_ASF: - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 200 ASF Redirect follows\r\n" "Content-type: video/x-ms-asf\r\n" "\r\n" "[Reference]\r\n" "Ref1=http://%s/%s%s\r\n", hostbuf, filename, info); - q += strlen(q); break; case REDIR_RTSP: { @@ -1738,13 +1701,12 @@ static int http_parse_request(HTTPContext *c) p = strrchr(hostname, ':'); if (p) *p = '\0'; - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n" - /* XXX: incorrect MIME type ? */ + /* XXX: incorrect mime type ? */ "Content-type: application/x-rtsp\r\n" "\r\n" "rtsp://%s:%d/%s\r\n", hostname, ntohs(my_rtsp_addr.sin_port), filename); - q += strlen(q); } break; case REDIR_SDP: @@ -1754,17 +1716,13 @@ static int http_parse_request(HTTPContext *c) socklen_t len; struct sockaddr_in my_addr; - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 200 OK\r\n" "Content-type: application/sdp\r\n" "\r\n"); - q += strlen(q); len = sizeof(my_addr); - - /* XXX: Should probably fail? */ - if (getsockname(c->fd, (struct sockaddr *)&my_addr, &len)) - http_log("getsockname() failed\n"); + getsockname(c->fd, (struct sockaddr *)&my_addr, &len); /* XXX: should use a dynamic buffer */ sdp_data_size = prepare_sdp_description(stream, @@ -1804,7 +1762,7 @@ static int http_parse_request(HTTPContext *c) /* if post, it means a feed is being sent */ if (!stream->is_feed) { /* However it might be a status report from WMP! Let us log the - * data as it might come handy one day. */ + * data as it might come in handy one day. */ const char *logline = 0; int client_id = 0; @@ -1879,13 +1837,13 @@ static int http_parse_request(HTTPContext *c) goto send_error; } - /* prepare HTTP header */ - c->buffer[0] = 0; - av_strlcatf(c->buffer, c->buffer_size, "HTTP/1.0 200 OK\r\n"); + /* prepare http header */ + q = c->buffer; + q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n"); mime_type = c->stream->fmt->mime_type; if (!mime_type) mime_type = "application/x-octet-stream"; - av_strlcatf(c->buffer, c->buffer_size, "Pragma: no-cache\r\n"); + q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n"); /* for asf, we need extra headers */ if (!strcmp(c->stream->fmt->name,"asf_stream")) { @@ -1893,11 +1851,10 @@ static int http_parse_request(HTTPContext *c) c->wmp_client_id = av_lfg_get(&random_state); - av_strlcatf(c->buffer, c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id); + q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id); } - av_strlcatf(c->buffer, c->buffer_size, "Content-Type: %s\r\n", mime_type); - av_strlcatf(c->buffer, c->buffer_size, "\r\n"); - q = c->buffer + strlen(c->buffer); + q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type); + q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n"); /* prepare output buffer */ c->http_error = 0; @@ -1908,8 +1865,7 @@ static int http_parse_request(HTTPContext *c) send_error: c->http_error = 404; q = c->buffer; - htmlstrip(msg); - snprintf(q, c->buffer_size, + q += snprintf(q, c->buffer_size, "HTTP/1.0 404 Not Found\r\n" "Content-type: text/html\r\n" "\r\n" @@ -1917,7 +1873,6 @@ static int http_parse_request(HTTPContext *c) "404 Not Found\n" "%s\n" "\n", msg); - q += strlen(q); /* prepare output buffer */ c->buffer_ptr = c->buffer; c->buffer_end = q; @@ -1958,7 +1913,7 @@ static void compute_status(HTTPContext *c) } avio_printf(pb, "HTTP/1.0 200 OK\r\n"); - avio_printf(pb, "Content-type: text/html\r\n"); + avio_printf(pb, "Content-type: %s\r\n", "text/html"); avio_printf(pb, "Pragma: no-cache\r\n"); avio_printf(pb, "\r\n"); @@ -2067,7 +2022,7 @@ static void compute_status(HTTPContext *c) if (stream->pid) { avio_printf(pb, "Running as pid %d.\n", stream->pid); -#if defined(linux) +#if defined(linux) && !defined(CONFIG_NOCUTILS) { FILE *pid_stat; char ps_cmd[64]; @@ -2082,7 +2037,7 @@ static void compute_status(HTTPContext *c) char cpuperc[10]; char cpuused[64]; - if (fscanf(pid_stat, "%9s %63s", cpuperc, + if (fscanf(pid_stat, "%10s %64s", cpuperc, cpuused) == 2) { avio_printf(pb, "Currently using %s%% of the cpu. Total time used %s.\n", cpuperc, cpuused); @@ -2188,19 +2143,16 @@ static int open_input_stream(HTTPContext *c, const char *info) char buf[128]; char input_filename[1024]; AVFormatContext *s = NULL; - int buf_size, i, ret; + int i, ret; int64_t stream_pos; /* find file name */ if (c->stream->feed) { strcpy(input_filename, c->stream->feed->feed_filename); - buf_size = FFM_PACKET_SIZE; /* compute position (absolute time) */ if (av_find_info_tag(buf, sizeof(buf), "date", info)) { - if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) { - http_log("Invalid date specification '%s' for stream\n", buf); + if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) return ret; - } } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) { int prebuffer = strtol(buf, 0, 10); stream_pos = av_gettime() - prebuffer * (int64_t)1000000; @@ -2208,41 +2160,31 @@ static int open_input_stream(HTTPContext *c, const char *info) stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000; } else { strcpy(input_filename, c->stream->feed_filename); - buf_size = 0; /* compute position (relative time) */ if (av_find_info_tag(buf, sizeof(buf), "date", info)) { - if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) { - http_log("Invalid date specification '%s' for stream\n", buf); + if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) return ret; - } } else stream_pos = 0; } - if (!input_filename[0]) { - http_log("No filename was specified for stream\n"); - return AVERROR(EINVAL); - } + if (input_filename[0] == '\0') + return -1; /* open stream */ if ((ret = avformat_open_input(&s, input_filename, c->stream->ifmt, &c->stream->in_opts)) < 0) { - http_log("Could not open input '%s': %s\n", input_filename, av_err2str(ret)); - return ret; + http_log("could not open %s: %d\n", input_filename, ret); + return -1; } - - /* set buffer size */ - if (buf_size > 0) ffio_set_buf_size(s->pb, buf_size); - s->flags |= AVFMT_FLAG_GENPTS; c->fmt_in = s; - if (strcmp(s->iformat->name, "ffm") && - (ret = avformat_find_stream_info(c->fmt_in, NULL)) < 0) { - http_log("Could not find stream info for input '%s'\n", input_filename); + if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) { + http_log("Could not find stream info '%s'\n", input_filename); avformat_close_input(&s); - return ret; + return -1; } - /* choose stream as clock source (we favor the video stream if - * present) for packet sending */ + /* choose stream as clock source (we favorize video stream if + present) for packet sending */ c->pts_stream_index = 0; for(i=0;istream->nb_streams;i++) { if (c->pts_stream_index == 0 && @@ -2291,10 +2233,12 @@ static int http_prepare_data(HTTPContext *c) av_freep(&c->pb_buffer); switch(c->state) { case HTTPSTATE_SEND_DATA_HEADER: - ctx = avformat_alloc_context(); - c->fmt_ctx = *ctx; - av_freep(&ctx); - av_dict_copy(&(c->fmt_ctx.metadata), c->stream->metadata, 0); + memset(&c->fmt_ctx, 0, sizeof(c->fmt_ctx)); + av_dict_set(&c->fmt_ctx.metadata, "author" , c->stream->author , 0); + av_dict_set(&c->fmt_ctx.metadata, "comment" , c->stream->comment , 0); + av_dict_set(&c->fmt_ctx.metadata, "copyright", c->stream->copyright, 0); + av_dict_set(&c->fmt_ctx.metadata, "title" , c->stream->title , 0); + c->fmt_ctx.streams = av_mallocz(sizeof(AVStream *) * c->stream->nb_streams); for(i=0;istream->nb_streams;i++) { @@ -2309,8 +2253,8 @@ static int http_prepare_data(HTTPContext *c) *(c->fmt_ctx.streams[i]) = *src; c->fmt_ctx.streams[i]->priv_data = 0; - /* XXX: should be done in AVStream, not in codec */ - c->fmt_ctx.streams[i]->codec->frame_number = 0; + c->fmt_ctx.streams[i]->codec->frame_number = 0; /* XXX: should be done in + AVStream, not in codec */ } /* set output format parameters */ c->fmt_ctx.oformat = c->stream->fmt; @@ -2326,16 +2270,15 @@ static int http_prepare_data(HTTPContext *c) c->fmt_ctx.pb->seekable = 0; /* - * HACK to avoid MPEG-PS muxer to spit many underflow errors - * Default value from FFmpeg - * Try to set it using configuration option + * HACK to avoid mpeg ps muxer to spit many underflow errors + * Default value from Libav + * Try to set it use configuration option */ c->fmt_ctx.max_delay = (int)(0.7*AV_TIME_BASE); - if ((ret = avformat_write_header(&c->fmt_ctx, NULL)) < 0) { - http_log("Error writing output header for stream '%s': %s\n", - c->stream->filename, av_err2str(ret)); - return ret; + if (avformat_write_header(&c->fmt_ctx, NULL) < 0) { + http_log("Error writing output header\n"); + return -1; } av_dict_free(&c->fmt_ctx.metadata); @@ -2379,7 +2322,7 @@ static int http_prepare_data(HTTPContext *c) goto redo; } else { no_loop: - /* must send trailer now because EOF or error */ + /* must send trailer now because eof or error */ c->state = HTTPSTATE_SEND_DATA_TRAILER; } } @@ -2421,8 +2364,8 @@ static int http_prepare_data(HTTPContext *c) send_it: ist = c->fmt_in->streams[source_index]; /* specific handling for RTP: we use several - * output streams (one for each RTP connection). - * XXX: need more abstract handling */ + output stream (one for each RTP + connection). XXX: need more abstract handling */ if (c->is_packetized) { /* compute send time and duration */ c->cur_pts = av_rescale_q(pkt.dts, ist->time_base, AV_TIME_BASE_Q); @@ -2466,9 +2409,8 @@ static int http_prepare_data(HTTPContext *c) if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, ist->time_base, ost->time_base); pkt.duration = av_rescale_q(pkt.duration, ist->time_base, ost->time_base); - if ((ret = av_write_frame(ctx, &pkt)) < 0) { - http_log("Error writing frame to output for stream '%s': %s\n", - c->stream->filename, av_err2str(ret)); + if (av_write_frame(ctx, &pkt) < 0) { + http_log("Error writing frame to output\n"); c->state = HTTPSTATE_SEND_DATA_TRAILER; } @@ -2512,7 +2454,7 @@ static int http_prepare_data(HTTPContext *c) /* should convert the format at the same time */ /* send data starting at c->buffer_ptr to the output connection - * (either UDP or TCP) */ + (either UDP or TCP connection) */ static int http_send_data(HTTPContext *c) { int len, ret; @@ -2635,26 +2577,19 @@ static int http_send_data(HTTPContext *c) static int http_start_receive_data(HTTPContext *c) { int fd; - int ret; - if (c->stream->feed_opened) { - http_log("Stream feed '%s' was not opened\n", c->stream->feed_filename); - return AVERROR(EINVAL); - } + if (c->stream->feed_opened) + return -1; /* Don't permit writing to this one */ - if (c->stream->readonly) { - http_log("Cannot write to read-only file '%s'\n", c->stream->feed_filename); - return AVERROR(EINVAL); - } + if (c->stream->readonly) + return -1; /* open feed */ fd = open(c->stream->feed_filename, O_RDWR); if (fd < 0) { - ret = AVERROR(errno); - http_log("Could not open feed file '%s': %s\n", - c->stream->feed_filename, strerror(errno)); - return ret; + http_log("Error opening feeder file: %s\n", strerror(errno)); + return -1; } c->feed_fd = fd; @@ -2663,19 +2598,13 @@ static int http_start_receive_data(HTTPContext *c) ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE); http_log("Truncating feed file '%s'\n", c->stream->feed_filename); if (ftruncate(c->feed_fd, FFM_PACKET_SIZE) < 0) { - ret = AVERROR(errno); - http_log("Error truncating feed file '%s': %s\n", - c->stream->feed_filename, strerror(errno)); - return ret; + http_log("Error truncating feed file: %s\n", strerror(errno)); + return -1; } } else { - ret = ffm_read_write_index(fd); - if (ret < 0) { - http_log("Error reading write index from feed file '%s': %s\n", - c->stream->feed_filename, strerror(errno)); - return ret; - } else { - c->stream->feed_write_index = ret; + if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) { + http_log("Error reading write index from feed file: %s\n", strerror(errno)); + return -1; } } @@ -2757,11 +2686,8 @@ static int http_receive_data(HTTPContext *c) /* a packet has been received : write it in the store, except if header */ if (c->data_count > FFM_PACKET_SIZE) { - /* XXX: use llseek or url_seek - * XXX: Should probably fail? */ - if (lseek(c->feed_fd, feed->feed_write_index, SEEK_SET) == -1) - http_log("Seek to %"PRId64" failed\n", feed->feed_write_index); - + /* XXX: use llseek or url_seek */ + lseek(c->feed_fd, feed->feed_write_index, SEEK_SET); if (write(c->feed_fd, c->buffer, FFM_PACKET_SIZE) < 0) { http_log("Error writing to feed file: %s\n", strerror(errno)); goto fail; @@ -2857,9 +2783,44 @@ static void rtsp_reply_header(HTTPContext *c, enum RTSPStatusCode error_number) struct tm *tm; char buf2[32]; - str = RTSP_STATUS_CODE2STRING(error_number); - if (!str) + switch(error_number) { + case RTSP_STATUS_OK: + str = "OK"; + break; + case RTSP_STATUS_METHOD: + str = "Method Not Allowed"; + break; + case RTSP_STATUS_BANDWIDTH: + str = "Not Enough Bandwidth"; + break; + case RTSP_STATUS_SESSION: + str = "Session Not Found"; + break; + case RTSP_STATUS_STATE: + str = "Method Not Valid in This State"; + break; + case RTSP_STATUS_AGGREGATE: + str = "Aggregate operation not allowed"; + break; + case RTSP_STATUS_ONLY_AGGREGATE: + str = "Only aggregate operation allowed"; + break; + case RTSP_STATUS_TRANSPORT: + str = "Unsupported transport"; + break; + case RTSP_STATUS_INTERNAL: + str = "Internal Server Error"; + break; + case RTSP_STATUS_SERVICE: + str = "Service Unavailable"; + break; + case RTSP_STATUS_VERSION: + str = "RTSP Version not supported"; + break; + default: str = "Unknown Error"; + break; + } avio_printf(c->pb, "RTSP/1.0 %d %s\r\n", error_number, str); avio_printf(c->pb, "CSeq: %d\r\n", c->seq); @@ -2947,9 +2908,9 @@ static int rtsp_parse_request(HTTPContext *c) else if (!strcmp(cmd, "PLAY")) rtsp_cmd_play(c, url, header); else if (!strcmp(cmd, "PAUSE")) - rtsp_cmd_interrupt(c, url, header, 1); + rtsp_cmd_pause(c, url, header); else if (!strcmp(cmd, "TEARDOWN")) - rtsp_cmd_interrupt(c, url, header, 0); + rtsp_cmd_teardown(c, url, header); else rtsp_reply_error(c, RTSP_STATUS_METHOD); @@ -2971,17 +2932,14 @@ static int prepare_sdp_description(FFStream *stream, uint8_t **pbuffer, { AVFormatContext *avc; AVStream *avs = NULL; - AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL); - AVDictionaryEntry *entry = av_dict_get(stream->metadata, "title", NULL, 0); int i; avc = avformat_alloc_context(); - if (avc == NULL || !rtp_format) { + if (avc == NULL) { return -1; } - avc->oformat = rtp_format; av_dict_set(&avc->metadata, "title", - entry ? entry->value : "No Title", 0); + stream->title[0] ? stream->title : "No Title", 0); avc->nb_streams = stream->nb_streams; if (stream->is_multicast) { snprintf(avc->filename, 1024, "rtp://%s:%d?multicast=1?ttl=%d", @@ -3033,7 +2991,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) socklen_t len; struct sockaddr_in my_addr; - /* find which URL is asked */ + /* find which url is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3051,7 +3009,7 @@ static void rtsp_cmd_describe(HTTPContext *c, const char *url) return; found: - /* prepare the media description in SDP format */ + /* prepare the media description in sdp format */ /* get the host IP */ len = sizeof(my_addr); @@ -3110,7 +3068,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, struct sockaddr_in dest_addr; RTSPActionServerSetup setup; - /* find which URL is asked */ + /* find which url is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3145,14 +3103,11 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, found: /* generate session id if needed */ - if (h->session_id[0] == '\0') { - unsigned random0 = av_lfg_get(&random_state); - unsigned random1 = av_lfg_get(&random_state); + if (h->session_id[0] == '\0') snprintf(h->session_id, sizeof(h->session_id), "%08x%08x", - random0, random1); - } + av_lfg_get(&random_state), av_lfg_get(&random_state)); - /* find RTP session, and create it if none found */ + /* find rtp session, and create it if none found */ rtp_c = find_rtp_session(h->session_id); if (!rtp_c) { /* always prefer UDP */ @@ -3241,7 +3196,7 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url, } -/* find an RTP connection by using the session ID. Check consistency +/* find an rtp connection by using the session ID. Check consistency with filename */ static HTTPContext *find_rtp_session_with_url(const char *url, const char *session_id) @@ -3256,7 +3211,7 @@ static HTTPContext *find_rtp_session_with_url(const char *url, if (!rtp_c) return NULL; - /* find which URL is asked */ + /* find which url is asked */ av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') @@ -3303,7 +3258,7 @@ static void rtsp_cmd_play(HTTPContext *c, const char *url, RTSPMessageHeader *h) avio_printf(c->pb, "\r\n"); } -static void rtsp_cmd_interrupt(HTTPContext *c, const char *url, RTSPMessageHeader *h, int pause_only) +static void rtsp_cmd_pause(HTTPContext *c, const char *url, RTSPMessageHeader *h) { HTTPContext *rtp_c; @@ -3313,14 +3268,29 @@ static void rtsp_cmd_interrupt(HTTPContext *c, const char *url, RTSPMessageHeade return; } - if (pause_only) { - if (rtp_c->state != HTTPSTATE_SEND_DATA && - rtp_c->state != HTTPSTATE_WAIT_FEED) { - rtsp_reply_error(c, RTSP_STATUS_STATE); - return; - } - rtp_c->state = HTTPSTATE_READY; - rtp_c->first_pts = AV_NOPTS_VALUE; + if (rtp_c->state != HTTPSTATE_SEND_DATA && + rtp_c->state != HTTPSTATE_WAIT_FEED) { + rtsp_reply_error(c, RTSP_STATUS_STATE); + return; + } + + rtp_c->state = HTTPSTATE_READY; + rtp_c->first_pts = AV_NOPTS_VALUE; + /* now everything is OK, so we can send the connection parameters */ + rtsp_reply_header(c, RTSP_STATUS_OK); + /* session ID */ + avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); + avio_printf(c->pb, "\r\n"); +} + +static void rtsp_cmd_teardown(HTTPContext *c, const char *url, RTSPMessageHeader *h) +{ + HTTPContext *rtp_c; + + rtp_c = find_rtp_session_with_url(url, h->session_id); + if (!rtp_c) { + rtsp_reply_error(c, RTSP_STATUS_SESSION); + return; } /* now everything is OK, so we can send the connection parameters */ @@ -3329,10 +3299,11 @@ static void rtsp_cmd_interrupt(HTTPContext *c, const char *url, RTSPMessageHeade avio_printf(c->pb, "Session: %s\r\n", rtp_c->session_id); avio_printf(c->pb, "\r\n"); - if (!pause_only) - close_connection(rtp_c); + /* abort the session */ + close_connection(rtp_c); } + /********************************************************************/ /* RTP handling */ @@ -3477,8 +3448,7 @@ static int rtp_new_av_stream(HTTPContext *c, ipaddr, ntohs(dest_addr->sin_port), c->stream->filename, stream_index, c->protocol); - /* normally, no packets should be output here, but the packet size may - * be checked */ + /* normally, no packets should be output here, but the packet size may be checked */ if (ffio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) { /* XXX: close stream */ goto fail; @@ -3487,7 +3457,6 @@ static int rtp_new_av_stream(HTTPContext *c, fail: if (h) ffurl_close(h); - av_free(st); av_free(ctx); return -1; } @@ -3499,15 +3468,12 @@ static int rtp_new_av_stream(HTTPContext *c, } /********************************************************************/ -/* ffserver initialization */ +/* avserver initialization */ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int copy) { AVStream *fst; - if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams)) - return NULL; - fst = av_mallocz(sizeof(AVStream)); if (!fst) return NULL; @@ -3515,13 +3481,13 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop fst->codec = avcodec_alloc_context3(NULL); memcpy(fst->codec, codec, sizeof(AVCodecContext)); if (codec->extradata_size) { - fst->codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); + fst->codec->extradata = av_malloc(codec->extradata_size); memcpy(fst->codec->extradata, codec->extradata, codec->extradata_size); } } else { /* live streams must use the actual feed's codec since it may be - * updated later to carry extradata needed by them. + * updated later to carry extradata needed by the streams. */ fst->codec = codec; } @@ -3586,7 +3552,7 @@ static void remove_stream(FFStream *stream) } } -/* specific MPEG4 handling : we extract the raw parameters */ +/* specific mpeg4 handling : we extract the raw parameters */ static void extract_mpeg4_header(AVFormatContext *infile) { int mpeg4_count, i, size; @@ -3624,7 +3590,7 @@ static void extract_mpeg4_header(AVFormatContext *infile) p[2] == 0x01 && p[3] == 0xb6) { size = p - pkt.data; // av_hex_dump_log(infile, AV_LOG_DEBUG, pkt.data, size); - st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); + st->codec->extradata = av_malloc(size); st->codec->extradata_size = size; memcpy(st->codec->extradata, pkt.data, size); break; @@ -3658,14 +3624,9 @@ static void build_file_streams(void) av_dict_set(&stream->in_opts, "mpeg2ts_compute_pcr", "1", 0); } - if (!stream->feed_filename[0]) { - http_log("Unspecified feed file for stream '%s'\n", stream->filename); - goto fail; - } - - http_log("Opening feed file '%s' for stream '%s'\n", stream->feed_filename, stream->filename); + http_log("Opening file '%s'\n", stream->feed_filename); if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { - http_log("Could not open '%s': %s\n", stream->feed_filename, av_err2str(ret)); + http_log("Could not open '%s': %d\n", stream->feed_filename, ret); /* remove stream (no need to spend more time on it) */ fail: remove_stream(stream); @@ -3720,8 +3681,6 @@ static void build_feed_streams(void) int matches = 0; if (avformat_open_input(&s, feed->feed_filename, NULL, NULL) >= 0) { - /* set buffer size */ - ffio_set_buf_size(s->pb, FFM_PACKET_SIZE); /* Now see if it matches */ if (s->nb_streams == feed->nb_streams) { matches = 1; @@ -3790,7 +3749,7 @@ static void build_feed_streams(void) } } if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) { - AVFormatContext *s = avformat_alloc_context(); + AVFormatContext s1 = {0}, *s = &s1; if (feed->readonly) { http_log("Unable to create feed file '%s' as it is marked readonly\n", @@ -3808,15 +3767,12 @@ static void build_feed_streams(void) s->nb_streams = feed->nb_streams; s->streams = feed->streams; if (avformat_write_header(s, NULL) < 0) { - http_log("Container doesn't support the required parameters\n"); + http_log("Container doesn't supports the required parameters\n"); exit(1); } - /* XXX: need better API */ + /* XXX: need better api */ av_freep(&s->priv_data); avio_close(s->pb); - s->streams = NULL; - s->nb_streams = 0; - avformat_free_context(s); } /* get feed size and write index */ fd = open(feed->feed_filename, O_RDONLY); @@ -3865,9 +3821,6 @@ static void add_codec(FFStream *stream, AVCodecContext *av) { AVStream *st; - if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams)) - return; - /* compute default parameters */ switch(av->codec_type) { case AVMEDIA_TYPE_AUDIO: @@ -3911,7 +3864,7 @@ static void add_codec(FFStream *stream, AVCodecContext *av) av->rc_buffer_aggressivity = 1.0; if (!av->rc_eq) - av->rc_eq = av_strdup("tex^qComp"); + av->rc_eq = "tex^qComp"; if (!av->i_quant_factor) av->i_quant_factor = -0.8; if (!av->b_quant_factor) @@ -3939,16 +3892,27 @@ static void add_codec(FFStream *stream, AVCodecContext *av) memcpy(st->codec, av, sizeof(AVCodecContext)); } -static enum AVCodecID opt_codec(const char *name, enum AVMediaType type) +static enum AVCodecID opt_audio_codec(const char *arg) { - AVCodec *codec = avcodec_find_encoder_by_name(name); + AVCodec *p= avcodec_find_encoder_by_name(arg); - if (!codec || codec->type != type) + if (p == NULL || p->type != AVMEDIA_TYPE_AUDIO) return AV_CODEC_ID_NONE; - return codec->id; + + return p->id; } -static int ffserver_opt_default(const char *opt, const char *arg, +static enum AVCodecID opt_video_codec(const char *arg) +{ + AVCodec *p= avcodec_find_encoder_by_name(arg); + + if (p == NULL || p->type != AVMEDIA_TYPE_VIDEO) + return AV_CODEC_ID_NONE; + + return p->id; +} + +static int avserver_opt_default(const char *opt, const char *arg, AVCodecContext *avctx, int type) { int ret = 0; @@ -3958,7 +3922,7 @@ static int ffserver_opt_default(const char *opt, const char *arg, return ret; } -static int ffserver_opt_preset(const char *arg, +static int avserver_opt_preset(const char *arg, AVCodecContext *avctx, int type, enum AVCodecID *audio_id, enum AVCodecID *video_id) { @@ -3984,12 +3948,12 @@ static int ffserver_opt_preset(const char *arg, break; } if(!strcmp(tmp, "acodec")){ - *audio_id = opt_codec(tmp2, AVMEDIA_TYPE_AUDIO); + *audio_id = opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ - *video_id = opt_codec(tmp2, AVMEDIA_TYPE_VIDEO); + *video_id = opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ /* opt_subtitle_codec(tmp2); */ - }else if(ffserver_opt_default(tmp, tmp2, avctx, type) < 0){ + }else if(avserver_opt_default(tmp, tmp2, avctx, type) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ret = 1; break; @@ -4001,7 +3965,8 @@ static int ffserver_opt_preset(const char *arg, return ret; } -static AVOutputFormat *ffserver_guess_format(const char *short_name, const char *filename, const char *mime_type) +static AVOutputFormat *avserver_guess_format(const char *short_name, const char *filename, + const char *mime_type) { AVOutputFormat *fmt = av_guess_format(short_name, filename, mime_type); @@ -4019,12 +3984,12 @@ static AVOutputFormat *ffserver_guess_format(const char *short_name, const char return fmt; } -static void report_config_error(const char *filename, int line_num, int log_level, int *errors, const char *fmt, ...) +static void report_config_error(const char *filename, int line_num, int *errors, const char *fmt, ...) { va_list vl; va_start(vl, fmt); - av_log(NULL, log_level, "%s:%d: ", filename, line_num); - av_vlog(NULL, log_level, fmt, vl); + fprintf(stderr, "%s:%d: ", filename, line_num); + vfprintf(stderr, fmt, vl); va_end(vl); (*errors)++; @@ -4035,23 +4000,21 @@ static int parse_ffconfig(const char *filename) FILE *f; char line[1024]; char cmd[64]; - char arg[1024], arg2[1024]; + char arg[1024]; const char *p; - int val, errors, warnings, line_num; + int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed, *s; AVCodecContext audio_enc, video_enc; enum AVCodecID audio_id, video_id; - int ret = 0; f = fopen(filename, "r"); if (!f) { - ret = AVERROR(errno); - av_log(NULL, AV_LOG_ERROR, "Could not open the configuration file '%s'\n", filename); - return ret; + perror(filename); + return -1; } - errors = warnings = 0; + errors = 0; line_num = 0; first_stream = NULL; last_stream = &first_stream; @@ -4062,9 +4025,8 @@ static int parse_ffconfig(const char *filename) redirect = NULL; audio_id = AV_CODEC_ID_NONE; video_id = AV_CODEC_ID_NONE; -#define ERROR(...) report_config_error(filename, line_num, AV_LOG_ERROR, &errors, __VA_ARGS__) -#define WARNING(...) report_config_error(filename, line_num, AV_LOG_WARNING, &warnings, __VA_ARGS__) +#define ERROR(...) report_config_error(filename, line_num, &errors, __VA_ARGS__) for(;;) { if (fgets(line, sizeof(line), f) == NULL) break; @@ -4089,8 +4051,6 @@ static int parse_ffconfig(const char *filename) if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { ERROR("%s:%d: Invalid host/IP address: %s\n", arg); } - } else if (!av_strcasecmp(cmd, "NoDaemon")) { - WARNING("NoDaemon option has no effect, you should remove it\n"); } else if (!av_strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); @@ -4121,13 +4081,13 @@ static int parse_ffconfig(const char *filename) } else if (!av_strcasecmp(cmd, "MaxBandwidth")) { int64_t llval; get_arg(arg, sizeof(arg), &p); - llval = strtoll(arg, NULL, 10); + llval = atoll(arg); if (llval < 10 || llval > 10000000) { ERROR("Invalid MaxBandwidth: %s\n", arg); } else max_bandwidth = llval; } else if (!av_strcasecmp(cmd, "CustomLog")) { - if (!ffserver_debug) + if (!avserver_debug) get_arg(logfilename, sizeof(logfilename), &p); } else if (!av_strcasecmp(cmd, "filename, sizeof(feed->filename), &p); q = strrchr(feed->filename, '>'); if (*q) @@ -4153,7 +4109,7 @@ static int parse_ffconfig(const char *filename) } feed->fmt = av_guess_format("ffm", NULL, NULL); - /* default feed file */ + /* defaut feed file */ snprintf(feed->feed_filename, sizeof(feed->feed_filename), "/tmp/%s.ffm", feed->filename); feed->feed_max_size = 5 * 1024 * 1024; @@ -4172,50 +4128,39 @@ static int parse_ffconfig(const char *filename) int i; feed->child_argv = av_mallocz(64 * sizeof(char *)); - if (!feed->child_argv) { - ret = AVERROR(ENOMEM); - goto end; - } + for (i = 0; i < 62; i++) { get_arg(arg, sizeof(arg), &p); if (!arg[0]) break; feed->child_argv[i] = av_strdup(arg); - if (!feed->child_argv[i]) { - ret = AVERROR(ENOMEM); - goto end; - } } - feed->child_argv[i] = - av_asprintf("http://%s:%d/%s", - (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" : - inet_ntoa(my_http_addr.sin_addr), ntohs(my_http_addr.sin_port), - feed->filename); - if (!feed->child_argv[i]) { - ret = AVERROR(ENOMEM); - goto end; - } + feed->child_argv[i] = av_malloc(30 + strlen(feed->filename)); + + snprintf(feed->child_argv[i], 30+strlen(feed->filename), + "http://%s:%d/%s", + (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" : + inet_ntoa(my_http_addr.sin_addr), + ntohs(my_http_addr.sin_port), feed->filename); } - } else if (!av_strcasecmp(cmd, "File") || !av_strcasecmp(cmd, "ReadOnlyFile")) { + } else if (!av_strcasecmp(cmd, "ReadOnlyFile")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); - feed->readonly = !av_strcasecmp(cmd, "ReadOnlyFile"); + feed->readonly = 1; } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } + } else if (!av_strcasecmp(cmd, "File")) { + if (feed) { + get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); + } else if (stream) + get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else if (!av_strcasecmp(cmd, "Truncate")) { if (feed) { get_arg(arg, sizeof(arg), &p); - /* assume Truncate is true in case no argument is specified */ - if (!arg[0]) { - feed->truncate = 1; - } else { - WARNING("Truncate N syntax in configuration file is deprecated, " - "use Truncate alone with no arguments\n"); - feed->truncate = strtod(arg, NULL); - } + feed->truncate = strtod(arg, NULL); } } else if (!av_strcasecmp(cmd, "FileMaxSize")) { if (feed) { @@ -4255,13 +4200,9 @@ static int parse_ffconfig(const char *filename) } else { FFStream *s; stream = av_mallocz(sizeof(FFStream)); - if (!stream) { - ret = AVERROR(ENOMEM); - goto end; - } get_arg(stream->filename, sizeof(stream->filename), &p); q = strrchr(stream->filename, '>'); - if (q) + if (*q) *q = '\0'; for (s = first_stream; s; s = s->next) { @@ -4270,10 +4211,9 @@ static int parse_ffconfig(const char *filename) } } - stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); + stream->fmt = avserver_guess_format(NULL, stream->filename, NULL); avcodec_get_context_defaults3(&video_enc, NULL); avcodec_get_context_defaults3(&audio_enc, NULL); - audio_id = AV_CODEC_ID_NONE; video_id = AV_CODEC_ID_NONE; if (stream->fmt) { @@ -4296,7 +4236,7 @@ static int parse_ffconfig(const char *filename) sfeed = sfeed->next_feed; } if (!sfeed) - ERROR("Feed with name '%s' for stream '%s' is not defined\n", arg, stream->filename); + ERROR("feed '%s' not defined\n", arg); else stream->feed = sfeed; } @@ -4308,10 +4248,10 @@ static int parse_ffconfig(const char *filename) stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; - /* JPEG cannot be used here, so use single frame MJPEG */ + /* jpeg cannot be used here, so use single frame jpeg */ if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); - stream->fmt = ffserver_guess_format(arg, NULL, NULL); + stream->fmt = avserver_guess_format(arg, NULL, NULL); if (!stream->fmt) { ERROR("Unknown Format: %s\n", arg); } @@ -4335,36 +4275,18 @@ static int parse_ffconfig(const char *filename) } else { ERROR("FaviconURL only permitted for status streams\n"); } - } else if (!av_strcasecmp(cmd, "Author") || - !av_strcasecmp(cmd, "Comment") || - !av_strcasecmp(cmd, "Copyright") || - !av_strcasecmp(cmd, "Title")) { - get_arg(arg, sizeof(arg), &p); - - if (stream) { - char key[32]; - int i, ret; - - for (i = 0; i < strlen(cmd); i++) - key[i] = av_tolower(cmd[i]); - key[i] = 0; - WARNING("'%s' option in configuration file is deprecated, " - "use 'Metadata %s VALUE' instead\n", cmd, key); - if ((ret = av_dict_set(&stream->metadata, key, arg, 0)) < 0) { - ERROR("Could not set metadata '%s' to value '%s': %s\n", - key, arg, av_err2str(ret)); - } - } - } else if (!av_strcasecmp(cmd, "Metadata")) { - get_arg(arg, sizeof(arg), &p); - get_arg(arg2, sizeof(arg2), &p); - if (stream) { - int ret; - if ((ret = av_dict_set(&stream->metadata, arg, arg2, 0)) < 0) { - ERROR("Could not set metadata '%s' to value '%s': %s\n", - arg, arg2, av_err2str(ret)); - } - } + } else if (!av_strcasecmp(cmd, "Author")) { + if (stream) + get_arg(stream->author, sizeof(stream->author), &p); + } else if (!av_strcasecmp(cmd, "Comment")) { + if (stream) + get_arg(stream->comment, sizeof(stream->comment), &p); + } else if (!av_strcasecmp(cmd, "Copyright")) { + if (stream) + get_arg(stream->copyright, sizeof(stream->copyright), &p); + } else if (!av_strcasecmp(cmd, "Title")) { + if (stream) + get_arg(stream->title, sizeof(stream->title), &p); } else if (!av_strcasecmp(cmd, "Preroll")) { get_arg(arg, sizeof(arg), &p); if (stream) @@ -4374,13 +4296,13 @@ static int parse_ffconfig(const char *filename) stream->send_on_key = 1; } else if (!av_strcasecmp(cmd, "AudioCodec")) { get_arg(arg, sizeof(arg), &p); - audio_id = opt_codec(arg, AVMEDIA_TYPE_AUDIO); + audio_id = opt_audio_codec(arg); if (audio_id == AV_CODEC_ID_NONE) { ERROR("Unknown AudioCodec: %s\n", arg); } } else if (!av_strcasecmp(cmd, "VideoCodec")) { get_arg(arg, sizeof(arg), &p); - video_id = opt_codec(arg, AVMEDIA_TYPE_VIDEO); + video_id = opt_video_codec(arg); if (video_id == AV_CODEC_ID_NONE) { ERROR("Unknown VideoCodec: %s\n", arg); } @@ -4400,6 +4322,11 @@ static int parse_ffconfig(const char *filename) get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.sample_rate = atoi(arg); + } else if (!av_strcasecmp(cmd, "AudioQuality")) { + get_arg(arg, sizeof(arg), &p); + if (stream) { +// audio_enc.quality = atof(arg) * 1000; + } } else if (!av_strcasecmp(cmd, "VideoBitRateRange")) { if (stream) { int minrate, maxrate; @@ -4441,14 +4368,10 @@ static int parse_ffconfig(const char *filename) } else if (!av_strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { - ret = av_parse_video_size(&video_enc.width, &video_enc.height, arg); - if (ret < 0) { - ERROR("Invalid video size '%s'\n", arg); - } else { - if ((video_enc.width % 16) != 0 || - (video_enc.height % 16) != 0) { - ERROR("Image size must be a multiple of 16\n"); - } + av_parse_video_size(&video_enc.width, &video_enc.height, arg); + if ((video_enc.width % 16) != 0 || + (video_enc.height % 16) != 0) { + ERROR("Image size must be a multiple of 16\n"); } } } else if (!av_strcasecmp(cmd, "VideoFrameRate")) { @@ -4462,14 +4385,6 @@ static int parse_ffconfig(const char *filename) video_enc.time_base.den = frame_rate.num; } } - } else if (!av_strcasecmp(cmd, "PixelFormat")) { - get_arg(arg, sizeof(arg), &p); - if (stream) { - video_enc.pix_fmt = av_get_pix_fmt(arg); - if (video_enc.pix_fmt == AV_PIX_FMT_NONE) { - ERROR("Unknown pixel format: %s\n", arg); - } - } } else if (!av_strcasecmp(cmd, "VideoGopSize")) { get_arg(arg, sizeof(arg), &p); if (stream) @@ -4487,6 +4402,7 @@ static int parse_ffconfig(const char *filename) } } else if (!av_strcasecmp(cmd, "AVOptionVideo") || !av_strcasecmp(cmd, "AVOptionAudio")) { + char arg2[1024]; AVCodecContext *avctx; int type; get_arg(arg, sizeof(arg), &p); @@ -4498,8 +4414,8 @@ static int parse_ffconfig(const char *filename) avctx = &audio_enc; type = AV_OPT_FLAG_AUDIO_PARAM; } - if (ffserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) { - ERROR("Error setting %s option to %s %s\n", cmd, arg, arg2); + if (avserver_opt_default(arg, arg2, avctx, type|AV_OPT_FLAG_ENCODING_PARAM)) { + ERROR("AVOption error: %s %s\n", arg, arg2); } } else if (!av_strcasecmp(cmd, "AVPresetVideo") || !av_strcasecmp(cmd, "AVPresetAudio")) { @@ -4515,7 +4431,7 @@ static int parse_ffconfig(const char *filename) audio_enc.codec_id = audio_id; type = AV_OPT_FLAG_AUDIO_PARAM; } - if (ffserver_opt_preset(arg, avctx, type|AV_OPT_FLAG_ENCODING_PARAM, &audio_id, &video_id)) { + if (avserver_opt_preset(arg, avctx, type|AV_OPT_FLAG_ENCODING_PARAM, &audio_id, &video_id)) { ERROR("AVPreset error: %s\n", arg); } } else if (!av_strcasecmp(cmd, "VideoTag")) { @@ -4630,10 +4546,6 @@ static int parse_ffconfig(const char *filename) ERROR("Already in a tag\n"); } else { redirect = av_mallocz(sizeof(FFStream)); - if (!redirect) { - ret = AVERROR(ENOMEM); - goto end; - } *last_stream = redirect; last_stream = &redirect->next; @@ -4663,12 +4575,9 @@ static int parse_ffconfig(const char *filename) } #undef ERROR -end: fclose(f); - if (ret < 0) - return ret; if (errors) - return AVERROR(EINVAL); + return -1; else return 0; } @@ -4700,13 +4609,13 @@ static void handle_child_exit(int sig) static void opt_debug(void) { - ffserver_debug = 1; + avserver_debug = 1; logfilename[0] = '-'; } void show_help_default(const char *opt, const char *arg) { - printf("usage: ffserver [options]\n" + printf("usage: avserver [options]\n" "Hyper fast multi format Audio/Video streaming server\n"); printf("\n"); show_help_options(options, "Main options:", 0, 0, 0); @@ -4716,22 +4625,21 @@ static const OptionDef options[] = { #include "cmdutils_common_opts.h" { "n", OPT_BOOL, {(void *)&no_launch }, "enable no-launch mode" }, { "d", 0, {(void*)opt_debug}, "enable debug mode" }, - { "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /etc/ffserver.conf", "configfile" }, + { "f", HAS_ARG | OPT_STRING, {(void*)&config_filename }, "use configfile instead of /etc/avserver.conf", "configfile" }, { NULL }, }; int main(int argc, char **argv) { struct sigaction sigact = { { 0 } }; - int ret = 0; - config_filename = av_strdup("/etc/ffserver.conf"); + config_filename = av_strdup("/etc/avserver.conf"); parse_loglevel(argc, argv, options); av_register_all(); avformat_network_init(); - show_banner(argc, argv, options); + show_banner(); my_program_name = argv[0]; @@ -4745,12 +4653,10 @@ int main(int argc, char **argv) sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART; sigaction(SIGCHLD, &sigact, 0); - if ((ret = parse_ffconfig(config_filename)) < 0) { - fprintf(stderr, "Error reading configuration file '%s': %s\n", - config_filename, av_err2str(ret)); + if (parse_ffconfig(config_filename) < 0) { + fprintf(stderr, "Incorrect config file - exiting.\n"); exit(1); } - av_freep(&config_filename); /* open log file if needed */ if (logfilename[0] != '\0') { diff --git a/cmdutils.c b/cmdutils.c index 1147bc338e..69a11bdd4f 100644 --- a/cmdutils.c +++ b/cmdutils.c @@ -2,20 +2,20 @@ * Various utilities for command line tools * Copyright (c) 2000-2003 Fabrice Bellard * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -30,17 +30,13 @@ references to libraries that are not being built. */ #include "config.h" -#include "compat/va_copy.h" #include "libavformat/avformat.h" #include "libavfilter/avfilter.h" #include "libavdevice/avdevice.h" #include "libavresample/avresample.h" #include "libswscale/swscale.h" -#include "libswresample/swresample.h" -#include "libpostproc/postprocess.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" -#include "libavutil/bprint.h" #include "libavutil/mathematics.h" #include "libavutil/imgutils.h" #include "libavutil/parseutils.h" @@ -49,8 +45,8 @@ #include "libavutil/dict.h" #include "libavutil/opt.h" #include "libavutil/cpu.h" -#include "libavutil/ffversion.h" #include "cmdutils.h" +#include "version.h" #if CONFIG_NETWORK #include "libavformat/network.h" #endif @@ -59,21 +55,17 @@ #include #endif -static int init_report(const char *env); - struct SwsContext *sws_opts; -AVDictionary *swr_opts; AVDictionary *format_opts, *codec_opts, *resample_opts; -static FILE *report_file; -int hide_banner = 0; +static const int this_year = 2014; 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 } void uninit_opts(void) @@ -82,8 +74,6 @@ void uninit_opts(void) sws_freeContext(sws_opts); sws_opts = NULL; #endif - - av_dict_free(&swr_opts); av_dict_free(&format_opts); av_dict_free(&codec_opts); av_dict_free(&resample_opts); @@ -94,20 +84,6 @@ void log_callback_help(void *ptr, int level, const char *fmt, va_list vl) vfprintf(stdout, fmt, vl); } -static void log_callback_report(void *ptr, int level, const char *fmt, va_list vl) -{ - va_list vl2; - char line[1024]; - static int print_prefix = 1; - - va_copy(vl2, vl); - av_log_default_callback(ptr, level, fmt, vl); - av_log_format_line(ptr, level, fmt, vl2, line, sizeof(line), &print_prefix); - va_end(vl2); - fputs(line, report_file); - fflush(report_file); -} - static void (*program_exit)(int ret); void register_exit(void (*cb)(int ret)) @@ -188,10 +164,8 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, void show_help_children(const AVClass *class, int flags) { const AVClass *child = NULL; - if (class->option) { - av_opt_show2(&class, NULL, flags, 0); - printf("\n"); - } + av_opt_show2(&class, NULL, flags, 0); + printf("\n"); while (child = av_opt_child_class_next(class, child)) show_help_children(child, flags); @@ -313,8 +287,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, 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': %s\n", - arg, opt, av_err2str(ret)); + "Failed to set value '%s' for option '%s'\n", arg, opt); return ret; } } @@ -441,142 +414,65 @@ int locate_option(int argc, char **argv, const OptionDef *options, (po->name && !strcmp(optname, po->name))) return i; - if (po->flags & HAS_ARG) + if (!po || po->flags & HAS_ARG) i++; } return 0; } -static void dump_argument(const char *a) -{ - const unsigned char *p; - - for (p = a; *p; p++) - if (!((*p >= '+' && *p <= ':') || (*p >= '@' && *p <= 'Z') || - *p == '_' || (*p >= 'a' && *p <= 'z'))) - break; - if (!*p) { - fputs(a, report_file); - return; - } - fputc('"', report_file); - for (p = a; *p; p++) { - if (*p == '\\' || *p == '"' || *p == '$' || *p == '`') - fprintf(report_file, "\\%c", *p); - else if (*p < ' ' || *p > '~') - fprintf(report_file, "\\x%02x", *p); - else - fputc(*p, report_file); - } - fputc('"', report_file); -} - void parse_loglevel(int argc, char **argv, const OptionDef *options) { int idx = locate_option(argc, argv, options, "loglevel"); - const char *env; if (!idx) idx = locate_option(argc, argv, options, "v"); if (idx && argv[idx + 1]) opt_loglevel(NULL, "loglevel", argv[idx + 1]); - idx = locate_option(argc, argv, options, "report"); - if ((env = getenv("FFREPORT")) || idx) { - init_report(env); - if (report_file) { - int i; - fprintf(report_file, "Command line:\n"); - for (i = 0; i < argc; i++) { - dump_argument(argv[i]); - fputc(i < argc - 1 ? ' ' : '\n', report_file); - } - fflush(report_file); - } - } - idx = locate_option(argc, argv, options, "hide_banner"); - if (idx) - hide_banner = 1; -} - -static const AVOption *opt_find(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags) -{ - const AVOption *o = av_opt_find(obj, name, unit, opt_flags, search_flags); - if(o && !o->flags) - return NULL; - return o; } #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 *o; - int consumed = 0; char opt_stripped[128]; const char *p; const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(); #if CONFIG_AVRESAMPLE const AVClass *rc = avresample_get_class(); #endif - const AVClass *sc, *swr_class; - - if (!strcmp(opt, "debug") || !strcmp(opt, "fdebug")) - av_log_set_level(AV_LOG_DEBUG); +#if CONFIG_SWSCALE + const AVClass *sc = sws_get_class(); +#endif if (!(p = strchr(opt, ':'))) p = opt + strlen(opt); av_strlcpy(opt_stripped, opt, FFMIN(sizeof(opt_stripped), p - opt + 1)); - if ((o = 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') && - (o = opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) { + (o = av_opt_find(&cc, opt + 1, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)))) av_dict_set(&codec_opts, opt, arg, FLAGS); - consumed = 1; - } - if ((o = opt_find(&fc, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { + 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 (consumed) - av_log(NULL, AV_LOG_VERBOSE, "Routing option %s to both codec and muxer layer\n", opt); - consumed = 1; - } +#if CONFIG_AVRESAMPLE + else if ((o = av_opt_find(&rc, opt, NULL, 0, + AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) + av_dict_set(&resample_opts, opt, arg, FLAGS); +#endif #if CONFIG_SWSCALE - sc = sws_get_class(); - if (!consumed && opt_find(&sc, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)) { + else if ((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) { av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); return ret; } - consumed = 1; - } -#endif -#if CONFIG_SWRESAMPLE - swr_class = swr_get_class(); - if (!consumed && (o=opt_find(&swr_class, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { - struct SwrContext *swr = swr_alloc(); - int ret = av_opt_set(swr, opt, arg, 0); - swr_free(&swr); - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt); - return ret; - } - av_dict_set(&swr_opts, opt, arg, FLAGS); - consumed = 1; - } -#endif -#if CONFIG_AVRESAMPLE - if ((o=opt_find(&rc, opt, NULL, 0, - AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { - av_dict_set(&resample_opts, opt, arg, FLAGS); - consumed = 1; } #endif - if (consumed) + if (o) return 0; return AVERROR_OPTION_NOT_FOUND; } @@ -621,7 +517,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, #if CONFIG_SWSCALE g->sws_opts = sws_opts; #endif - g->swr_opts = swr_opts; g->codec_opts = codec_opts; g->format_opts = format_opts; g->resample_opts = resample_opts; @@ -632,7 +527,6 @@ static void finish_group(OptionParseContext *octx, int group_idx, #if CONFIG_SWSCALE sws_opts = NULL; #endif - swr_opts = NULL; init_opts(); memset(&octx->cur_group, 0, sizeof(octx->cur_group)); @@ -662,7 +556,7 @@ static void init_parse_context(OptionParseContext *octx, memset(octx, 0, sizeof(*octx)); octx->nb_groups = nb_groups; - octx->groups = av_mallocz_array(octx->nb_groups, sizeof(*octx->groups)); + octx->groups = av_mallocz(sizeof(*octx->groups) * octx->nb_groups); if (!octx->groups) exit_program(1); @@ -690,7 +584,6 @@ void uninit_parse_context(OptionParseContext *octx) #if CONFIG_SWSCALE sws_freeContext(l->groups[j].sws_opts); #endif - av_dict_free(&l->groups[j].swr_opts); } av_freep(&l->groups); } @@ -707,7 +600,6 @@ int split_commandline(OptionParseContext *octx, int argc, char *argv[], const OptionGroupDef *groups, int nb_groups) { int optindex = 1; - int dashdash = -2; /* perform system-dependent conversions for arguments list */ prepare_app_arguments(&argc, &argv); @@ -722,12 +614,8 @@ int split_commandline(OptionParseContext *octx, int argc, char *argv[], av_log(NULL, AV_LOG_DEBUG, "Reading option '%s' ...", opt); - if (opt[0] == '-' && opt[1] == '-' && !opt[2]) { - dashdash = optindex; - continue; - } /* unnamed group separators, e.g. output filename */ - if (opt[0] != '-' || !opt[1] || dashdash+1 == optindex) { + if (opt[0] != '-' || !opt[1]) { finish_group(octx, 0, opt); av_log(NULL, AV_LOG_DEBUG, " matched as %s.\n", groups[0].name); continue; @@ -810,13 +698,12 @@ do { \ int opt_cpuflags(void *optctx, const char *opt, const char *arg) { - int ret; - unsigned flags = av_get_cpu_flags(); + int flags = av_parse_cpu_flags(arg); - if ((ret = av_parse_cpu_caps(&flags, arg)) < 0) - return ret; + if (flags < 0) + return flags; - av_force_cpu_flags(flags); + av_set_cpu_flags_mask(flags); return 0; } @@ -834,22 +721,8 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) }; char *tail; int level; - int flags; int i; - flags = av_log_get_flags(); - tail = strstr(arg, "repeat"); - if (tail) - flags &= ~AV_LOG_SKIP_REPEATED; - else - flags |= AV_LOG_SKIP_REPEATED; - - av_log_set_flags(flags); - if (tail == arg) - arg += 6 + (arg[6]=='+'); - if(tail && !*arg) - return 0; - for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) { if (!strcmp(log_levels[i].name, arg)) { av_log_set_level(log_levels[i].level); @@ -869,116 +742,6 @@ int opt_loglevel(void *optctx, const char *opt, const char *arg) return 0; } -static void expand_filename_template(AVBPrint *bp, const char *template, - struct tm *tm) -{ - int c; - - while ((c = *(template++))) { - if (c == '%') { - if (!(c = *(template++))) - break; - switch (c) { - case 'p': - av_bprintf(bp, "%s", program_name); - break; - case 't': - av_bprintf(bp, "%04d%02d%02d-%02d%02d%02d", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - break; - case '%': - av_bprint_chars(bp, c, 1); - break; - } - } else { - av_bprint_chars(bp, c, 1); - } - } -} - -static int init_report(const char *env) -{ - char *filename_template = NULL; - char *key, *val; - int ret, count = 0; - time_t now; - struct tm *tm; - AVBPrint filename; - - if (report_file) /* already opened */ - return 0; - time(&now); - tm = localtime(&now); - - while (env && *env) { - if ((ret = av_opt_get_key_value(&env, "=", ":", 0, &key, &val)) < 0) { - if (count) - av_log(NULL, AV_LOG_ERROR, - "Failed to parse FFREPORT environment variable: %s\n", - av_err2str(ret)); - break; - } - if (*env) - env++; - count++; - if (!strcmp(key, "file")) { - av_free(filename_template); - filename_template = val; - val = NULL; - } else { - av_log(NULL, AV_LOG_ERROR, "Unknown key '%s' in FFREPORT\n", key); - } - av_free(val); - av_free(key); - } - - av_bprint_init(&filename, 0, 1); - expand_filename_template(&filename, - av_x_if_null(filename_template, "%p-%t.log"), tm); - av_free(filename_template); - if (!av_bprint_is_complete(&filename)) { - av_log(NULL, AV_LOG_ERROR, "Out of memory building report file name\n"); - return AVERROR(ENOMEM); - } - - report_file = fopen(filename.str, "w"); - if (!report_file) { - av_log(NULL, AV_LOG_ERROR, "Failed to open report \"%s\": %s\n", - filename.str, strerror(errno)); - return AVERROR(errno); - } - av_log_set_callback(log_callback_report); - av_log(NULL, AV_LOG_INFO, - "%s started on %04d-%02d-%02d at %02d:%02d:%02d\n" - "Report written to \"%s\"\n", - program_name, - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec, - filename.str); - av_bprint_finalize(&filename, NULL); - return 0; -} - -int opt_report(const char *opt) -{ - return init_report(NULL); -} - -int opt_max_alloc(void *optctx, const char *opt, const char *arg) -{ - char *tail; - size_t max; - - max = strtol(arg, &tail, 10); - if (*tail) { - av_log(NULL, AV_LOG_FATAL, "Invalid max_alloc \"%s\".\n", arg); - exit_program(1); - } - av_max_alloc(max); - return 0; -} - int opt_timelimit(void *optctx, const char *opt, const char *arg) { #if HAVE_SETRLIMIT @@ -1007,7 +770,6 @@ static int warned_cfg = 0; #define INDENT 1 #define SHOW_VERSION 2 #define SHOW_CONFIG 4 -#define SHOW_COPYRIGHT 8 #define PRINT_LIB_INFO(libname, LIBNAME, flags, level) \ if (CONFIG_##LIBNAME) { \ @@ -1015,7 +777,7 @@ static int warned_cfg = 0; if (flags & SHOW_VERSION) { \ unsigned int version = libname##_version(); \ av_log(NULL, level, \ - "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \ + "%slib%-10s %2d.%3d.%2d / %2d.%3d.%2d\n", \ indent, #libname, \ LIB##LIBNAME##_VERSION_MAJOR, \ LIB##LIBNAME##_VERSION_MINOR, \ @@ -1024,7 +786,7 @@ static int warned_cfg = 0; } \ if (flags & SHOW_CONFIG) { \ const char *cfg = libname##_configuration(); \ - if (strcmp(FFMPEG_CONFIGURATION, cfg)) { \ + if (strcmp(LIBAV_CONFIGURATION, cfg)) { \ if (!warned_cfg) { \ av_log(NULL, level, \ "%sWARNING: library configuration mismatch\n", \ @@ -1046,88 +808,37 @@ static void print_all_libs_info(int flags, int 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); - PRINT_LIB_INFO(postproc, POSTPROC, flags, level); } -static void print_program_info(int flags, int level) +void show_banner(void) { - const char *indent = flags & INDENT? " " : ""; - - av_log(NULL, level, "%s version " FFMPEG_VERSION, program_name); - if (flags & SHOW_COPYRIGHT) - av_log(NULL, level, " Copyright (c) %d-%d the FFmpeg developers", - program_birth_year, CONFIG_THIS_YEAR); - av_log(NULL, level, "\n"); - 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); -} - -static void print_buildconf(int flags, int level) -{ - const char *indent = flags & INDENT ? " " : ""; - char str[] = { FFMPEG_CONFIGURATION }; - char *conflist, *remove_tilde, *splitconf; - - // Change all the ' --' strings to '~--' so that - // they can be identified as tokens. - while ((conflist = strstr(str, " --")) != NULL) { - strncpy(conflist, "~--", 3); - } - - // Compensate for the weirdness this would cause - // when passing 'pkg-config --static'. - while ((remove_tilde = strstr(str, "pkg-config~")) != NULL) { - strncpy(remove_tilde, "pkg-config ", 11); - } - - splitconf = strtok(str, "~"); - av_log(NULL, level, "\n%sconfiguration:\n", indent); - while (splitconf != NULL) { - av_log(NULL, level, "%s%s%s\n", indent, indent, splitconf); - splitconf = strtok(NULL, "~"); - } -} - -void show_banner(int argc, char **argv, const OptionDef *options) -{ - int idx = locate_option(argc, argv, options, "version"); - if (hide_banner || idx) - return; - - print_program_info (INDENT|SHOW_COPYRIGHT, AV_LOG_INFO); - print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_INFO); - print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_INFO); + av_log(NULL, AV_LOG_INFO, + "%s version " LIBAV_VERSION ", Copyright (c) %d-%d the Libav developers\n", + program_name, program_birth_year, this_year); + av_log(NULL, AV_LOG_INFO, " built on %s %s with %s\n", + __DATE__, __TIME__, CC_IDENT); + av_log(NULL, AV_LOG_VERBOSE, " configuration: " LIBAV_CONFIGURATION "\n"); + print_all_libs_info(INDENT|SHOW_CONFIG, AV_LOG_VERBOSE); + print_all_libs_info(INDENT|SHOW_VERSION, AV_LOG_VERBOSE); } 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); + printf("%s " LIBAV_VERSION "\n", program_name); print_all_libs_info(SHOW_VERSION, AV_LOG_INFO); return 0; } -int show_buildconf(void *optctx, const char *opt, const char *arg) -{ - av_log_set_callback(log_callback_help); - print_buildconf (INDENT|0, AV_LOG_INFO); - - return 0; -} - int show_license(void *optctx, const char *opt, const char *arg) { -#if CONFIG_NONFREE printf( +#if CONFIG_NONFREE "This version of %s has nonfree parts compiled in.\n" "Therefore it is not legally redistributable.\n", - program_name ); + program_name #elif CONFIG_GPLV3 - printf( "%s is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 3 of the License, or\n" @@ -1140,9 +851,8 @@ int show_license(void *optctx, const char *opt, const char *arg) "\n" "You should have received a copy of the GNU General Public License\n" "along with %s. If not, see .\n", - program_name, program_name, program_name ); + program_name, program_name, program_name #elif CONFIG_GPL - printf( "%s is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" @@ -1156,9 +866,8 @@ int show_license(void *optctx, const char *opt, const char *arg) "You should have received a copy of the GNU General Public License\n" "along with %s; if not, write to the Free Software\n" "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n", - program_name, program_name, program_name ); + program_name, program_name, program_name #elif CONFIG_LGPLV3 - printf( "%s is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU Lesser General Public License as published by\n" "the Free Software Foundation; either version 3 of the License, or\n" @@ -1171,9 +880,8 @@ int show_license(void *optctx, const char *opt, const char *arg) "\n" "You should have received a copy of the GNU Lesser General Public License\n" "along with %s. If not, see .\n", - program_name, program_name, program_name ); + program_name, program_name, program_name #else - printf( "%s is free software; you can redistribute it and/or\n" "modify it under the terms of the GNU Lesser General Public\n" "License as published by the Free Software Foundation; either\n" @@ -1187,8 +895,9 @@ int show_license(void *optctx, const char *opt, const char *arg) "You should have received a copy of the GNU Lesser General Public\n" "License along with %s; if not, write to the Free Software\n" "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA\n", - program_name, program_name, program_name ); + program_name, program_name, program_name #endif + ); return 0; } @@ -1243,7 +952,7 @@ int show_formats(void *optctx, const char *opt, const char *arg) #define PRINT_CODEC_SUPPORTED(codec, field, type, list_name, term, get_name) \ if (codec->field) { \ - const type *p = codec->field; \ + const type *p = c->field; \ \ printf(" Supported " list_name ":"); \ while (*p != term) { \ @@ -1261,8 +970,7 @@ static void print_codec(const AVCodec *c) printf("%s %s [%s]:\n", encoder ? "Encoder" : "Decoder", c->name, c->long_name ? c->long_name : ""); - if (c->type == AVMEDIA_TYPE_VIDEO || - c->type == AVMEDIA_TYPE_AUDIO) { + if (c->type == AVMEDIA_TYPE_VIDEO) { printf(" Threading capabilities: "); switch (c->capabilities & (CODEC_CAP_FRAME_THREADS | CODEC_CAP_SLICE_THREADS)) { @@ -1306,9 +1014,7 @@ 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 '?'; } } @@ -1324,36 +1030,6 @@ static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev, return NULL; } -static int compare_codec_desc(const void *a, const void *b) -{ - const AVCodecDescriptor * const *da = a; - const AVCodecDescriptor * const *db = b; - - return (*da)->type != (*db)->type ? (*da)->type - (*db)->type : - strcmp((*da)->name, (*db)->name); -} - -static unsigned get_codecs_sorted(const AVCodecDescriptor ***rcodecs) -{ - const AVCodecDescriptor *desc = NULL; - const AVCodecDescriptor **codecs; - unsigned nb_codecs = 0, i = 0; - - while ((desc = avcodec_descriptor_next(desc))) - nb_codecs++; - if (!(codecs = av_calloc(nb_codecs, sizeof(*codecs)))) { - av_log(NULL, AV_LOG_ERROR, "Out of memory\n"); - exit_program(1); - } - desc = NULL; - while ((desc = avcodec_descriptor_next(desc))) - codecs[i++] = desc; - av_assert0(i == nb_codecs); - qsort(codecs, nb_codecs, sizeof(*codecs), compare_codec_desc); - *rcodecs = codecs; - return nb_codecs; -} - static void print_codecs_for_id(enum AVCodecID id, int encoder) { const AVCodec *codec = NULL; @@ -1368,8 +1044,7 @@ static void print_codecs_for_id(enum AVCodecID id, int encoder) int show_codecs(void *optctx, const char *opt, const char *arg) { - const AVCodecDescriptor **codecs; - unsigned i, nb_codecs = get_codecs_sorted(&codecs); + const AVCodecDescriptor *desc = NULL; printf("Codecs:\n" " D..... = Decoding supported\n" @@ -1381,14 +1056,9 @@ int show_codecs(void *optctx, const char *opt, const char *arg) " ....L. = Lossy compression\n" " .....S = Lossless compression\n" " -------\n"); - for (i = 0; i < nb_codecs; i++) { - const AVCodecDescriptor *desc = codecs[i]; + while ((desc = avcodec_descriptor_next(desc))) { const AVCodec *codec = NULL; - if (strstr(desc->name, "_deprecated")) - continue; - - printf(" "); printf(avcodec_find_decoder(desc->id) ? "D" : "."); printf(avcodec_find_encoder(desc->id) ? "E" : "."); @@ -1417,37 +1087,30 @@ int show_codecs(void *optctx, const char *opt, const char *arg) printf("\n"); } - av_free(codecs); return 0; } static void print_codecs(int encoder) { - const AVCodecDescriptor **codecs; - unsigned i, nb_codecs = get_codecs_sorted(&codecs); + 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", + " V... = Video\n" + " A... = Audio\n" + " S... = Subtitle\n" + " .F.. = Frame-level multithreading\n" + " ..S. = Slice-level multithreading\n" + " ...X = Codec is experimental\n" + " ---\n", encoder ? "Encoders" : "Decoders"); - for (i = 0; i < nb_codecs; i++) { - const AVCodecDescriptor *desc = codecs[i]; + 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("%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)) @@ -1456,7 +1119,6 @@ static void print_codecs(int encoder) printf("\n"); } } - av_free(codecs); } int show_decoders(void *optctx, const char *opt, const char *arg) @@ -1500,61 +1162,15 @@ int show_protocols(void *optctx, const char *opt, const char *arg) int show_filters(void *optctx, const char *opt, const char *arg) { const AVFilter av_unused(*filter) = NULL; - char descr[64], *descr_cur; - int i, j; - const AVFilterPad *pad; - printf("Filters:\n" - " T.. = Timeline support\n" - " .S. = Slice threading\n" - " ..C = Commmand support\n" - " A = Audio input/output\n" - " V = Video input/output\n" - " N = Dynamic number and/or type of input/output\n" - " | = Source or sink filter\n"); + printf("Filters:\n"); #if CONFIG_AVFILTER - while ((filter = avfilter_next(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 && 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++) = ((!i && (filter->flags & AVFILTER_FLAG_DYNAMIC_INPUTS)) || - ( i && (filter->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS))) ? 'N' : '|'; - } - *descr_cur = 0; - printf(" %c%c%c %-16s %-10s %s\n", - filter->flags & AVFILTER_FLAG_SUPPORT_TIMELINE ? 'T' : '.', - filter->flags & AVFILTER_FLAG_SLICE_THREADS ? 'S' : '.', - filter->process_command ? 'C' : '.', - filter->name, descr, filter->description); - } + while ((filter = avfilter_next(filter))) + printf("%-16s %s\n", filter->name, filter->description); #endif return 0; } -int show_colors(void *optctx, const char *opt, const char *arg) -{ - const char *name; - const uint8_t *rgb; - int i; - - printf("%-32s #RRGGBB\n", "name"); - - for (i = 0; name = av_get_known_color_name(i, &rgb); i++) - printf("%-32s #%02x%02x%02x\n", name, rgb[0], rgb[1], rgb[2]); - - return 0; -} - int show_pix_fmts(void *optctx, const char *opt, const char *arg) { const AVPixFmtDescriptor *pix_desc = NULL; @@ -1588,35 +1204,6 @@ int show_pix_fmts(void *optctx, const char *opt, const char *arg) return 0; } -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; @@ -1650,13 +1237,13 @@ static void show_help_codec(const char *name, int encoder) } 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 " + av_log(NULL, AV_LOG_ERROR, "Codec '%s' is known to Libav, " + "but no %s for it are available. Libav 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", + av_log(NULL, AV_LOG_ERROR, "Codec '%s' is not recognized by Libav.\n", name); } } @@ -1715,7 +1302,6 @@ static void show_help_muxer(const char *name) #if CONFIG_AVFILTER static void show_help_filter(const char *name) { -#if CONFIG_AVFILTER const AVFilter *f = avfilter_get_by_name(name); int i, count; @@ -1727,9 +1313,7 @@ static void show_help_filter(const char *name) return; } - printf("Filter %s\n", f->name); - if (f->description) - printf(" %s\n", f->description); + printf("Filter %s [%s]:\n", f->name, f->description); if (f->flags & AVFILTER_FLAG_SLICE_THREADS) printf(" slice threading supported\n"); @@ -1737,34 +1321,24 @@ static void show_help_filter(const char *name) printf(" Inputs:\n"); count = avfilter_pad_count(f->inputs); for (i = 0; i < count; i++) { - printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i), + printf(" %d %s (%s)\n", i, avfilter_pad_get_name(f->inputs, i), media_type_string(avfilter_pad_get_type(f->inputs, i))); } if (f->flags & AVFILTER_FLAG_DYNAMIC_INPUTS) printf(" dynamic (depending on the options)\n"); - else if (!count) - printf(" none (source filter)\n"); printf(" Outputs:\n"); count = avfilter_pad_count(f->outputs); for (i = 0; i < count; i++) { - printf(" #%d: %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i), + printf(" %d %s (%s)\n", i, avfilter_pad_get_name(f->outputs, i), media_type_string(avfilter_pad_get_type(f->outputs, i))); } if (f->flags & AVFILTER_FLAG_DYNAMIC_OUTPUTS) printf(" dynamic (depending on the options)\n"); - else if (!count) - printf(" none (sink filter)\n"); if (f->priv_class) - show_help_children(f->priv_class, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM | + show_help_children(f->priv_class, AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_AUDIO_PARAM); - if (f->flags & AVFILTER_FLAG_SUPPORT_TIMELINE) - printf("This filter has support for timeline through the 'enable' option.\n"); -#else - av_log(NULL, AV_LOG_ERROR, "Build without libavfilter; " - "can not to satisfy request\n"); -#endif } #endif @@ -1814,7 +1388,7 @@ int read_yesno(void) int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) { int ret; - FILE *f = av_fopen_utf8(filename, "rb"); + FILE *f = fopen(filename, "rb"); if (!f) { av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename, @@ -1824,11 +1398,6 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) fseek(f, 0, SEEK_END); *size = ftell(f); fseek(f, 0, SEEK_SET); - if (*size == (size_t)-1) { - av_log(NULL, AV_LOG_ERROR, "IO error: %s\n", strerror(errno)); - fclose(f); - return AVERROR(errno); - } *bufptr = av_malloc(*size + 1); if (!*bufptr) { av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n"); @@ -1853,47 +1422,58 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size) return ret; } +void init_pts_correction(PtsCorrectionContext *ctx) +{ + ctx->num_faulty_pts = ctx->num_faulty_dts = 0; + ctx->last_pts = ctx->last_dts = INT64_MIN; +} + +int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t reordered_pts, + int64_t dts) +{ + int64_t pts = AV_NOPTS_VALUE; + + if (dts != AV_NOPTS_VALUE) { + ctx->num_faulty_dts += dts <= ctx->last_dts; + ctx->last_dts = dts; + } + if (reordered_pts != AV_NOPTS_VALUE) { + ctx->num_faulty_pts += reordered_pts <= ctx->last_pts; + ctx->last_pts = reordered_pts; + } + if ((ctx->num_faulty_pts<=ctx->num_faulty_dts || dts == AV_NOPTS_VALUE) + && reordered_pts != AV_NOPTS_VALUE) + pts = reordered_pts; + else + pts = dts; + + return pts; +} + FILE *get_preset_file(char *filename, size_t filename_size, const char *preset_name, int is_path, const char *codec_name) { FILE *f = NULL; int i; - const char *base[3] = { getenv("FFMPEG_DATADIR"), + const char *base[3] = { getenv("AVCONV_DATADIR"), getenv("HOME"), - FFMPEG_DATADIR, }; + AVCONV_DATADIR, }; if (is_path) { av_strlcpy(filename, preset_name, filename_size); f = fopen(filename, "r"); } else { -#ifdef _WIN32 - char datadir[MAX_PATH], *ls; - base[2] = NULL; - - if (GetModuleFileNameA(GetModuleHandleA(NULL), datadir, sizeof(datadir) - 1)) - { - for (ls = datadir; ls < datadir + strlen(datadir); ls++) - if (*ls == '\\') *ls = '/'; - - if (ls = strrchr(datadir, '/')) - { - *ls = 0; - strncat(datadir, "/ffpresets", sizeof(datadir) - 1 - strlen(datadir)); - base[2] = datadir; - } - } -#endif for (i = 0; i < 3 && !f; i++) { if (!base[i]) continue; - snprintf(filename, filename_size, "%s%s/%s.ffpreset", base[i], - i != 1 ? "" : "/.ffmpeg", preset_name); + snprintf(filename, filename_size, "%s%s/%s.avpreset", base[i], + i != 1 ? "" : "/.avconv", preset_name); f = fopen(filename, "r"); if (!f && codec_name) { snprintf(filename, filename_size, - "%s%s/%s-%s.ffpreset", - base[i], i != 1 ? "" : "/.ffmpeg", codec_name, + "%s%s/%s-%s.avpreset", + base[i], i != 1 ? "" : "/.avconv", codec_name, preset_name); f = fopen(filename, "r"); } @@ -1905,10 +1485,62 @@ FILE *get_preset_file(char *filename, size_t filename_size, int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec) { - 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; + 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: av_assert0(0); + } + 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 == 'i' && *(spec + 1) == ':') { + int stream_id; + char *endptr; + spec += 2; + stream_id = strtol(spec, &endptr, 0); + return stream_id == st->id; + } else if (!*spec) /* empty specifier, matches everything */ + return 1; + + av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec); + return AVERROR(EINVAL); } AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, @@ -1952,8 +1584,7 @@ AVDictionary *filter_codec_opts(AVDictionary *opts, enum AVCodecID codec_id, } if (av_opt_find(&cc, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ) || - !codec || - (codec->priv_class && + (codec && codec->priv_class && av_opt_find(&codec->priv_class, t->key, NULL, flags, AV_OPT_SEARCH_FAKE_OBJ))) av_dict_set(&ret, t->key, t->value, 0); @@ -1976,7 +1607,7 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, if (!s->nb_streams) return NULL; - opts = av_mallocz_array(s->nb_streams, sizeof(*opts)); + opts = av_mallocz(s->nb_streams * sizeof(*opts)); if (!opts) { av_log(NULL, AV_LOG_ERROR, "Could not alloc memory for stream options.\n"); @@ -2006,3 +1637,15 @@ void *grow_array(void *array, int elem_size, int *size, int new_size) } return array; } + +const char *media_type_string(enum AVMediaType media_type) +{ + switch (media_type) { + case AVMEDIA_TYPE_VIDEO: return "video"; + case AVMEDIA_TYPE_AUDIO: return "audio"; + case AVMEDIA_TYPE_DATA: return "data"; + case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; + case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; + default: return "unknown"; + } +} diff --git a/cmdutils.h b/cmdutils.h index c4a16aac73..d90ad4549d 100644 --- a/cmdutils.h +++ b/cmdutils.h @@ -2,38 +2,33 @@ * Various utilities for command line tools * copyright (c) 2003 Fabrice Bellard * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef FFMPEG_CMDUTILS_H -#define FFMPEG_CMDUTILS_H +#ifndef LIBAV_CMDUTILS_H +#define LIBAV_CMDUTILS_H #include -#include "config.h" #include "libavcodec/avcodec.h" #include "libavfilter/avfilter.h" #include "libavformat/avformat.h" #include "libswscale/swscale.h" -#ifdef _WIN32 -#undef main /* We don't want SDL to override our main() */ -#endif - /** * program name, defined by the program for show_version(). */ @@ -47,9 +42,7 @@ extern const int program_birth_year; extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVFormatContext *avformat_opts; extern struct SwsContext *sws_opts; -extern AVDictionary *swr_opts; extern AVDictionary *format_opts, *codec_opts, *resample_opts; -extern int hide_banner; /** * Register a program-specific cleanup routine. @@ -74,12 +67,12 @@ void uninit_opts(void); /** * Trivial log callback. - * Only suitable for opt_help and similar since it lacks prefix handling. + * Only suitable for show_help and similar since it lacks prefix handling. */ void log_callback_help(void* ptr, int level, const char* fmt, va_list vl); /** - * Override the cpuflags. + * Override the cpuflags mask. */ int opt_cpuflags(void *optctx, const char *opt, const char *arg); @@ -94,18 +87,6 @@ int opt_default(void *optctx, 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(void *optctx, const char *opt, const char *arg); - -int opt_codec_debug(void *optctx, const char *opt, const char *arg); - -#if CONFIG_OPENCL -int opt_opencl(void *optctx, const char *opt, const char *arg); - -int opt_opencl_bench(void *optctx, const char *opt, const char *arg); -#endif - /** * Limit the execution time. */ @@ -139,7 +120,7 @@ double parse_number_or_die(const char *context, const char *numstr, int type, * not zero timestr is interpreted as a duration, otherwise as a * date * - * @see av_parse_time() + * @see parse_date() */ int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration); @@ -170,7 +151,7 @@ typedef struct OptionDef { #define OPT_INT64 0x0400 #define OPT_EXIT 0x0800 #define OPT_DATA 0x1000 -#define OPT_PERFILE 0x2000 /* the option is per-file (currently ffmpeg-only). +#define OPT_PERFILE 0x2000 /* the option is per-file (currently avconv-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. @@ -208,13 +189,13 @@ void show_help_options(const OptionDef *options, const char *msg, int req_flags, void show_help_children(const AVClass *class, int flags); /** - * Per-fftool specific help handler. Implemented in each - * fftool, called by show_help(). + * 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 fftools. + * Generic -h handler common to all avtools. */ int show_help(void *optctx, const char *opt, const char *arg); @@ -257,7 +238,7 @@ typedef struct OptionGroupDef { const char *name; /** * Option to be used as group separator. Can be NULL for groups which - * are terminated by a non-option argument (e.g. ffmpeg output files) + * are terminated by a non-option argument (e.g. avconv output files) */ const char *sep; /** @@ -278,7 +259,6 @@ typedef struct OptionGroup { AVDictionary *format_opts; AVDictionary *resample_opts; struct SwsContext *sws_opts; - AVDictionary *swr_opts; } OptionGroup; /** @@ -405,41 +385,30 @@ void print_error(const char *filename, int err); * current version of the repository and of the libav* libraries used by * the program. */ -void show_banner(int argc, char **argv, const OptionDef *options); +void show_banner(void); /** * Print the version of the program to stdout. The version message * depends on the current versions of the repository and of the libav* * libraries. - * This option processing function does not utilize the arguments. */ int show_version(void *optctx, const char *opt, const char *arg); -/** - * Print the build configuration of the program to stdout. The contents - * depend on the definition of FFMPEG_CONFIGURATION. - * This option processing function does not utilize the arguments. - */ -int show_buildconf(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 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 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 show_codecs(void *optctx, const char *opt, const char *arg); @@ -458,50 +427,33 @@ 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 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 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 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 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(void *optctx, const char *opt, const char *arg); -/** - * Print a listing containing all the color names and values recognized - * by the program. - */ -int show_colors(void *optctx, const char *opt, const char *arg); - /** * Return a positive value if a line read from standard input * starts with [yY], otherwise return 0. @@ -515,19 +467,43 @@ int read_yesno(void); * @param filename file to read from * @param bufptr location where pointer to buffer is returned * @param size location where size of buffer is returned - * @return >= 0 in case of success, a negative value corresponding to an + * @return 0 in case of success, a negative value corresponding to an * AVERROR error code in case of failure. */ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size); +typedef struct PtsCorrectionContext { + int64_t num_faulty_pts; /// Number of incorrect PTS values so far + int64_t num_faulty_dts; /// Number of incorrect DTS values so far + int64_t last_pts; /// PTS of the last frame + int64_t last_dts; /// DTS of the last frame +} PtsCorrectionContext; + +/** + * Reset the state of the PtsCorrectionContext. + */ +void init_pts_correction(PtsCorrectionContext *ctx); + +/** + * Attempt to guess proper monotonic timestamps for decoded video frames + * which might have incorrect times. Input timestamps may wrap around, in + * which case the output will as well. + * + * @param ctx the PtsCorrectionContext carrying stream pts information + * @param pts the pts field of the decoded AVPacket, as passed through + * AVCodecContext.reordered_opaque + * @param dts the dts field of the decoded AVPacket + * @return one of the input values, may be AV_NOPTS_VALUE + */ +int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts); + /** * Get a file corresponding to a preset file. * * If is_path is non-zero, look for the file in the path preset_name. - * Otherwise search for a file named arg.ffpreset in the directories - * $FFMPEG_DATADIR (if set), $HOME/.ffmpeg, and in the datadir defined - * at configuration time or in a "ffpresets" folder along the executable - * on win32, in that order. If no such file is found and + * Otherwise search for a file named arg.avpreset in the directories + * $AVCONV_DATADIR (if set), $HOME/.avconv, and in the datadir defined + * at configuration time, in that order. If no such file is found and * codec_name is defined, then search for a file named * codec_name-preset_name.avpreset in the above-mentioned directories. * @@ -553,7 +529,10 @@ FILE *get_preset_file(char *filename, size_t filename_size, */ void *grow_array(void *array, int elem_size, int *size, int new_size); -#define media_type_string av_get_media_type_string +/** + * Get a string describing a media type. + */ +const char *media_type_string(enum AVMediaType media_type); #define GROW_ARRAY(array, nb_elems)\ array = grow_array(array, sizeof(*array), &nb_elems, nb_elems + 1) @@ -576,4 +555,4 @@ void *grow_array(void *array, int elem_size, int *size, int new_size); char name[128];\ av_get_channel_layout_string(name, sizeof(name), 0, ch_layout); -#endif /* CMDUTILS_H */ +#endif /* LIBAV_CMDUTILS_H */ diff --git a/cmdutils_common_opts.h b/cmdutils_common_opts.h index 190dba674f..8693f59c56 100644 --- a/cmdutils_common_opts.h +++ b/cmdutils_common_opts.h @@ -4,7 +4,6 @@ { "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" }, - { "buildconf" , OPT_EXIT, {.func_arg = show_buildconf}, "show build configuration" }, { "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" }, @@ -13,16 +12,7 @@ { "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" }, - { "colors" , OPT_EXIT, {.func_arg = show_colors }, "show available color names" }, - { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, - { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set logging level", "loglevel" }, - { "report" , 0, {(void*)opt_report}, "generate a report" }, - { "max_alloc" , HAS_ARG, {.func_arg = opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, - { "cpuflags" , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" }, - { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner}, "do not show program banner", "hide_banner" }, -#if CONFIG_OPENCL - { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" }, - { "opencl_options", HAS_ARG, {.func_arg = opt_opencl}, "set OpenCL environment options" }, -#endif + { "loglevel" , HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" }, + { "v", HAS_ARG, {.func_arg = opt_loglevel}, "set libav* logging level", "loglevel" }, + { "cpuflags", HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "set CPU flags mask", "mask" }, diff --git a/cmdutils_opencl.c b/cmdutils_opencl.c deleted file mode 100644 index 0fa8cc0ada..0000000000 --- a/cmdutils_opencl.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright (C) 2013 Lenny Wang - * - * 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 - */ - -#include "libavutil/opt.h" -#include "libavutil/time.h" -#include "libavutil/log.h" -#include "libavutil/opencl.h" -#include "cmdutils.h" - -typedef struct { - int platform_idx; - int device_idx; - char device_name[64]; - int64_t runtime; -} OpenCLDeviceBenchmark; - -const char *ocl_bench_source = AV_OPENCL_KERNEL( -inline unsigned char clip_uint8(int a) -{ - if (a & (~0xFF)) - return (-a)>>31; - else - return a; -} - -kernel void unsharp_bench( - global unsigned char *src, - global unsigned char *dst, - global int *mask, - int width, - int height) -{ - int i, j, local_idx, lc_idx, sum = 0; - int2 thread_idx, block_idx, global_idx, lm_idx; - thread_idx.x = get_local_id(0); - thread_idx.y = get_local_id(1); - block_idx.x = get_group_id(0); - block_idx.y = get_group_id(1); - global_idx.x = get_global_id(0); - global_idx.y = get_global_id(1); - local uchar data[32][32]; - local int lc[128]; - - for (i = 0; i <= 1; i++) { - lm_idx.y = -8 + (block_idx.y + i) * 16 + thread_idx.y; - lm_idx.y = lm_idx.y < 0 ? 0 : lm_idx.y; - lm_idx.y = lm_idx.y >= height ? height - 1: lm_idx.y; - for (j = 0; j <= 1; j++) { - lm_idx.x = -8 + (block_idx.x + j) * 16 + thread_idx.x; - lm_idx.x = lm_idx.x < 0 ? 0 : lm_idx.x; - lm_idx.x = lm_idx.x >= width ? width - 1: lm_idx.x; - data[i*16 + thread_idx.y][j*16 + thread_idx.x] = src[lm_idx.y*width + lm_idx.x]; - } - } - local_idx = thread_idx.y*16 + thread_idx.x; - if (local_idx < 128) - lc[local_idx] = mask[local_idx]; - barrier(CLK_LOCAL_MEM_FENCE); - - \n#pragma unroll\n - for (i = -4; i <= 4; i++) { - lm_idx.y = 8 + i + thread_idx.y; - \n#pragma unroll\n - for (j = -4; j <= 4; j++) { - lm_idx.x = 8 + j + thread_idx.x; - lc_idx = (i + 4)*8 + j + 4; - sum += (int)data[lm_idx.y][lm_idx.x] * lc[lc_idx]; - } - } - int temp = (int)data[thread_idx.y + 8][thread_idx.x + 8]; - int res = temp + (((temp - (int)((sum + 1<<15) >> 16))) >> 16); - if (global_idx.x < width && global_idx.y < height) - dst[global_idx.x + global_idx.y*width] = clip_uint8(res); -} -); - -#define OCLCHECK(method, ... ) \ -do { \ - status = method(__VA_ARGS__); \ - if (status != CL_SUCCESS) { \ - av_log(NULL, AV_LOG_ERROR, # method " error '%s'\n", \ - av_opencl_errstr(status)); \ - ret = AVERROR_EXTERNAL; \ - goto end; \ - } \ -} while (0) - -#define CREATEBUF(out, flags, size) \ -do { \ - out = clCreateBuffer(ext_opencl_env->context, flags, size, NULL, &status); \ - if (status != CL_SUCCESS) { \ - av_log(NULL, AV_LOG_ERROR, "Could not create OpenCL buffer\n"); \ - ret = AVERROR_EXTERNAL; \ - goto end; \ - } \ -} while (0) - -static void fill_rand_int(int *data, int n) -{ - int i; - srand(av_gettime()); - for (i = 0; i < n; i++) - data[i] = rand(); -} - -#define OPENCL_NB_ITER 5 -static int64_t run_opencl_bench(AVOpenCLExternalEnv *ext_opencl_env) -{ - int i, arg = 0, width = 1920, height = 1088; - int64_t start, ret = 0; - cl_int status; - size_t kernel_len; - char *inbuf; - int *mask; - int buf_size = width * height * sizeof(char); - int mask_size = sizeof(uint32_t) * 128; - - cl_mem cl_mask, cl_inbuf, cl_outbuf; - cl_kernel kernel = NULL; - cl_program program = NULL; - size_t local_work_size_2d[2] = {16, 16}; - size_t global_work_size_2d[2] = {(size_t)width, (size_t)height}; - - if (!(inbuf = av_malloc(buf_size)) || !(mask = av_malloc(mask_size))) { - av_log(NULL, AV_LOG_ERROR, "Out of memory\n"); - ret = AVERROR(ENOMEM); - goto end; - } - fill_rand_int((int*)inbuf, buf_size/4); - fill_rand_int(mask, mask_size/4); - - CREATEBUF(cl_mask, CL_MEM_READ_ONLY, mask_size); - CREATEBUF(cl_inbuf, CL_MEM_READ_ONLY, buf_size); - CREATEBUF(cl_outbuf, CL_MEM_READ_WRITE, buf_size); - - kernel_len = strlen(ocl_bench_source); - program = clCreateProgramWithSource(ext_opencl_env->context, 1, &ocl_bench_source, - &kernel_len, &status); - if (status != CL_SUCCESS || !program) { - av_log(NULL, AV_LOG_ERROR, "OpenCL unable to create benchmark program\n"); - ret = AVERROR_EXTERNAL; - goto end; - } - status = clBuildProgram(program, 1, &(ext_opencl_env->device_id), NULL, NULL, NULL); - if (status != CL_SUCCESS) { - av_log(NULL, AV_LOG_ERROR, "OpenCL unable to build benchmark program\n"); - ret = AVERROR_EXTERNAL; - goto end; - } - kernel = clCreateKernel(program, "unsharp_bench", &status); - if (status != CL_SUCCESS) { - av_log(NULL, AV_LOG_ERROR, "OpenCL unable to create benchmark kernel\n"); - ret = AVERROR_EXTERNAL; - goto end; - } - - OCLCHECK(clEnqueueWriteBuffer, ext_opencl_env->command_queue, cl_inbuf, CL_TRUE, 0, - buf_size, inbuf, 0, NULL, NULL); - OCLCHECK(clEnqueueWriteBuffer, ext_opencl_env->command_queue, cl_mask, CL_TRUE, 0, - mask_size, mask, 0, NULL, NULL); - OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_inbuf); - OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_outbuf); - OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_mem), &cl_mask); - OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_int), &width); - OCLCHECK(clSetKernelArg, kernel, arg++, sizeof(cl_int), &height); - - start = av_gettime_relative(); - for (i = 0; i < OPENCL_NB_ITER; i++) - OCLCHECK(clEnqueueNDRangeKernel, ext_opencl_env->command_queue, kernel, 2, NULL, - global_work_size_2d, local_work_size_2d, 0, NULL, NULL); - clFinish(ext_opencl_env->command_queue); - ret = (av_gettime_relative() - start)/OPENCL_NB_ITER; -end: - if (kernel) - clReleaseKernel(kernel); - if (program) - clReleaseProgram(program); - if (cl_inbuf) - clReleaseMemObject(cl_inbuf); - if (cl_outbuf) - clReleaseMemObject(cl_outbuf); - if (cl_mask) - clReleaseMemObject(cl_mask); - av_free(inbuf); - av_free(mask); - return ret; -} - -static int compare_ocl_device_desc(const void *a, const void *b) -{ - return ((OpenCLDeviceBenchmark*)a)->runtime - ((OpenCLDeviceBenchmark*)b)->runtime; -} - -int opt_opencl_bench(void *optctx, const char *opt, const char *arg) -{ - int i, j, nb_devices = 0, count = 0; - int64_t score = 0; - AVOpenCLDeviceList *device_list; - AVOpenCLDeviceNode *device_node = NULL; - OpenCLDeviceBenchmark *devices = NULL; - cl_platform_id platform; - - av_opencl_get_device_list(&device_list); - for (i = 0; i < device_list->platform_num; i++) - nb_devices += device_list->platform_node[i]->device_num; - if (!nb_devices) { - av_log(NULL, AV_LOG_ERROR, "No OpenCL device detected!\n"); - return AVERROR(EINVAL); - } - if (!(devices = av_malloc(sizeof(OpenCLDeviceBenchmark) * nb_devices))) { - av_log(NULL, AV_LOG_ERROR, "Could not allocate buffer\n"); - return AVERROR(ENOMEM); - } - - for (i = 0; i < device_list->platform_num; i++) { - for (j = 0; j < device_list->platform_node[i]->device_num; j++) { - device_node = device_list->platform_node[i]->device_node[j]; - platform = device_list->platform_node[i]->platform_id; - score = av_opencl_benchmark(device_node, platform, run_opencl_bench); - if (score > 0) { - devices[count].platform_idx = i; - devices[count].device_idx = j; - devices[count].runtime = score; - strcpy(devices[count].device_name, device_node->device_name); - count++; - } - } - } - qsort(devices, count, sizeof(OpenCLDeviceBenchmark), compare_ocl_device_desc); - fprintf(stderr, "platform_idx\tdevice_idx\tdevice_name\truntime\n"); - for (i = 0; i < count; i++) - fprintf(stdout, "%d\t%d\t%s\t%"PRId64"\n", - devices[i].platform_idx, devices[i].device_idx, - devices[i].device_name, devices[i].runtime); - - av_opencl_free_device_list(&device_list); - av_free(devices); - return 0; -} - -int opt_opencl(void *optctx, const char *opt, const char *arg) -{ - char *key, *value; - const char *opts = arg; - int ret = 0; - while (*opts) { - ret = av_opt_get_key_value(&opts, "=", ":", 0, &key, &value); - if (ret < 0) - return ret; - ret = av_opencl_set_option(key, value); - if (ret < 0) - return ret; - if (*opts) - opts++; - } - return ret; -} diff --git a/common.mak b/common.mak index a493792657..9244fd366d 100644 --- a/common.mak +++ b/common.mak @@ -5,94 +5,9 @@ # first so "all" becomes default target all: all-yes -ifndef SUBDIR - -ifndef V -Q = @ -ECHO = printf "$(1)\t%s\n" $(2) -BRIEF = CC CXX HOSTCC HOSTLD AS YASM AR LD STRIP CP WINDRES -SILENT = DEPCC DEPHOSTCC DEPAS DEPYASM RANLIB RM - -MSG = $@ -M = @$(call ECHO,$(TAG),$@); -$(foreach VAR,$(BRIEF), \ - $(eval override $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR)))) -$(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR)))) -$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) -endif - -ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample - -# NASM requires -I path terminated with / -IFLAGS := -I. -I$(SRC_PATH)/ -CPPFLAGS := $(IFLAGS) $(CPPFLAGS) -CFLAGS += $(ECFLAGS) -CCFLAGS = $(CPPFLAGS) $(CFLAGS) -ASFLAGS := $(CPPFLAGS) $(ASFLAGS) -CXXFLAGS += $(CPPFLAGS) $(CFLAGS) -YASMFLAGS += $(IFLAGS:%=%/) -Pconfig.asm - -HOSTCCFLAGS = $(IFLAGS) $(HOSTCPPFLAGS) $(HOSTCFLAGS) -LDFLAGS := $(ALLFFLIBS:%=$(LD_PATH)lib%) $(LDFLAGS) - -define COMPILE - $(call $(1)DEP,$(1)) - $($(1)) $($(1)FLAGS) $($(1)_DEPFLAGS) $($(1)_C) $($(1)_O) $< -endef - -COMPILE_C = $(call COMPILE,CC) -COMPILE_CXX = $(call COMPILE,CXX) -COMPILE_S = $(call COMPILE,AS) -COMPILE_HOSTC = $(call COMPILE,HOSTCC) - -%.o: %.c - $(COMPILE_C) - -%.o: %.cpp - $(COMPILE_CXX) - -%.o: %.m - $(COMPILE_C) - -%.s: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) -S -o $@ $< - -%.o: %.S - $(COMPILE_S) - -%_host.o: %.c - $(COMPILE_HOSTC) - -%.o: %.rc - $(WINDRES) $(IFLAGS) --preprocessor "$(DEPWINDRES) -E -xc-header -DRC_INVOKED $(CC_DEPFLAGS)" -o $@ $< - -%.i: %.c - $(CC) $(CCFLAGS) $(CC_E) $< - -%.h.c: - $(Q)echo '#include "$*.h"' >$@ - -%.ver: %.v - $(Q)sed 's/$$MAJOR/$($(basename $(@F))_VERSION_MAJOR)/' $^ > $@ - -%.c %.h: TAG = GEN - -# Dummy rule to stop make trying to rebuild removed or renamed headers -%.h: - @: - -# Disable suffix rules. Most of the builtin rules are suffix rules, -# so this saves some time on slow systems. -.SUFFIXES: - -# Do not delete intermediate files from chains of implicit rules -$(OBJS): -endif - include $(SRC_PATH)/arch.mak OBJS += $(OBJS-yes) -SLIBOBJS += $(SLIBOBJS-yes) FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) @@ -100,7 +15,6 @@ LDLIBS = $(FFLIBS:%=%$(BUILDSUF)) FFEXTRALIBS := $(LDLIBS:%=$(LD_LIB)) $(EXTRALIBS) OBJS := $(sort $(OBJS:%=$(SUBDIR)%)) -SLIBOBJS := $(sort $(SLIBOBJS:%=$(SUBDIR)%)) TESTOBJS := $(TESTOBJS:%=$(SUBDIR)%) $(TESTPROGS:%=$(SUBDIR)%-test.o) TESTPROGS := $(TESTPROGS:%=$(SUBDIR)%-test$(EXESUF)) HOSTOBJS := $(HOSTPROGS:%=$(SUBDIR)%.o) @@ -132,13 +46,12 @@ $(HOSTPROGS): %$(HOSTEXESUF): %.o $(OBJS): | $(sort $(dir $(OBJS))) $(HOBJS): | $(sort $(dir $(HOBJS))) $(HOSTOBJS): | $(sort $(dir $(HOSTOBJS))) -$(SLIBOBJS): | $(sort $(dir $(SLIBOBJS))) $(TESTOBJS): | $(sort $(dir $(TESTOBJS))) $(TOOLOBJS): | tools -OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(SLIBOBJS) $(TESTOBJS)) +OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOBJS) $(HOSTOBJS) $(TESTOBJS)) -CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.ho *.gcno *.gcda +CLEANSUFFIXES = *.d *.o *~ *.h.c *.map *.ver *.gcno *.gcda DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a @@ -151,4 +64,4 @@ endef $(eval $(RULES)) --include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d) $(SLIBOBJS:.o=.d)) +-include $(wildcard $(OBJS:.o=.d) $(HOSTOBJS:.o=.d) $(TESTOBJS:.o=.d) $(HOBJS:.o=.d)) diff --git a/compat/aix/math.h b/compat/aix/math.h index 65a89c4565..380f87804d 100644 --- a/compat/aix/math.h +++ b/compat/aix/math.h @@ -2,25 +2,25 @@ * Work around the class() function in AIX math.h clashing with * identifiers named "class". * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef FFMPEG_COMPAT_AIX_MATH_H -#define FFMPEG_COMPAT_AIX_MATH_H +#ifndef LIBAV_COMPAT_AIX_MATH_H +#define LIBAV_COMPAT_AIX_MATH_H #define class class_in_math_h_causes_problems @@ -28,4 +28,4 @@ #undef class -#endif /* FFMPEG_COMPAT_AIX_MATH_H */ +#endif /* LIBAV_COMPAT_AIX_MATH_H */ diff --git a/compat/avisynth/avisynth_c.h b/compat/avisynth/avisynth_c.h deleted file mode 100644 index 448493b839..0000000000 --- a/compat/avisynth/avisynth_c.h +++ /dev/null @@ -1,880 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// 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, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -// NOTE: this is a partial update of the Avisynth C interface to recognize -// new color spaces added in Avisynth 2.60. By no means is this document -// completely Avisynth 2.60 compliant. - -#ifndef __AVISYNTH_C__ -#define __AVISYNTH_C__ - -#ifdef __cplusplus -# define EXTERN_C extern "C" -#else -# define EXTERN_C -#endif - -#define AVSC_USE_STDCALL 1 - -#ifndef AVSC_USE_STDCALL -# define AVSC_CC __cdecl -#else -# define AVSC_CC __stdcall -#endif - -#define AVSC_INLINE static __inline - -#ifdef AVISYNTH_C_EXPORTS -# define AVSC_EXPORT EXTERN_C -# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name -#else -# define AVSC_EXPORT EXTERN_C __declspec(dllexport) -# ifndef AVSC_NO_DECLSPEC -# define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name -# else -# define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func) -# endif -#endif - -typedef unsigned char BYTE; -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - - -///////////////////////////////////////////////////////////////////// -// -// Constants -// - -#ifndef __AVISYNTH_H__ -enum { AVISYNTH_INTERFACE_VERSION = 4 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1, - AVS_SAMPLE_INT24 = 1<<2, - AVS_SAMPLE_INT32 = 1<<3, - AVS_SAMPLE_FLOAT = 1<<4}; - -enum {AVS_PLANAR_Y=1<<0, - AVS_PLANAR_U=1<<1, - AVS_PLANAR_V=1<<2, - AVS_PLANAR_ALIGNED=1<<3, - AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED, - AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED, - AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED, - AVS_PLANAR_A=1<<4, - AVS_PLANAR_R=1<<5, - AVS_PLANAR_G=1<<6, - AVS_PLANAR_B=1<<7, - AVS_PLANAR_A_ALIGNED=AVS_PLANAR_A|AVS_PLANAR_ALIGNED, - AVS_PLANAR_R_ALIGNED=AVS_PLANAR_R|AVS_PLANAR_ALIGNED, - AVS_PLANAR_G_ALIGNED=AVS_PLANAR_G|AVS_PLANAR_ALIGNED, - AVS_PLANAR_B_ALIGNED=AVS_PLANAR_B|AVS_PLANAR_ALIGNED}; - - // Colorspace properties. -enum {AVS_CS_BGR = 1<<28, - AVS_CS_YUV = 1<<29, - AVS_CS_INTERLEAVED = 1<<30, - AVS_CS_PLANAR = 1<<31, - - AVS_CS_SHIFT_SUB_WIDTH = 0, - AVS_CS_SHIFT_SUB_HEIGHT = 1 << 3, - AVS_CS_SHIFT_SAMPLE_BITS = 1 << 4, - - AVS_CS_SUB_WIDTH_MASK = 7 << AVS_CS_SHIFT_SUB_WIDTH, - AVS_CS_SUB_WIDTH_1 = 3 << AVS_CS_SHIFT_SUB_WIDTH, // YV24 - AVS_CS_SUB_WIDTH_2 = 0 << AVS_CS_SHIFT_SUB_WIDTH, // YV12, I420, YV16 - AVS_CS_SUB_WIDTH_4 = 1 << AVS_CS_SHIFT_SUB_WIDTH, // YUV9, YV411 - - AVS_CS_VPLANEFIRST = 1 << 3, // YV12, YV16, YV24, YV411, YUV9 - AVS_CS_UPLANEFIRST = 1 << 4, // I420 - - AVS_CS_SUB_HEIGHT_MASK = 7 << AVS_CS_SHIFT_SUB_HEIGHT, - AVS_CS_SUB_HEIGHT_1 = 3 << AVS_CS_SHIFT_SUB_HEIGHT, // YV16, YV24, YV411 - AVS_CS_SUB_HEIGHT_2 = 0 << AVS_CS_SHIFT_SUB_HEIGHT, // YV12, I420 - AVS_CS_SUB_HEIGHT_4 = 1 << AVS_CS_SHIFT_SUB_HEIGHT, // YUV9 - - AVS_CS_SAMPLE_BITS_MASK = 7 << AVS_CS_SHIFT_SAMPLE_BITS, - AVS_CS_SAMPLE_BITS_8 = 0 << AVS_CS_SHIFT_SAMPLE_BITS, - AVS_CS_SAMPLE_BITS_16 = 1 << AVS_CS_SHIFT_SAMPLE_BITS, - AVS_CS_SAMPLE_BITS_32 = 2 << AVS_CS_SHIFT_SAMPLE_BITS, - - AVS_CS_PLANAR_MASK = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_BGR | AVS_CS_SAMPLE_BITS_MASK | AVS_CS_SUB_HEIGHT_MASK | AVS_CS_SUB_WIDTH_MASK, - AVS_CS_PLANAR_FILTER = ~( AVS_CS_VPLANEFIRST | AVS_CS_UPLANEFIRST )}; - - // Specific colorformats -enum { - AVS_CS_UNKNOWN = 0, - AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, - // AVS_CS_YV12 = 1<<3 Reserved - // AVS_CS_I420 = 1<<4 Reserved - AVS_CS_RAW32 = 1<<5 | AVS_CS_INTERLEAVED, - - AVS_CS_YV24 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_1, // YVU 4:4:4 planar - AVS_CS_YV16 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:2 planar - AVS_CS_YV12 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YVU 4:2:0 planar - AVS_CS_I420 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_UPLANEFIRST | AVS_CS_SUB_HEIGHT_2 | AVS_CS_SUB_WIDTH_2, // YUV 4:2:0 planar - AVS_CS_IYUV = AVS_CS_I420, - AVS_CS_YV411 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_1 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:1 planar - AVS_CS_YUV9 = AVS_CS_PLANAR | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 | AVS_CS_VPLANEFIRST | AVS_CS_SUB_HEIGHT_4 | AVS_CS_SUB_WIDTH_4, // YVU 4:1:0 planar - AVS_CS_Y8 = AVS_CS_PLANAR | AVS_CS_INTERLEAVED | AVS_CS_YUV | AVS_CS_SAMPLE_BITS_8 // Y 4:0:0 planar -}; - -enum { - AVS_IT_BFF = 1<<0, - AVS_IT_TFF = 1<<1, - AVS_IT_FIELDBASED = 1<<2}; - -enum { - AVS_FILTER_TYPE=1, - AVS_FILTER_INPUT_COLORSPACE=2, - AVS_FILTER_OUTPUT_TYPE=9, - AVS_FILTER_NAME=4, - AVS_FILTER_AUTHOR=5, - AVS_FILTER_VERSION=6, - AVS_FILTER_ARGS=7, - AVS_FILTER_ARGS_INFO=8, - AVS_FILTER_ARGS_DESCRIPTION=10, - AVS_FILTER_DESCRIPTION=11}; - -enum { //SUBTYPES - AVS_FILTER_TYPE_AUDIO=1, - AVS_FILTER_TYPE_VIDEO=2, - AVS_FILTER_OUTPUT_TYPE_SAME=3, - AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4}; - -enum { - AVS_CACHE_NOTHING=0, - AVS_CACHE_RANGE=1, - AVS_CACHE_ALL=2, - AVS_CACHE_AUDIO=3, - AVS_CACHE_AUDIO_NONE=4, - AVS_CACHE_AUDIO_AUTO=5 - }; - -#define AVS_FRAME_ALIGN 16 - -typedef struct AVS_Clip AVS_Clip; -typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment; - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoInfo -// - -// AVS_VideoInfo is layed out identicly to VideoInfo -typedef struct AVS_VideoInfo { - int width, height; // width=0 means no video - unsigned fps_numerator, fps_denominator; - int num_frames; - - int pixel_type; - - int audio_samples_per_second; // 0 means no audio - int sample_type; - INT64 num_audio_samples; - int nchannels; - - // Imagetype properties - - int image_type; -} AVS_VideoInfo; - -// useful functions of the above -AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p) - { return (p->width!=0); } - -AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p) - { return (p->audio_samples_per_second!=0); } - -AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_BGR); } - -AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p) - { return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties - -AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; } - -AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_YUV ); } - -AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; } - -AVSC_INLINE int avs_is_yv24(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV24 & AVS_CS_PLANAR_FILTER); } - -AVSC_INLINE int avs_is_yv16(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV16 & AVS_CS_PLANAR_FILTER); } - -AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV12 & AVS_CS_PLANAR_FILTER); } - -AVSC_INLINE int avs_is_yv411(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_YV411 & AVS_CS_PLANAR_FILTER); } - -AVSC_INLINE int avs_is_y8(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_PLANAR_MASK) == (AVS_CS_Y8 & AVS_CS_PLANAR_FILTER); } - -AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property) - { return ((p->pixel_type & property)==property ); } - -AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p) - { return !!(p->pixel_type & AVS_CS_PLANAR); } - -AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space) - { return avs_is_planar(p) ? ((p->pixel_type & AVS_CS_PLANAR_MASK) == (c_space & AVS_CS_PLANAR_FILTER)) : ((p->pixel_type & c_space) == c_space); } - -AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_FIELDBASED); } - -AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p) - { return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); } - -AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_BFF); } - -AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_TFF); } - -AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo * p) -{ - switch (p->pixel_type) { - case AVS_CS_BGR24: return 24; - case AVS_CS_BGR32: return 32; - case AVS_CS_YUY2: return 16; - case AVS_CS_YV12: - case AVS_CS_I420: return 12; - default: return 0; - } -} -AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels) - { return pixels * (avs_bits_per_pixel(p)>>3); } // Will work on planar images, but will return only luma planes - -AVSC_INLINE int avs_row_size(const AVS_VideoInfo * p) - { return avs_bytes_from_pixels(p,p->width); } // Also only returns first plane on planar images - -AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo * vi) - { if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p; } return vi->height * ((avs_row_size(vi)+3) & ~3); } - -AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p) - { return p->audio_samples_per_second; } - - -AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) -{ - switch (p->sample_type) { - case AVS_SAMPLE_INT8: return sizeof(signed char); - case AVS_SAMPLE_INT16: return sizeof(signed short); - case AVS_SAMPLE_INT24: return 3; - case AVS_SAMPLE_INT32: return sizeof(signed int); - case AVS_SAMPLE_FLOAT: return sizeof(float); - default: return 0; - } -} -AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) - { return p->nchannels*avs_bytes_per_channel_sample(p);} - -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) - { return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } - -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } - -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) - { return bytes / avs_bytes_per_audio_sample(p); } - -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return samples * avs_bytes_per_audio_sample(p); } - -AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) - { return p->nchannels; } - -AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p) - { return p->sample_type;} - -// useful mutator -AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property) - { p->image_type|=property; } - -AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property) - { p->image_type&=~property; } - -AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased) - { if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; } - -AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator) -{ - unsigned x=numerator, y=denominator; - while (y) { // find gcd - unsigned t = x%y; x = y; y = t; - } - p->fps_numerator = numerator/x; - p->fps_denominator = denominator/x; -} - -AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y) -{ - return (x->pixel_type == y->pixel_type) - || (avs_is_yv12(x) && avs_is_yv12(y)); -} - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoFrame -// - -// VideoFrameBuffer holds information about a memory block which is used -// for video data. For efficiency, instances of this class are not deleted -// when the refcount reaches zero; instead they're stored in a linked list -// to be reused. The instances are deleted when the corresponding AVS -// file is closed. - -// AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrameBuffer { - BYTE * data; - int data_size; - // sequence_number is incremented every time the buffer is changed, so - // that stale views can tell they're no longer valid. - volatile long sequence_number; - - volatile long refcount; -} AVS_VideoFrameBuffer; - -// VideoFrame holds a "window" into a VideoFrameBuffer. - -// AVS_VideoFrame is layed out identicly to IVideoFrame -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrame { - volatile long refcount; - AVS_VideoFrameBuffer * vfb; - int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture. - int row_sizeUV, heightUV; -} AVS_VideoFrame; - -// Access functions for AVS_VideoFrame -AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) { - return p->pitch;} - -AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame * p, int plane) { - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;} - return p->pitch;} - -AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) { - return p->row_size; } - -AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame * p, int plane) { - int r; - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) return p->row_sizeUV; - else return 0; - case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED: - if (p->pitchUV) { - r = (p->row_sizeUV+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize - if (r < p->pitchUV) - return r; - return p->row_sizeUV; - } else return 0; - case AVS_PLANAR_Y_ALIGNED: - r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize - if (r <= p->pitch) - return r; - return p->row_size; - } - return p->row_size; -} - -AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) { - return p->height;} - -AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame * p, int plane) { - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) return p->heightUV; - return 0; - } - return p->height;} - -AVSC_INLINE const BYTE* avs_get_read_ptr(const AVS_VideoFrame * p) { - return p->vfb->data + p->offset;} - -AVSC_INLINE const BYTE* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane) -{ - switch (plane) { - case AVS_PLANAR_U: return p->vfb->data + p->offsetU; - case AVS_PLANAR_V: return p->vfb->data + p->offsetV; - default: return p->vfb->data + p->offset;} -} - -AVSC_INLINE int avs_is_writable(const AVS_VideoFrame * p) { - return (p->refcount == 1 && p->vfb->refcount == 1);} - -AVSC_INLINE BYTE* avs_get_write_ptr(const AVS_VideoFrame * p) -{ - if (avs_is_writable(p)) { - ++p->vfb->sequence_number; - return p->vfb->data + p->offset; - } else - return 0; -} - -AVSC_INLINE BYTE* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane) -{ - if (plane==AVS_PLANAR_Y && avs_is_writable(p)) { - ++p->vfb->sequence_number; - return p->vfb->data + p->offset; - } else if (plane==AVS_PLANAR_Y) { - return 0; - } else { - switch (plane) { - case AVS_PLANAR_U: return p->vfb->data + p->offsetU; - case AVS_PLANAR_V: return p->vfb->data + p->offsetV; - default: return p->vfb->data + p->offset; - } - } -} - - -AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *); -// makes a shallow copy of a video frame -AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *); - -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f) - {avs_release_video_frame(f);} -AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f) - {return avs_copy_video_frame(f);} -#endif - -///////////////////////////////////////////////////////////////////// -// -// AVS_Value -// - -// Treat AVS_Value as a fat pointer. That is use avs_copy_value -// and avs_release_value appropiaty as you would if AVS_Value was -// a pointer. - -// To maintain source code compatibility with future versions of the -// avisynth_c API don't use the AVS_Value directly. Use the helper -// functions below. - -// AVS_Value is layed out identicly to AVSValue -typedef struct AVS_Value AVS_Value; -struct AVS_Value { - short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong - // for some function e'rror - short array_size; - union { - void * clip; // do not use directly, use avs_take_clip - char boolean; - int integer; - float floating_pt; - const char * string; - const AVS_Value * array; - } d; -}; - -// AVS_Value should be initilized with avs_void. -// Should also set to avs_void after the value is released -// with avs_copy_value. Consider it the equalvent of setting -// a pointer to NULL -static const AVS_Value avs_void = {'v'}; - -AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src); -AVSC_API(void, avs_release_value)(AVS_Value); - -AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; } -AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; } -AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; } -AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; } -AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; } -AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; } -AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; } -AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; } - -AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *); -AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *); - -AVSC_INLINE int avs_as_bool(AVS_Value v) - { return v.d.boolean; } -AVSC_INLINE int avs_as_int(AVS_Value v) - { return v.d.integer; } -AVSC_INLINE const char * avs_as_string(AVS_Value v) - { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; } -AVSC_INLINE double avs_as_float(AVS_Value v) - { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; } -AVSC_INLINE const char * avs_as_error(AVS_Value v) - { return avs_is_error(v) ? v.d.string : 0; } -AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v) - { return v.d.array; } -AVSC_INLINE int avs_array_size(AVS_Value v) - { return avs_is_array(v) ? v.array_size : 1; } -AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index) - { return avs_is_array(v) ? v.d.array[index] : v; } - -// only use these functions on an AVS_Value that does not already have -// an active value. Remember, treat AVS_Value as a fat pointer. -AVSC_INLINE AVS_Value avs_new_value_bool(int v0) - { AVS_Value v; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; } -AVSC_INLINE AVS_Value avs_new_value_int(int v0) - { AVS_Value v; v.type = 'i'; v.d.integer = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_string(const char * v0) - { AVS_Value v; v.type = 's'; v.d.string = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_float(float v0) - { AVS_Value v; v.type = 'f'; v.d.floating_pt = v0; return v;} -AVSC_INLINE AVS_Value avs_new_value_error(const char * v0) - { AVS_Value v; v.type = 'e'; v.d.string = v0; return v; } -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0) - { AVS_Value v; avs_set_to_clip(&v, v0); return v; } -#endif -AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size) - { AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; } - -///////////////////////////////////////////////////////////////////// -// -// AVS_Clip -// - -AVSC_API(void, avs_release_clip)(AVS_Clip *); -AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *); - -AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error - -AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *); - -AVSC_API(int, avs_get_version)(AVS_Clip *); - -AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n); -// The returned video frame must be released with avs_release_video_frame - -AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); -// return field parity if field_based, else parity of first field in frame - -AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); -// start and count are in samples - -AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, - int cachehints, int frame_range); - -// This is the callback type used by avs_add_function -typedef AVS_Value (AVSC_CC * AVS_ApplyFunc) - (AVS_ScriptEnvironment *, AVS_Value args, void * user_data); - -typedef struct AVS_FilterInfo AVS_FilterInfo; -struct AVS_FilterInfo -{ - // these members should not be modified outside of the AVS_ApplyFunc callback - AVS_Clip * child; - AVS_VideoInfo vi; - AVS_ScriptEnvironment * env; - AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); - int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, - int frame_range); - void (AVSC_CC * free_filter)(AVS_FilterInfo *); - - // Should be set when ever there is an error to report. - // It is cleared before any of the above methods are called - const char * error; - // this is to store whatever and may be modified at will - void * user_data; -}; - -// Create a new filter -// fi is set to point to the AVS_FilterInfo so that you can -// modify it once it is initilized. -// store_child should generally be set to true. If it is not -// set than ALL methods (the function pointers) must be defined -// If it is set than you do not need to worry about freeing the child -// clip. -AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e, - AVS_FilterInfo * * fi, - AVS_Value child, int store_child); - -///////////////////////////////////////////////////////////////////// -// -// AVS_ScriptEnvironment -// - -// For GetCPUFlags. These are backwards-compatible with those in VirtualDub. -enum { - /* slowest CPU to support extension */ - AVS_CPU_FORCE = 0x01, // N/A - AVS_CPU_FPU = 0x02, // 386/486DX - AVS_CPU_MMX = 0x04, // P55C, K6, PII - AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon - AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP - AVS_CPU_SSE2 = 0x20, // PIV, Hammer - AVS_CPU_3DNOW = 0x40, // K6-2 - AVS_CPU_3DNOW_EXT = 0x80, // Athlon - AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2, - // which only Hammer will have anyway) - AVS_CPUF_SSE3 = 0x100, // PIV+, K8 Venice - AVS_CPUF_SSSE3 = 0x200, // Core 2 - AVS_CPUF_SSE4 = 0x400, // Penryn, Wolfdale, Yorkfield - AVS_CPUF_SSE4_1 = 0x400, - AVS_CPUF_SSE4_2 = 0x800, // Nehalem -}; - -AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error - -AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *); -AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version); - -AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length); -AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...); - -AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, void* val); - // note: val is really a va_list; I hope everyone typedefs va_list to a pointer - -AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *, - const char * name, const char * params, - AVS_ApplyFunc apply, void * user_data); - -AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name); - -AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name, - AVS_Value args, const char** arg_names); -// The returned value must be be released with avs_release_value - -AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name); -// The returned value must be be released with avs_release_value - -AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val); - -AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val); - -//void avs_push_context(AVS_ScriptEnvironment *, int level=0); -//void avs_pop_context(AVS_ScriptEnvironment *); - -AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *, - const AVS_VideoInfo * vi, int align); -// align should be at least 16 - -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE -AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env, - const AVS_VideoInfo * vi) - {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} - -AVSC_INLINE -AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env, - const AVS_VideoInfo * vi) - {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} -#endif - - -AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf); - -AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height); - -typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env); -AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data); - -AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height); -// The returned video frame must be be released - -AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem); - -AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir); - -// avisynth.dll exports this; it's a way to use it as a library, without -// writing an AVS script or without going through AVIFile. -AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version); - -// this symbol is the entry point for the plugin and must -// be defined -AVSC_EXPORT -const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env); - - -AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); - - -AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); -// The returned video frame must be be released - -#ifdef AVSC_NO_DECLSPEC -// use LoadLibrary and related functions to dynamically load Avisynth instead of declspec(dllimport) -/* - The following functions needs to have been declared, probably from windows.h - - void* malloc(size_t) - void free(void*); - - HMODULE LoadLibrary(const char*); - void* GetProcAddress(HMODULE, const char*); - FreeLibrary(HMODULE); -*/ - - -typedef struct AVS_Library AVS_Library; - -#define AVSC_DECLARE_FUNC(name) name##_func name - -struct AVS_Library { - HMODULE handle; - - AVSC_DECLARE_FUNC(avs_add_function); - AVSC_DECLARE_FUNC(avs_at_exit); - AVSC_DECLARE_FUNC(avs_bit_blt); - AVSC_DECLARE_FUNC(avs_check_version); - AVSC_DECLARE_FUNC(avs_clip_get_error); - AVSC_DECLARE_FUNC(avs_copy_clip); - AVSC_DECLARE_FUNC(avs_copy_value); - AVSC_DECLARE_FUNC(avs_copy_video_frame); - AVSC_DECLARE_FUNC(avs_create_script_environment); - AVSC_DECLARE_FUNC(avs_delete_script_environment); - AVSC_DECLARE_FUNC(avs_function_exists); - AVSC_DECLARE_FUNC(avs_get_audio); - AVSC_DECLARE_FUNC(avs_get_cpu_flags); - AVSC_DECLARE_FUNC(avs_get_error); - AVSC_DECLARE_FUNC(avs_get_frame); - AVSC_DECLARE_FUNC(avs_get_parity); - AVSC_DECLARE_FUNC(avs_get_var); - AVSC_DECLARE_FUNC(avs_get_version); - AVSC_DECLARE_FUNC(avs_get_video_info); - AVSC_DECLARE_FUNC(avs_invoke); - AVSC_DECLARE_FUNC(avs_make_writable); - AVSC_DECLARE_FUNC(avs_new_c_filter); - AVSC_DECLARE_FUNC(avs_new_video_frame_a); - AVSC_DECLARE_FUNC(avs_release_clip); - AVSC_DECLARE_FUNC(avs_release_value); - AVSC_DECLARE_FUNC(avs_release_video_frame); - AVSC_DECLARE_FUNC(avs_save_string); - AVSC_DECLARE_FUNC(avs_set_cache_hints); - AVSC_DECLARE_FUNC(avs_set_global_var); - AVSC_DECLARE_FUNC(avs_set_memory_max); - AVSC_DECLARE_FUNC(avs_set_to_clip); - AVSC_DECLARE_FUNC(avs_set_var); - AVSC_DECLARE_FUNC(avs_set_working_dir); - AVSC_DECLARE_FUNC(avs_sprintf); - AVSC_DECLARE_FUNC(avs_subframe); - AVSC_DECLARE_FUNC(avs_subframe_planar); - AVSC_DECLARE_FUNC(avs_take_clip); - AVSC_DECLARE_FUNC(avs_vsprintf); -}; - -#undef AVSC_DECLARE_FUNC - - -AVSC_INLINE AVS_Library * avs_load_library() { - AVS_Library *library = (AVS_Library *)malloc(sizeof(AVS_Library)); - if (library == NULL) - return NULL; - library->handle = LoadLibrary("avisynth"); - if (library->handle == NULL) - goto fail; - -#define __AVSC_STRINGIFY(x) #x -#define AVSC_STRINGIFY(x) __AVSC_STRINGIFY(x) -#define AVSC_LOAD_FUNC(name) {\ - library->name = (name##_func) GetProcAddress(library->handle, AVSC_STRINGIFY(name));\ - if (library->name == NULL)\ - goto fail;\ -} - - AVSC_LOAD_FUNC(avs_add_function); - AVSC_LOAD_FUNC(avs_at_exit); - AVSC_LOAD_FUNC(avs_bit_blt); - AVSC_LOAD_FUNC(avs_check_version); - AVSC_LOAD_FUNC(avs_clip_get_error); - AVSC_LOAD_FUNC(avs_copy_clip); - AVSC_LOAD_FUNC(avs_copy_value); - AVSC_LOAD_FUNC(avs_copy_video_frame); - AVSC_LOAD_FUNC(avs_create_script_environment); - AVSC_LOAD_FUNC(avs_delete_script_environment); - AVSC_LOAD_FUNC(avs_function_exists); - AVSC_LOAD_FUNC(avs_get_audio); - AVSC_LOAD_FUNC(avs_get_cpu_flags); - AVSC_LOAD_FUNC(avs_get_error); - AVSC_LOAD_FUNC(avs_get_frame); - AVSC_LOAD_FUNC(avs_get_parity); - AVSC_LOAD_FUNC(avs_get_var); - AVSC_LOAD_FUNC(avs_get_version); - AVSC_LOAD_FUNC(avs_get_video_info); - AVSC_LOAD_FUNC(avs_invoke); - AVSC_LOAD_FUNC(avs_make_writable); - AVSC_LOAD_FUNC(avs_new_c_filter); - AVSC_LOAD_FUNC(avs_new_video_frame_a); - AVSC_LOAD_FUNC(avs_release_clip); - AVSC_LOAD_FUNC(avs_release_value); - AVSC_LOAD_FUNC(avs_release_video_frame); - AVSC_LOAD_FUNC(avs_save_string); - AVSC_LOAD_FUNC(avs_set_cache_hints); - AVSC_LOAD_FUNC(avs_set_global_var); - AVSC_LOAD_FUNC(avs_set_memory_max); - AVSC_LOAD_FUNC(avs_set_to_clip); - AVSC_LOAD_FUNC(avs_set_var); - AVSC_LOAD_FUNC(avs_set_working_dir); - AVSC_LOAD_FUNC(avs_sprintf); - AVSC_LOAD_FUNC(avs_subframe); - AVSC_LOAD_FUNC(avs_subframe_planar); - AVSC_LOAD_FUNC(avs_take_clip); - AVSC_LOAD_FUNC(avs_vsprintf); - -#undef __AVSC_STRINGIFY -#undef AVSC_STRINGIFY -#undef AVSC_LOAD_FUNC - - return library; - -fail: - free(library); - return NULL; -} - -AVSC_INLINE void avs_free_library(AVS_Library *library) { - if (library == NULL) - return; - FreeLibrary(library->handle); - free(library); -} -#endif - -#endif diff --git a/compat/avisynth/avisynth_c_25.h b/compat/avisynth/avisynth_c_25.h deleted file mode 100644 index 9288761331..0000000000 --- a/compat/avisynth/avisynth_c_25.h +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) 2011 FFmpegSource Project -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/* these are defines/functions that are used and were changed in the switch to 2.6 - * and are needed to maintain full compatility with 2.5 */ - -enum { - AVS_CS_YV12_25 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar - AVS_CS_I420_25 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar -}; - -AVSC_INLINE int avs_get_height_p_25(const AVS_VideoFrame * p, int plane) { - switch (plane) - { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) - return p->height>>1; - return 0; - } - return p->height;} - -AVSC_INLINE int avs_get_row_size_p_25(const AVS_VideoFrame * p, int plane) { - int r; - switch (plane) - { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) - return p->row_size>>1; - else - return 0; - case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED: - if (p->pitchUV) - { - r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize - if (r < p->pitchUV) - return r; - return p->row_size>>1; - } - else - return 0; - case AVS_PLANAR_Y_ALIGNED: - r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize - if (r <= p->pitch) - return r; - return p->row_size; - } - return p->row_size; -} - -AVSC_INLINE int avs_is_yv12_25(const AVS_VideoInfo * p) - { return ((p->pixel_type & AVS_CS_YV12_25) == AVS_CS_YV12_25)||((p->pixel_type & AVS_CS_I420_25) == AVS_CS_I420_25); } diff --git a/compat/avisynth/avxsynth_c.h b/compat/avisynth/avxsynth_c.h deleted file mode 100644 index b20f46081e..0000000000 --- a/compat/avisynth/avxsynth_c.h +++ /dev/null @@ -1,728 +0,0 @@ -// Avisynth C Interface Version 0.20 -// Copyright 2003 Kevin Atkinson - -// 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, or visit -// http://www.gnu.org/copyleft/gpl.html . -// -// As a special exception, I give you permission to link to the -// Avisynth C interface with independent modules that communicate with -// the Avisynth C interface solely through the interfaces defined in -// avisynth_c.h, regardless of the license terms of these independent -// modules, and to copy and distribute the resulting combined work -// under terms of your choice, provided that every copy of the -// combined work is accompanied by a complete copy of the source code -// of the Avisynth C interface and Avisynth itself (with the version -// used to produce the combined work), being distributed under the -// terms of the GNU General Public License plus this exception. An -// independent module is a module which is not derived from or based -// on Avisynth C Interface, such as 3rd-party filters, import and -// export plugins, or graphical user interfaces. - -#ifndef __AVXSYNTH_C__ -#define __AVXSYNTH_C__ - -#include "windowsPorts/windows2linux.h" -#include - -#ifdef __cplusplus -# define EXTERN_C extern "C" -#else -# define EXTERN_C -#endif - -#define AVSC_USE_STDCALL 1 - -#ifndef AVSC_USE_STDCALL -# define AVSC_CC __cdecl -#else -# define AVSC_CC __stdcall -#endif - -#define AVSC_INLINE static __inline - -#ifdef AVISYNTH_C_EXPORTS -# define AVSC_EXPORT EXTERN_C -# define AVSC_API(ret, name) EXTERN_C __declspec(dllexport) ret AVSC_CC name -#else -# define AVSC_EXPORT EXTERN_C __declspec(dllexport) -# ifndef AVSC_NO_DECLSPEC -# define AVSC_API(ret, name) EXTERN_C __declspec(dllimport) ret AVSC_CC name -# else -# define AVSC_API(ret, name) typedef ret (AVSC_CC *name##_func) -# endif -#endif - -#ifdef __GNUC__ -typedef long long int INT64; -#else -typedef __int64 INT64; -#endif - - -///////////////////////////////////////////////////////////////////// -// -// Constants -// - -#ifndef __AVXSYNTH_H__ -enum { AVISYNTH_INTERFACE_VERSION = 3 }; -#endif - -enum {AVS_SAMPLE_INT8 = 1<<0, - AVS_SAMPLE_INT16 = 1<<1, - AVS_SAMPLE_INT24 = 1<<2, - AVS_SAMPLE_INT32 = 1<<3, - AVS_SAMPLE_FLOAT = 1<<4}; - -enum {AVS_PLANAR_Y=1<<0, - AVS_PLANAR_U=1<<1, - AVS_PLANAR_V=1<<2, - AVS_PLANAR_ALIGNED=1<<3, - AVS_PLANAR_Y_ALIGNED=AVS_PLANAR_Y|AVS_PLANAR_ALIGNED, - AVS_PLANAR_U_ALIGNED=AVS_PLANAR_U|AVS_PLANAR_ALIGNED, - AVS_PLANAR_V_ALIGNED=AVS_PLANAR_V|AVS_PLANAR_ALIGNED}; - - // Colorspace properties. -enum {AVS_CS_BGR = 1<<28, - AVS_CS_YUV = 1<<29, - AVS_CS_INTERLEAVED = 1<<30, - AVS_CS_PLANAR = 1<<31}; - - // Specific colorformats -enum { - AVS_CS_UNKNOWN = 0, - AVS_CS_BGR24 = 1<<0 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_BGR32 = 1<<1 | AVS_CS_BGR | AVS_CS_INTERLEAVED, - AVS_CS_YUY2 = 1<<2 | AVS_CS_YUV | AVS_CS_INTERLEAVED, - AVS_CS_YV12 = 1<<3 | AVS_CS_YUV | AVS_CS_PLANAR, // y-v-u, planar - AVS_CS_I420 = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR, // y-u-v, planar - AVS_CS_IYUV = 1<<4 | AVS_CS_YUV | AVS_CS_PLANAR // same as above -}; - -enum { - AVS_IT_BFF = 1<<0, - AVS_IT_TFF = 1<<1, - AVS_IT_FIELDBASED = 1<<2}; - -enum { - AVS_FILTER_TYPE=1, - AVS_FILTER_INPUT_COLORSPACE=2, - AVS_FILTER_OUTPUT_TYPE=9, - AVS_FILTER_NAME=4, - AVS_FILTER_AUTHOR=5, - AVS_FILTER_VERSION=6, - AVS_FILTER_ARGS=7, - AVS_FILTER_ARGS_INFO=8, - AVS_FILTER_ARGS_DESCRIPTION=10, - AVS_FILTER_DESCRIPTION=11}; - -enum { //SUBTYPES - AVS_FILTER_TYPE_AUDIO=1, - AVS_FILTER_TYPE_VIDEO=2, - AVS_FILTER_OUTPUT_TYPE_SAME=3, - AVS_FILTER_OUTPUT_TYPE_DIFFERENT=4}; - -enum { - AVS_CACHE_NOTHING=0, - AVS_CACHE_RANGE=1, - AVS_CACHE_ALL=2, - AVS_CACHE_AUDIO=3, - AVS_CACHE_AUDIO_NONE=4, - AVS_CACHE_AUDIO_AUTO=5 -}; - -#define AVS_FRAME_ALIGN 16 - -typedef struct AVS_Clip AVS_Clip; -typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment; - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoInfo -// - -// AVS_VideoInfo is layed out identicly to VideoInfo -typedef struct AVS_VideoInfo { - int width, height; // width=0 means no video - unsigned fps_numerator, fps_denominator; - int num_frames; - - int pixel_type; - - int audio_samples_per_second; // 0 means no audio - int sample_type; - INT64 num_audio_samples; - int nchannels; - - // Imagetype properties - - int image_type; -} AVS_VideoInfo; - -// useful functions of the above -AVSC_INLINE int avs_has_video(const AVS_VideoInfo * p) - { return (p->width!=0); } - -AVSC_INLINE int avs_has_audio(const AVS_VideoInfo * p) - { return (p->audio_samples_per_second!=0); } - -AVSC_INLINE int avs_is_rgb(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_BGR); } - -AVSC_INLINE int avs_is_rgb24(const AVS_VideoInfo * p) - { return (p->pixel_type&AVS_CS_BGR24)==AVS_CS_BGR24; } // Clear out additional properties - -AVSC_INLINE int avs_is_rgb32(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_BGR32) == AVS_CS_BGR32 ; } - -AVSC_INLINE int avs_is_yuv(const AVS_VideoInfo * p) - { return !!(p->pixel_type&AVS_CS_YUV ); } - -AVSC_INLINE int avs_is_yuy2(const AVS_VideoInfo * p) - { return (p->pixel_type & AVS_CS_YUY2) == AVS_CS_YUY2; } - -AVSC_INLINE int avs_is_yv12(const AVS_VideoInfo * p) - { return ((p->pixel_type & AVS_CS_YV12) == AVS_CS_YV12)||((p->pixel_type & AVS_CS_I420) == AVS_CS_I420); } - -AVSC_INLINE int avs_is_color_space(const AVS_VideoInfo * p, int c_space) - { return ((p->pixel_type & c_space) == c_space); } - -AVSC_INLINE int avs_is_property(const AVS_VideoInfo * p, int property) - { return ((p->pixel_type & property)==property ); } - -AVSC_INLINE int avs_is_planar(const AVS_VideoInfo * p) - { return !!(p->pixel_type & AVS_CS_PLANAR); } - -AVSC_INLINE int avs_is_field_based(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_FIELDBASED); } - -AVSC_INLINE int avs_is_parity_known(const AVS_VideoInfo * p) - { return ((p->image_type & AVS_IT_FIELDBASED)&&(p->image_type & (AVS_IT_BFF | AVS_IT_TFF))); } - -AVSC_INLINE int avs_is_bff(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_BFF); } - -AVSC_INLINE int avs_is_tff(const AVS_VideoInfo * p) - { return !!(p->image_type & AVS_IT_TFF); } - -AVSC_INLINE int avs_bits_per_pixel(const AVS_VideoInfo * p) -{ - switch (p->pixel_type) { - case AVS_CS_BGR24: return 24; - case AVS_CS_BGR32: return 32; - case AVS_CS_YUY2: return 16; - case AVS_CS_YV12: - case AVS_CS_I420: return 12; - default: return 0; - } -} -AVSC_INLINE int avs_bytes_from_pixels(const AVS_VideoInfo * p, int pixels) - { return pixels * (avs_bits_per_pixel(p)>>3); } // Will work on planar images, but will return only luma planes - -AVSC_INLINE int avs_row_size(const AVS_VideoInfo * p) - { return avs_bytes_from_pixels(p,p->width); } // Also only returns first plane on planar images - -AVSC_INLINE int avs_bmp_size(const AVS_VideoInfo * vi) - { if (avs_is_planar(vi)) {int p = vi->height * ((avs_row_size(vi)+3) & ~3); p+=p>>1; return p; } return vi->height * ((avs_row_size(vi)+3) & ~3); } - -AVSC_INLINE int avs_samples_per_second(const AVS_VideoInfo * p) - { return p->audio_samples_per_second; } - - -AVSC_INLINE int avs_bytes_per_channel_sample(const AVS_VideoInfo * p) -{ - switch (p->sample_type) { - case AVS_SAMPLE_INT8: return sizeof(signed char); - case AVS_SAMPLE_INT16: return sizeof(signed short); - case AVS_SAMPLE_INT24: return 3; - case AVS_SAMPLE_INT32: return sizeof(signed int); - case AVS_SAMPLE_FLOAT: return sizeof(float); - default: return 0; - } -} -AVSC_INLINE int avs_bytes_per_audio_sample(const AVS_VideoInfo * p) - { return p->nchannels*avs_bytes_per_channel_sample(p);} - -AVSC_INLINE INT64 avs_audio_samples_from_frames(const AVS_VideoInfo * p, INT64 frames) - { return ((INT64)(frames) * p->audio_samples_per_second * p->fps_denominator / p->fps_numerator); } - -AVSC_INLINE int avs_frames_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return (int)(samples * (INT64)p->fps_numerator / (INT64)p->fps_denominator / (INT64)p->audio_samples_per_second); } - -AVSC_INLINE INT64 avs_audio_samples_from_bytes(const AVS_VideoInfo * p, INT64 bytes) - { return bytes / avs_bytes_per_audio_sample(p); } - -AVSC_INLINE INT64 avs_bytes_from_audio_samples(const AVS_VideoInfo * p, INT64 samples) - { return samples * avs_bytes_per_audio_sample(p); } - -AVSC_INLINE int avs_audio_channels(const AVS_VideoInfo * p) - { return p->nchannels; } - -AVSC_INLINE int avs_sample_type(const AVS_VideoInfo * p) - { return p->sample_type;} - -// useful mutator -AVSC_INLINE void avs_set_property(AVS_VideoInfo * p, int property) - { p->image_type|=property; } - -AVSC_INLINE void avs_clear_property(AVS_VideoInfo * p, int property) - { p->image_type&=~property; } - -AVSC_INLINE void avs_set_field_based(AVS_VideoInfo * p, int isfieldbased) - { if (isfieldbased) p->image_type|=AVS_IT_FIELDBASED; else p->image_type&=~AVS_IT_FIELDBASED; } - -AVSC_INLINE void avs_set_fps(AVS_VideoInfo * p, unsigned numerator, unsigned denominator) -{ - unsigned x=numerator, y=denominator; - while (y) { // find gcd - unsigned t = x%y; x = y; y = t; - } - p->fps_numerator = numerator/x; - p->fps_denominator = denominator/x; -} - -AVSC_INLINE int avs_is_same_colorspace(AVS_VideoInfo * x, AVS_VideoInfo * y) -{ - return (x->pixel_type == y->pixel_type) - || (avs_is_yv12(x) && avs_is_yv12(y)); -} - -///////////////////////////////////////////////////////////////////// -// -// AVS_VideoFrame -// - -// VideoFrameBuffer holds information about a memory block which is used -// for video data. For efficiency, instances of this class are not deleted -// when the refcount reaches zero; instead they're stored in a linked list -// to be reused. The instances are deleted when the corresponding AVS -// file is closed. - -// AVS_VideoFrameBuffer is layed out identicly to VideoFrameBuffer -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrameBuffer { - unsigned char * data; - int data_size; - // sequence_number is incremented every time the buffer is changed, so - // that stale views can tell they're no longer valid. - long sequence_number; - - long refcount; -} AVS_VideoFrameBuffer; - -// VideoFrame holds a "window" into a VideoFrameBuffer. - -// AVS_VideoFrame is layed out identicly to IVideoFrame -// DO NOT USE THIS STRUCTURE DIRECTLY -typedef struct AVS_VideoFrame { - int refcount; - AVS_VideoFrameBuffer * vfb; - int offset, pitch, row_size, height, offsetU, offsetV, pitchUV; // U&V offsets are from top of picture. -} AVS_VideoFrame; - -// Access functions for AVS_VideoFrame -AVSC_INLINE int avs_get_pitch(const AVS_VideoFrame * p) { - return p->pitch;} - -AVSC_INLINE int avs_get_pitch_p(const AVS_VideoFrame * p, int plane) { - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: return p->pitchUV;} - return p->pitch;} - -AVSC_INLINE int avs_get_row_size(const AVS_VideoFrame * p) { - return p->row_size; } - -AVSC_INLINE int avs_get_row_size_p(const AVS_VideoFrame * p, int plane) { - int r; - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) return p->row_size>>1; - else return 0; - case AVS_PLANAR_U_ALIGNED: case AVS_PLANAR_V_ALIGNED: - if (p->pitchUV) { - r = ((p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)) )>>1; // Aligned rowsize - if (r < p->pitchUV) - return r; - return p->row_size>>1; - } else return 0; - case AVS_PLANAR_Y_ALIGNED: - r = (p->row_size+AVS_FRAME_ALIGN-1)&(~(AVS_FRAME_ALIGN-1)); // Aligned rowsize - if (r <= p->pitch) - return r; - return p->row_size; - } - return p->row_size; -} - -AVSC_INLINE int avs_get_height(const AVS_VideoFrame * p) { - return p->height;} - -AVSC_INLINE int avs_get_height_p(const AVS_VideoFrame * p, int plane) { - switch (plane) { - case AVS_PLANAR_U: case AVS_PLANAR_V: - if (p->pitchUV) return p->height>>1; - return 0; - } - return p->height;} - -AVSC_INLINE const unsigned char* avs_get_read_ptr(const AVS_VideoFrame * p) { - return p->vfb->data + p->offset;} - -AVSC_INLINE const unsigned char* avs_get_read_ptr_p(const AVS_VideoFrame * p, int plane) -{ - switch (plane) { - case AVS_PLANAR_U: return p->vfb->data + p->offsetU; - case AVS_PLANAR_V: return p->vfb->data + p->offsetV; - default: return p->vfb->data + p->offset;} -} - -AVSC_INLINE int avs_is_writable(const AVS_VideoFrame * p) { - return (p->refcount == 1 && p->vfb->refcount == 1);} - -AVSC_INLINE unsigned char* avs_get_write_ptr(const AVS_VideoFrame * p) -{ - if (avs_is_writable(p)) { - ++p->vfb->sequence_number; - return p->vfb->data + p->offset; - } else - return 0; -} - -AVSC_INLINE unsigned char* avs_get_write_ptr_p(const AVS_VideoFrame * p, int plane) -{ - if (plane==AVS_PLANAR_Y && avs_is_writable(p)) { - ++p->vfb->sequence_number; - return p->vfb->data + p->offset; - } else if (plane==AVS_PLANAR_Y) { - return 0; - } else { - switch (plane) { - case AVS_PLANAR_U: return p->vfb->data + p->offsetU; - case AVS_PLANAR_V: return p->vfb->data + p->offsetV; - default: return p->vfb->data + p->offset; - } - } -} - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_release_video_frame)(AVS_VideoFrame *); -// makes a shallow copy of a video frame -AVSC_API(AVS_VideoFrame *, avs_copy_video_frame)(AVS_VideoFrame *); -#if defined __cplusplus -} -#endif // __cplusplus - -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE void avs_release_frame(AVS_VideoFrame * f) - {avs_release_video_frame(f);} -AVSC_INLINE AVS_VideoFrame * avs_copy_frame(AVS_VideoFrame * f) - {return avs_copy_video_frame(f);} -#endif - -///////////////////////////////////////////////////////////////////// -// -// AVS_Value -// - -// Treat AVS_Value as a fat pointer. That is use avs_copy_value -// and avs_release_value appropiaty as you would if AVS_Value was -// a pointer. - -// To maintain source code compatibility with future versions of the -// avisynth_c API don't use the AVS_Value directly. Use the helper -// functions below. - -// AVS_Value is layed out identicly to AVSValue -typedef struct AVS_Value AVS_Value; -struct AVS_Value { - short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong - // for some function e'rror - short array_size; - union { - void * clip; // do not use directly, use avs_take_clip - char boolean; - int integer; - INT64 integer64; // match addition of __int64 to avxplugin.h - float floating_pt; - const char * string; - const AVS_Value * array; - } d; -}; - -// AVS_Value should be initilized with avs_void. -// Should also set to avs_void after the value is released -// with avs_copy_value. Consider it the equalvent of setting -// a pointer to NULL -static const AVS_Value avs_void = {'v'}; - -AVSC_API(void, avs_copy_value)(AVS_Value * dest, AVS_Value src); -AVSC_API(void, avs_release_value)(AVS_Value); - -AVSC_INLINE int avs_defined(AVS_Value v) { return v.type != 'v'; } -AVSC_INLINE int avs_is_clip(AVS_Value v) { return v.type == 'c'; } -AVSC_INLINE int avs_is_bool(AVS_Value v) { return v.type == 'b'; } -AVSC_INLINE int avs_is_int(AVS_Value v) { return v.type == 'i'; } -AVSC_INLINE int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; } -AVSC_INLINE int avs_is_string(AVS_Value v) { return v.type == 's'; } -AVSC_INLINE int avs_is_array(AVS_Value v) { return v.type == 'a'; } -AVSC_INLINE int avs_is_error(AVS_Value v) { return v.type == 'e'; } - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(AVS_Clip *, avs_take_clip)(AVS_Value, AVS_ScriptEnvironment *); -AVSC_API(void, avs_set_to_clip)(AVS_Value *, AVS_Clip *); -#if defined __cplusplus -} -#endif // __cplusplus - -AVSC_INLINE int avs_as_bool(AVS_Value v) - { return v.d.boolean; } -AVSC_INLINE int avs_as_int(AVS_Value v) - { return v.d.integer; } -AVSC_INLINE const char * avs_as_string(AVS_Value v) - { return avs_is_error(v) || avs_is_string(v) ? v.d.string : 0; } -AVSC_INLINE double avs_as_float(AVS_Value v) - { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; } -AVSC_INLINE const char * avs_as_error(AVS_Value v) - { return avs_is_error(v) ? v.d.string : 0; } -AVSC_INLINE const AVS_Value * avs_as_array(AVS_Value v) - { return v.d.array; } -AVSC_INLINE int avs_array_size(AVS_Value v) - { return avs_is_array(v) ? v.array_size : 1; } -AVSC_INLINE AVS_Value avs_array_elt(AVS_Value v, int index) - { return avs_is_array(v) ? v.d.array[index] : v; } - -// only use these functions on am AVS_Value that does not already have -// an active value. Remember, treat AVS_Value as a fat pointer. -AVSC_INLINE AVS_Value avs_new_value_bool(int v0) - { AVS_Value v; v.type = 'b'; v.d.boolean = v0 == 0 ? 0 : 1; return v; } -AVSC_INLINE AVS_Value avs_new_value_int(int v0) - { AVS_Value v; v.type = 'i'; v.d.integer = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_string(const char * v0) - { AVS_Value v; v.type = 's'; v.d.string = v0; return v; } -AVSC_INLINE AVS_Value avs_new_value_float(float v0) - { AVS_Value v; v.type = 'f'; v.d.floating_pt = v0; return v;} -AVSC_INLINE AVS_Value avs_new_value_error(const char * v0) - { AVS_Value v; v.type = 'e'; v.d.string = v0; return v; } -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE AVS_Value avs_new_value_clip(AVS_Clip * v0) - { AVS_Value v; avs_set_to_clip(&v, v0); return v; } -#endif -AVSC_INLINE AVS_Value avs_new_value_array(AVS_Value * v0, int size) - { AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; } - -///////////////////////////////////////////////////////////////////// -// -// AVS_Clip -// -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_release_clip)(AVS_Clip *); -AVSC_API(AVS_Clip *, avs_copy_clip)(AVS_Clip *); - -AVSC_API(const char *, avs_clip_get_error)(AVS_Clip *); // return 0 if no error - -AVSC_API(const AVS_VideoInfo *, avs_get_video_info)(AVS_Clip *); - -AVSC_API(int, avs_get_version)(AVS_Clip *); - -AVSC_API(AVS_VideoFrame *, avs_get_frame)(AVS_Clip *, int n); -// The returned video frame must be released with avs_release_video_frame - -AVSC_API(int, avs_get_parity)(AVS_Clip *, int n); -// return field parity if field_based, else parity of first field in frame - -AVSC_API(int, avs_get_audio)(AVS_Clip *, void * buf, - INT64 start, INT64 count); -// start and count are in samples - -AVSC_API(int, avs_set_cache_hints)(AVS_Clip *, - int cachehints, size_t frame_range); -#if defined __cplusplus -} -#endif // __cplusplus - -// This is the callback type used by avs_add_function -typedef AVS_Value (AVSC_CC * AVS_ApplyFunc) - (AVS_ScriptEnvironment *, AVS_Value args, void * user_data); - -typedef struct AVS_FilterInfo AVS_FilterInfo; -struct AVS_FilterInfo -{ - // these members should not be modified outside of the AVS_ApplyFunc callback - AVS_Clip * child; - AVS_VideoInfo vi; - AVS_ScriptEnvironment * env; - AVS_VideoFrame * (AVSC_CC * get_frame)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_parity)(AVS_FilterInfo *, int n); - int (AVSC_CC * get_audio)(AVS_FilterInfo *, void * buf, - INT64 start, INT64 count); - int (AVSC_CC * set_cache_hints)(AVS_FilterInfo *, int cachehints, - int frame_range); - void (AVSC_CC * free_filter)(AVS_FilterInfo *); - - // Should be set when ever there is an error to report. - // It is cleared before any of the above methods are called - const char * error; - // this is to store whatever and may be modified at will - void * user_data; -}; - -// Create a new filter -// fi is set to point to the AVS_FilterInfo so that you can -// modify it once it is initilized. -// store_child should generally be set to true. If it is not -// set than ALL methods (the function pointers) must be defined -// If it is set than you do not need to worry about freeing the child -// clip. -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(AVS_Clip *, avs_new_c_filter)(AVS_ScriptEnvironment * e, - AVS_FilterInfo * * fi, - AVS_Value child, int store_child); -#if defined __cplusplus -} -#endif // __cplusplus - - -///////////////////////////////////////////////////////////////////// -// -// AVS_ScriptEnvironment -// - -// For GetCPUFlags. These are backwards-compatible with those in VirtualDub. -enum { - /* slowest CPU to support extension */ - AVS_CPU_FORCE = 0x01, // N/A - AVS_CPU_FPU = 0x02, // 386/486DX - AVS_CPU_MMX = 0x04, // P55C, K6, PII - AVS_CPU_INTEGER_SSE = 0x08, // PIII, Athlon - AVS_CPU_SSE = 0x10, // PIII, Athlon XP/MP - AVS_CPU_SSE2 = 0x20, // PIV, Hammer - AVS_CPU_3DNOW = 0x40, // K6-2 - AVS_CPU_3DNOW_EXT = 0x80, // Athlon - AVS_CPU_X86_64 = 0xA0, // Hammer (note: equiv. to 3DNow + SSE2, - // which only Hammer will have anyway) -}; - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(const char *, avs_get_error)(AVS_ScriptEnvironment *); // return 0 if no error - -AVSC_API(long, avs_get_cpu_flags)(AVS_ScriptEnvironment *); -AVSC_API(int, avs_check_version)(AVS_ScriptEnvironment *, int version); - -AVSC_API(char *, avs_save_string)(AVS_ScriptEnvironment *, const char* s, int length); -AVSC_API(char *, avs_sprintf)(AVS_ScriptEnvironment *, const char * fmt, ...); - -AVSC_API(char *, avs_vsprintf)(AVS_ScriptEnvironment *, const char * fmt, va_list val); - // note: val is really a va_list; I hope everyone typedefs va_list to a pointer - -AVSC_API(int, avs_add_function)(AVS_ScriptEnvironment *, - const char * name, const char * params, - AVS_ApplyFunc apply, void * user_data); - -AVSC_API(int, avs_function_exists)(AVS_ScriptEnvironment *, const char * name); - -AVSC_API(AVS_Value, avs_invoke)(AVS_ScriptEnvironment *, const char * name, - AVS_Value args, const char** arg_names); -// The returned value must be be released with avs_release_value - -AVSC_API(AVS_Value, avs_get_var)(AVS_ScriptEnvironment *, const char* name); -// The returned value must be be released with avs_release_value - -AVSC_API(int, avs_set_var)(AVS_ScriptEnvironment *, const char* name, AVS_Value val); - -AVSC_API(int, avs_set_global_var)(AVS_ScriptEnvironment *, const char* name, const AVS_Value val); - -//void avs_push_context(AVS_ScriptEnvironment *, int level=0); -//void avs_pop_context(AVS_ScriptEnvironment *); - -AVSC_API(AVS_VideoFrame *, avs_new_video_frame_a)(AVS_ScriptEnvironment *, - const AVS_VideoInfo * vi, int align); -// align should be at least 16 -#if defined __cplusplus -} -#endif // __cplusplus - -#ifndef AVSC_NO_DECLSPEC -AVSC_INLINE -AVS_VideoFrame * avs_new_video_frame(AVS_ScriptEnvironment * env, - const AVS_VideoInfo * vi) - {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} - -AVSC_INLINE -AVS_VideoFrame * avs_new_frame(AVS_ScriptEnvironment * env, - const AVS_VideoInfo * vi) - {return avs_new_video_frame_a(env,vi,AVS_FRAME_ALIGN);} -#endif - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(int, avs_make_writable)(AVS_ScriptEnvironment *, AVS_VideoFrame * * pvf); - -AVSC_API(void, avs_bit_blt)(AVS_ScriptEnvironment *, unsigned char* dstp, int dst_pitch, const unsigned char* srcp, int src_pitch, int row_size, int height); - -typedef void (AVSC_CC *AVS_ShutdownFunc)(void* user_data, AVS_ScriptEnvironment * env); -AVSC_API(void, avs_at_exit)(AVS_ScriptEnvironment *, AVS_ShutdownFunc function, void * user_data); - -AVSC_API(AVS_VideoFrame *, avs_subframe)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height); -// The returned video frame must be be released - -AVSC_API(int, avs_set_memory_max)(AVS_ScriptEnvironment *, int mem); - -AVSC_API(int, avs_set_working_dir)(AVS_ScriptEnvironment *, const char * newdir); - -// avisynth.dll exports this; it's a way to use it as a library, without -// writing an AVS script or without going through AVIFile. -AVSC_API(AVS_ScriptEnvironment *, avs_create_script_environment)(int version); -#if defined __cplusplus -} -#endif // __cplusplus - -// this symbol is the entry point for the plugin and must -// be defined -AVSC_EXPORT -const char * AVSC_CC avisynth_c_plugin_init(AVS_ScriptEnvironment* env); - - -#if defined __cplusplus -extern "C" -{ -#endif // __cplusplus -AVSC_API(void, avs_delete_script_environment)(AVS_ScriptEnvironment *); - - -AVSC_API(AVS_VideoFrame *, avs_subframe_planar)(AVS_ScriptEnvironment *, AVS_VideoFrame * src, int rel_offset, int new_pitch, int new_row_size, int new_height, int rel_offsetU, int rel_offsetV, int new_pitchUV); -// The returned video frame must be be released -#if defined __cplusplus -} -#endif // __cplusplus - -#endif //__AVXSYNTH_C__ diff --git a/compat/avisynth/windowsPorts/basicDataTypeConversions.h b/compat/avisynth/windowsPorts/basicDataTypeConversions.h deleted file mode 100644 index ff367d5a2a..0000000000 --- a/compat/avisynth/windowsPorts/basicDataTypeConversions.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __DATA_TYPE_CONVERSIONS_H__ -#define __DATA_TYPE_CONVERSIONS_H__ - -#include -#include - -#ifdef __cplusplus -namespace avxsynth { -#endif // __cplusplus - -typedef int64_t __int64; -typedef int32_t __int32; -#ifdef __cplusplus -typedef bool BOOL; -#else -typedef uint32_t BOOL; -#endif // __cplusplus -typedef void* HMODULE; -typedef void* LPVOID; -typedef void* PVOID; -typedef PVOID HANDLE; -typedef HANDLE HWND; -typedef HANDLE HINSTANCE; -typedef void* HDC; -typedef void* HBITMAP; -typedef void* HICON; -typedef void* HFONT; -typedef void* HGDIOBJ; -typedef void* HBRUSH; -typedef void* HMMIO; -typedef void* HACMSTREAM; -typedef void* HACMDRIVER; -typedef void* HIC; -typedef void* HACMOBJ; -typedef HACMSTREAM* LPHACMSTREAM; -typedef void* HACMDRIVERID; -typedef void* LPHACMDRIVER; -typedef unsigned char BYTE; -typedef BYTE* LPBYTE; -typedef char TCHAR; -typedef TCHAR* LPTSTR; -typedef const TCHAR* LPCTSTR; -typedef char* LPSTR; -typedef LPSTR LPOLESTR; -typedef const char* LPCSTR; -typedef LPCSTR LPCOLESTR; -typedef wchar_t WCHAR; -typedef unsigned short WORD; -typedef unsigned int UINT; -typedef UINT MMRESULT; -typedef uint32_t DWORD; -typedef DWORD COLORREF; -typedef DWORD FOURCC; -typedef DWORD HRESULT; -typedef DWORD* LPDWORD; -typedef DWORD* DWORD_PTR; -typedef int32_t LONG; -typedef int32_t* LONG_PTR; -typedef LONG_PTR LRESULT; -typedef uint32_t ULONG; -typedef uint32_t* ULONG_PTR; -//typedef __int64_t intptr_t; -typedef uint64_t _fsize_t; - - -// -// Structures -// - -typedef struct _GUID { - DWORD Data1; - WORD Data2; - WORD Data3; - BYTE Data4[8]; -} GUID; - -typedef GUID REFIID; -typedef GUID CLSID; -typedef CLSID* LPCLSID; -typedef GUID IID; - -#ifdef __cplusplus -}; // namespace avxsynth -#endif // __cplusplus -#endif // __DATA_TYPE_CONVERSIONS_H__ diff --git a/compat/avisynth/windowsPorts/windows2linux.h b/compat/avisynth/windowsPorts/windows2linux.h deleted file mode 100644 index 5476afe847..0000000000 --- a/compat/avisynth/windowsPorts/windows2linux.h +++ /dev/null @@ -1,77 +0,0 @@ -#ifndef __WINDOWS2LINUX_H__ -#define __WINDOWS2LINUX_H__ - -/* - * LINUX SPECIFIC DEFINITIONS -*/ -// -// Data types conversions -// -#include -#include -#include "basicDataTypeConversions.h" - -#ifdef __cplusplus -namespace avxsynth { -#endif // __cplusplus -// -// purposefully define the following MSFT definitions -// to mean nothing (as they do not mean anything on Linux) -// -#define __stdcall -#define __cdecl -#define noreturn -#define __declspec(x) -#define STDAPI extern "C" HRESULT -#define STDMETHODIMP HRESULT __stdcall -#define STDMETHODIMP_(x) x __stdcall - -#define STDMETHOD(x) virtual HRESULT x -#define STDMETHOD_(a, x) virtual a x - -#ifndef TRUE -#define TRUE true -#endif - -#ifndef FALSE -#define FALSE false -#endif - -#define S_OK (0x00000000) -#define S_FALSE (0x00000001) -#define E_NOINTERFACE (0X80004002) -#define E_POINTER (0x80004003) -#define E_FAIL (0x80004005) -#define E_OUTOFMEMORY (0x8007000E) - -#define INVALID_HANDLE_VALUE ((HANDLE)((LONG_PTR)-1)) -#define FAILED(hr) ((hr) & 0x80000000) -#define SUCCEEDED(hr) (!FAILED(hr)) - - -// -// Functions -// -#define MAKEDWORD(a,b,c,d) ((a << 24) | (b << 16) | (c << 8) | (d)) -#define MAKEWORD(a,b) ((a << 8) | (b)) - -#define lstrlen strlen -#define lstrcpy strcpy -#define lstrcmpi strcasecmp -#define _stricmp strcasecmp -#define InterlockedIncrement(x) __sync_fetch_and_add((x), 1) -#define InterlockedDecrement(x) __sync_fetch_and_sub((x), 1) -// Windows uses (new, old) ordering but GCC has (old, new) -#define InterlockedCompareExchange(x,y,z) __sync_val_compare_and_swap(x,z,y) - -#define UInt32x32To64(a, b) ( (uint64_t) ( ((uint64_t)((uint32_t)(a))) * ((uint32_t)(b)) ) ) -#define Int64ShrlMod32(a, b) ( (uint64_t) ( (uint64_t)(a) >> (b) ) ) -#define Int32x32To64(a, b) ((__int64)(((__int64)((long)(a))) * ((long)(b)))) - -#define MulDiv(nNumber, nNumerator, nDenominator) (int32_t) (((int64_t) (nNumber) * (int64_t) (nNumerator) + (int64_t) ((nDenominator)/2)) / (int64_t) (nDenominator)) - -#ifdef __cplusplus -}; // namespace avxsynth -#endif // __cplusplus - -#endif // __WINDOWS2LINUX_H__ diff --git a/compat/float/float.h b/compat/float/float.h index 1f0d3ab4b5..c69f728e32 100644 --- a/compat/float/float.h +++ b/compat/float/float.h @@ -1,20 +1,20 @@ /* * Work around broken floating point limits on some systems. * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/compat/float/limits.h b/compat/float/limits.h index 7ea374a8bc..9150bc8134 100644 --- a/compat/float/limits.h +++ b/compat/float/limits.h @@ -1,20 +1,20 @@ /* * Work around broken floating point limits on some systems. * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/compat/getopt.c b/compat/getopt.c index 9a9c5421de..7c646f6a05 100644 --- a/compat/getopt.c +++ b/compat/getopt.c @@ -1,18 +1,18 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -44,7 +44,7 @@ static int getopt(int argc, char *argv[], char *opts) int c; char *cp; - if (sp == 1) { + if (sp == 1) if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0') return EOF; @@ -52,7 +52,6 @@ static int getopt(int argc, char *argv[], char *opts) optind++; return EOF; } - } optopt = c = argv[optind][sp]; if (c == ':' || (cp = strchr(opts, c)) == NULL) { fprintf(stderr, ": illegal option -- %c\n", c); diff --git a/compat/msvcrt/snprintf.c b/compat/msvcrt/snprintf.c index c64653fe82..0af7b54353 100644 --- a/compat/msvcrt/snprintf.c +++ b/compat/msvcrt/snprintf.c @@ -2,20 +2,20 @@ * C99-compatible snprintf() and vsnprintf() implementations * Copyright (c) 2012 Ronald S. Bultje * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -24,11 +24,10 @@ #include #include -#include "compat/va_copy.h" #include "libavutil/error.h" -#if defined(__MINGW32__) -#define EOVERFLOW EFBIG +#if !defined(va_copy) && defined(_MSC_VER) +#define va_copy(dst, src) ((dst) = (src)) #endif int avpriv_snprintf(char *s, size_t n, const char *fmt, ...) diff --git a/compat/msvcrt/snprintf.h b/compat/msvcrt/snprintf.h deleted file mode 100644 index f02113c5a2..0000000000 --- a/compat/msvcrt/snprintf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * C99-compatible snprintf() and vsnprintf() implementations - * Copyright (c) 2012 Ronald S. Bultje - * - * 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 COMPAT_SNPRINTF_H -#define COMPAT_SNPRINTF_H - -#include -#include - -int avpriv_snprintf(char *s, size_t n, const char *fmt, ...); -int avpriv_vsnprintf(char *s, size_t n, const char *fmt, va_list ap); - -#undef snprintf -#undef _snprintf -#undef vsnprintf -#define snprintf avpriv_snprintf -#define _snprintf avpriv_snprintf -#define vsnprintf avpriv_vsnprintf - -#endif /* COMPAT_SNPRINTF_H */ diff --git a/compat/os2threads.h b/compat/os2threads.h deleted file mode 100644 index 441ac43710..0000000000 --- a/compat/os2threads.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2011 KO Myung-Hun - * - * 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 - * os2threads to pthreads wrapper - */ - -#ifndef AVCODEC_OS2PTHREADS_H -#define AVCODEC_OS2PTHREADS_H - -#define INCL_DOS -#include - -#undef __STRICT_ANSI__ /* for _beginthread() */ -#include - -#include "libavutil/mem.h" - -typedef TID pthread_t; -typedef void pthread_attr_t; - -typedef HMTX pthread_mutex_t; -typedef void pthread_mutexattr_t; - -typedef struct { - HEV event_sem; - int wait_count; -} pthread_cond_t; - -typedef void pthread_condattr_t; - -struct thread_arg { - void *(*start_routine)(void *); - void *arg; -}; - -static void thread_entry(void *arg) -{ - struct thread_arg *thread_arg = arg; - - thread_arg->start_routine(thread_arg->arg); - - av_free(thread_arg); -} - -static av_always_inline int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void*), void *arg) -{ - struct thread_arg *thread_arg; - - thread_arg = av_mallocz(sizeof(struct thread_arg)); - - thread_arg->start_routine = start_routine; - thread_arg->arg = arg; - - *thread = _beginthread(thread_entry, NULL, 256 * 1024, thread_arg); - - return 0; -} - -static av_always_inline int pthread_join(pthread_t thread, void **value_ptr) -{ - DosWaitThread((PTID)&thread, DCWW_WAIT); - - return 0; -} - -static av_always_inline int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) -{ - DosCreateMutexSem(NULL, (PHMTX)mutex, 0, FALSE); - - return 0; -} - -static av_always_inline int pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - DosCloseMutexSem(*(PHMTX)mutex); - - return 0; -} - -static av_always_inline int pthread_mutex_lock(pthread_mutex_t *mutex) -{ - DosRequestMutexSem(*(PHMTX)mutex, SEM_INDEFINITE_WAIT); - - return 0; -} - -static av_always_inline int pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - DosReleaseMutexSem(*(PHMTX)mutex); - - return 0; -} - -static av_always_inline int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr) -{ - DosCreateEventSem(NULL, &cond->event_sem, DCE_POSTONE, FALSE); - - cond->wait_count = 0; - - return 0; -} - -static av_always_inline int pthread_cond_destroy(pthread_cond_t *cond) -{ - DosCloseEventSem(cond->event_sem); - - return 0; -} - -static av_always_inline int pthread_cond_signal(pthread_cond_t *cond) -{ - if (cond->wait_count > 0) { - DosPostEventSem(cond->event_sem); - - cond->wait_count--; - } - - return 0; -} - -static av_always_inline int pthread_cond_broadcast(pthread_cond_t *cond) -{ - while (cond->wait_count > 0) { - DosPostEventSem(cond->event_sem); - - cond->wait_count--; - } - - return 0; -} - -static av_always_inline int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) -{ - cond->wait_count++; - - pthread_mutex_unlock(mutex); - - DosWaitEventSem(cond->event_sem, SEM_INDEFINITE_WAIT); - - pthread_mutex_lock(mutex); - - return 0; -} - -#endif /* AVCODEC_OS2PTHREADS_H */ diff --git a/compat/plan9/main.c b/compat/plan9/main.c index d46f96d170..97d70678a6 100644 --- a/compat/plan9/main.c +++ b/compat/plan9/main.c @@ -1,18 +1,18 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/compat/strtod.c b/compat/strtod.c index 3a9452eac2..258909f409 100644 --- a/compat/strtod.c +++ b/compat/strtod.c @@ -2,20 +2,20 @@ * C99-compatible strtod() implementation * Copyright (c) 2012 Ronald S. Bultje * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ diff --git a/compat/tms470/math.h b/compat/tms470/math.h index 6234cc597b..b686d4d8a9 100644 --- a/compat/tms470/math.h +++ b/compat/tms470/math.h @@ -1,23 +1,23 @@ /* - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef FFMPEG_COMPAT_TMS470_MATH_H -#define FFMPEG_COMPAT_TMS470_MATH_H +#ifndef LIBAV_COMPAT_TMS470_MATH_H +#define LIBAV_COMPAT_TMS470_MATH_H #include_next @@ -27,4 +27,4 @@ #define INFINITY (*(const float*)((const unsigned []){ 0x7f800000 })) #define NAN (*(const float*)((const unsigned []){ 0x7fc00000 })) -#endif /* FFMPEG_COMPAT_TMS470_MATH_H */ +#endif /* LIBAV_COMPAT_TMS470_MATH_H */ diff --git a/compat/va_copy.h b/compat/va_copy.h deleted file mode 100644 index 3cb5ebee33..0000000000 --- a/compat/va_copy.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * MSVC Compatible va_copy macro - * Copyright (c) 2012 Derek Buitenhuis - * - * 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 - */ - -#include - -#if !defined(va_copy) && defined(_MSC_VER) -#define va_copy(dst, src) ((dst) = (src)) -#endif -#if !defined(va_copy) && defined(__GNUC__) && __GNUC__ < 3 -#define va_copy(dst, src) __va_copy(dst, src) -#endif diff --git a/compat/w32pthreads.h b/compat/w32pthreads.h index cfb8f6471f..be275edce7 100644 --- a/compat/w32pthreads.h +++ b/compat/w32pthreads.h @@ -4,20 +4,20 @@ * Authors: Steven Walters * Pegasys Inc. * - * This file is part of FFmpeg. + * This file is part of Libav. * - * FFmpeg is free software; you can redistribute it and/or + * 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. * - * FFmpeg is distributed in the hope that it will be useful, + * 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 FFmpeg; if not, write to the Free Software + * License along with Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -26,8 +26,8 @@ * w32threads to pthreads wrapper */ -#ifndef FFMPEG_COMPAT_W32PTHREADS_H -#define FFMPEG_COMPAT_W32PTHREADS_H +#ifndef LIBAV_COMPAT_W32PTHREADS_H +#define LIBAV_COMPAT_W32PTHREADS_H /* Build up a pthread-like API using underlying Windows API. Have only static * methods so as to not conflict with a potentially linked in pthread-win32 @@ -39,7 +39,6 @@ #include #include -#include "libavutil/common.h" #include "libavutil/internal.h" #include "libavutil/mem.h" @@ -134,29 +133,28 @@ typedef struct win32_cond_t { volatile int is_broadcast; } win32_cond_t; -static int pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) +static void pthread_cond_init(pthread_cond_t *cond, const void *unused_attr) { win32_cond_t *win32_cond = NULL; if (cond_init) { cond_init(cond); - return 0; + return; } /* non native condition variables */ win32_cond = av_mallocz(sizeof(win32_cond_t)); if (!win32_cond) - return ENOMEM; + return; cond->ptr = win32_cond; win32_cond->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); if (!win32_cond->semaphore) - return ENOMEM; + return; win32_cond->waiters_done = CreateEvent(NULL, TRUE, FALSE, NULL); if (!win32_cond->waiters_done) - return ENOMEM; + return; pthread_mutex_init(&win32_cond->mtx_waiter_count, NULL); pthread_mutex_init(&win32_cond->mtx_broadcast, NULL); - return 0; } static void pthread_cond_destroy(pthread_cond_t *cond) @@ -280,4 +278,4 @@ static void w32thread_init(void) } -#endif /* FFMPEG_COMPAT_W32PTHREADS_H */ +#endif /* LIBAV_COMPAT_W32PTHREADS_H */ diff --git a/configure b/configure index faaee7f715..ccf437f73a 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #!/bin/sh # -# FFmpeg configure script +# Libav configure script # # Copyright (c) 2000-2002 Fabrice Bellard # Copyright (c) 2005-2008 Diego Biurrun @@ -44,9 +44,9 @@ if test "$E1" != 0 || test "$E2" = 0; then echo "No compatible shell script interpreter found." echo "This configure script requires a POSIX-compatible shell" echo "such as bash or ksh." - echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH." + echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH." echo "Instead, install a working POSIX-compatible shell." - echo "Disabling this configure test will create a broken FFmpeg." + echo "Disabling this configure test will create a broken Libav." if test "$BASH_VERSION" = '2.04.0(1)-release'; then echo "This bash version ($BASH_VERSION) is broken on your platform." echo "Upgrade to a later version if available." @@ -78,17 +78,14 @@ Help options: Standard options: --logfile=FILE log tests and output to FILE [config.log] --disable-logging do not log configure debug information - --fatal-warnings fail if any configure warning is generated --prefix=PREFIX install in PREFIX [$prefix] --bindir=DIR install binaries in DIR [PREFIX/bin] - --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg] - --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg] + --datadir=DIR install data files in DIR [PREFIX/share/avconv] + --docdir=DIR install documentation in DIR [PREFIX/share/doc/libav] --libdir=DIR install libs in DIR [PREFIX/lib] --shlibdir=DIR install shared libs in DIR [PREFIX/lib] --incdir=DIR install includes in DIR [PREFIX/include] --mandir=DIR install man page in DIR [PREFIX/share/man] - --enable-rpath use rpath to allow installing libraries in paths - not part of the dynamic linker search path Licensing options: --enable-gpl allow use of GPL code, the resulting libs @@ -101,43 +98,31 @@ Configuration options: --disable-static do not build static libraries [no] --enable-shared build shared libraries [no] --enable-small optimize for size instead of speed - --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary) + --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary) --enable-gray enable full grayscale support (slower color) --disable-swscale-alpha disable alpha channel support in swscale --disable-all disable building components, libraries and programs - --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no] - --enable-raise-major increase major version numbers in sonames [no] Program options: --disable-programs do not build command line programs - --disable-ffmpeg disable ffmpeg build - --disable-ffplay disable ffplay build - --disable-ffprobe disable ffprobe build - --disable-ffserver disable ffserver build - -Documentation options: - --disable-doc do not build documentation - --disable-htmlpages do not build HTML documentation pages - --disable-manpages do not build man documentation pages - --disable-podpages do not build POD documentation pages - --disable-txtpages do not build text documentation pages + --disable-avconv disable avconv build + --disable-avplay disable avplay build + --disable-avprobe disable avprobe build + --disable-avserver disable avserver build Component options: + --disable-doc do not build documentation --disable-avdevice disable libavdevice build --disable-avcodec disable libavcodec build --disable-avformat disable libavformat build --disable-avutil disable libavutil build - --disable-swresample disable libswresample build --disable-swscale disable libswscale build - --disable-postproc disable libpostproc build - --disable-avfilter disable libavfilter build - --enable-avresample enable libavresample build [no] + --disable-avfilter disable video filter support [no] + --disable-avresample disable libavresample build [no] --disable-pthreads disable pthreads [auto] --disable-w32threads disable Win32 threads [auto] - --disable-os2threads disable OS/2 threads [auto] --disable-network disable network support [no] --disable-dct disable DCT code - --disable-dwt disable DWT code --disable-error-resilience disable error resilience code --disable-lsp disable LSP code --disable-lzo disable LZO decoder code @@ -146,10 +131,10 @@ Component options: --disable-fft disable FFT code Hardware accelerators: - --disable-dxva2 disable DXVA2 code [autodetect] - --disable-vaapi disable VAAPI code [autodetect] - --disable-vda disable VDA code [autodetect] - --disable-vdpau disable VDPAU code [autodetect] + --enable-dxva2 enable DXVA2 code + --enable-vaapi enable VAAPI code + --enable-vda enable VDA code + --enable-vdpau enable VDPAU code Individual component options: --disable-everything disable all components listed below @@ -190,56 +175,33 @@ Individual component options: External library support: --enable-avisynth enable reading of AviSynth script files [no] - --disable-bzlib disable bzlib [autodetect] - --enable-fontconfig enable fontconfig + --enable-bzlib enable bzlib [autodetect] --enable-frei0r enable frei0r video filtering --enable-gnutls enable gnutls [no] - --disable-iconv disable iconv [autodetect] - --enable-ladspa enable LADSPA audio filtering - --enable-libaacplus enable AAC+ encoding via libaacplus [no] - --enable-libass enable libass subtitles rendering [no] - --enable-libbluray enable BluRay reading using libbluray [no] --enable-libbs2b enable bs2b DSP library [no] - --enable-libcaca enable textual display using libcaca - --enable-libcelt enable CELT decoding via libcelt [no] --enable-libcdio enable audio CD grabbing with libcdio --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 and libraw1394 [no] --enable-libfaac enable AAC encoding via libfaac [no] --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no] - --enable-libflite enable flite (voice synthesis) support via libflite [no] --enable-libfreetype enable libfreetype [no] - --enable-libgme enable Game Music Emu via libgme [no] --enable-libgsm enable GSM de/encoding via libgsm [no] - --enable-libiec61883 enable iec61883 via libiec61883 [no] --enable-libilbc enable iLBC de/encoding via libilbc [no] - --enable-libmodplug enable ModPlug via libmodplug [no] --enable-libmp3lame enable MP3 encoding via libmp3lame [no] - --enable-libnut enable NUT (de)muxing via libnut, - native (de)muxer exists [no] --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] --enable-libopencv enable video filtering via libopencv [no] --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no] --enable-libopus enable Opus de/encoding via libopus [no] --enable-libpulse enable Pulseaudio input via libpulse [no] - --enable-libquvi enable quvi input via libquvi [no] --enable-librtmp enable RTMP[E] support via librtmp [no] --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no] - --enable-libshine enable fixed-point MP3 encoding via libshine [no] - --enable-libsoxr enable Include libsoxr resampling [no] --enable-libspeex enable Speex de/encoding via libspeex [no] - --enable-libssh enable SFTP protocol via libssh [no] - --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no] --enable-libtheora enable Theora encoding via libtheora [no] --enable-libtwolame enable MP2 encoding via libtwolame [no] - --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no] - --enable-libv4l2 enable libv4l2/v4l-utils [no] - --enable-libvidstab enable video stabilization using vid.stab [no] --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no] --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no] - --enable-libvorbis enable Vorbis en/decoding via libvorbis, - native implementation exists [no] + --enable-libvorbis enable Vorbis encoding via libvorbis [no] --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no] --enable-libwavpack enable wavpack encoding via libwavpack [no] --enable-libwebp enable WebP encoding via libwebp [no] @@ -248,23 +210,15 @@ External library support: --enable-libxavs enable AVS encoding via xavs [no] --enable-libxvid enable Xvid encoding via xvidcore, native MPEG-4/Xvid encoder exists [no] - --enable-libzmq enable message passing via libzmq [no] - --enable-libzvbi enable teletext support via libzvbi [no] - --enable-decklink enable Blackmagick DeckLink output [no] - --enable-openal enable OpenAL 1.1 capture support [no] - --enable-opencl enable OpenCL code - --enable-opengl enable OpenGL rendering [no] --enable-openssl enable openssl [no] --enable-x11grab enable X11 grabbing [no] - --disable-xlib disable xlib [autodetect] - --disable-zlib disable zlib [autodetect] + --enable-zlib enable zlib [autodetect] Toolchain options: --arch=ARCH select architecture [$arch] --cpu=CPU select the minimum required CPU (affects instruction selection, may crash on older CPUs) --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix] - --progs-suffix=SUFFIX program name suffix [] --enable-cross-compile assume a cross-compiler is used --sysroot=PATH root of cross-build tree --sysinclude=PATH location of cross-build system headers @@ -272,21 +226,16 @@ Toolchain options: --target-exec=CMD command to run executables on target --target-path=DIR path to view of build directory on target --target-samples=DIR path to samples directory on target - --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks --toolchain=NAME set tool defaults according to NAME --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default] - --nm=NM use nm tool NM [$nm_default] + --nm=NM use nm tool --ar=AR use archive tool AR [$ar_default] --as=AS use assembler AS [$as_default] - --windres=WINDRES use windows resource compiler WINDRES [$windres_default] - --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default] --cc=CC use C compiler CC [$cc_default] - --cxx=CXX use C compiler CXX [$cxx_default] --dep-cc=DEPCC use dependency generator DEPCC [$cc_default] - --ld=LD use linker LD [$ld_default] + --ld=LD use linker LD --pkg-config=PKGCONF use pkg-config PKGCONF [$pkg_config_default] --pkg-config-flags=FLAGS pass additional flags to pkgconf [] - --ranlib=RANLIB use ranlib RANLIB [$ranlib_default] --host-cc=HOSTCC use host C compiler HOSTCC --host-cflags=HCFLAGS use HCFLAGS when compiling for host --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host @@ -295,7 +244,6 @@ Toolchain options: --host-libs=HLIBS use libs HLIBS when linking for host --host-os=OS compiler host OS [$target_os] --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] - --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS] --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS] --extra-libs=ELIBS add ELIBS [$ELIBS] --extra-version=STRING version string suffix [] @@ -340,27 +288,14 @@ Optimization options (experts only): --disable-neon disable NEON optimizations --disable-inline-asm disable use of inline assembler --disable-yasm disable use of yasm assembler - --disable-mips32r2 disable MIPS32R2 optimizations - --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations - --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations - --disable-mipsfpu disable floating point MIPS optimizations - --disable-fast-unaligned consider unaligned accesses slow -Developer options (useful when working on FFmpeg itself): +Developer options (useful when working on Libav itself): --disable-debug disable debugging symbols --enable-debug=LEVEL set the debug level [$debuglevel] --disable-optimizations disable compiler optimizations --enable-extra-warnings enable more compiler warnings - --disable-stripping disable stripping of executables and shared libraries - --assert-level=level 0(default), 1 or 2, amount of assertion testing, - 2 causes a slowdown at runtime. - --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data - --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory - leaks and errors, using the specified valgrind binary. - Cannot be combined with --target-exec - --enable-ftrapv Trap arithmetic overflows --samples=PATH location of test samples for FATE, if not set use - \$FATE_SAMPLES at make invocation time. + \$LIBAV_SAMPLES at make invocation time. --enable-neon-clobber-test check NEON registers for clobbering (should be used only for debugging purposes) --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only; @@ -407,7 +342,7 @@ die(){ If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the -ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. +libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net. EOF if disabled logging; then cat <>file; - } else if (file ~ /\\.texi\$/) { - pre = -v ? \"\" : \"@c \"; - yesno = \$2; - c2 = tolower(c); - gsub(/_/, \"-\", c2); - printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file; } } }" @@ -743,10 +672,6 @@ add_cflags(){ append CFLAGS $($cflags_filter "$@") } -add_cxxflags(){ - append CXXFLAGS $($cflags_filter "$@") -} - add_asflags(){ append ASFLAGS $($asflags_filter "$@") } @@ -756,7 +681,7 @@ add_ldflags(){ } add_stripflags(){ - append ASMSTRIPFLAGS "$@" + append STRIPFLAGS "$@" } add_extralibs(){ @@ -786,11 +711,6 @@ check_cmd(){ "$@" >> $logfile 2>&1 } -check_stat(){ - log check_stat "$@" - stat "$1" >> $logfile 2>&1 -} - cc_o(){ eval printf '%s\\n' $CC_O } @@ -806,20 +726,6 @@ check_cc(){ check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC } -check_cxx(){ - log check_cxx "$@" - cat > $TMPCPP - log_file $TMPCPP - check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP -} - -check_oc(){ - log check_oc "$@" - cat > $TMPM - log_file $TMPM - check_cmd $cc -Werror=missing-prototypes $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPM -} - check_cpp(){ log check_cpp "$@" cat > $TMPC @@ -860,7 +766,7 @@ check_yasm(){ echo "$1" > $TMPS log_file $TMPS shift 1 - check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS + check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS } ld_o(){ @@ -869,11 +775,9 @@ ld_o(){ check_ld(){ log check_ld "$@" - type=$1 - shift 1 - flags=$(filter_out '-l*|*.so' $@) - libs=$(filter '-l*|*.so' $@) - check_$type $($cflags_filter $flags) || return + flags=$(filter_out '-l*' "$@") + libs=$(filter '-l*' "$@") + check_cc $($cflags_filter $flags) || return flags=$($ldflags_filter $flags) libs=$($ldflags_filter $libs) check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs @@ -920,17 +824,9 @@ check_cflags(){ test_cflags "$@" && add_cflags "$@" } -check_cxxflags(){ - log check_cxxflags "$@" - set -- $($cflags_filter "$@") - check_cxx "$@" <" - echo "int main(void) { return 0; }" - } | check_oc && check_stat "$TMPO" && enable_safe $headers -} - check_func(){ log check_func "$@" func=$1 shift disable $func - check_ld "cc" "$@" < float foo(float f, float g) { return $func($args); } -int main(void){ return (int) foo; } +int main(void){ return 0; } EOF } @@ -1015,26 +899,7 @@ check_func_headers(){ echo "long check_$func(void) { return (long) $func; }" done echo "int main(void) { return 0; }" - } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers -} - -check_class_headers_cpp(){ - log check_class_headers_cpp "$@" - headers=$1 - classes=$2 - shift 2 - { - for hdr in $headers; do - echo "#include <$hdr>" - done - echo "int main(void) { " - i=1 - for class in $classes; do - echo "$class obj$i;" - i=$(expr $i + 1) - done - echo "return 0; }" - } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers + } | check_ld "$@" && enable $funcs && enable_safe $headers } check_cpp_condition(){ @@ -1066,22 +931,13 @@ check_lib2(){ check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@" } -check_lib_cpp(){ - log check_lib_cpp "$@" - headers="$1" - classes="$2" - shift 2 - check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@" -} - check_pkg_config(){ log check_pkg_config "$@" - pkgandversion="$1" - pkg="${1%% *}" + pkg="$1" headers="$2" funcs="$3" shift 3 - check_cmd $pkg_config --exists --print-errors $pkgandversion || return + check_cmd $pkg_config --exists --print-errors $pkg || return pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" && @@ -1090,7 +946,7 @@ check_pkg_config(){ } check_exec(){ - check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } + check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } } check_exec_crash(){ @@ -1150,7 +1006,7 @@ check_builtin(){ builtin=$3 shift 3 disable "$name" - check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name" + check_code ld "$headers" "$builtin" "$@" && enable "$name" } check_compile_assert(){ @@ -1179,14 +1035,6 @@ require2(){ check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" } -require_cpp(){ - name="$1" - headers="$2" - classes="$3" - shift 3 - check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found" -} - require_pkg_config(){ pkg="$1" check_pkg_config "$@" || die "ERROR: $pkg not found" @@ -1194,26 +1042,6 @@ require_pkg_config(){ add_extralibs $(get_safe ${pkg}_libs) } -require_libfreetype(){ - log require_libfreetype "$@" - pkg="freetype2" - check_cmd $pkg_config --exists --print-errors $pkg \ - || die "ERROR: $pkg not found" - pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg) - pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg) - { - echo "#include " - echo "#include FT_FREETYPE_H" - echo "long check_func(void) { return (long) FT_Init_FreeType; }" - echo "int main(void) { return 0; }" - } | check_ld "cc" $pkg_cflags $pkg_libs \ - && set_safe ${pkg}_cflags $pkg_cflags \ - && set_safe ${pkg}_libs $pkg_libs \ - || die "ERROR: $pkg not found" - add_cflags $(get_safe ${pkg}_cflags) - add_extralibs $(get_safe ${pkg}_libs) -} - hostcc_e(){ eval printf '%s\\n' $HOSTCC_E } @@ -1294,69 +1122,39 @@ COMPONENT_LIST=" " EXAMPLE_LIST=" - avio_reading_example - decoding_encoding_example - demuxing_decoding_example + avcodec_example filter_audio_example - filtering_audio_example - filtering_video_example metadata_example - muxing_example - remuxing_example - resampling_audio_example - scaling_video_example + output_example transcode_aac_example - transcoding_example " EXTERNAL_LIBRARY_LIST=" avisynth bzlib - crystalhd - decklink frei0r gnutls - iconv - ladspa - libaacplus - libass - libbluray libbs2b - libcaca libcdio - libcelt libdc1394 libfaac libfdk_aac - libflite libfontconfig libfreetype - libgme libgsm - libiec61883 libilbc - libmodplug libmp3lame - libnut libopencore_amrnb libopencore_amrwb libopencv libopenjpeg libopus libpulse - libquvi librtmp libschroedinger - libshine - libsoxr libspeex - libssh - libstagefright_h264 libtheora libtwolame - libutvideo - libv4l2 - libvidstab libvo_aacenc libvo_amrwbenc libvorbis @@ -1367,27 +1165,12 @@ EXTERNAL_LIBRARY_LIST=" libx265 libxavs libxvid - libzmq - libzvbi - openal - opencl - opengl openssl x11grab - xlib zlib " -DOCUMENT_LIST=" - doc - htmlpages - manpages - podpages - txtpages -" - FEATURE_LIST=" - ftrapv gray hardcoded_tables runtime_cpudetect @@ -1404,7 +1187,6 @@ HWACCEL_LIST=" vaapi vda vdpau - xvmc " LIBRARY_LIST=" @@ -1414,8 +1196,6 @@ LIBRARY_LIST=" avformat avresample avutil - postproc - swresample swscale " @@ -1426,17 +1206,16 @@ LICENSE_LIST=" " PROGRAM_LIST=" - ffplay - ffprobe - ffserver - ffmpeg + avconv + avplay + avprobe + avserver " SUBSYSTEM_LIST=" dct - dwt + doc error_resilience - fast_unaligned fft lsp lzo @@ -1447,7 +1226,6 @@ SUBSYSTEM_LIST=" CONFIG_LIST=" $COMPONENT_LIST - $DOCUMENT_LIST $EXAMPLE_LIST $EXTERNAL_LIBRARY_LIST $FEATURE_LIST @@ -1456,21 +1234,17 @@ CONFIG_LIST=" $LIBRARY_LIST $PROGRAM_LIST $SUBSYSTEM_LIST - fontconfig - incompatible_libav_abi memalign_hack - memory_poisoning neon_clobber_test pic pod2man - raise_major + texi2html thumb xmm_clobber_test " THREADS_LIST=" pthreads - os2threads w32threads " @@ -1517,13 +1291,6 @@ ARCH_EXT_LIST_ARM=" vfpv3 " -ARCH_EXT_LIST_MIPS=" - mipsfpu - mips32r2 - mipsdspr1 - mipsdspr2 -" - ARCH_EXT_LIST_X86_SIMD=" amd3dnow amd3dnowext @@ -1559,8 +1326,8 @@ ARCH_EXT_LIST=" $ARCH_EXT_LIST_ARM $ARCH_EXT_LIST_PPC $ARCH_EXT_LIST_X86 - $ARCH_EXT_LIST_MIPS loongson + vis " ARCH_FEATURES=" @@ -1570,7 +1337,6 @@ ARCH_FEATURES=" fast_cmov local_aligned_8 local_aligned_16 - local_aligned_32 " BUILTIN_LIST=" @@ -1579,7 +1345,6 @@ BUILTIN_LIST=" MemoryBarrier mm_empty rdtsc - sarestart sync_val_compare_and_swap " HAVE_LIST_CMDLINE=" @@ -1591,17 +1356,14 @@ HAVE_LIST_CMDLINE=" HAVE_LIST_PUB=" bigendian fast_unaligned - incompatible_libav_abi " HEADERS_LIST=" alsa_asoundlib_h altivec_h arpa_inet_h - asm_types_h cdio_paranoia_h cdio_paranoia_paranoia_h - CL_cl_h dev_bktr_ioctl_bt848_h dev_bktr_ioctl_meteor_h dev_ic_bt8xx_h @@ -1610,15 +1372,12 @@ HEADERS_LIST=" direct_h dlfcn_h dxva_h - ES2_gl_h gsm_h io_h mach_mach_time_h machine_ioctl_bt848_h machine_ioctl_meteor_h malloc_h - openjpeg_1_5_openjpeg_h - OpenGL_gl3_h poll_h sndio_h soundcard_h @@ -1630,7 +1389,6 @@ HEADERS_LIST=" sys_time_h sys_un_h sys_videoio_h - termios_h unistd_h windows_h winsock2_h @@ -1639,7 +1397,6 @@ HEADERS_LIST=" MATH_FUNCS=" atanf atan2f - cbrt cbrtf cosf exp2 @@ -1665,9 +1422,7 @@ MATH_FUNCS=" " SYSTEM_FUNCS=" - access aligned_malloc - clock_gettime closesocket CommandLineToArgvW CoTaskMemFree @@ -1686,14 +1441,10 @@ SYSTEM_FUNCS=" getservbyport GetSystemTimeAsFileTime gettimeofday - glob - glXGetProcAddress inet_aton isatty jack_port_get_latency_range - kbhit localtime_r - lzo1x_999_compress mach_absolute_time MapViewOfFile memalign @@ -1701,20 +1452,18 @@ SYSTEM_FUNCS=" mmap mprotect nanosleep - PeekNamedPipe posix_memalign - pthread_cancel sched_getaffinity SetConsoleTextAttribute setmode setrlimit Sleep strerror_r + strptime sysconf sysctl usleep VirtualAlloc - wglGetProcAddress " TOOLCHAIN_FEATURES=" @@ -1724,13 +1473,9 @@ TOOLCHAIN_FEATURES=" ebp_available ebx_available gnu_as - gnu_windres ibm_asm inline_asm_labels - inline_asm_nonlocal_labels - inline_asm_direct_symbol_refs pragma_deprecated - rsync_contimeout symver_asm_label symver_gnu_asm vfp_args @@ -1746,11 +1491,9 @@ TYPES_LIST=" struct_ipv6_mreq struct_pollfd struct_rusage_ru_maxrss - struct_sctp_event_subscribe struct_sockaddr_in6 struct_sockaddr_sa_len struct_sockaddr_storage - struct_stat_st_mtim_tv_nsec struct_v4l2_frmivalenum_discrete " @@ -1771,16 +1514,11 @@ HAVE_LIST=" $TYPES_LIST atomics_native dos_paths - dxva2api_cobj dxva2_lib libc_msvcrt libdc1394_1 libdc1394_2 - makeinfo - perl - pod2man sdl - texi2html threads vdpau_x11 xlib @@ -1793,8 +1531,6 @@ CONFIG_EXTRA=" audio_frame_queue cabac dsputil - exif - frame_thread_encoder gcrypt golomb gplv3 @@ -1807,7 +1543,6 @@ CONFIG_EXTRA=" huffman intrax8 lgplv3 - llviddsp lpc mpegaudio mpegaudiodsp @@ -1837,8 +1572,6 @@ CMDLINE_SELECT=" logging lto optimizations - rpath - stripping " PATHS_LIST=" @@ -1857,22 +1590,18 @@ CMDLINE_SET=" ar arch as - assert_level build_suffix cc cpu cross_prefix - cxx dep_cc extra_version - gas host_cc host_cflags host_ld host_ldflags host_libs host_os - install ld logfile malloc_prefix @@ -1880,26 +1609,19 @@ CMDLINE_SET=" optflags pkg_config pkg_config_flags - progs_suffix random_seed - ranlib samples - strip sysinclude sysroot target_exec target_os target_path target_samples - tempprefix toolchain - valgrind - yasmexe " CMDLINE_APPEND=" extra_cflags - extra_cxxflags host_cppflags " @@ -1917,11 +1639,6 @@ vfpv3_deps="vfp" map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM -mipsfpu_deps="mips" -mips32r2_deps="mips" -mipsdspr1_deps="mips" -mipsdspr2_deps="mips" - altivec_deps="ppc" ppc4xx_deps="ppc" @@ -1965,6 +1682,7 @@ fast_unaligned_if_any="aarch64 ppc x86" need_memalign="altivec neon sse" # system capabilities +log2_deps="!libc_msvcrt" symver_if_any="symver_asm_label symver_gnu_asm" @@ -1979,12 +1697,11 @@ threads_if_any="$THREADS_LIST" # subsystems dct_select="rdft" error_resilience_select="dsputil" -frame_thread_encoder_deps="encoders threads" mdct_select="fft" rdft_select="fft" mpegaudio_select="mpegaudiodsp" mpegaudiodsp_select="dct" -mpegvideo_select="dsputil h264chroma hpeldsp videodsp" +mpegvideo_select="dsputil hpeldsp videodsp" mpegvideoenc_select="dsputil mpegvideo" # decoders / encoders @@ -1992,7 +1709,6 @@ aac_decoder_select="mdct sinewin" aac_encoder_select="audio_frame_queue mdct sinewin" aac_latm_decoder_select="aac_decoder aac_latm_parser" ac3_decoder_select="mdct ac3dsp ac3_parser dsputil" -ac3_fixed_decoder_select="mdct ac3dsp ac3_parser dsputil" ac3_encoder_select="mdct ac3dsp dsputil" ac3_fixed_encoder_select="mdct ac3dsp dsputil" aic_decoder_select="dsputil golomb" @@ -2000,8 +1716,7 @@ alac_encoder_select="lpc" als_decoder_select="dsputil" amrnb_decoder_select="lsp" amrwb_decoder_select="lsp" -amv_decoder_select="sp5x_decoder exif" -amv_encoder_select="aandcttables" +amv_decoder_select="sp5x_decoder" ape_decoder_select="dsputil" asv1_decoder_select="dsputil" asv1_encoder_select="dsputil" @@ -2010,7 +1725,6 @@ asv2_encoder_select="dsputil" atrac1_decoder_select="mdct sinewin" atrac3_decoder_select="mdct" atrac3p_decoder_select="mdct sinewin" -avrn_decoder_select="exif" bink_decoder_select="dsputil hpeldsp" binkaudio_dct_decoder_select="mdct rdft dct sinewin" binkaudio_rdft_decoder_select="mdct rdft sinewin" @@ -2021,18 +1735,17 @@ cook_decoder_select="dsputil mdct sinewin" cscd_decoder_select="lzo" cscd_decoder_suggest="zlib" dca_decoder_select="mdct" -dirac_decoder_select="dsputil dwt golomb videodsp" dnxhd_decoder_select="dsputil" dnxhd_encoder_select="aandcttables dsputil mpegvideoenc" dvvideo_decoder_select="dsputil" dvvideo_encoder_select="dsputil" -dxa_decoder_select="zlib" +dxa_decoder_deps="zlib" eac3_decoder_select="ac3_decoder" eac3_encoder_select="ac3_encoder" eamad_decoder_select="aandcttables dsputil mpegvideo" -eatgq_decoder_select="aandcttables" +eatgq_decoder_select="aandcttables dsputil" eatqi_decoder_select="aandcttables dsputil error_resilience mpegvideo" -exr_decoder_select="zlib" +exr_decoder_deps="zlib" ffv1_decoder_select="golomb rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" @@ -2040,16 +1753,15 @@ ffvhuff_encoder_select="huffyuv_encoder" fic_decoder_select="golomb" flac_decoder_select="golomb" flac_encoder_select="dsputil golomb lpc" -flashsv_decoder_select="zlib" -flashsv_encoder_select="zlib" -flashsv2_encoder_select="zlib" -flashsv2_decoder_select="zlib" +flashsv_decoder_deps="zlib" +flashsv_encoder_deps="zlib" +flashsv2_decoder_deps="zlib" flv_decoder_select="h263_decoder" flv_encoder_select="h263_encoder" fourxm_decoder_select="dsputil" fraps_decoder_select="dsputil huffman" -g2m_decoder_select="dsputil zlib" -g729_decoder_select="dsputil" +g2m_decoder_deps="zlib" +g2m_decoder_select="dsputil" h261_decoder_select="error_resilience mpegvideo" h261_encoder_select="aandcttables mpegvideoenc" h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo" @@ -2059,8 +1771,8 @@ h263p_encoder_select="h263_encoder" h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp" h264_decoder_suggest="error_resilience" hevc_decoder_select="cabac dsputil golomb videodsp" -huffyuv_decoder_select="dsputil llviddsp" -huffyuv_encoder_select="dsputil huffman llviddsp" +huffyuv_decoder_select="dsputil" +huffyuv_encoder_select="dsputil huffman" iac_decoder_select="imc_decoder" imc_decoder_select="dsputil fft mdct sinewin" indeo3_decoder_select="hpeldsp" @@ -2074,7 +1786,7 @@ loco_decoder_select="golomb" mdec_decoder_select="dsputil error_resilience mpegvideo" metasound_decoder_select="lsp mdct sinewin" mimic_decoder_select="dsputil hpeldsp" -mjpeg_decoder_select="dsputil hpeldsp exif" +mjpeg_decoder_select="dsputil hpeldsp" mjpeg_encoder_select="aandcttables mpegvideoenc" mjpegb_decoder_select="mjpeg_decoder" mlp_decoder_select="mlp_parser" @@ -2094,9 +1806,9 @@ mpc8_decoder_select="mpegaudiodsp" mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" mpeg_xvmc_decoder_select="mpeg2video_decoder" mpeg1video_decoder_select="error_resilience mpegvideo" -mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp" +mpeg1video_encoder_select="aandcttables mpegvideoenc" mpeg2video_decoder_select="error_resilience mpegvideo" -mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp" +mpeg2video_encoder_select="aandcttables mpegvideoenc" mpeg4_decoder_select="h263_decoder mpeg4video_parser" mpeg4_encoder_select="h263_encoder" msmpeg4v1_decoder_select="h263_decoder" @@ -2110,17 +1822,16 @@ nellymoser_decoder_select="mdct sinewin" nellymoser_encoder_select="audio_frame_queue mdct sinewin" nuv_decoder_select="dsputil lzo" on2avc_decoder_select="mdct" -opus_decoder_deps="swresample" -png_decoder_select="zlib" -png_encoder_select="dsputil zlib" +opus_decoder_deps="avresample" +png_decoder_deps="zlib" +png_encoder_deps="zlib" +png_encoder_select="dsputil" prores_decoder_select="dsputil" prores_encoder_select="dsputil" qcelp_decoder_select="lsp" qdm2_decoder_select="mdct rdft mpegaudiodsp" ra_144_encoder_select="audio_frame_queue lpc" ralf_decoder_select="golomb" -rawvideo_decoder_select="dsputil" -rtjpeg_decoder_select="dsputil" rv10_decoder_select="error_resilience h263_decoder h263dsp" rv10_encoder_select="h263_encoder" rv20_decoder_select="error_resilience h263_decoder h263dsp" @@ -2129,11 +1840,6 @@ rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvi rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp" shorten_decoder_select="golomb" sipr_decoder_select="lsp" -snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder" -snow_encoder_select="aandcttables dsputil dwt h264qpel hpeldsp mpegvideoenc rangecoder" -sonic_decoder_select="golomb rangecoder" -sonic_encoder_select="golomb rangecoder" -sonic_ls_encoder_select="golomb rangecoder" sp5x_decoder_select="mjpeg_decoder" svq1_decoder_select="hpeldsp" svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc" @@ -2144,10 +1850,10 @@ theora_decoder_select="vp3_decoder" thp_decoder_select="mjpeg_decoder" tiff_decoder_suggest="zlib" tiff_encoder_suggest="zlib" -truehd_decoder_select="mlp_parser" +truehd_decoder_select="mlp_decoder" truemotion2_decoder_select="dsputil" truespeech_decoder_select="dsputil" -tscc_decoder_select="zlib" +tscc_decoder_deps="zlib" twinvq_decoder_select="mdct lsp sinewin" utvideo_decoder_select="dsputil" utvideo_encoder_select="dsputil huffman" @@ -2163,7 +1869,7 @@ vp6a_decoder_select="vp6_decoder" vp6f_decoder_select="vp6_decoder" vp7_decoder_select="h264pred videodsp" vp8_decoder_select="h264pred videodsp" -vp9_decoder_select="videodsp vp9_parser" +vp9_decoder_select="videodsp" webp_decoder_select="vp8_decoder" wmapro_decoder_select="mdct sinewin" wmav1_decoder_select="mdct sinewin" @@ -2177,105 +1883,73 @@ wmv2_decoder_select="h263_decoder intrax8 videodsp" wmv2_encoder_select="h263_encoder" wmv3_decoder_select="vc1_decoder" wmv3image_decoder_select="wmv3_decoder" -zerocodec_decoder_select="zlib" -zlib_decoder_select="zlib" -zlib_encoder_select="zlib" -zmbv_decoder_select="zlib" -zmbv_encoder_select="zlib" +zerocodec_decoder_deps="zlib" +zlib_decoder_deps="zlib" +zlib_encoder_deps="zlib" +zmbv_decoder_deps="zlib" +zmbv_encoder_deps="zlib" # hardware accelerators -crystalhd_deps="libcrystalhd_libcrystalhd_if_h" dxva2_deps="dxva2api_h" vaapi_deps="va_va_h" vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore" vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" -xvmc_deps="X11_extensions_XvMClib_h" h263_vaapi_hwaccel_deps="vaapi" h263_vaapi_hwaccel_select="h263_decoder" h263_vdpau_hwaccel_deps="vdpau" h263_vdpau_hwaccel_select="h263_decoder" -h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" -h264_vda_decoder_deps="vda" -h264_vda_decoder_select="h264_decoder" h264_vda_hwaccel_deps="vda" h264_vda_hwaccel_select="h264_decoder" h264_vda_old_hwaccel_deps="vda" h264_vda_old_hwaccel_select="h264_decoder" -h264_vdpau_decoder_deps="vdpau" -h264_vdpau_decoder_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" h264_vdpau_hwaccel_select="h264_decoder" -mpeg_vdpau_decoder_deps="vdpau" -mpeg_vdpau_decoder_select="mpeg2video_decoder" -mpeg_xvmc_hwaccel_deps="xvmc" -mpeg_xvmc_hwaccel_select="mpeg2video_decoder" -mpeg1_vdpau_decoder_deps="vdpau" -mpeg1_vdpau_decoder_select="mpeg1video_decoder" mpeg1_vdpau_hwaccel_deps="vdpau" mpeg1_vdpau_hwaccel_select="mpeg1video_decoder" -mpeg1_xvmc_hwaccel_deps="xvmc" -mpeg1_xvmc_hwaccel_select="mpeg1video_decoder" -mpeg2_crystalhd_decoder_select="crystalhd" mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" mpeg2_vaapi_hwaccel_deps="vaapi" mpeg2_vaapi_hwaccel_select="mpeg2video_decoder" mpeg2_vdpau_hwaccel_deps="vdpau" mpeg2_vdpau_hwaccel_select="mpeg2video_decoder" -mpeg2_xvmc_hwaccel_deps="xvmc" -mpeg2_xvmc_hwaccel_select="mpeg2video_decoder" -mpeg4_crystalhd_decoder_select="crystalhd" mpeg4_vaapi_hwaccel_deps="vaapi" mpeg4_vaapi_hwaccel_select="mpeg4_decoder" -mpeg4_vdpau_decoder_deps="vdpau" -mpeg4_vdpau_decoder_select="mpeg4_decoder" mpeg4_vdpau_hwaccel_deps="vdpau" mpeg4_vdpau_hwaccel_select="mpeg4_decoder" -msmpeg4_crystalhd_decoder_select="crystalhd" -vc1_crystalhd_decoder_select="crystalhd" vc1_dxva2_hwaccel_deps="dxva2" vc1_dxva2_hwaccel_select="vc1_decoder" vc1_vaapi_hwaccel_deps="vaapi" vc1_vaapi_hwaccel_select="vc1_decoder" -vc1_vdpau_decoder_deps="vdpau" -vc1_vdpau_decoder_select="vc1_decoder" vc1_vdpau_hwaccel_deps="vdpau" vc1_vdpau_hwaccel_select="vc1_decoder" -wmv3_crystalhd_decoder_select="crystalhd" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" -wmv3_vdpau_decoder_select="vc1_vdpau_decoder" wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # parsers h264_parser_select="h264_decoder" -hevc_parser_select="hevc_decoder" mpeg4video_parser_select="error_resilience h263dsp mpegvideo" mpegvideo_parser_select="error_resilience mpegvideo" vc1_parser_select="mpegvideo" # external libraries -libaacplus_encoder_deps="libaacplus" -libcelt_decoder_deps="libcelt" libfaac_encoder_deps="libfaac" libfaac_encoder_select="audio_frame_queue" libfdk_aac_decoder_deps="libfdk_aac" libfdk_aac_encoder_deps="libfdk_aac" libfdk_aac_encoder_select="audio_frame_queue" -libgme_demuxer_deps="libgme" libgsm_decoder_deps="libgsm" libgsm_encoder_deps="libgsm" libgsm_ms_decoder_deps="libgsm" libgsm_ms_encoder_deps="libgsm" libilbc_decoder_deps="libilbc" libilbc_encoder_deps="libilbc" -libmodplug_demuxer_deps="libmodplug" libmp3lame_encoder_deps="libmp3lame" libmp3lame_encoder_select="audio_frame_queue" libopencore_amrnb_decoder_deps="libopencore_amrnb" @@ -2287,21 +1961,16 @@ libopenjpeg_encoder_deps="libopenjpeg" libopus_decoder_deps="libopus" libopus_encoder_deps="libopus" libopus_encoder_select="audio_frame_queue" -libquvi_demuxer_deps="libquvi" libschroedinger_decoder_deps="libschroedinger" libschroedinger_encoder_deps="libschroedinger" -libshine_encoder_deps="libshine" -libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" -libstagefright_h264_decoder_deps="libstagefright_h264" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_aacenc_encoder_deps="libvo_aacenc" libvo_aacenc_encoder_select="audio_frame_queue" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" -libvorbis_decoder_deps="libvorbis" libvorbis_encoder_deps="libvorbis" libvorbis_encoder_select="audio_frame_queue" libvpx_vp8_decoder_deps="libvpx" @@ -2311,39 +1980,29 @@ libvpx_vp9_encoder_deps="libvpx" libwavpack_encoder_deps="libwavpack" libwebp_encoder_deps="libwebp" libx264_encoder_deps="libx264" -libx264rgb_encoder_deps="libx264" libx265_encoder_deps="libx265" libxavs_encoder_deps="libxavs" libxvid_encoder_deps="libxvid" -libutvideo_decoder_deps="libutvideo" -libutvideo_encoder_deps="libutvideo" -libzvbi_teletext_decoder_deps="libzvbi" # demuxers / muxers ac3_demuxer_select="ac3_parser" asf_demuxer_select="riffdec" asf_muxer_select="riffenc" asf_stream_muxer_select="asf_muxer" -avi_demuxer_select="riffdec exif" +avi_demuxer_select="riffdec" avi_muxer_select="riffenc" avisynth_demuxer_deps="avisynth" avisynth_demuxer_select="riffdec" caf_demuxer_select="riffdec" dirac_demuxer_select="dirac_parser" -dts_demuxer_select="dca_parser" -dtshd_demuxer_select="dca_parser" dxa_demuxer_select="riffdec" eac3_demuxer_select="ac3_parser" f4v_muxer_select="mov_muxer" flac_demuxer_select="flac_parser" hds_muxer_select="flv_muxer" hls_muxer_select="mpegts_muxer" -image2_alias_pix_demuxer_select="image2_demuxer" -image2_brender_pix_demuxer_select="image2_demuxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" -libnut_demuxer_deps="libnut" -libnut_muxer_deps="libnut" matroska_audio_muxer_select="matroska_muxer" matroska_demuxer_select="riffdec" matroska_demuxer_suggest="bzlib lzo zlib" @@ -2373,69 +2032,40 @@ spdif_muxer_select="aac_parser" tak_demuxer_select="tak_parser" tg2_muxer_select="mov_muxer" tgp_muxer_select="mov_muxer" -vobsub_demuxer_select="mpegps_demuxer" w64_demuxer_select="wav_demuxer" -w64_muxer_select="wav_muxer" wav_demuxer_select="riffdec" wav_muxer_select="riffenc" webm_muxer_select="riffenc" wtv_demuxer_select="riffdec" -wtv_muxer_select="riffenc" xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" # indevs / outdevs alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" alsa_outdev_deps="alsa_asoundlib_h" -avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia" -avfoundation_indev_select="avfoundation" bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" -caca_outdev_deps="libcaca" -decklink_outdev_deps="decklink pthreads" -decklink_outdev_extralibs="-lstdc++" -dshow_indev_deps="IBaseFilter" -dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid" dv1394_indev_deps="dv1394" dv1394_indev_select="dv_demuxer" fbdev_indev_deps="linux_fb_h" -fbdev_outdev_deps="linux_fb_h" -gdigrab_indev_deps="CreateDIBSection" -gdigrab_indev_extralibs="-lgdi32" -gdigrab_indev_select="bmp_decoder" -iec61883_indev_deps="libiec61883" -jack_indev_deps="jack_jack_h sem_timedwait" -lavfi_indev_deps="avfilter" +jack_indev_deps="jack_jack_h pthreads" libcdio_indev_deps="libcdio" libdc1394_indev_deps="libdc1394" -libv4l2_indev_deps="libv4l2" -openal_indev_deps="openal" -opengl_outdev_deps="opengl" oss_indev_deps_any="soundcard_h sys_soundcard_h" oss_outdev_deps_any="soundcard_h sys_soundcard_h" pulse_indev_deps="libpulse" -pulse_outdev_deps="libpulse" -qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore" -qtkit_indev_select="qtkit" -sdl_outdev_deps="sdl" sndio_indev_deps="sndio_h" sndio_outdev_deps="sndio_h" -v4l_indev_deps="linux_videodev_h" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" -v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h" vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines" vfwcap_indev_extralibs="-lavicap32" -xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute" -xv_outdev_extralibs="-lXv -lX11 -lXext" -x11grab_indev_deps="x11grab" +x11grab_indev_deps="x11grab XShmCreateImage" # protocols -bluray_protocol_deps="libbluray" ffrtmpcrypt_protocol_deps="!librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl" ffrtmpcrypt_protocol_select="tcp_protocol" ffrtmphttp_protocol_deps="!librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" -ftp_protocol_select="tcp_protocol" gopher_protocol_select="network" http_protocol_select="tcp_protocol" httpproxy_protocol_select="tcp_protocol" @@ -2445,7 +2075,6 @@ librtmpe_protocol_deps="librtmp" librtmps_protocol_deps="librtmp" librtmpt_protocol_deps="librtmp" librtmpte_protocol_deps="librtmp" -libssh_protocol_deps="libssh" mmsh_protocol_select="http_protocol" mmst_protocol_select="network" rtmp_protocol_deps="!librtmp_protocol" @@ -2468,85 +2097,28 @@ unix_protocol_deps="sys_un_h" unix_protocol_select="network" # filters -aconvert_filter_deps="swresample" -amovie_filter_deps="avcodec avformat" -aresample_filter_deps="swresample" -ass_filter_deps="libass" -asyncts_filter_deps="avresample" -atempo_filter_deps="avcodec" -atempo_filter_select="rdft" -azmq_filter_deps="libzmq" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" -colormatrix_filter_deps="gpl" cropdetect_filter_deps="gpl" -dctdnoiz_filter_deps="avcodec" -dctdnoiz_filter_select="dct" delogo_filter_deps="gpl" -deshake_filter_deps="avcodec" -deshake_filter_select="dsputil" drawtext_filter_deps="libfreetype" -ebur128_filter_deps="gpl" -flite_filter_deps="libflite" frei0r_filter_deps="frei0r dlopen" frei0r_filter_extralibs='$ldl' frei0r_src_filter_deps="frei0r dlopen" frei0r_src_filter_extralibs='$ldl' -geq_filter_deps="gpl" -histeq_filter_deps="gpl" hqdn3d_filter_deps="gpl" interlace_filter_deps="gpl" -kerndeint_filter_deps="gpl" -ladspa_filter_deps="ladspa dlopen" -ladspa_filter_extralibs='$ldl' -mcdeint_filter_deps="avcodec gpl" -movie_filter_deps="avcodec avformat" -mp_filter_deps="gpl avcodec swscale inline_asm" -mpdecimate_filter_deps="gpl avcodec" -mptestsrc_filter_deps="gpl" -negate_filter_deps="lut_filter" -perspective_filter_deps="gpl" ocv_filter_deps="libopencv" -owdenoise_filter_deps="gpl" -pan_filter_deps="swresample" -phase_filter_deps="gpl" -pp_filter_deps="gpl postproc" -pullup_filter_deps="gpl" -removelogo_filter_deps="avcodec avformat swscale" resample_filter_deps="avresample" -sab_filter_deps="gpl swscale" scale_filter_deps="swscale" -smartblur_filter_deps="gpl swscale" -showspectrum_filter_deps="avcodec" -showspectrum_filter_select="rdft" -spp_filter_deps="gpl avcodec" -spp_filter_select="fft" -stereo3d_filter_deps="gpl" -subtitles_filter_deps="avformat avcodec libass" -super2xsai_filter_deps="gpl" -tinterlace_filter_deps="gpl" -vidstabdetect_filter_deps="libvidstab" -vidstabtransform_filter_deps="libvidstab" -pixfmts_super2xsai_test_deps="super2xsai_filter" -tinterlace_merge_test_deps="tinterlace_filter" -tinterlace_pad_test_deps="tinterlace_filter" -zmq_filter_deps="libzmq" # examples -avio_reading="avformat avcodec avutil" avcodec_example_deps="avcodec avutil" -demuxing_decoding_example_deps="avcodec avformat avutil" filter_audio_example_deps="avfilter avutil" -filtering_audio_example_deps="avfilter avcodec avformat avutil" -filtering_video_example_deps="avfilter avcodec avformat avutil" metadata_example_deps="avformat avutil" -muxing_example_deps="avcodec avformat avutil swscale" -remuxing_example_deps="avcodec avformat avutil" -resampling_audio_example_deps="avutil swresample" -scaling_video_example_deps="avutil swscale" -transcode_aac_example_deps="avcodec avformat swresample" -transcoding_example_deps="avfilter avcodec avformat avutil" +output_example_deps="avcodec avformat avutil swscale" +transcode_aac_example_deps="avcodec avformat avresample" # libraries, in linking order avcodec_deps="avutil" @@ -2554,28 +2126,23 @@ avdevice_deps="avformat avcodec avutil" avfilter_deps="avutil" avformat_deps="avcodec avutil" avresample_deps="avutil" -postproc_deps="avutil gpl" -swresample_deps="avutil" swscale_deps="avutil" # programs -ffmpeg_deps="avcodec avfilter avformat swresample" -ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter - null_filter +avconv_deps="avcodec avfilter avformat avresample swscale" +avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter + fps_filter null_filter resample_filter scale_filter setpts_filter trim_filter" -ffplay_deps="avcodec avformat swscale swresample sdl" -ffplay_libs='$sdl_libs' -ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter" -ffprobe_deps="avcodec avformat" -ffserver_deps="avformat fork sarestart" -ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer" +avplay_deps="avcodec avformat avresample swscale sdl" +avplay_libs='$sdl_libs' +avplay_select="rdft" +avprobe_deps="avcodec avformat" +avserver_deps="avformat fork !shared" +avserver_select="ffm_muxer rtp_protocol rtsp_demuxer" # documentation -podpages_deps="perl" -manpages_deps="perl pod2man" -htmlpages_deps="perl texi2html" -txtpages_deps="perl makeinfo" -doc_deps_any="manpages htmlpages podpages txtpages" +pod2man_deps="doc" +texi2html_deps="doc" # default parameters @@ -2584,8 +2151,8 @@ logfile="config.log" # installation paths prefix_default="/usr/local" bindir_default='${prefix}/bin' -datadir_default='${prefix}/share/ffmpeg' -docdir_default='${prefix}/share/doc/ffmpeg' +datadir_default='${prefix}/share/avconv' +docdir_default='${prefix}/share/doc/libav' incdir_default='${prefix}/include' libdir_default='${prefix}/lib' mandir_default='${prefix}/share/man' @@ -2594,52 +2161,39 @@ shlibdir_default="$libdir_default" # toolchain ar_default="ar" cc_default="gcc" -cxx_default="g++" host_cc_default="gcc" cp_f="cp -f" -install="install" ln_s="ln -s -f" nm_default="nm -g" objformat="elf" pkg_config_default=pkg-config -ranlib_default="ranlib" -strip_default="strip" -yasmexe_default="yasm" -windres_default="windres" +ranlib="ranlib" +strip="strip" +yasmexe="yasm" nogas=":" +# machine +arch_default=$(uname -m) +cpu="generic" + # OS target_os_default=$(tolower $(uname -s)) host_os=$target_os_default -# machine -if test "$target_os_default" = aix; then - arch_default=$(uname -p) -else - arch_default=$(uname -m) -fi -cpu="generic" - # configurable options -enable $PROGRAM_LIST -enable $DOCUMENT_LIST -enable $EXAMPLE_LIST -enable $(filter_out avresample $LIBRARY_LIST) -enable stripping +enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST enable asm enable debug enable doc enable optimizations -enable runtime_cpudetect enable safe_bitstream_reader enable static enable swscale_alpha -# Enable hwaccels by default. -enable dxva2 vaapi vda vdpau xvmc -enable xlib +# By default, enable only those hwaccels that have no external dependencies. +enable dxva2 vdpau # build settings SHFLAGS='-shared -Wl,-soname,$$(@F)' @@ -2665,8 +2219,6 @@ AS_O='-o $@' CC_C='-c' CC_E='-E -o $@' CC_O='-o $@' -CXX_C='-c' -CXX_O='-o $@' LD_O='-o $@' LD_LIB='-l%' LD_PATH='-L' @@ -2701,7 +2253,7 @@ for v in "$@"; do r=${v#*=} l=${v%"$r"} r=$(sh_quote "$r") - FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" + LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}" done find_things(){ @@ -2821,9 +2373,7 @@ for opt do is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" eval list=\$$(toupper $thing)_LIST name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing} - list=$(filter "$name" $list) - [ "$list" = "" ] && warn "Option $opt did not match anything" - $action $list + $action $(filter "$name" $list) ;; --enable-?*|--disable-?*) eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') @@ -2844,8 +2394,6 @@ for opt do ;; --help|-h) show_help ;; - --fatal-warnings) enable fatal_warnings - ;; *) optname="${opt%%=*}" optname="${optname#--}" @@ -2863,7 +2411,7 @@ done disabled logging && logfile=/dev/null -echo "# $0 $FFMPEG_CONFIGURATION" > $logfile +echo "# $0 $LIBAV_CONFIGURATION" > $logfile set >> $logfile test -n "$cross_prefix" && enable cross_compile @@ -2875,17 +2423,13 @@ fi ar_default="${cross_prefix}${ar_default}" cc_default="${cross_prefix}${cc_default}" -cxx_default="${cross_prefix}${cxx_default}" nm_default="${cross_prefix}${nm_default}" pkg_config_default="${cross_prefix}${pkg_config_default}" -ranlib_default="${cross_prefix}${ranlib_default}" -strip_default="${cross_prefix}${strip_default}" -windres_default="${cross_prefix}${windres_default}" +ranlib="${cross_prefix}${ranlib}" +strip="${cross_prefix}${strip}" sysinclude_default="${sysroot}/usr/include" -test -n "$valgrind" && toolchain="valgrind-memcheck" - case "$toolchain" in clang-asan) cc_default="clang" @@ -2899,7 +2443,7 @@ case "$toolchain" in ;; clang-usan) cc_default="clang" - add_cflags -fsanitize=undefined + add_cflags -fsanitize=undefined -O1 add_ldflags -fsanitize=undefined ;; gcc-asan) @@ -2918,17 +2462,17 @@ case "$toolchain" in add_ldflags -fsanitize=undefined ;; valgrind-massif) - target_exec_default=${valgrind:-"valgrind"} - target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc" + target_exec_default="valgrind" + target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz" ;; valgrind-memcheck) - target_exec_default=${valgrind:-"valgrind"} - target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp" + target_exec_default="valgrind" + target_exec_args="--track-origins=yes --leak-check=full" ;; msvc) # Check whether the current MSVC version needs the C99 converter. # From MSVC 2013 (compiler major version 18) onwards, it does actually - # support enough of C99 to build ffmpeg. Default to the new + # support enough of C99 to build libav. Default to the new # behaviour if the regexp was unable to match anything, since this # successfully parses the version number of existing supported # versions that require the converter (MSVC 2010 and 2012). @@ -2969,7 +2513,7 @@ case "$toolchain" in ;; esac -set_default arch cc cxx pkg_config ranlib strip sysinclude target_exec target_os yasmexe +set_default arch cc pkg_config sysinclude target_exec target_os enabled cross_compile || host_cc_default=$cc set_default host_cc @@ -2992,11 +2536,7 @@ HOSTEXESUF=$(exesuf $host_os) : ${TMPDIR:=$TMP} : ${TMPDIR:=/tmp} -if [ -n "$tempprefix" ] ; then - mktemp(){ - echo $tempprefix.${HOSTNAME}.${UID} - } -elif ! check_cmd mktemp -u XXXXXX; then +if ! check_cmd mktemp -u XXXXXX; then # simple replacement for missing mktemp # NOT SAFE FOR GENERAL USE mktemp(){ @@ -3016,10 +2556,8 @@ trap 'rm -f -- $TMPFILES' EXIT tmpfile TMPASM .asm tmpfile TMPC .c -tmpfile TMPCPP .cpp tmpfile TMPE $EXESUF tmpfile TMPH .h -tmpfile TMPM .m tmpfile TMPO .o tmpfile TMPS .S tmpfile TMPSH .sh @@ -3105,7 +2643,6 @@ msvc_flags(){ -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \ -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \ -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \ - -wd4554 \ -wd4273 ;; esac done @@ -3123,15 +2660,6 @@ icl_flags(){ done } -icc_flags(){ - for flag; do - case $flag in - -flto) echo -ipo ;; - *) echo $flag ;; - esac - done -} - pgi_flags(){ for flag; do case $flag in @@ -3160,16 +2688,9 @@ suncc_flags(){ prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;; *-sse3) echo -xarch=sse3 ;; core2) echo -xarch=ssse3 -xchip=core2 ;; - bonnell) echo -xarch=ssse3 ;; - corei7|nehalem) echo -xtarget=nehalem ;; - westmere) echo -xtarget=westmere ;; - silvermont) echo -xarch=sse4_2 ;; - corei7-avx|sandybridge) echo -xtarget=sandybridge ;; - core-avx*|ivybridge|haswell|broadwell) - echo -xarch=avx ;; - amdfam10|barcelona) echo -xtarget=barcelona ;; - btver1) echo -xarch=amdsse4a ;; - btver2|bdver*) echo -xarch=avx ;; + corei7) echo -xarch=sse4_2 -xchip=nehalem ;; + corei7-avx) echo -xarch=avx -xchip=sandybridge ;; + amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;; athlon-4|athlon-[mx]p) echo -xarch=ssea ;; k8|opteron|athlon64|athlon-fx) echo -xarch=sse2a ;; @@ -3225,9 +2746,7 @@ probe_cc(){ unset _depflags _DEPCMD _DEPFLAGS _flags_filter=echo - if $_cc --version 2>&1 | grep -q '^GNU assembler'; then - true # no-op to avoid reading stdin in following checks - elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then + if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then _type=llvm_gcc gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)') _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver" @@ -3253,7 +2772,6 @@ probe_cc(){ _cflags_speed='-O3' _cflags_size='-Os' _cflags_noopt='-O1' - _flags_filter=icc_flags elif $_cc -v 2>&1 | grep -q xlc; then _type=xlc _ident=$($_cc -qversion 2>/dev/null | head -n1) @@ -3327,7 +2845,7 @@ probe_cc(){ opt_common='-alias=ansi -Mdse -Mlre -Mpre' _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common" _cflags_size="-O2 -Munroll=c:1 $opt_common" - _cflags_noopt="-O" + _cflags_noopt="-O1" _flags_filter=pgi_flags elif $_cc 2>&1 | grep -q Microsoft; then _type=msvc @@ -3351,7 +2869,6 @@ probe_cc(){ if [ $pfx = hostcc ]; then append _cflags -Dsnprintf=_snprintf fi - disable stripping elif $_cc 2>&1 | grep -q Intel; then _type=icl _ident=$($cc 2>&1 | head -n1) @@ -3372,9 +2889,9 @@ probe_cc(){ _ld_path='-libpath:' # -Qdiag-error to make icl error when seeing certain unknown arguments _flags='-nologo -Qdiag-error:4044,10157' - # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency + # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency # with MSVC which enables it by default. - _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS -fp:precise' + _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS' if [ $pfx = hostcc ]; then append _cflags -Dsnprintf=_snprintf fi @@ -3426,7 +2943,7 @@ test -n "$cc_type" && enable $cc_type || : ${dep_cc_default:=$cc} : ${ld_default:=$cc} : ${host_ld_default:=$host_cc} -set_default ar as dep_cc ld host_ld windres +set_default ar as dep_cc ld host_ld probe_cc as "$as" asflags_filter=$_flags_filter @@ -3468,7 +2985,6 @@ else fi add_cflags $extra_cflags -add_cxxflags $extra_cxxflags add_asflags $extra_cflags if test -n "$sysroot"; then @@ -3476,9 +2992,6 @@ if test -n "$sysroot"; then gcc|llvm_gcc|clang) add_cppflags --sysroot="$sysroot" add_ldflags --sysroot="$sysroot" -# On Darwin --sysroot may be ignored, -isysroot always affects headers and linking - add_cppflags -isysroot "$sysroot" - add_ldflags -isysroot "$sysroot" ;; tms470) add_cppflags -I"$sysinclude" @@ -3514,7 +3027,7 @@ case "$arch" in aarch64|arm64) arch="aarch64" ;; - arm*|iPad*|iPhone*) + arm*) arch="arm" ;; mips*|IP*) @@ -3538,7 +3051,7 @@ case "$arch" in tilegx|tile-gx) arch="tilegx" ;; - i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64) + i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64) arch="x86" ;; esac @@ -3616,10 +3129,7 @@ elif enabled arm; then case "$subarch" in armv5t*) enable fast_clz ;; - armv[6-8]*) - enable fast_clz - disabled fast_unaligned || enable fast_unaligned - ;; + armv[6-8]*) enable fast_clz fast_unaligned ;; esac elif enabled avr32; then @@ -3651,28 +3161,6 @@ elif enabled mips; then cpuflags="-march=$cpu" - case $cpu in - 24kc) - disable mipsfpu - disable mipsdspr1 - disable mipsdspr2 - ;; - 24kf*) - disable mipsdspr1 - disable mipsdspr2 - ;; - 24kec|34kc|1004kc) - disable mipsfpu - disable mipsdspr2 - ;; - 24kef*|34kf*|1004kf*) - disable mipsdspr2 - ;; - 74kc) - disable mipsfpu - ;; - esac - elif enabled ppc; then disable ldbrx @@ -3750,8 +3238,7 @@ elif enabled x86; then disable i686 ;; # targets that do support nopl and conditional mov (cmov) - i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\ - |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|amdfam10|barcelona|b[dt]ver*) + i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx|core2|corei7*|amdfam10|barcelona|atom|bdver*) cpuflags="-march=$cpu" enable i686 enable fast_cmov @@ -3785,7 +3272,6 @@ if test "$?" != 0; then fi add_cppflags -D_ISOC99_SOURCE -add_cxxflags -D__STDC_CONSTANT_MACROS check_cflags -std=c99 check_cc -D_FILE_OFFSET_BITS=64 < @@ -3837,11 +3323,6 @@ case "$arch" in spic=$shared fi ;; - ppc) - check_cc < $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)' - if enabled x86_64; then - LIBTARGET=x64 - fi - elif check_cmd $dlltool --version; then - SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)' - fi + SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base' objformat="win32" + dlltool="${cross_prefix}dlltool" ranlib=: enable dos_paths ;; @@ -3986,7 +3456,6 @@ case $target_os in SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a' objformat="win32" enable dos_paths - enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres ;; *-dos|freedos|opendos) network_extralibs="-lsocket" @@ -4002,7 +3471,6 @@ case $target_os in ranlib="echo ignoring ranlib" ;; os/2*) - strip="lxlite -CS" ln_s="cp -f" objformat="aout" add_cppflags -D_GNU_SOURCE @@ -4023,7 +3491,6 @@ case $target_os in emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;' SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib' enable dos_paths - enable_weak os2threads ;; gnu/kfreebsd) add_cppflags -D_BSD_SOURCE @@ -4060,7 +3527,7 @@ case $target_os in add_compat strtod.o strtod=avpriv_strtod network_extralibs='-lbsd' exeobjs=compat/plan9/main.o - disable ffserver + disable avserver cp_f='cp' ;; none) @@ -4089,10 +3556,6 @@ probe_libc(){ # MinGW64 is backwards compatible with MinGW32, so check for it first. elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then eval ${pfx}libc_type=mingw64 - if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then - add_compat msvcrt/snprintf.o - add_cflags "-include $source_path/compat/msvcrt/snprintf.h" - fi add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ @@ -4163,7 +3626,7 @@ esc(){ echo "$*" | sed 's/%/%25/g;s/:/%3a/g' } -echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate +echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic @@ -4185,25 +3648,16 @@ die_license_disabled() { enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } } -die_license_disabled_gpl() { - enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; } -} - -die_license_disabled gpl frei0r die_license_disabled gpl libcdio -die_license_disabled gpl libutvideo -die_license_disabled gpl libvidstab die_license_disabled gpl libx264 die_license_disabled gpl libx265 die_license_disabled gpl libxavs die_license_disabled gpl libxvid -die_license_disabled gpl libzvbi die_license_disabled gpl x11grab -die_license_disabled nonfree libaacplus die_license_disabled nonfree libfaac -enabled gpl && die_license_disabled_gpl nonfree libfdk_aac -enabled gpl && die_license_disabled_gpl nonfree openssl +die_license_disabled nonfree libfdk_aac +die_license_disabled nonfree openssl die_license_disabled version3 libopencore_amrnb die_license_disabled version3 libopencore_amrwb @@ -4266,8 +3720,6 @@ od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian check_inline_asm inline_asm_labels '"1:\n"' -check_inline_asm inline_asm_nonlocal_labels '"Label:\n"' - if enabled aarch64; then enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]' # internal assembler in clang 3.3 does not support this instruction @@ -4282,10 +3734,7 @@ elif enabled alpha; then elif enabled arm; then - check_cpp_condition stddef.h "defined __thumb__" && check_cc <= 2.0.0" aacplus.h aacplusEncOpen -laacplus -enabled libass && require_pkg_config libass ass/ass.h ass_library_init -enabled libbluray && require_pkg_config libbluray libbluray/bluray.h bd_open enabled libbs2b && require_pkg_config libbs2b bs2b.h bs2b_open -enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 && - { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 || - die "ERROR: libcelt must be installed and version must be >= 0.11.0."; } -enabled libcaca && require_pkg_config caca caca.h caca_create_canvas enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac -flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite" -enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs -enabled fontconfig && enable libfontconfig enabled libfontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit -enabled libfreetype && require_libfreetype -enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++ +enabled libfreetype && require_pkg_config freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do check_lib "${gsm_hdr}" gsm_create -lgsm && break; done || die "ERROR: libgsm not found"; } enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc -enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame -enabled libnut && require libnut libnut.h nut_demuxer_init -lnut enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb -enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader -enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC || - check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC || - die "ERROR: libopenjpeg not found"; } +enabled libopencv && require_pkg_config opencv opencv/cv.h cvCreateImageHeader +enabled libopenjpeg && { { check_header openjpeg.h && check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC; } || + { require_pkg_config libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; } } enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new -enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init -enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer -enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr -enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex -enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h - media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h - media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg -enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame && - { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame || - die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; } -enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++ -enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl -enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit +enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg enabled libvpx && { enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || die "ERROR: libvpx decoder version must be >=0.9.1"; } - enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx || - die "ERROR: libvpx encoder version must be >=0.9.7"; } + enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || + die "ERROR: libvpx encoder version must be >=0.9.6"; } enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; } - enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_SVC" -lvpx || disable libvpx_vp9_encoder; } } + enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx" -lvpx || disable libvpx_vp9_encoder; } } enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && { check_cpp_condition x264.h "X264_BUILD >= 118" || - die "ERROR: libx264 must be installed and version must be >= 0.118."; } + die "ERROR: libx264 version must be >= 0.118."; } enabled libx265 && require_pkg_config x265 x265.h x265_encoder_encode && { check_cpp_condition x265.h "X265_BUILD >= 13" || die "ERROR: libx265 version must be >= 13."; } enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore -enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new -enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi -enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do - check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } || - die "ERROR: openal not found"; } && - { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" || - die "ERROR: openal must be installed and version must be 1.1 or compatible"; } -enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL || - check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL || - die "ERROR: opencl not found"; } && - { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" || - check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" || - die "ERROR: opencl must be installed and version must be 1.2 or compatible"; } -enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" || - check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" || - check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" || - check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" || - die "ERROR: opengl not found." - } enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -enabled qtkit_indev && { check_header_oc QTKit/QTKit.h || disable qtkit_indev; } if enabled gnutls; then { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } || @@ -4742,33 +4103,18 @@ if enabled libdc1394; then die "ERROR: No version of libdc1394 found " fi -SDL_CONFIG="${cross_prefix}sdl-config" if check_pkg_config sdl SDL_events.h SDL_PollEvent; then check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags && check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags && enable sdl -else - if "${SDL_CONFIG}" --version > /dev/null 2>&1; then - sdl_cflags=$("${SDL_CONFIG}" --cflags) - sdl_libs=$("${SDL_CONFIG}" --libs) - check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs && - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags && - check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags && - enable sdl - fi fi -enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs -texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html -makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo -perl -v > /dev/null 2>&1 && enable perl || disable perl pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man -rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout +texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html check_header linux/fb.h -check_header linux/videodev.h check_header linux/videodev2.h -check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete +check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete check_header sys/videoio.h @@ -4777,8 +4123,6 @@ check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extra # w32api 3.12 had it defined wrong check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines -check_type "dshow.h" IBaseFilter - # check for ioctl_meteor.h, ioctl_bt848.h and alternatives { check_header dev/bktr/ioctl_meteor.h && check_header dev/bktr/ioctl_bt848.h; } || @@ -4789,66 +4133,38 @@ check_type "dshow.h" IBaseFilter check_header dev/ic/bt8xx.h check_header sndio.h -if check_struct sys/soundcard.h audio_buf_info bytes; then - enable_safe sys/soundcard.h -else - check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE < - audio_buf_info abc; -EOF -fi +check_header sys/soundcard.h check_header soundcard.h enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound -enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait && +enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func jack_port_get_latency_range -ljack enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio if enabled libcdio; then check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || - check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || - die "ERROR: libcdio-paranoia not found" + check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio fi -enabled xlib && - check_lib X11/Xlib.h XOpenDisplay -lX11 || disable xlib +check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib enabled x11grab && require Xext X11/extensions/XShm.h XShmCreateImage -lXext && require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes && { enabled xlib || die "ERROR: Xlib not found"; } -check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs" - -enabled dxva2api_h && - check_cc < -#include -#include -int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; } -EOF - -enabled vaapi && - check_lib va/va.h vaInitialize -lva || - disable vaapi - enabled vdpau && check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || disable vdpau enabled vdpau && enabled xlib && check_func_headers "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau && - prepend ffmpeg_libs $($ldflags_filter "-lvdpau") && + prepend avconv_libs $($ldflags_filter "-lvdpau") && enable vdpau_x11 -# Funny iconv installations are not unusual, so check it after all flags have been set -disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv - enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" # add some useful compiler flags if supported @@ -4857,13 +4173,12 @@ check_cflags -Wall check_cflags -Wdisabled-optimization check_cflags -Wpointer-arith check_cflags -Wredundant-decls +check_cflags -Wcast-qual check_cflags -Wwrite-strings check_cflags -Wtype-limits check_cflags -Wundef check_cflags -Wmissing-prototypes -check_cflags -Wno-pointer-to-int-cast check_cflags -Wstrict-prototypes -check_cflags -Wempty-body enabled extra_warnings && check_cflags -Winline check_disable_warning(){ @@ -4878,13 +4193,12 @@ check_disable_warning -Wno-pointer-sign # add some linker flags check_ldflags -Wl,--warn-common -check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -enabled rpath && add_ldflags -Wl,-rpath,$libdir +check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic # add some strip flags # -wN '..@*' is more selective than -x, but not available everywhere. -check_stripflags -wN \'..@*\' || check_stripflags -x +check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true' enabled neon_clobber_test && check_ldflags -Wl,--wrap,avcodec_open2 \ @@ -4894,7 +4208,6 @@ enabled neon_clobber_test && -Wl,--wrap,avcodec_encode_audio2 \ -Wl,--wrap,avcodec_encode_video2 \ -Wl,--wrap,avcodec_encode_subtitle \ - -Wl,--wrap,swr_convert \ -Wl,--wrap,avresample_convert || disable neon_clobber_test @@ -4904,10 +4217,8 @@ enabled xmm_clobber_test && -Wl,--wrap,avcodec_decode_video2 \ -Wl,--wrap,avcodec_decode_subtitle2 \ -Wl,--wrap,avcodec_encode_audio2 \ - -Wl,--wrap,avcodec_encode_video \ -Wl,--wrap,avcodec_encode_video2 \ -Wl,--wrap,avcodec_encode_subtitle \ - -Wl,--wrap,swr_convert \ -Wl,--wrap,avresample_convert \ -Wl,--wrap,sws_scale || disable xmm_clobber_test @@ -4945,39 +4256,28 @@ if enabled lto; then test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker" check_cflags -flto check_ldflags -flto $cpuflags - disable inline_asm_direct_symbol_refs fi check_optflags $optflags check_optflags -fno-math-errno check_optflags -fno-signed-zeros -enabled ftrapv && check_cflags -ftrapv - -check_cc -mno-red-zone <= 1400" && add_cflags -Qansi-alias - # Some inline asm is not compilable in debug - if enabled debug; then - disable ebp_available - disable ebx_available - fi + # icl will pass the inline asm tests but inline asm is currently + # not supported (build will fail) + disable inline_asm fi - # msvcrt10 x64 incorrectly enables log2, only msvcrt12 onwards actually has log2. - check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2 fi case $as_type in @@ -5064,8 +4361,6 @@ case $target_os in ;; esac -enable frame_thread_encoder - enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } check_deps $CONFIG_LIST \ @@ -5073,48 +4368,13 @@ check_deps $CONFIG_LIST \ $HAVE_LIST \ $ALL_COMPONENTS \ -enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86" - - -if test $target_os = "haiku"; then - disable memalign - disable posix_memalign -fi - -enabled_all dxva2 dxva2api_cobj CoTaskMemFree && - prepend ffmpeg_libs $($ldflags_filter "-lole32") && +enabled_all dxva2 CoTaskMemFree && + prepend avconv_libs $($ldflags_filter "-lole32") && enable dxva2_lib ! enabled_any memalign posix_memalign aligned_malloc && enabled_any $need_memalign && enable memalign_hack -# add_dep lib dep -# -> enable ${lib}_deps_${dep} -# -> add $dep to ${lib}_deps only once -add_dep() { - lib=$1 - dep=$2 - enabled "${lib}_deps_${dep}" && return 0 - enable "${lib}_deps_${dep}" - prepend "${lib}_deps" $dep -} - -# merge deps lib components -# merge all ${component}_deps into ${lib}_deps and ${lib}_deps_* -merge_deps() { - lib=$1 - shift - for comp in $*; do - enabled $comp || continue - eval "dep=\"\$${comp}_deps\"" - for d in $dep; do - add_dep $lib $d - done - done -} - -merge_deps libavfilter $FILTER_LIST - for thread in $THREADS_LIST; do if enabled $thread; then test -n "$thread_type" && @@ -5124,31 +4384,11 @@ for thread in $THREADS_LIST; do done # conditional library dependencies, in linking order -enabled aconvert_filter && prepend avfilter_deps "swresample" -enabled amovie_filter && prepend avfilter_deps "avformat avcodec" -enabled aresample_filter && prepend avfilter_deps "swresample" -enabled asyncts_filter && prepend avfilter_deps "avresample" -enabled atempo_filter && prepend avfilter_deps "avcodec" -enabled decimate_filter && prepend avfilter_deps "avcodec" -enabled deshake_filter && prepend avfilter_deps "avcodec" -enabled ebur128_filter && enabled swresample && prepend avfilter_deps "swresample" -enabled elbg_filter && prepend avfilter_deps "avcodec" -enabled mcdeint_filter && prepend avfilter_deps "avcodec" enabled movie_filter && prepend avfilter_deps "avformat avcodec" -enabled mp_filter && prepend avfilter_deps "avcodec" -enabled pan_filter && prepend avfilter_deps "swresample" -enabled pp_filter && prepend avfilter_deps "postproc" -enabled removelogo_filter && prepend avfilter_deps "avformat avcodec swscale" enabled resample_filter && prepend avfilter_deps "avresample" -enabled sab_filter && prepend avfilter_deps "swscale" enabled scale_filter && prepend avfilter_deps "swscale" -enabled showspectrum_filter && prepend avfilter_deps "avcodec" -enabled smartblur_filter && prepend avfilter_deps "swscale" -enabled subtitles_filter && prepend avfilter_deps "avformat avcodec" -enabled lavfi_indev && prepend avdevice_deps "avfilter" - -enabled opus_decoder && prepend avcodec_deps "swresample" +enabled opus_decoder && prepend avcodec_deps "avresample" expand_deps(){ lib_deps=${1}_deps @@ -5157,9 +4397,6 @@ expand_deps(){ unique $lib_deps } -#we have to remove gpl from the deps here as some code assumes all lib deps are libs -postproc_deps="$(filter_out 'gpl' $postproc_deps)" - map 'expand_deps $v' $LIBRARY_LIST echo "install prefix $prefix" @@ -5174,9 +4411,6 @@ echo "ARCH $arch ($cpu)" if test "$build_suffix" != ""; then echo "build suffix $build_suffix" fi -if test "$progs_suffix" != ""; then - echo "progs suffix $progs_suffix" -fi if test "$extra_version" != ""; then echo "version string suffix $extra_version" fi @@ -5209,13 +4443,6 @@ if enabled arm; then echo "ARMv6T2 enabled ${armv6t2-no}" echo "VFP enabled ${vfp-no}" echo "NEON enabled ${neon-no}" - echo "THUMB enabled ${thumb-no}" -fi -if enabled mips; then - echo "MIPS FPU enabled ${mipsfpu-no}" - echo "MIPS32R2 enabled ${mips32r2-no}" - echo "MIPS DSP R1 enabled ${mipsdspr1-no}" - echo "MIPS DSP R2 enabled ${mipsdspr2-no}" fi if enabled ppc; then echo "AltiVec enabled ${altivec-no}" @@ -5223,23 +4450,15 @@ if enabled ppc; then echo "dcbzl available ${dcbzl-no}" fi echo "debug symbols ${debug-no}" -echo "strip symbols ${stripping-no}" echo "optimize for size ${small-no}" echo "optimizations ${optimizations-no}" echo "static ${static-no}" echo "shared ${shared-no}" -echo "postprocessing support ${postproc-no}" echo "new filter support ${avfilter-no}" echo "network support ${network-no}" echo "threading support ${thread_type-no}" echo "safe bitstream reader ${safe_bitstream_reader-no}" echo "SDL support ${sdl-no}" -echo "opencl enabled ${opencl-no}" -echo "libzvbi enabled ${libzvbi-no}" -echo "texi2html enabled ${texi2html-no}" -echo "perl enabled ${perl-no}" -echo "pod2man enabled ${pod2man-no}" -echo "makeinfo enabled ${makeinfo-no}" test -n "$random_seed" && echo "random seed ${random_seed}" echo @@ -5268,19 +4487,15 @@ fi echo "License: $license" -echo "Creating config.mak, config.h, and doc/config.texi..." +echo "Creating config.mak and config.h..." test -e Makefile || echo "include $source_path/Makefile" > Makefile -enabled stripping || strip="echo skipping strip" - -config_files="$TMPH config.mak doc/config.texi" +config_files="$TMPH config.mak" cat > config.mak <> config.mak eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak @@ -5414,25 +4615,18 @@ map 'print_program_libs $v' $PROGRAM_LIST cat > $TMPH <>$TMPH - test -n "$malloc_prefix" && echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH @@ -5443,18 +4637,13 @@ fi enabled getenv || echo "#define getenv(x) NULL" >> $TMPH - -mkdir -p doc -echo "@c auto-generated by configure" > doc/config.texi - print_config ARCH_ "$config_files" $ARCH_LIST print_config HAVE_ "$config_files" $HAVE_LIST print_config CONFIG_ "$config_files" $CONFIG_LIST \ $CONFIG_EXTRA \ $ALL_COMPONENTS \ -echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH -echo "endif # FFMPEG_CONFIG_MAK" >> config.mak +echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. cp_if_changed $TMPH config.h @@ -5474,15 +4663,12 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH cp_if_changed $TMPH libavutil/avconfig.h -if test -n "$WARNINGS"; then - printf "\n$WARNINGS" - enabled fatal_warnings && exit 1 -fi +test -n "$WARNINGS" && printf "\n$WARNINGS" # build pkg-config files lib_version(){ - eval printf "\"lib${1}${build_suffix} >= \$LIB$(toupper ${1})_VERSION, \"" + eval printf "\"lib${1} >= \$LIB$(toupper ${1})_VERSION, \"" } pkgconfig_generate(){ @@ -5495,7 +4681,7 @@ pkgconfig_generate(){ requires=${requires%, } enabled ${name#lib} || return 0 mkdir -p $name - cat < $name/$name${build_suffix}.pc + cat < $name/$name.pc prefix=$prefix exec_prefix=\${prefix} libdir=$libdir @@ -5507,36 +4693,30 @@ Version: $version Requires: $(enabled shared || echo $requires) Requires.private: $(enabled shared && echo $requires) Conflicts: -Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs) +Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs) Libs.private: $(enabled shared && echo $libs) Cflags: -I\${includedir} EOF - -mkdir -p doc/examples/pc-uninstalled -includedir=${source_path} -[ "$includedir" = . ] && includedir="\${pcfiledir}/../../.." - cat < doc/examples/pc-uninstalled/$name.pc + cat < $name/$name-uninstalled.pc prefix= exec_prefix= -libdir=\${pcfiledir}/../../../$name -includedir=${includedir} +libdir=\${pcfiledir} +includedir=${source_path} Name: $name Description: $comment Version: $version Requires: $requires Conflicts: -Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs) +Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs Cflags: -I\${includedir} EOF } -pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM" -pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" -pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" -pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" -pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" -pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" -pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" -pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" -pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" +pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$LIBM" +pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs" +pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs" +pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" +pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" +pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" +pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" diff --git a/doc/APIchanges b/doc/APIchanges index 395083c091..9bc3f1acdc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -1,5 +1,5 @@ Never assume the API of libav* to be stable unless at least 1 month has passed -since the last major version increase or the API was added. +since the last major version increase. The last version increases were: libavcodec: 2013-03-xx @@ -7,71 +7,49 @@ libavdevice: 2013-03-xx libavfilter: 2013-12-xx libavformat: 2013-03-xx libavresample: 2012-10-05 -libpostproc: 2011-04-18 -libswresample: 2011-09-19 libswscale: 2011-06-20 -libavutil: 2012-10-22 +libavutil: 2013-12-xx API changes, most recent first: -2014-05-26 - xxxxxxx - lavu 52.87.100 - threadmessage.h - Add thread message queue API. - -2014-05-26 - c37d179 - lavf 55.41.100 - avformat.h - Add format_probesize to AVFormatContext. - 2014-05-19 - xxxxxxx - lavf 55.18.0 - avformat.h Add av_stream_get_side_data() to access stream-level side data in the same way as av_packet_get_side_data(). -2014-05-xx - xxxxxxx - lavu 52.86.100 - fifo.h - Add av_fifo_alloc_array() function. - 2014-05-xx - xxxxxxx - lavu 53.15.0 - frame.h, display.h Add AV_FRAME_DATA_DISPLAYMATRIX for exporting frame-level spatial rendering on video frames for proper display. -2014-05-xx - xxxxxxx - lavc 55.64.100 / 55.53.0 - avcodec.h +2014-05-xx - xxxxxxx - lavc 55.53.0 - avcodec.h Add AV_PKT_DATA_DISPLAYMATRIX for exporting packet-level spatial rendering on video frames for proper display. 2014-05-xx - xxxxxxx - lavf 55.17.1 - avformat.h Deprecate AVStream.pts and the AVFrac struct, which was its only use case. - See use av_stream_get_end_pts() + Those fields were poorly defined and not meant to be public, so there is + no replacement for them. 2014-05-18 - fd05602 - lavc 55.52.0 - avcodec.h Add avcodec_free_context(). From now on it should be used for freeing AVCodecContext. -2014-05-xx - xxxxxxx - lavu 52.84.100 - time.h - Add av_gettime_relative() av_gettime_relative_is_monotonic() - 2014-05-15 - 0c1959b - lavf 55.17.0 - avformat.h Add AVMFT_FLAG_BITEXACT flag. Muxers now use it instead of checking CODEC_FLAG_BITEXACT on the first stream. -2014-05-15 - xxxxxxx - lswr 0.19.100 - swresample.h - Add swr_close() - 2014-05-11 - 66e6c8a - lavu 53.14.0 - pixfmt.h Add AV_PIX_FMT_VDA for new-style VDA acceleration. -2014-05-xx - xxxxxxx - lavu 52.82.0 - fifo.h - Add av_fifo_freep() function. - -2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h - Add av_opt_set_dict2() function. - -2014-05-01 - e77b985 / a2941c8 - lavc 55.60.103 / 55.50.3 - avcodec.h +2014-05-01 - a2941c8 - lavc 55.50.3 - avcodec.h Deprecate CODEC_FLAG_MV0. It is replaced by the flag "mv0" in the "mpv_flags" private option of the mpegvideo encoders. -2014-05-01 - e40ae8c / 6484149 - lavc 55.60.102 / 55.50.2 - avcodec.h +2014-05-01 - 6484149 - lavc 55.50.2 - avcodec.h Deprecate CODEC_FLAG_GMC. It is replaced by the "gmc" private option of the libxvid encoder. -2014-05-01 - 1851643 / b2c3171 - lavc 55.60.101 / 55.50.1 - avcodec.h +2014-05-01 - b2c3171 - lavc 55.50.1 - avcodec.h Deprecate CODEC_FLAG_NORMALIZE_AQP. It is replaced by the flag "naq" in the "mpv_flags" private option of the mpegvideo encoders. @@ -79,528 +57,213 @@ API changes, most recent first: Deprecate CODEC_FLAG_INPUT_PRESERVED. Its functionality is replaced by passing reference-counted frames to encoders. -2014-04-29 - 1bf6396 - lavc 55.60.100 - avcodec.h - Add AVCodecDescriptor.mime_types field. - -2014-04-29 - xxxxxxx - lavu 52.80.0 - hash.h - Add av_hash_final_bin(), av_hash_final_hex() and av_hash_final_b64(). - -2014-03-07 - 8b2a130 - lavc 55.50.0 / 55.53.100 - dxva2.h +2014-04-28 - ed4b757 - lavc 55.50.0 - dxva2.h Add FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO for old Intel GPUs. -2014-04-22 - 502512e /dac7e8a - lavu 53.13.0 / 52.78.100 - avutil.h +2014-04-22 - 502512e - lavu 53.13.0 - avutil.h Add av_get_time_base_q(). -2014-04-17 - 0983d48 - lavu 53.12.0 / 52.77.100 - crc.h +2014-04-17 - 0983d48 - lavu 53.12.0 - crc.h Add AV_CRC_16_ANSI_LE crc variant. -2014-04-XX - xxxxxxx - lavf xx.xx.1xx - avformat.h - Add av_format_inject_global_side_data() - -2014-04-12 - 4f698be - lavu 52.76.100 - log.h - Add av_log_get_flags() - -2014-04-11 - 6db42a2b - lavd 55.12.100 - avdevice.h - Add avdevice_capabilities_create() function. - Add avdevice_capabilities_free() function. - -2014-04-07 - 0a1cc04 / 8b17243 - lavu 52.75.100 / 53.11.0 - pixfmt.h +2014-04-07 - 8b17243 - lavu 53.11.0 - pixfmt.h Add AV_PIX_FMT_YVYU422 pixel format. -2014-04-04 - c1d0536 / 8542f9c - lavu 52.74.100 / 53.10.0 - replaygain.h +2014-04-04 - 8542f9c - lavu 53.10.0 - replaygain.h Full scale for peak values is now 100000 (instead of UINT32_MAX) and values may overflow. -2014-04-03 - c16e006 / 7763118 - lavu 52.73.100 / 53.9.0 - log.h +2014-04-03 - 7763118 - lavu 53.09.0 - log.h Add AV_LOG(c) macro to have 256 color debug messages. -2014-04-03 - eaed4da9 - lavu 52.72.100 - opt.h - Add AV_OPT_MULTI_COMPONENT_RANGE define to allow return - multi-component option ranges. - -2014-03-29 - cd50a44b - lavu 52.70.100 - mem.h - Add av_dynarray_add_nofree() function. - -2014-02-24 - 3e1f241 / d161ae0 - lavu 52.69.100 / 53.8.0 - frame.h +2014-03-24 - d161ae0 - lavu 53.08.0 - frame.h Add av_frame_remove_side_data() for removing a single side data instance from a frame. -2014-03-24 - 83e8978 / 5a7e35d - lavu 52.68.100 / 53.7.0 - frame.h, replaygain.h +2014-03-24 - 5a7e35d - lavu 53.07.0 - frame.h, replaygain.h Add AV_FRAME_DATA_REPLAYGAIN for exporting replaygain tags. Add a new header replaygain.h with the AVReplayGain struct. -2014-03-24 - 83e8978 / 5a7e35d - lavc 55.54.100 / 55.36.0 - avcodec.h +2014-03-24 - 5a7e35d - lavc 55.36.0 - avcodec.h Add AV_PKT_DATA_REPLAYGAIN for exporting replaygain tags. -2014-03-24 - 595ba3b / 25b3258 - lavf 55.35.100 / 55.13.0 - avformat.h +2014-03-24 - 25b3258 - lavf 55.13.0 - avformat.h Add AVStream.side_data and AVStream.nb_side_data for exporting stream-global side data (e.g. replaygain tags, video rotation) -2014-03-24 - bd34e26 / 0e2c3ee - lavc 55.53.100 / 55.35.0 - avcodec.h +2014-03-24 - 0e2c3ee - lavc 55.35.0 - avcodec.h Give the name AVPacketSideData to the previously anonymous struct used for AVPacket.side_data. -2014-03-18 - 37c07d4 - lsws 2.5.102 - Make gray16 full-scale. +2014-03-16 - 1481d24 - lavu 53.06.0 - pixfmt.h + Add RGBA64 pixel format and variants. -2014-03-16 - 6b1ca17 / 1481d24 - lavu 52.67.100 / 53.6.0 - pixfmt.h - Add RGBA64_LIBAV pixel format and variants for compatibility - -2014-03-11 - 3f3229c - lavf 55.34.101 - avformat.h - Set AVFormatContext.start_time_realtime when demuxing. - -2014-03-03 - 06fed440 - lavd 55.11.100 - avdevice.h - Add av_input_audio_device_next(). - Add av_input_video_device_next(). - Add av_output_audio_device_next(). - Add av_output_video_device_next(). - -2014-02-24 - fff5262 / 1155fd0 - lavu 52.66.100 / 53.5.0 - frame.h +2014-02-24 - 1155fd0 - lavu 53.05.0 - frame.h Add av_frame_copy() for copying the frame data. -2014-02-24 - a66be60 - lswr 0.18.100 - swresample.h - Add swr_is_initialized() for checking whether a resample context is initialized. - -2014-02-22 - 5367c0b / 7e86c27 - lavr 1.2.0 - avresample.h +2014-02-22 - 7e86c27 - lavr 1.2.0 - avresample.h Add avresample_is_open() for checking whether a resample context is open. -2014-02-19 - 6a24d77 / c3ecd96 - lavu 52.65.100 / 53.4.0 - opt.h +2014-02-19 - c3ecd96 - lavu 53.04.0 - opt.h Add AV_OPT_FLAG_EXPORT and AV_OPT_FLAG_READONLY to mark options meant (only) for reading. -2014-02-19 - f4c8d00 / 6bb8720 - lavu 52.64.101 / 53.3.1 - opt.h +2014-02-19 - 6bb8720 - lavu 53.03.01 - opt.h Deprecate unused AV_OPT_FLAG_METADATA. -2014-02-xx - xxxxxxx - lavd 55.10.100 - avdevice.h - Add avdevice_list_devices() and avdevice_free_list_devices() +------------------------------8<------------------------------------- + 10 branch was cut here +----------------------------->8-------------------------------------- -2014-02-16 - db3c970 - lavf 55.33.100 - avio.h - Add avio_find_protocol_name() to find out the name of the protocol that would - be selected for a given URL. - -2014-02-15 - a2bc6c1 / c98f316 - lavu 52.64.100 / 53.3.0 - frame.h +2014-02-15 - c98f316 - lavu 53.3.0 - frame.h Add AV_FRAME_DATA_DOWNMIX_INFO value to the AVFrameSideDataType enum and downmix_info.h API, which identify downmix-related metadata. -2014-02-11 - 1b05ac2 - lavf 55.32.100 - avformat.h - Add av_write_uncoded_frame() and av_interleaved_write_uncoded_frame(). - -2014-02-04 - 3adb5f8 / d9ae103 - lavf 55.30.100 / 55.11.0 - avformat.h +2014-02-04 - d9ae103 - lavf 55.11.0 - avformat.h Add AVFormatContext.max_interleave_delta for controlling amount of buffering when interleaving. -2014-02-02 - 5871ee5 - lavf 55.29.100 - avformat.h - Add output_ts_offset muxing option to AVFormatContext. - -2014-01-27 - 102bd64 - lavd 55.7.100 - avdevice.h - lavf 55.28.100 - avformat.h - Add avdevice_dev_to_app_control_message() function. - -2014-01-27 - 7151411 - lavd 55.6.100 - avdevice.h - lavf 55.27.100 - avformat.h - Add avdevice_app_to_dev_control_message() function. - -2014-01-24 - 86bee79 - lavf 55.26.100 - avformat.h - Add AVFormatContext option metadata_header_padding to allow control over the - amount of padding added. - -2014-01-20 - eef74b2 / 93c553c - lavc 55.48.102 / 55.32.1 - avcodec.h +2014-01-20 - 93c553c - lavc 55.32.1 - avcodec.h Edges are not required anymore on video buffers allocated by get_buffer2() (i.e. as if the CODEC_FLAG_EMU_EDGE flag was always on). Deprecate CODEC_FLAG_EMU_EDGE and avcodec_get_edge_width(). -2014-01-19 - 1a193c4 - lavf 55.25.100 - avformat.h - Add avformat_get_mov_video_tags() and avformat_get_mov_audio_tags(). - -2014-01-19 - xxxxxxx - lavu 52.63.100 - rational.h - Add av_make_q() function. - -2014-01-05 - 4cf4da9 / 5b4797a - lavu 52.62.100 / 53.2.0 - frame.h +2014-01-05 - 5b4797a - lavu 53.2.0 - frame.h Add AV_FRAME_DATA_MATRIXENCODING value to the AVFrameSideDataType enum, which identifies AVMatrixEncoding data. -2014-01-05 - 751385f / 5c437fb - lavu 52.61.100 / 53.1.0 - channel_layout.h +2014-01-05 - 5c437fb - lavu 53.1.0 - channel_layout.h Add values for various Dolby flags to the AVMatrixEncoding enum. -2014-01-04 - b317f94 - lavu 52.60.100 - mathematics.h - Add av_add_stable() function. +2013-12-20 - 2a41826 - lavc 55.30.0 - avcodec.h + Add HEVC profiles -2013-12-22 - 911676c - lavu 52.59.100 - avstring.h - Add av_strnlen() function. - -2013-12-09 - 64f73ac - lavu 52.57.100 - opencl.h - Add av_opencl_benchmark() function. - -2013-11-30 - 82b2e9c - lavu 52.56.100 - ffversion.h - Moves version.h to libavutil/ffversion.h. - Install ffversion.h and make it public. - -2013-12-11 - 29c83d2 / b9fb59d,409a143 / 9431356,44967ab / d7b3ee9 - lavc 55.45.101 / 55.28.1 - avcodec.h +2013-12-11 - b9fb59d,9431356,d7b3ee9 - lavc 55.28.1 - avcodec.h av_frame_alloc(), av_frame_unref() and av_frame_free() now can and should be used instead of avcodec_alloc_frame(), avcodec_get_frame_defaults() and avcodec_free_frame() respectively. The latter three functions are deprecated. -2013-12-09 - 7a60348 / 7e244c6- - lavu 52.58.100 / 52.20.0 - frame.h +2013-12-09 - 7e244c6- - lavu 52.20.0 - frame.h Add AV_FRAME_DATA_STEREO3D value to the AVFrameSideDataType enum and stereo3d.h API, that identify codec-independent stereo3d information. -2013-11-26 - 625b290 / 1eaac1d- - lavu 52.55.100 / 52.19.0 - frame.h +2013-11-26 - 1eaac1d- - lavu 52.19.0 - frame.h Add AV_FRAME_DATA_A53_CC value to the AVFrameSideDataType enum, which identifies ATSC A53 Part 4 Closed Captions data. -2013-11-22 - 6859065 - lavu 52.54.100 - avstring.h - Add av_utf8_decode() function. - -2013-11-22 - fb7d70c - lavc 55.44.100 - avcodec.h - Add HEVC profiles - -2013-11-20 - c28b61c - lavc 55.44.100 - avcodec.h - Add av_packet_{un,}pack_dictionary() - Add AV_PKT_METADATA_UPDATE side data type, used to transmit key/value - strings between a stream and the application. - -2013-11-14 - 7c888ae / cce3e0a - lavu 52.53.100 / 52.18.0 - mem.h +2013-11-14 - cce3e0a - lavu 52.18.0 - mem.h Move av_fast_malloc() and av_fast_realloc() for libavcodec to libavutil. -2013-11-14 - b71e4d8 / 8941971 - lavc 55.43.100 / 55.27.0 - avcodec.h +2013-11-14 - 8941971 - lavc 55.27.0 - avcodec.h Deprecate AVCodecContext.error_rate, it is replaced by the 'error_rate' private option of the mpegvideo encoder family. -2013-11-14 - 31c09b7 / 728c465 - lavc 55.42.100 / 55.26.0 - vdpau.h +2013-11-14 - 728c465 - lavc 55.26.0 - vdpau.h Add av_vdpau_get_profile(). Add av_vdpau_alloc_context(). This function must from now on be used for allocating AVVDPAUContext. -2013-11-04 - be41f21 / cd8f772 - lavc 55.41.100 / 55.25.0 - avcodec.h - lavu 52.51.100 - frame.h +2013-11-04 - cd8f772 - lavc 55.25.0 - avcodec.h Add ITU-R BT.2020 and other not yet included values to color primaries, transfer characteristics and colorspaces. -2013-11-04 - 85cabf1 - lavu 52.50.100 - avutil.h - Add av_fopen_utf8() - -2013-10-31 - 78265fc / 28096e0 - lavu 52.49.100 / 52.17.0 - frame.h +2013-10-31 - 28096e0 - lavu 52.17.0 - frame.h Add AVFrame.flags and AV_FRAME_FLAG_CORRUPT. -2013-10-27 - dbe6f9f - lavc 55.39.100 - avcodec.h - Add CODEC_CAP_DELAY support to avcodec_decode_subtitle2. - -2013-10-27 - d61617a - lavu 52.48.100 - parseutils.h - Add av_get_known_color_name(). - -2013-10-17 - 8696e51 - lavu 52.47.100 - opt.h - Add AV_OPT_TYPE_CHANNEL_LAYOUT and channel layout option handlers - av_opt_get_channel_layout() and av_opt_set_channel_layout(). - -2013-10-06 - ccf96f8 -libswscale 2.5.101 - options.c - Change default scaler to bicubic - -2013-10-03 - e57dba0 - lavc 55.34.100 - avcodec.h - Add av_codec_get_max_lowres() - -2013-10-02 - 5082fcc - lavf 55.19.100 - avformat.h - Add audio/video/subtitle AVCodec fields to AVFormatContext to force specific - decoders - -2013-09-28 - 7381d31 / 0767bfd - lavfi 3.88.100 / 3.11.0 - avfilter.h +2013-09-28 - 0767bfd - lavfi 3.11.0 - avfilter.h Add AVFilterGraph.execute and AVFilterGraph.opaque for custom slice threading implementations. -2013-09-21 - 85f8a3c / e208e6d - lavu 52.46.100 / 52.16.0 - pixfmt.h +2013-09-21 - e208e6d - lavu 52.16.0 - pixfmt.h Add interleaved 4:2:2 8/10-bit formats AV_PIX_FMT_NV16 and AV_PIX_FMT_NV20. -2013-09-16 - c74c3fb / 3feb3d6 - lavu 52.44.100 / 52.15.0 - mem.h +2013-09-16 - 3feb3d6 - lavu 52.15.0 - mem.h Add av_reallocp. -2013-09-04 - 3e1f507 - lavc 55.31.101 - avcodec.h - avcodec_close() argument can be NULL. - -2013-09-04 - 36cd017 - lavf 55.16.101 - avformat.h - avformat_close_input() argument can be NULL and point on NULL. - -2013-08-29 - e31db62 - lavf 55.15.100 - avformat.h - Add av_format_get_probe_score(). - -2013-08-15 - 1e0e193 - lsws 2.5.100 - - Add a sws_dither AVOption, allowing to set the dither algorithm used - -2013-08-11 - d404fe35 - lavc 55.27.100 - vdpau.h - Add a render2 alternative to the render callback function. - -2013-08-11 - af05edc - lavc 55.26.100 - vdpau.h - Add allocation function for AVVDPAUContext, allowing - to extend it in the future without breaking ABI/API. - -2013-08-10 - 67a580f / 5a9a9d4 - lavc 55.25.100 / 55.16.0 - avcodec.h +2013-08-10 - 5a9a9d4 - lavc 55.16.0 - avcodec.h Extend AVPacket API with av_packet_unref, av_packet_ref, av_packet_move_ref, av_packet_copy_props, av_packet_free_side_data. -2013-08-05 - 9547e3e / f824535 - lavc 55.22.100 / 55.13.0 - avcodec.h +2013-08-05 - f824535 - lavc 55.13.0 - avcodec.h Deprecate the bitstream-related members from struct AVVDPAUContext. - The bitstream buffers no longer need to be explicitly freed. + The bistream buffers no longer need to be explicitly freed. -2013-08-05 - 3b805dc / 549294f - lavc 55.21.100 / 55.12.0 - avcodec.h +2013-08-05 - 549294f - lavc 55.12.0 - avcodec.h Deprecate the CODEC_CAP_HWACCEL_VDPAU codec capability. Use CODEC_CAP_HWACCEL and select the AV_PIX_FMT_VDPAU format with get_format() instead. -2013-08-05 - 4ee0984 / a0ad5d0 - lavu 52.41.100 / 52.14.0 - pixfmt.h +2013-08-05 - a0ad5d0 - lavu 52.14.0 - pixfmt.h Deprecate AV_PIX_FMT_VDPAU_*. Use AV_PIX_FMT_VDPAU instead. -2013-08-02 - 82fdfe8 / a8b1927 - lavc 55.20.100 / 55.11.0 - avcodec.h +2013-08-02 - a8b1927 - lavc 55.11.0 - avcodec.h Add output_picture_number to AVCodecParserContext. -2013-07-23 - abc8110 - lavc 55.19.100 - avcodec.h - Add avcodec_chroma_pos_to_enum() - Add avcodec_enum_to_chroma_pos() - -2013-07-03 - 838bd73 - lavfi 3.78.100 - avfilter.h - Deprecate avfilter_graph_parse() in favor of the equivalent - avfilter_graph_parse_ptr(). - -2013-06-24 - af5f9c0 / 95d5246 - lavc 55.17.100 / 55.10.0 - avcodec.h +2013-06-24 - 95d5246 - lavc 55.10.0 - avcodec.h Add MPEG-2 AAC profiles -2013-06-25 - af5f9c0 / 95d5246 - lavf 55.10.100 - avformat.h - Add AV_DISPOSITION_* flags to indicate text track kind. - -2013-06-15 - 99b8cd0 - lavu 52.36.100 - Add AVRIPEMD: - av_ripemd_alloc() - av_ripemd_init() - av_ripemd_update() - av_ripemd_final() - -2013-06-04 - 30b491f / fc962d4 - lavu 52.35.100 / 52.13.0 - mem.h +2013-06-04 - fc962d4 - lavu 52.13.0 - mem.h Add av_realloc_array and av_reallocp_array -2013-05-30 - 682b227 - lavu 52.35.100 - Add AVSHA512: - av_sha512_alloc() - av_sha512_init() - av_sha512_update() - av_sha512_final() - -2013-05-24 - 8d4e969 / 129bb23 - lavfi 3.10.0 / 3.70.100 - avfilter.h +2013-05-24 - 129bb23 - lavfi 3.10.0 - avfilter.h Add support for slice multithreading to lavfi. Filters supporting threading are marked with AVFILTER_FLAG_SLICE_THREADS. New fields AVFilterContext.thread_type, AVFilterGraph.thread_type and AVFilterGraph.nb_threads (accessible directly or through AVOptions) may be used to configure multithreading. -2013-05-24 - fe40a9f / 2a6eaea - lavu 52.12.0 / 52.34.100 - cpu.h +2013-05-24 - 2a6eaea - lavu 52.12.0 - cpu.h Add av_cpu_count() function for getting the number of logical CPUs. -2013-05-24 - 0c25c39 / b493847 - lavc 55.7.0 / 55.12.100 - avcodec.h +2013-05-24 - b493847 - lavc 55.7.0 - avcodec.h Add picture_structure to AVCodecParserContext. -2013-05-17 - 3a751ea - lavu 52.33.100 - opt.h - Add AV_OPT_TYPE_COLOR value to AVOptionType enum. - -2013-05-13 - e398416 - lavu 52.31.100 - mem.h - Add av_dynarray2_add(). - -2013-05-12 - 1776177 - lavfi 3.65.100 - Add AVFILTER_FLAG_SUPPORT_TIMELINE* filter flags. - -2013-04-19 - 380cfce - lavc 55.4.100 - Add AV_CODEC_PROP_TEXT_SUB property for text based subtitles codec. - -2013-04-18 - 7c1a002 - lavf 55.3.100 - The matroska demuxer can now output proper verbatim ASS packets. It will - become the default starting lavf 56.0.100. - -2013-04-10 - af0d270 - lavu 25.26.100 - avutil.h,opt.h - Add av_int_list_length() - and av_opt_set_int_list(). - -2013-03-30 - 5c73645 - lavu 52.24.100 - samplefmt.h - Add av_samples_alloc_array_and_samples(). - -2013-03-29 - ef7b6b4 - lavf 55.1.100 - avformat.h - Add av_guess_frame_rate() - -2013-03-20 - 8d928a9 - lavu 52.22.100 - opt.h - Add AV_OPT_TYPE_DURATION value to AVOptionType enum. - -2013-03-17 - 7aa9af5 - lavu 52.20.100 - opt.h - Add AV_OPT_TYPE_VIDEO_RATE value to AVOptionType enum. - -2013-03-07 - 9767ec6 - lavu 52.18.100 - avstring.h,bprint.h - Add av_escape() and av_bprint_escape() API. - -2013-02-24 - b59cd08 - lavfi 3.41.100 - buffersink.h - Add sample_rates field to AVABufferSinkParams. - -2013-01-17 - a1a707f - lavf 54.61.100 - Add av_codec_get_tag2(). - -2013-01-01 - 2eb2e17 - lavfi 3.34.100 - Add avfilter_get_audio_buffer_ref_from_arrays_channels. - -2012-12-20 - 34de47aa - lavfi 3.29.100 - avfilter.h - Add AVFilterLink.channels, avfilter_link_get_channels() - and avfilter_ref_get_channels(). - -2012-12-15 - 96d815fc - lavc 54.80.100 - avcodec.h - Add pkt_size field to AVFrame. - -2012-11-25 - c70ec631 - lavu 52.9.100 - opt.h - Add the following convenience functions to opt.h: - av_opt_get_image_size - av_opt_get_pixel_fmt - av_opt_get_sample_fmt - av_opt_set_image_size - av_opt_set_pixel_fmt - av_opt_set_sample_fmt - -2012-11-17 - 4cd74c81 - lavu 52.8.100 - bprint.h - Add av_bprint_strftime(). - -2012-11-15 - 92648107 - lavu 52.7.100 - opt.h - Add av_opt_get_key_value(). - -2012-11-13 - 79456652 - lavfi 3.23.100 - avfilter.h - Add channels field to AVFilterBufferRefAudioProps. - -2012-11-03 - 481fdeee - lavu 52.3.100 - opt.h - Add AV_OPT_TYPE_SAMPLE_FMT value to AVOptionType enum. - -2012-10-21 - 6fb2fd8 - lavc 54.68.100 - avcodec.h - lavfi 3.20.100 - avfilter.h - Add AV_PKT_DATA_STRINGS_METADATA side data type, used to transmit key/value - strings between AVPacket and AVFrame, and add metadata field to - AVCodecContext (which shall not be accessed by users; see AVFrame metadata - instead). - -2012-09-27 - a70b493 - lavd 54.3.100 - version.h - Add LIBAVDEVICE_IDENT symbol. - -2012-09-27 - a70b493 - lavfi 3.18.100 - version.h - Add LIBAVFILTER_IDENT symbol. - -2012-09-27 - a70b493 - libswr 0.16.100 - version.h - Add LIBSWRESAMPLE_VERSION, LIBSWRESAMPLE_BUILD - and LIBSWRESAMPLE_IDENT symbols. - -2012-09-06 - 29e972f - lavu 51.72.100 - parseutils.h - Add av_small_strptime() time parsing function. - - Can be used as a stripped-down replacement for strptime(), on - systems which do not support it. - -2012-08-25 - 2626cc4 - lavf 54.28.100 - Matroska demuxer now identifies SRT subtitles as AV_CODEC_ID_SUBRIP instead - of AV_CODEC_ID_TEXT. - -2012-08-13 - 5c0d8bc - lavfi 3.8.100 - avfilter.h - Add avfilter_get_class() function, and priv_class field to AVFilter - struct. - -2012-08-12 - a25346e - lavu 51.69.100 - opt.h - Add AV_OPT_FLAG_FILTERING_PARAM symbol in opt.h. - -2012-07-31 - 23fc4dd - lavc 54.46.100 - Add channels field to AVFrame. - -2012-07-30 - f893904 - lavu 51.66.100 - Add av_get_channel_description() - and av_get_standard_channel_layout() functions. - -2012-07-21 - 016a472 - lavc 54.43.100 - Add decode_error_flags field to AVFrame. - -2012-07-20 - b062936 - lavf 54.18.100 - Add avformat_match_stream_specifier() function. - -2012-07-14 - f49ec1b - lavc 54.38.100 - avcodec.h - Add metadata to AVFrame, and the accessor functions - av_frame_get_metadata() and av_frame_set_metadata(). - -2012-07-10 - 0e003d8 - lavc 54.33.100 - Add av_fast_padded_mallocz(). - -2012-07-10 - 21d5609 - lavfi 3.2.0 - avfilter.h - Add init_opaque() callback to AVFilter struct. - -2012-06-26 - e6674e4 - lavu 51.63.100 - imgutils.h - Add functions to libavutil/imgutils.h: - av_image_get_buffer_size() - av_image_fill_arrays() - av_image_copy_to_buffer() - -2012-06-24 - c41899a - lavu 51.62.100 - version.h - version moved from avutil.h to version.h - -2012-04-11 - 359abb1 - lavu 51.58.100 - error.h - Add av_make_error_string() and av_err2str() utilities to - libavutil/error.h. - -2012-06-05 - 62b39d4 - lavc 54.24.100 - Add pkt_duration field to AVFrame. - -2012-05-24 - f2ee065 - lavu 51.54.100 - Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from - libavcodec/avcodec.h to libavutil/pixfmt.h. - -2012-05-14 - 94a9ac1 - lavf 54.5.100 - Add av_guess_sample_aspect_ratio() function. - -2012-04-20 - 65fa7bc - lavfi 2.70.100 - Add avfilter_unref_bufferp() to avfilter.h. - -2012-04-13 - 162e400 - lavfi 2.68.100 - Install libavfilter/asrc_abuffer.h public header. - -2012-03-26 - a67d9cf - lavfi 2.66.100 - Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions. - -2013-05-15 - ff46809 / e6c4ac7 - lavu 52.32.100 / 52.11.0 - pixdesc.h +2013-05-15 - e6c4ac7 - lavu 52.11.0 - pixdesc.h Replace PIX_FMT_* flags with AV_PIX_FMT_FLAG_*. -2013-04-03 - 6fc58a8 / 507b1e4 - lavc 55.7.100 / 55.4.0 - avcodec.h +2013-04-03 - 507b1e4 - lavc 55.4.0 - avcodec.h Add field_order to AVCodecParserContext. -2013-04-19 - f4b05cd / 5e83d9a - lavc 55.5.100 / 55.2.0 - avcodec.h +2013-04-19 - 5e83d9a - lavc 55.2.0 - avcodec.h Add CODEC_FLAG_UNALIGNED to allow decoders to produce unaligned output. -2013-04-11 - lavfi 3.53.100 / 3.8.0 - 231fd44 / 38f0c07 - Move all content from avfiltergraph.h to avfilter.h. Deprecate +2013-04-11 - lavfi 3.8.0 + 38f0c07 - Move all content from avfiltergraph.h to avfilter.h. Deprecate avfilterhraph.h, user applications should include just avfilter.h - 86070b8 / bc1a985 - Add avfilter_graph_alloc_filter(), deprecate avfilter_open() and + bc1a985 - Add avfilter_graph_alloc_filter(), deprecate avfilter_open() and avfilter_graph_add_filter(). - 4fde705 / 1113672 - Add AVFilterContext.graph pointing to the AVFilterGraph that contains the + 1113672 - Add AVFilterContext.graph pointing to the AVFilterGraph that contains the filter. - 710b0aa / 48a5ada - Add avfilter_init_str(), deprecate avfilter_init_filter(). - 46de9ba / 1ba95a9 - Add avfilter_init_dict(). - 16fc24b / 7cdd737 - Add AVFilter.flags field and AVFILTER_FLAG_DYNAMIC_{INPUTS,OUTPUTS} flags. - f4db6bf / 7e8fe4b - Add avfilter_pad_count() for counting filter inputs/outputs. - 835cc0f / fa2a34c - Add avfilter_next(), deprecate av_filter_next(). + 48a5ada - Add avfilter_init_str(), deprecate avfilter_init_filter(). + 1ba95a9 - Add avfilter_init_dict(). + 7cdd737 - Add AVFilter.flags field and AVFILTER_FLAG_DYNAMIC_{INPUTS,OUTPUTS} flags. + 7e8fe4b - Add avfilter_pad_count() for counting filter inputs/outputs. + fa2a34c - Add avfilter_next(), deprecate av_filter_next(). Deprecate avfilter_uninit(). -2013-04-09 - lavfi 3.51.100 / 3.7.0 - avfilter.h - 0594ef0 / b439c99 - Add AVFilter.priv_class for exporting filter options through the +2013-04-09 - lavfi 3.7.0 - avfilter.h + b439c99 - Add AVFilter.priv_class for exporting filter options through the AVOptions API in the similar way private options work in lavc and lavf. - 44d4488 / 8114c10 - Add avfilter_get_class(). + 8114c10 - Add avfilter_get_class(). Switch all filters to use AVOptions. -2013-03-19 - 17ebef2 / 2c328a9 - lavu 52.20.100 / 52.9.0 - pixdesc.h +2013-03-19 - 2c328a9 - lavu 52.9.0 - pixdesc.h Add av_pix_fmt_count_planes() function for counting planes in a pixel format. -2013-03-16 - ecade98 / 42c7c61 - lavfi 3.47.100 / 3.6.0 +2013-03-16 - 42c7c61 - lavfi 3.6.0 Add AVFilterGraph.nb_filters, deprecate AVFilterGraph.filter_count. -2013-03-08 - Reference counted buffers - lavu 52.8.0, lavc 55.0.100 / 55.0.0, lavf 55.0.100 / 55.0.0, -lavd 54.4.100 / 54.0.0, lavfi 3.5.0 - 36099df / 8e401db, 532f31a / 1cec062 - add a new API for reference counted buffers and buffer +2013-03-08 - Reference counted buffers - lavu 52.8.0, lavc 55.0.0, lavf 55.0.0, +lavd 54.0.0, lavfi 3.5.0 + 8e401db, 1cec062 - add a new API for reference counted buffers and buffer pools (new header libavutil/buffer.h). - 2653e12 / 1afddbe - add AVPacket.buf to allow reference counting for the AVPacket data. + 1afddbe - add AVPacket.buf to allow reference counting for the AVPacket data. Add av_packet_from_data() function for constructing packets from av_malloc()ed data. - c4e8821 / 7ecc2d4 - move AVFrame from lavc to lavu (new header libavutil/frame.h), add + 7ecc2d4 - move AVFrame from lavc to lavu (new header libavutil/frame.h), add AVFrame.buf/extended_buf to allow reference counting for the AVFrame data. Add new API for working with reference-counted AVFrames. - 80e9e63 / 759001c - add the refcounted_frames field to AVCodecContext to make audio and + 759001c - add the refcounted_frames field to AVCodecContext to make audio and video decoders return reference-counted frames. Add get_buffer2() callback to AVCodecContext which allocates reference-counted frames. Add avcodec_default_get_buffer2() as the default get_buffer2() @@ -618,63 +281,68 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 * qscale_table, qstride, qscale_type, mbskip_table, motion_val, mb_type, dct_coeff, ref_index -- mpegvideo-specific tables, which are not exported anymore. - a05a44e / 7e35037 - switch libavfilter to use AVFrame instead of AVFilterBufferRef. Add + 7e35037 - switch libavfilter to use AVFrame instead of AVFilterBufferRef. Add av_buffersrc_add_frame(), deprecate av_buffersrc_buffer(). Add av_buffersink_get_frame() and av_buffersink_get_samples(), deprecate av_buffersink_read() and av_buffersink_read_samples(). Deprecate AVFilterBufferRef and all functions for working with it. -2013-03-17 - 6c17ff8 / 12c5c1d - lavu 52.19.100 / 52.8.0 - avstring.h +2013-03-17 - 12c5c1d - lavu 52.8.0 - avstring.h Add av_isdigit, av_isgraph, av_isspace, av_isxdigit. -2013-02-23 - 71cf094 / 9f12235 - lavfi 3.40.100 / 3.4.0 - avfiltergraph.h +2013-02-23 - 9f12235 - lavfi 3.4.0 - avfiltergraph.h Add resample_lavr_opts to AVFilterGraph for setting libavresample options for auto-inserted resample filters. -2013-01-25 - e7e14bc / 38c1466 - lavu 52.17.100 / 52.7.0 - dict.h +2013-01-25 - 38c1466 - lavu 52.7.0 - dict.h Add av_dict_parse_string() to set multiple key/value pairs at once from a string. -2013-01-25 - 25be630 / b85a5e8 - lavu 52.16.100 / 52.6.0 - avstring.h +2013-01-25 - b85a5e8 - lavu 52.6.0 - avstring.h Add av_strnstr() -2013-01-15 - e7e0186 / 8ee288d - lavu 52.15.100 / 52.5.0 - hmac.h +2013-01-15 - 8ee288d - lavu 52.5.0 - hmac.h Add AVHMAC. -2013-01-13 - 8ee7b38 / 44e065d - lavc 54.87.100 / 54.36.0 - vdpau.h +2013-01-13 - 44e065d - lavc 54.36.0 - vdpau.h Add AVVDPAUContext struct for VDPAU hardware-accelerated decoding. -2013-01-12 - dae382b / 169fb94 - lavu 52.14.100 / 52.4.0 - pixdesc.h +2013-01-12 - 169fb94 - lavu 52.4.0 - pixdesc.h Add AV_PIX_FMT_VDPAU flag. -2013-01-07 - 249fca3 / 074a00d - lavr 1.1.0 +2013-01-07 - 074a00d - lavr 1.1.0 Add avresample_set_channel_mapping() for input channel reordering, duplication, and silencing. -2012-12-29 - 2ce43b3 / d8fd06c - lavu 52.13.100 / 52.3.0 - avstring.h +------------------------------8<------------------------------------- + 9 branch was cut here +----------------------------->8-------------------------------------- + +2012-12-29 - d8fd06c - lavu 52.3.0 - avstring.h Add av_basename() and av_dirname(). -2012-11-11 - 03b0787 / 5980f5d - lavu 52.6.100 / 52.2.0 - audioconvert.h +2012-11-11 - 5980f5d - lavu 52.2.0 - audioconvert.h Rename audioconvert.h to channel_layout.h. audioconvert.h is now deprecated. -2012-11-05 - 7d26be6 / dfde8a3 - lavu 52.5.100 / 52.1.0 - intmath.h +2012-11-05 - dfde8a3 - lavu 52.1.0 - intmath.h Add av_ctz() for trailing zero bit count -2012-10-21 - e3a91c5 / a893655 - lavu 51.77.100 / 51.45.0 - error.h +2012-10-21 - a893655 - lavu 51.45.0 - error.h Add AVERROR_EXPERIMENTAL -2012-10-12 - a33ed6b / d2fcb35 - lavu 51.76.100 / 51.44.0 - pixdesc.h +2012-10-12 - d2fcb35 - lavu 51.44.0 - pixdesc.h Add functions for accessing pixel format descriptors. Accessing the av_pix_fmt_descriptors array directly is now deprecated. -2012-10-11 - f391e40 / 9a92aea - lavu 51.75.100 / 51.43.0 - aes.h, md5.h, sha.h, tree.h +2012-10-11 - 9a92aea - lavu 51.43.0 - aes.h, md5.h, sha.h, tree.h Add functions for allocating the opaque contexts for the algorithms, + deprecate the context size variables. -2012-10-10 - de31814 / b522000 - lavf 54.32.100 / 54.18.0 - avio.h +2012-10-10 - b522000 - lavf 54.18.0 - avio.h Add avio_closep to complement avio_close. -2012-10-08 - ae77266 / 78071a1 - lavu 51.74.100 / 51.42.0 - pixfmt.h +2012-10-08 - 78071a1 - lavu 51.42.0 - pixfmt.h Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*. To provide backwards compatibility, PixelFormat is now #defined as AVPixelFormat. @@ -682,23 +350,23 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 'PixelFormat' identifier. Such code should either #undef PixelFormat or stop using the PixelFormat name. -2012-10-05 - 55c49af / e7ba5b1 - lavr 1.0.0 - avresample.h +2012-10-05 - e7ba5b1 - lavr 1.0.0 - avresample.h Data planes parameters to avresample_convert() and avresample_read() are now uint8_t** instead of void**. Libavresample is now stable. -2012-09-24 - 46a3595 / a42aada - lavc 54.59.100 / 54.28.0 - avcodec.h +2012-09-24 - a42aada - lavc 54.28.0 - avcodec.h Add avcodec_free_frame(). This function must now be used for freeing an AVFrame. -2012-09-12 - e3e09f2 / 8919fee - lavu 51.73.100 / 51.41.0 - audioconvert.h +2012-09-12 - 8919fee - lavu 51.41.0 - audioconvert.h Added AV_CH_LOW_FREQUENCY_2 channel mask value. -2012-09-04 - b21b5b0 / 686a329 - lavu 51.71.100 / 51.40.0 - opt.h +2012-09-04 - 686a329 - lavu 51.40.0 - opt.h Reordered the fields in default_val in AVOption, changed which default_val field is used for which AVOptionType. -2012-08-30 - 98298eb / a231832 - lavc 54.54.101 / 54.26.1 - avcodec.h +2012-08-30 - a231832 - lavc 54.26.1 - avcodec.h Add codec descriptor properties AV_CODEC_PROP_LOSSY and AV_CODEC_PROP_LOSSLESS. @@ -706,90 +374,101 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 Add codec descriptors for accessing codec properties without having to refer to a specific decoder or encoder. - f5f3684 / c223d79 - Add an AVCodecDescriptor struct and functions + c223d79 - Add an AVCodecDescriptor struct and functions avcodec_descriptor_get() and avcodec_descriptor_next(). - f5f3684 / 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY. - 6c180b3 / 91e59fe - Add avcodec_descriptor_get_by_name(). + 51efed1 - Add AVCodecDescriptor.props and AV_CODEC_PROP_INTRA_ONLY. + 91e59fe - Add avcodec_descriptor_get_by_name(). -2012-08-08 - f5f3684 / 987170c - lavu 51.68.100 / 51.38.0 - dict.h + +2012-08-08 - 1d9c2dc - lavu 51.39 - avutil.h + Don't implicitly include libavutil/common.h in avutil.h + +2012-08-08 - 987170c - lavu 51.38 - dict.h Add av_dict_count(). -2012-08-07 - 7a72695 / 104e10f - lavc 54.51.100 / 54.25.0 - avcodec.h +2012-08-07 - 104e10f - lavc 54.25 - avcodec.h Rename CodecID to AVCodecID and all CODEC_ID_* to AV_CODEC_ID_*. To provide backwards compatibility, CodecID is now #defined as AVCodecID. Note that this can break user code that includes avcodec.h and uses the 'CodecID' identifier. Such code should either #undef CodecID or stop using the CodecID name. -2012-08-03 - e776ee8 / 239fdf1 - lavu 51.66.101 / 51.37.1 - cpu.h +2012-08-03 - 239fdf1 - lavu 51.37.1 - cpu.h lsws 2.1.1 - swscale.h Rename AV_CPU_FLAG_MMX2 ---> AV_CPU_FLAG_MMXEXT. Rename SWS_CPU_CAPS_MMX2 ---> SWS_CPU_CAPS_MMXEXT. -2012-07-29 - 7c26761 / 681ed00 - lavf 54.22.100 / 54.13.0 - avformat.h +2012-07-29 - 681ed00 - lavf 54.13.0 - avformat.h Add AVFMT_FLAG_NOBUFFER for low latency use cases. -2012-07-10 - fbe0245 / f3e5e6f - lavu 51.65.100 / 51.37.0 +2012-07-20 - b70d89a - lavfi 3.0.0 - avfilter.h + Add avfilter_unref_bufferp(). + +2012-07-10 - 5fade8a - lavu 51.37.0 Add av_malloc_array() and av_mallocz_array() -2012-06-22 - e847f41 / d3d3a32 - lavu 51.61.100 / 51.34.0 +2012-06-22 - d3d3a32 - lavu 51.34.0 Add av_usleep() -2012-06-20 - 4da42eb / ae0a301 - lavu 51.60.100 / 51.33.0 +2012-06-20 - ae0a301 - lavu 51.33.0 Move av_gettime() to libavutil, add libavutil/time.h -2012-06-09 - 82edf67 / 3971be0 - lavr 0.0.3 +2012-06-09 - 3971be0 - lavr 0.0.3 Add a parameter to avresample_build_matrix() for Dolby/DPLII downmixing. -2012-06-12 - c7b9eab / 9baeff9 - lavfi 2.79.100 / 2.23.0 - avfilter.h +2012-06-12 - 9baeff9 - lavfi 2.23.0 - avfilter.h Add AVFilterContext.nb_inputs/outputs. Deprecate AVFilterContext.input/output_count. -2012-06-12 - c7b9eab / 84b9fbe - lavfi 2.79.100 / 2.22.0 - avfilter.h +2012-06-12 - 84b9fbe - lavfi 2.22.0 - avfilter.h Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those should now be used instead of accessing AVFilterPad members directly. -2012-06-12 - 3630a07 / b0f0dfc - lavu 51.57.100 / 51.32.0 - audioconvert.h +2012-06-12 - b0f0dfc - lavu 51.32.0 - audioconvert.h Add av_get_channel_layout_channel_index(), av_get_channel_name() and av_channel_layout_extract_channel(). -2012-05-25 - 53ce990 / 154486f - lavu 51.55.100 / 51.31.0 - opt.h +2012-05-25 - 154486f - lavu 51.31.0 - opt.h Add av_opt_set_bin() -2012-05-15 - lavfi 2.74.100 / 2.17.0 +2012-05-26 - e9cef89 - lavf 54.3.0 + Add AVFMT_TS_NONSTRICT format flag to indicate that a muxer supports + non-increasing monotone timestamps. + +2012-05-15 - lavfi 2.17.0 Add support for audio filters - 61930bd / ac71230, 1cbf7fb / a2cd9be - add video/audio buffer sink in a new installed + ac71230/a2cd9be - add video/audio buffer sink in a new installed header buffersink.h - 1cbf7fb / 720c6b7 - add av_buffersrc_write_frame(), deprecate + 720c6b7 - add av_buffersrc_write_frame(), deprecate av_vsrc_buffer_add_frame() - 61930bd / ab16504 - add avfilter_copy_buf_props() - 61930bd / 9453c9e - add extended_data to AVFilterBuffer - 61930bd / 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() + ab16504 - add avfilter_copy_buf_props() + 9453c9e - add extended_data to AVFilterBuffer + 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays() -2012-05-09 - lavu 51.53.100 / 51.30.0 - samplefmt.h - 61930bd / 142e740 - add av_samples_copy() - 61930bd / 6d7f617 - add av_samples_set_silence() +2012-05-09 - lavu 51.30.0 - samplefmt.h + 142e740 - add av_samples_copy() + 6d7f617 - add av_samples_set_silence() -2012-05-09 - 61930bd / a5117a2 - lavc 54.21.101 / 54.13.1 +2012-05-09 - a5117a2 - lavc 54.13.1 For audio formats with fixed frame size, the last frame no longer needs to be padded with silence, libavcodec will handle this internally (effectively all encoders behave as if they had CODEC_CAP_SMALL_LAST_FRAME set). -2012-05-07 - 653d117 / 828bd08 - lavc 54.20.100 / 54.13.0 - avcodec.h +2012-05-07 - 828bd08 - lavc 54.13.0 - avcodec.h Add sample_rate and channel_layout fields to AVFrame. -2012-05-01 - 2330eb1 / 4010d72 - lavr 0.0.1 +2012-05-01 - 4010d72 - lavr 0.0.1 Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8. -2012-04-25 - e890b68 / 3527a73 - lavu 51.48.100 / 51.29.0 - cpu.h +2012-04-25 - 3527a73 - lavu 51.29.0 - cpu.h Add av_parse_cpu_flags() -2012-04-24 - 3ead79e / c8af852 - lavr 0.0.0 +2012-04-24 - c8af852 - lavr 0.0.0 Add libavresample audio conversion library -2012-04-20 - 3194ab7 / 0c0d1bc - lavu 51.47.100 / 51.28.0 - audio_fifo.h +2012-04-20 - 0c0d1bc - lavu 51.28.0 - audio_fifo.h Add audio FIFO functions: av_audio_fifo_free() av_audio_fifo_alloc() @@ -801,155 +480,137 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 av_audio_fifo_size() av_audio_fifo_space() -2012-04-14 - lavfi 2.70.100 / 2.16.0 - avfiltergraph.h - 7432bcf / d7bcc71 Add avfilter_graph_parse2(). +2012-04-14 - lavfi 2.16.0 - avfiltergraph.h + d7bcc71 Add avfilter_graph_parse2(). + 91d3cbe Add avfilter_inout_alloc() and avfilter_inout_free(). -2012-04-08 - 6bfb304 / 4d693b0 - lavu 51.46.100 / 51.27.0 - samplefmt.h +2012-04-08 - 4d693b0 - lavu 51.27.0 - samplefmt.h Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() -2012-03-21 - b75c67d - lavu 51.43.100 - Add bprint.h for bprint API. +2012-04-05 - 5cc51a5 - lavu 51.26.0 - audioconvert.h + Add av_get_default_channel_layout() -2012-02-21 - 9cbf17e - lavc 54.4.100 - Add av_get_pcm_codec() function. - -2012-02-16 - 560b224 - libswr 0.7.100 - Add swr_set_matrix() function. - -2012-02-09 - c28e7af - lavu 51.39.100 - Add a new installed header libavutil/timestamp.h with timestamp - utilities. - -2012-02-06 - 70ffda3 - lavu 51.38.100 - Add av_parse_ratio() function to parseutils.h. - -2012-02-06 - 70ffda3 - lavu 51.38.100 - Add AV_LOG_MAX_OFFSET macro to log.h. - -2012-02-02 - 0eaa123 - lavu 51.37.100 - Add public timecode helpers. - -2012-01-24 - 0c3577b - lavfi 2.60.100 - Add avfilter_graph_dump. - -2012-03-20 - 0ebd836 / 3c90cc2 - lavfo 54.2.0 +2012-03-20 - 3c90cc2 - lavfo 54.2.0 Deprecate av_read_packet(), use av_read_frame() with AVFMT_FLAG_NOPARSE | AVFMT_FLAG_NOFILLIN in AVFormatContext.flags -2012-03-05 - lavc 54.10.100 / 54.8.0 - f095391 / 6699d07 Add av_get_exact_bits_per_sample() - f095391 / 9524cf7 Add av_get_audio_frame_duration() +2012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h + Add av_set_cpu_flags_mask(). -2012-03-04 - 2af8f2c / 44fe77b - lavc 54.8.100 / 54.7.0 - avcodec.h +2012-03-05 - lavc 54.8.0 + 6699d07 Add av_get_exact_bits_per_sample() + 9524cf7 Add av_get_audio_frame_duration() + +2012-03-04 - 44fe77b - lavc 54.7.0 - avcodec.h Add av_codec_is_encoder/decoder(). -2012-03-01 - 1eb7f39 / 442c132 - lavc 54.5.100 / 54.3.0 - avcodec.h +2012-03-01 - 442c132 - lavc 54.3.0 - avcodec.h Add av_packet_shrink_side_data. -2012-02-29 - 79ae084 / dd2a4bc - lavf 54.2.100 / 54.2.0 - avformat.h +2012-02-29 - dd2a4bc - lavf 54.2.0 - avformat.h Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC, used for dealing with attached pictures/cover art. -2012-02-25 - 305e4b3 / c9bca80 - lavu 51.41.100 / 51.24.0 - error.h +2012-02-25 - c9bca80 - lavu 51.24.0 - error.h Add AVERROR_UNKNOWN NOTE: this was backported to 0.8 -2012-02-20 - eadd426 / e9cda85 - lavc 54.2.100 / 54.2.0 +2012-02-20 - e9cda85 - lavc 54.2.0 Add duration field to AVCodecParserContext -2012-02-20 - eadd426 / 0b42a93 - lavu 51.40.100 / 51.23.1 - mathematics.h +2012-02-20 - 0b42a93 - lavu 51.23.1 - mathematics.h Add av_rescale_q_rnd() -2012-02-08 - f2b20b7 / 38d5533 - lavu 51.38.101 / 51.22.1 - pixdesc.h +2012-02-08 - 38d5533 - lavu 51.22.1 - pixdesc.h Add PIX_FMT_PSEUDOPAL flag. -2012-02-08 - f2b20b7 / 52f82a1 - lavc 54.2.100 / 54.1.0 +2012-02-08 - 52f82a1 - lavc 54.01.0 Add avcodec_encode_video2() and deprecate avcodec_encode_video(). -2012-02-01 - 4c677df / 316fc74 - lavc 54.1.0 +2012-02-01 - 316fc74 - lavc 54.01.0 Add av_fast_padded_malloc() as alternative for av_realloc() when aligned memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE zero-padded bytes at the end. -2012-01-31 - a369a6b / dd6d3b0 - lavf 54.1.0 +2012-01-31 - dd6d3b0 - lavf 54.01.0 Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags(). NOTE: this was backported to 0.8 -2012-01-31 - a369a6b / af08d9a - lavc 54.1.0 +2012-01-31 - af08d9a - lavc 54.01.0 Add avcodec_is_open() function. NOTE: this was backported to 0.8 -2012-01-30 - 151ecc2 / 8b93312 - lavu 51.36.100 / 51.22.0 - intfloat.h +2012-01-30 - 8b93312 - lavu 51.22.0 - intfloat.h Add a new installed header libavutil/intfloat.h with int/float punning functions. NOTE: this was backported to 0.8 -2012-01-25 - lavf 53.31.100 / 53.22.0 - 3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible +2012-01-25 - lavf 53.22.0 + f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for muxers supporting it (av_write_frame makes sure it is called only for muxers with this flag). -2012-01-15 - lavc 53.56.105 / 53.34.0 +------------------------------8<------------------------------------- + 0.8 branch was cut here +----------------------------->8-------------------------------------- + +2012-01-15 - lavc 53.34.0 New audio encoding API: - 67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio + b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio encoders. - 67f5650 / 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. - 67f5650 / b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). + 5ee5fa0 Add avcodec_fill_audio_frame() as a convenience function. + b2c75b6 Add avcodec_encode_audio2() and deprecate avcodec_encode_audio(). Add AVCodec.encode2(). -2012-01-12 - b18e17e / 3167dc9 - lavfi 2.59.100 / 2.15.0 +2012-01-12 - 3167dc9 - lavfi 2.15.0 Add a new installed header -- libavfilter/version.h -- with version macros. -2011-12-08 - a502939 - lavfi 2.52.0 - Add av_buffersink_poll_frame() to buffersink.h. - -2011-12-08 - 26c6fec - lavu 51.31.0 - Add av_log_format_line. - -2011-12-03 - 976b095 - lavu 51.30.0 - Add AVERROR_BUG. - -2011-11-24 - 573ffbb - lavu 51.28.1 - Add av_get_alt_sample_fmt() to samplefmt.h. - -2011-11-03 - 96949da - lavu 51.23.0 - Add av_strcasecmp() and av_strncasecmp() to avstring.h. - -2011-10-20 - b35e9e1 - lavu 51.22.0 - Add av_strtok() to avstring.h. - -2012-01-03 - ad1c8dd / b73ec05 - lavu 51.34.100 / 51.21.0 +2011-01-03 - b73ec05 - lavu 51.21.0 Add av_popcount64 -2011-12-18 - 7c29313 / 8400b12 - lavc 53.46.1 / 53.28.1 +2011-12-25 - lavfi 2.14.0 + e1d9dbf Add a new installed header - buffersrc.h + It contains a new function av_buffersrc_buffer() that allows passing + frames to the 'buffer' filter, but unlike av_vsrc_buffer_add_frame() + it allows for direct rendering. + 1c9e340 Add avfilter_copy_frame_props() for copying properties from + AVFrame to AVFilterBufferRef. + +2011-12-25 - lavc 53.31.0 + Add the following new fields to AVFrame: + b58dbb5 sample_aspect_ratio + 3a2ddf7 width, height + 8a4a5f6 format + +2011-12-18 - 8400b12 - lavc 53.28.1 Deprecate AVFrame.age. The field is unused. -2011-12-12 - 8bc7fe4 / 5266045 - lavf 53.25.0 / 53.17.0 +2011-12-12 - 5266045 - lavf 53.17.0 Add avformat_close_input(). Deprecate av_close_input_file() and av_close_input_stream(). -2011-12-02 - e4de716 / 0eea212 - lavc 53.40.0 / 53.25.0 +2011-12-02 - 0eea212 - lavc 53.25.0 Add nb_samples and extended_data fields to AVFrame. Deprecate AVCODEC_MAX_AUDIO_FRAME_SIZE. Deprecate avcodec_decode_audio3() in favor of avcodec_decode_audio4(). avcodec_decode_audio4() writes output samples to an AVFrame, which allows audio decoders to use get_buffer(). -2011-12-04 - e4de716 / 560f773 - lavc 53.40.0 / 53.24.0 +2011-12-04 - 560f773 - lavc 53.24.0 Change AVFrame.data[4]/base[4]/linesize[4]/error[4] to [8] at next major bump. Change AVPicture.data[4]/linesize[4] to [8] at next major bump. Change AVCodecContext.error[4] to [8] at next major bump. Add AV_NUM_DATA_POINTERS to simplify the bump transition. -2011-11-23 - 8e576d5 / bbb46f3 - lavu 51.27.0 / 51.18.0 +2011-11-23 - bbb46f3 - lavu 51.18.0 Add av_samples_get_buffer_size(), av_samples_fill_arrays(), and av_samples_alloc(), to samplefmt.h. -2011-11-23 - 8e576d5 / 8889cc4 - lavu 51.27.0 / 51.17.0 +2011-11-23 - 8889cc4 - lavu 51.17.0 Add planar sample formats and av_sample_fmt_is_planar() to samplefmt.h. -2011-11-19 - dbb38bc / f3a29b7 - lavc 53.36.0 / 53.21.0 +2011-11-19 - f3a29b7 - lavc 53.21.0 Move some AVCodecContext fields to a new private struct, AVCodecInternal, which is accessed from a new field, AVCodecContext.internal. - fields moved: @@ -957,364 +618,220 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 AVCodecContext.internal_buffer_count --> AVCodecInternal.buffer_count AVCodecContext.is_copy --> AVCodecInternal.is_copy -2011-11-16 - 8709ba9 / 6270671 - lavu 51.26.0 / 51.16.0 +2011-11-16 - 6270671 - lavu 51.16.0 Add av_timegm() -2011-11-13 - lavf 53.21.0 / 53.15.0 +2011-11-13 - lavf 53.15.0 New interrupt callback API, allowing per-AVFormatContext/AVIOContext interrupt callbacks. - 5f268ca / 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to + 6aa0b98 Add AVIOInterruptCB struct and the interrupt_callback field to AVFormatContext. - 5f268ca / 1dee0ac Add avio_open2() with additional parameters. Those are + 1dee0ac Add avio_open2() with additional parameters. Those are an interrupt callback and an options AVDictionary. This will allow passing AVOptions to protocols after lavf 54.0. -2011-11-06 - 13b7781 / ba04ecf - lavu 51.24.0 / 51.14.0 +2011-11-06 - ba04ecf - lavu 51.14.0 Add av_strcasecmp() and av_strncasecmp() to avstring.h. -2011-11-06 - 13b7781 / 07b172f - lavu 51.24.0 / 51.13.0 +2011-11-06 - 07b172f - lavu 51.13.0 Add av_toupper()/av_tolower() -2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0 +2011-11-05 - b6d08f4 - lavf 53.13.0 Add avformat_network_init()/avformat_network_deinit() -2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0 +2011-10-27 - 512557b - lavc 53.15.0 Remove avcodec_parse_frame. Deprecate AVCodecContext.parse_only and CODEC_CAP_PARSE_ONLY. -2011-10-19 - d049257 / 569129a - lavf 53.17.0 / 53.10.0 +2011-10-19 - 569129a - lavf 53.10.0 Add avformat_new_stream(). Deprecate av_new_stream(). -2011-10-13 - 91eb1b1 / b631fba - lavf 53.16.0 / 53.9.0 +2011-10-13 - b631fba - lavf 53.9.0 Add AVFMT_NO_BYTE_SEEK AVInputFormat flag. -2011-10-12 - lavu 51.21.0 / 51.12.0 +2011-10-12 - lavu 51.12.0 AVOptions API rewrite. - - f884ef0 / 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* + - 145f741 FF_OPT_TYPE* renamed to AV_OPT_TYPE_* - new setting/getting functions with slightly different semantics: - f884ef0 / dac66da av_set_string3 -> av_opt_set + dac66da av_set_string3 -> av_opt_set av_set_double -> av_opt_set_double av_set_q -> av_opt_set_q av_set_int -> av_opt_set_int - f884ef0 / 41d9d51 av_get_string -> av_opt_get + 41d9d51 av_get_string -> av_opt_get av_get_double -> av_opt_get_double av_get_q -> av_opt_get_q av_get_int -> av_opt_get_int - - f884ef0 / 8c5dcaa trivial rename av_next_option -> av_opt_next - - f884ef0 / 641c7af new functions - av_opt_child_next, av_opt_child_class_next + - 8c5dcaa trivial rename av_next_option -> av_opt_next + - 641c7af new functions - av_opt_child_next, av_opt_child_class_next and av_opt_find2() -2011-09-22 - a70e787 - lavu 51.17.0 - Add av_x_if_null(). - -2011-09-18 - 645cebb - lavc 53.16.0 - Add showall flag2 - -2011-09-16 - ea8de10 - lavfi 2.42.0 - Add avfilter_all_channel_layouts. - -2011-09-16 - 9899037 - lavfi 2.41.0 - Rename avfilter_all_* function names to avfilter_make_all_*. - - In particular, apply the renames: - avfilter_all_formats -> avfilter_make_all_formats - avfilter_all_channel_layouts -> avfilter_make_all_channel_layouts - avfilter_all_packing_formats -> avfilter_make_all_packing_formats - -2011-09-12 - 4381bdd - lavfi 2.40.0 - Change AVFilterBufferRefAudioProps.sample_rate type from uint32_t to int. - -2011-09-12 - 2c03174 - lavfi 2.40.0 - Simplify signature for avfilter_get_audio_buffer(), make it - consistent with avfilter_get_video_buffer(). - -2011-09-06 - 4f7dfe1 - lavfi 2.39.0 - Rename libavfilter/vsink_buffer.h to libavfilter/buffersink.h. - -2011-09-06 - c4415f6 - lavfi 2.38.0 - Unify video and audio sink API. - - In particular, add av_buffersink_get_buffer_ref(), deprecate - av_vsink_buffer_get_video_buffer_ref() and change the value for the - opaque field passed to the abuffersink init function. - -2011-09-04 - 61e2e29 - lavu 51.16.0 - Add av_asprintf(). - -2011-08-22 - dacd827 - lavf 53.10.0 - Add av_find_program_from_stream(). - -2011-08-20 - 69e2c1a - lavu 51.13.0 - Add av_get_media_type_string(). - -2011-09-03 - 1889c67 / fb4ca26 - lavc 53.13.0 - lavf 53.11.0 +2011-09-03 - fb4ca26 - lavc 53.10.0 + lavf 53.6.0 lsws 2.1.0 Add {avcodec,avformat,sws}_get_class(). -2011-08-03 - 1889c67 / c11fb82 - lavu 51.15.0 +2011-09-03 - c11fb82 - lavu 51.10.0 Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. -2011-08-14 - 323b930 - lavu 51.12.0 - Add av_fifo_peek2(), deprecate av_fifo_peek(). - -2011-08-26 - lavu 51.14.0 / 51.9.0 - - 976a8b2 / add41de..976a8b2 / abc78a5 Do not include intfloat_readwrite.h, +2011-08-26 - lavu 51.9.0 + - f2011ed Add av_fifo_peek2(), deprecate av_fifo_peek(). + - add41de..abc78a5 Do not include intfloat_readwrite.h, mathematics.h, rational.h, pixfmt.h, or log.h from avutil.h. -2011-08-16 - 27fbe31 / 48f9e45 - lavf 53.11.0 / 53.8.0 +2011-08-16 - 48f9e45 - lavf 53.4.0 Add avformat_query_codec(). -2011-08-16 - 27fbe31 / bca06e7 - lavc 53.11.0 +2011-08-16 - bca06e7 - lavc 53.8.0 Add avcodec_get_type(). -2011-08-06 - 0cb233c / 2f63440 - lavf 53.7.0 +2011-08-06 - 2f63440 - lavf 53.4.0 Add error_recognition to AVFormatContext. -2011-08-02 - 1d186e9 / 9d39cbf - lavc 53.9.1 +2011-08-02 - 9d39cbf - lavc 53.7.1 Add AV_PKT_FLAG_CORRUPT AVPacket flag. -2011-07-16 - b57df29 - lavfi 2.27.0 - Add audio packing negotiation fields and helper functions. - - In particular, add AVFilterPacking enum, planar, in_packings and - out_packings fields to AVFilterLink, and the functions: - avfilter_set_common_packing_formats() - avfilter_all_packing_formats() - -2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0 +2011-07-10 - a67c061 - lavf 53.3.0 Add avformat_find_stream_info(), deprecate av_find_stream_info(). NOTE: this was backported to 0.7 -2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0 +2011-07-10 - 0b950fe - lavc 53.6.0 Add avcodec_open2(), deprecate avcodec_open(). NOTE: this was backported to 0.7 Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and avcodec_alloc_context2(). -2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h - Add function av_get_output_timestamp(). - -2011-06-28 - 5129336 - lavu 51.11.0 - avutil.h - Define the AV_PICTURE_TYPE_NONE value in AVPictureType enum. - -2011-06-19 - fd2c0a5 - lavfi 2.23.0 - avfilter.h - Add layout negotiation fields and helper functions. - - In particular, add in_chlayouts and out_chlayouts to AVFilterLink, - and the functions: - avfilter_set_common_sample_formats() - avfilter_set_common_channel_layouts() - avfilter_all_channel_layouts() - -2011-06-19 - 527ca39 - lavfi 2.22.0 - AVFilterFormats - Change type of AVFilterFormats.formats from int * to int64_t *, - and update formats handling API accordingly. - - avfilter_make_format_list() still takes a int32_t array and converts - it to int64_t. A new function, avfilter_make_format64_list(), that - takes int64_t arrays has been added. - -2011-06-19 - 44f669e - lavfi 2.21.0 - vsink_buffer.h - Add video sink buffer and vsink_buffer.h public header. - -2011-06-12 - 9fdf772 - lavfi 2.18.0 - avcodec.h - Add avfilter_get_video_buffer_ref_from_frame() function in - libavfilter/avcodec.h. - -2011-06-12 - c535494 - lavfi 2.17.0 - avfiltergraph.h - Add avfilter_inout_alloc() and avfilter_inout_free() functions. - -2011-06-12 - 6119b23 - lavfi 2.16.0 - avfilter_graph_parse() - Change avfilter_graph_parse() signature. - -2011-06-23 - 686959e / 67e9ae1 - lavu 51.10.0 / 51.8.0 - attributes.h +2011-06-23 - 67e9ae1 - lavu 51.8.0 - attributes.h Add av_printf_format(). -2011-06-16 - 2905e3f / 05e84c9, 2905e3f / 25de595 - lavf 53.4.0 / 53.2.0 - avformat.h +------------------------------8<------------------------------------- + 0.7 branch was cut here +----------------------------->8-------------------------------------- + +2011-06-16 - 05e84c9, 25de595 - lavf 53.2.0 - avformat.h Add avformat_open_input and avformat_write_header(). Deprecate av_open_input_stream, av_open_input_file, AVFormatParameters and av_write_header. -2011-06-16 - 2905e3f / 7e83e1c, 2905e3f / dc59ec5 - lavu 51.9.0 / 51.7.0 - opt.h +2011-06-16 - 7e83e1c, dc59ec5 - lavu 51.7.0 - opt.h Add av_opt_set_dict() and av_opt_find(). Deprecate av_find_opt(). Add AV_DICT_APPEND flag. -2011-06-10 - 45fb647 / cb7c11c - lavu 51.6.0 - opt.h +2011-06-10 - cb7c11c - lavu 51.6.0 - opt.h Add av_opt_flag_is_set(). -2011-06-10 - c381960 - lavfi 2.15.0 - avfilter_get_audio_buffer_ref_from_arrays - Add avfilter_get_audio_buffer_ref_from_arrays() to avfilter.h. - -2011-06-09 - f9ecb84 / d9f80ea - lavu 51.8.0 - AVMetadata +2011-06-08 - d9f80ea - lavu 51.5.0 - AVMetadata Move AVMetadata from lavf to lavu and rename it to AVDictionary -- new installed header dict.h. All av_metadata_* functions renamed to av_dict_*. -2011-06-07 - d552f61 / a6703fa - lavu 51.8.0 - av_get_bytes_per_sample() +2011-06-07 - a6703fa - lavu 51.4.0 - av_get_bytes_per_sample() Add av_get_bytes_per_sample() in libavutil/samplefmt.h. Deprecate av_get_bits_per_sample_fmt(). -2011-06-05 - f956924 / b39b062 - lavu 51.8.0 - opt.h +2011-06-05 - b39b062 - lavu 51.3.0 - opt.h Add av_opt_free convenience function. -2011-06-06 - 95a0242 - lavfi 2.14.0 - AVFilterBufferRefAudioProps - Remove AVFilterBufferRefAudioProps.size, and use nb_samples in - avfilter_get_audio_buffer() and avfilter_default_get_audio_buffer() in - place of size. - -2011-06-06 - 0bc2cca - lavu 51.6.0 - av_samples_alloc() - Switch nb_channels and nb_samples parameters order in - av_samples_alloc(). - -2011-06-06 - e1c7414 - lavu 51.5.0 - av_samples_* - Change the data layout created by av_samples_fill_arrays() and - av_samples_alloc(). - -2011-06-06 - 27bcf55 - lavfi 2.13.0 - vsrc_buffer.h - Make av_vsrc_buffer_add_video_buffer_ref() accepts an additional - flags parameter in input. - -2011-06-03 - e977ca2 - lavfi 2.12.0 - avfilter_link_free() - Add avfilter_link_free() function. - -2011-06-02 - 5ad38d9 - lavu 51.4.0 - av_force_cpu_flags() - Add av_cpu_flags() in libavutil/cpu.h. - -2011-05-28 - e71f260 - lavu 51.3.0 - pixdesc.h +2011-05-28 - 0420bd7 - lavu 51.2.0 - pixdesc.h Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor. -2011-05-25 - 39e4206 / 30315a8 - lavf 53.3.0 - avformat.h +2011-05-25 - 30315a8 - lavf 53.1.0 - avformat.h Add fps_probe_size to AVFormatContext. -2011-05-22 - 5ecdfd0 - lavf 53.2.0 - avformat.h - Introduce avformat_alloc_output_context2() and deprecate - avformat_alloc_output_context(). - -2011-05-22 - 83db719 - lavfi 2.10.0 - vsrc_buffer.h - Make libavfilter/vsrc_buffer.h public. - -2011-05-19 - c000a9f - lavfi 2.8.0 - avcodec.h - Add av_vsrc_buffer_add_frame() to libavfilter/avcodec.h. - -2011-05-14 - 9fdf772 - lavfi 2.6.0 - avcodec.h - Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h. - -2011-05-18 - 75a37b5 / 64150ff - lavc 53.7.0 - AVCodecContext.request_sample_fmt +2011-05-18 - 64150ff - lavc 53.4.0 - AVCodecContext.request_sample_fmt Add request_sample_fmt field to AVCodecContext. -2011-05-10 - 59eb12f / 188dea1 - lavc 53.6.0 - avcodec.h +2011-05-10 - 188dea1 - lavc 53.3.0 - avcodec.h Deprecate AVLPCType and the following fields in AVCodecContext: lpc_coeff_precision, prediction_order_method, min_partition_order, max_partition_order, lpc_type, lpc_passes. Corresponding FLAC encoder options should be used instead. -2011-05-07 - 9fdf772 - lavfi 2.5.0 - avcodec.h - Add libavfilter/avcodec.h header and avfilter_copy_frame_props() - function. - -2011-05-07 - 18ded93 - lavc 53.5.0 - AVFrame - Add format field to AVFrame. - -2011-05-07 - 22333a6 - lavc 53.4.0 - AVFrame - Add width and height fields to AVFrame. - -2011-05-01 - 35fe66a - lavfi 2.4.0 - avfilter.h - Rename AVFilterBufferRefVideoProps.pixel_aspect to - sample_aspect_ratio. - -2011-05-01 - 77e9dee - lavc 53.3.0 - AVFrame - Add a sample_aspect_ratio field to AVFrame. - -2011-05-01 - 1ba5727 - lavc 53.2.0 - AVFrame - Add a pkt_pos field to AVFrame. - -2011-04-29 - 35ceaa7 - lavu 51.2.0 - mem.h - Add av_dynarray_add function for adding - an element to a dynamic array. - -2011-04-26 - d7e5aeb / bebe72f - lavu 51.1.0 - avutil.h +2011-04-26 - bebe72f - lavu 51.1.0 - avutil.h Add AVPictureType enum and av_get_picture_type_char(), deprecate FF_*_TYPE defines and av_get_pict_type_char() defined in libavcodec/avcodec.h. -2011-04-26 - d7e5aeb / 10d3940 - lavfi 2.3.0 - avfilter.h +2011-04-26 - 10d3940 - lavfi 2.3.0 - avfilter.h Add pict_type and key_frame fields to AVFilterBufferRefVideo. -2011-04-26 - d7e5aeb / 7a11c82 - lavfi 2.2.0 - vsrc_buffer +2011-04-26 - 7a11c82 - lavfi 2.2.0 - vsrc_buffer Add sample_aspect_ratio fields to vsrc_buffer arguments -2011-04-21 - 8772156 / 94f7451 - lavc 53.1.0 - avcodec.h +2011-04-21 - 94f7451 - lavc 53.1.0 - avcodec.h Add CODEC_CAP_SLICE_THREADS for codecs supporting sliced threading. 2011-04-15 - lavc 52.120.0 - avcodec.h AVPacket structure got additional members for passing side information: - c407984 / 4de339e introduce side information for AVPacket - c407984 / 2d8591c make containers pass palette change in AVPacket + 4de339e introduce side information for AVPacket + 2d8591c make containers pass palette change in AVPacket 2011-04-12 - lavf 52.107.0 - avio.h Avio cleanup, part II - deprecate the entire URLContext API: - c55780d / 175389c add avio_check as a replacement for url_exist - 9891004 / ff1ec0c add avio_pause and avio_seek_time as replacements + 175389c add avio_check as a replacement for url_exist + ff1ec0c add avio_pause and avio_seek_time as replacements for _av_url_read_fseek/fpause - d4d0932 / cdc6a87 deprecate av_protocol_next(), avio_enum_protocols + cdc6a87 deprecate av_protocol_next(), avio_enum_protocols should be used instead. - c88caa5 / 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. - c88caa5 / f87b1b3 rename open flags: URL_* -> AVIO_* - d4d0932 / f8270bb add avio_enum_protocols. - d4d0932 / 5593f03 deprecate URLProtocol. - d4d0932 / c486dad deprecate URLContext. - d4d0932 / 026e175 deprecate the typedef for URLInterruptCB - c88caa5 / 8e76a19 deprecate av_register_protocol2. - 11d7841 / b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME - 11d7841 / 1305d93 deprecate av_url_read_seek - 11d7841 / fa104e1 deprecate av_url_read_pause - 434f248 / 727c7aa deprecate url_get_filename(). - 434f248 / 5958df3 deprecate url_max_packet_size(). - 434f248 / 1869ea0 deprecate url_get_file_handle(). - 434f248 / 32a97d4 deprecate url_filesize(). - 434f248 / e52a914 deprecate url_close(). - 434f248 / 58a48c6 deprecate url_seek(). - 434f248 / 925e908 deprecate url_write(). - 434f248 / dce3756 deprecate url_read_complete(). - 434f248 / bc371ac deprecate url_read(). - 434f248 / 0589da0 deprecate url_open(). - 434f248 / 62eaaea deprecate url_connect. - 434f248 / 5652bb9 deprecate url_alloc. - 434f248 / 333e894 deprecate url_open_protocol - 434f248 / e230705 deprecate url_poll and URLPollEntry + 80c6e23 rename url_set_interrupt_cb->avio_set_interrupt_cb. + f87b1b3 rename open flags: URL_* -> AVIO_* + f8270bb add avio_enum_protocols. + 5593f03 deprecate URLProtocol. + c486dad deprecate URLContext. + 026e175 deprecate the typedef for URLInterruptCB + 8e76a19 deprecate av_register_protocol2. + b840484 deprecate URL_PROTOCOL_FLAG_NESTED_SCHEME + 1305d93 deprecate av_url_read_seek + fa104e1 deprecate av_url_read_pause + 727c7aa deprecate url_get_filename(). + 5958df3 deprecate url_max_packet_size(). + 1869ea0 deprecate url_get_file_handle(). + 32a97d4 deprecate url_filesize(). + e52a914 deprecate url_close(). + 58a48c6 deprecate url_seek(). + 925e908 deprecate url_write(). + dce3756 deprecate url_read_complete(). + bc371ac deprecate url_read(). + 0589da0 deprecate url_open(). + 62eaaea deprecate url_connect. + 5652bb9 deprecate url_alloc. + 333e894 deprecate url_open_protocol + e230705 deprecate url_poll and URLPollEntry + +2011-04-10 - lavu 50.40.0 - pixfmt.h + Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats 2011-04-08 - lavf 52.106.0 - avformat.h Minor avformat.h cleanup: - d4d0932 / a9bf9d8 deprecate av_guess_image2_codec - d4d0932 / c3675df rename avf_sdp_create->av_sdp_create + a9bf9d8 deprecate av_guess_image2_codec + c3675df rename avf_sdp_create->av_sdp_create 2011-04-03 - lavf 52.105.0 - avio.h Large-scale renaming/deprecating of AVIOContext-related functions: - 2cae980 / 724f6a0 deprecate url_fdopen - 2cae980 / 403ee83 deprecate url_open_dyn_packet_buf - 2cae980 / 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf - 2cae980 / b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf - 2cae980 / 8978fed introduce an AVIOContext.seekable field as a replacement for + 724f6a0 deprecate url_fdopen + 403ee83 deprecate url_open_dyn_packet_buf + 6dc7d80 rename url_close_dyn_buf -> avio_close_dyn_buf + b92c545 rename url_open_dyn_buf -> avio_open_dyn_buf + 8978fed introduce an AVIOContext.seekable field as a replacement for AVIOContext.is_streamed and url_is_streamed() - 1caa412 / b64030f deprecate get_checksum() - 1caa412 / 4c4427a deprecate init_checksum() - 2fd41c9 / 4ec153b deprecate udp_set_remote_url/get_local_port - 4fa0e24 / 933e90a deprecate av_url_read_fseek/fpause - 4fa0e24 / 8d9769a deprecate url_fileno - 0fecf26 / b7f2fdd rename put_flush_packet -> avio_flush - 0fecf26 / 35f1023 deprecate url_close_buf - 0fecf26 / 83fddae deprecate url_open_buf - 0fecf26 / d9d86e0 rename url_fprintf -> avio_printf - 0fecf26 / 59f65d9 deprecate url_setbufsize - 6947b0c / 3e68b3b deprecate url_ferror + b64030f deprecate get_checksum() + 4c4427a deprecate init_checksum() + 4ec153b deprecate udp_set_remote_url/get_local_port + 933e90a deprecate av_url_read_fseek/fpause + 8d9769a deprecate url_fileno + b7f2fdd rename put_flush_packet -> avio_flush + 35f1023 deprecate url_close_buf + 83fddae deprecate url_open_buf + d9d86e0 rename url_fprintf -> avio_printf + 59f65d9 deprecate url_setbufsize + 3e68b3b deprecate url_ferror + 66e5b1d deprecate url_feof e8bb2e2 deprecate url_fget_max_packet_size 76aa876 rename url_fsize -> avio_size e519753 deprecate url_fgetc @@ -1335,12 +852,9 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 b3db9ce deprecate get_partial_buffer 8d9ac96 rename av_alloc_put_byte -> avio_alloc_context -2011-03-25 - 27ef7b1 / 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type +2011-03-25 - 34b47d7 - lavc 52.115.0 - AVCodecContext.audio_service_type Add audio_service_type field to AVCodecContext. -2011-03-17 - e309fdc - lavu 50.40.0 - pixfmt.h - Add PIX_FMT_BGR48LE and PIX_FMT_BGR48BE pixel formats - 2011-03-02 - 863c471 - lavf 52.103.0 - av_pkt_dump2, av_pkt_dump_log2 Add new functions av_pkt_dump2, av_pkt_dump_log2 that uses the source stream timebase for outputting timestamps. Deprecate @@ -1373,11 +887,11 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 2011-02-10 - 12c14cd - lavf 52.99.0 - AVStream.disposition Add AV_DISPOSITION_HEARING_IMPAIRED and AV_DISPOSITION_VISUAL_IMPAIRED. -2011-02-09 - c0b102c - lavc 52.112.0 - avcodec_thread_init() +2011-02-09 - 5592734 - lavc 52.112.0 - avcodec_thread_init() Deprecate avcodec_thread_init()/avcodec_thread_free() use; instead set thread_count before calling avcodec_open. -2011-02-09 - 37b00b4 - lavc 52.111.0 - threading API +2011-02-09 - 778b08a - lavc 52.111.0 - threading API Add CODEC_CAP_FRAME_THREADS with new restrictions on get_buffer()/ release_buffer()/draw_horiz_band() callbacks for appropriate codecs. Add thread_type and active_thread_type fields to AVCodecContext. @@ -1407,12 +921,6 @@ lavd 54.4.100 / 54.0.0, lavfi 3.5.0 2011-02-02 - dfd2a00 - lavu 50.37.0 - log.h Make av_dlog public. -2011-01-31 - 7b3ea55 - lavfi 1.76.0 - vsrc_buffer - Add sample_aspect_ratio fields to vsrc_buffer arguments - -2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio - Add sample_aspect_ratio field to AVFilterLink. - 2011-01-15 - a242ac3 - lavfi 1.74.0 - AVFilterBufferRefAudioProps Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. diff --git a/doc/Doxyfile b/doc/Doxyfile index 96327ff6e5..58f7dfbece 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = FFmpeg +PROJECT_NAME = Libav # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or @@ -33,7 +33,7 @@ PROJECT_NAME = FFmpeg PROJECT_NUMBER = -# With the PROJECT_LOGO tag one can specify a logo or icon that is included +# With the PROJECT_LOGO tag one can specify an logo or icon that is included # in the documentation. The maximum height of the logo should not exceed 55 # pixels and the maximum width should not exceed 200 pixels. Doxygen will # copy the logo to the output directory. @@ -639,14 +639,14 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = doc/examples/ +EXAMPLE_PATH = # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp # and *.h) to filter out the source-files in the directories. If left # blank all files are included. -EXAMPLE_PATTERNS = *.c +EXAMPLE_PATTERNS = *-example.c # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be # searched for input files to be used with the \include or \dontinclude @@ -709,7 +709,7 @@ INLINE_SOURCES = NO # doxygen to hide any special comment blocks from generated source code # fragments. Normal C and C++ comments will always remain visible. -STRIP_CODE_COMMENTS = NO +STRIP_CODE_COMMENTS = YES # If the REFERENCED_BY_RELATION tag is set to YES # then for each documented function all documented @@ -818,7 +818,7 @@ HTML_STYLESHEET = # 180 is cyan, 240 is blue, 300 purple, and 360 is red again. # The allowed range is 0 to 359. -#HTML_COLORSTYLE_HUE = 120 +HTML_COLORSTYLE_HUE = 120 # The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of # the colors in the HTML output. For a value of 0 the output will use diff --git a/doc/Makefile b/doc/Makefile index 10f03cc8cb..1c205a5236 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,76 +1,39 @@ -LIBRARIES-$(CONFIG_AVUTIL) += libavutil -LIBRARIES-$(CONFIG_SWSCALE) += libswscale -LIBRARIES-$(CONFIG_SWRESAMPLE) += libswresample -LIBRARIES-$(CONFIG_AVCODEC) += libavcodec -LIBRARIES-$(CONFIG_AVFORMAT) += libavformat -LIBRARIES-$(CONFIG_AVDEVICE) += libavdevice -LIBRARIES-$(CONFIG_AVFILTER) += libavfilter - -COMPONENTS-$(CONFIG_AVUTIL) += ffmpeg-utils -COMPONENTS-$(CONFIG_SWSCALE) += ffmpeg-scaler -COMPONENTS-$(CONFIG_SWRESAMPLE) += ffmpeg-resampler -COMPONENTS-$(CONFIG_AVCODEC) += ffmpeg-codecs ffmpeg-bitstream-filters -COMPONENTS-$(CONFIG_AVFORMAT) += ffmpeg-formats ffmpeg-protocols -COMPONENTS-$(CONFIG_AVDEVICE) += ffmpeg-devices -COMPONENTS-$(CONFIG_AVFILTER) += ffmpeg-filters - -MANPAGES1 = $(AVPROGS-yes:%=doc/%.1) $(AVPROGS-yes:%=doc/%-all.1) $(COMPONENTS-yes:%=doc/%.1) -MANPAGES3 = $(LIBRARIES-yes:%=doc/%.3) -MANPAGES = $(MANPAGES1) $(MANPAGES3) -PODPAGES = $(AVPROGS-yes:%=doc/%.pod) $(AVPROGS-yes:%=doc/%-all.pod) $(COMPONENTS-yes:%=doc/%.pod) $(LIBRARIES-yes:%=doc/%.pod) -HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) $(AVPROGS-yes:%=doc/%-all.html) $(COMPONENTS-yes:%=doc/%.html) $(LIBRARIES-yes:%=doc/%.html) \ +ALLMANPAGES = $(AVBASENAMES:%=%.1) +MANPAGES = $(AVPROGS-yes:%=doc/%.1) +PODPAGES = $(AVPROGS-yes:%=doc/%.pod) +HTMLPAGES = $(AVPROGS-yes:%=doc/%.html) \ doc/developer.html \ doc/faq.html \ doc/fate.html \ doc/general.html \ doc/git-howto.html \ + doc/libavfilter.html \ doc/nut.html \ doc/platform.html \ -TXTPAGES = doc/fate.txt \ - - -DOCS-$(CONFIG_HTMLPAGES) += $(HTMLPAGES) -DOCS-$(CONFIG_PODPAGES) += $(PODPAGES) -DOCS-$(CONFIG_MANPAGES) += $(MANPAGES) -DOCS-$(CONFIG_TXTPAGES) += $(TXTPAGES) +DOCS-$(CONFIG_POD2MAN) += $(MANPAGES) $(PODPAGES) +DOCS-$(CONFIG_TEXI2HTML) += $(HTMLPAGES) DOCS = $(DOCS-yes) -DOC_EXAMPLES-$(CONFIG_AVIO_READING_EXAMPLE) += avio_reading -DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec -DOC_EXAMPLES-$(CONFIG_DEMUXING_DECODING_EXAMPLE) += demuxing_decoding -DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio -DOC_EXAMPLES-$(CONFIG_FILTERING_AUDIO_EXAMPLE) += filtering_audio -DOC_EXAMPLES-$(CONFIG_FILTERING_VIDEO_EXAMPLE) += filtering_video -DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata -DOC_EXAMPLES-$(CONFIG_MUXING_EXAMPLE) += muxing -DOC_EXAMPLES-$(CONFIG_REMUXING_EXAMPLE) += remuxing -DOC_EXAMPLES-$(CONFIG_RESAMPLING_AUDIO_EXAMPLE) += resampling_audio -DOC_EXAMPLES-$(CONFIG_SCALING_VIDEO_EXAMPLE) += scaling_video -DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac -DOC_EXAMPLES-$(CONFIG_TRANSCODING_EXAMPLE) += transcoding -ALL_DOC_EXAMPLES_LIST = $(DOC_EXAMPLES-) $(DOC_EXAMPLES-yes) +DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE) += avcodec +DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE) += filter_audio +DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE) += metadata +DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE) += output +DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE) += transcode_aac +ALL_DOC_EXAMPLES = avcodec filter_audio metadata output transcode_aac -DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(PROGSSUF)$(EXESUF)) -ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)$(EXESUF)) -ALL_DOC_EXAMPLES_G := $(ALL_DOC_EXAMPLES_LIST:%=doc/examples/%$(PROGSSUF)_g$(EXESUF)) -PROGS += $(DOC_EXAMPLES) +DOC_EXAMPLES := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF)) +ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF)) +PROGS += $(DOC_EXAMPLES) -all-$(CONFIG_DOC): doc - -doc: documentation +all: $(DOCS) apidoc: doc/doxy/html documentation: $(DOCS) examples: $(DOC_EXAMPLES) -TEXIDEP = perl $(SRC_PATH)/doc/texidep.pl $(SRC_PATH) $< $@ >$(@:%=%.d) - -doc/%.txt: TAG = TXT -doc/%.txt: doc/%.texi - $(Q)$(TEXIDEP) - $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null +TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d) GENTEXI = format codec GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi) @@ -82,87 +45,53 @@ $(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF) doc/%.html: TAG = HTML doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI) $(Q)$(TEXIDEP) - $(M)texi2html -I doc -monolithic --D=config-not-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $< - -doc/%-all.html: TAG = HTML -doc/%-all.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI) - $(Q)$(TEXIDEP) - $(M)texi2html -I doc -monolithic --D=config-all --init-file $(SRC_PATH)/doc/t2h.init --output $@ $< + $(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $< doc/%.pod: TAG = POD doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI) $(Q)$(TEXIDEP) - $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-not-all=yes -Idoc $< $@ + $(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@ -doc/%-all.pod: TAG = POD -doc/%-all.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI) - $(Q)$(TEXIDEP) - $(M)perl $(SRC_PATH)/doc/texi2pod.pl -Dconfig-all=yes -Idoc $< $@ - -doc/%.1 doc/%.3: TAG = MAN +doc/%.1: TAG = MAN doc/%.1: doc/%.pod $(GENTEXI) $(M)pod2man --section=1 --center=" " --release=" " $< > $@ -doc/%.3: doc/%.pod $(GENTEXI) - $(M)pod2man --section=3 --center=" " --release=" " $< > $@ $(DOCS) doc/doxy/html: | doc/ $(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples OBJDIRS += doc/examples DOXY_INPUT = $(addprefix $(SRC_PATH)/, $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c)) +DOXY_TEMPLATES = doxy_stylesheet.css footer.html header.html +DOXY_TEMPLATES := $(addprefix $(SRC_PATH)/doc/doxy/, $(DOXY_TEMPLATES)) -doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT) +doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT) $(DOXY_TEMPLATES) $(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $< $(DOXY_INPUT) -install-doc: install-html install-man +install-progs-$(CONFIG_POD2MAN): install-man +install-progs-$(CONFIG_TEXI2HTML): install-doc -install-html: - -install-man: - -ifdef CONFIG_HTMLPAGES -install-progs-$(CONFIG_DOC): install-html - -install-html: $(HTMLPAGES) +install-doc: $(HTMLPAGES) $(Q)mkdir -p "$(DOCDIR)" $(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)" -endif - -ifdef CONFIG_MANPAGES -install-progs-$(CONFIG_DOC): install-man install-man: $(MANPAGES) $(Q)mkdir -p "$(MANDIR)/man1" - $(INSTALL) -m 644 $(MANPAGES1) "$(MANDIR)/man1" - $(Q)mkdir -p "$(MANDIR)/man3" - $(INSTALL) -m 644 $(MANPAGES3) "$(MANDIR)/man3" -endif + $(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1" -uninstall: uninstall-doc +uninstall: uninstall-doc uninstall-man -uninstall-doc: uninstall-html uninstall-man - -uninstall-html: +uninstall-doc: $(RM) -r "$(DOCDIR)" uninstall-man: - $(RM) $(addprefix "$(MANDIR)/man1/",$(AVPROGS-yes:%=%.1) $(AVPROGS-yes:%=%-all.1) $(COMPONENTS-yes:%=%.1)) - $(RM) $(addprefix "$(MANDIR)/man3/",$(LIBRARIES-yes:%=%.3)) + $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) -clean:: docclean - -distclean:: docclean - $(RM) doc/config.texi - -examplesclean: - $(RM) $(ALL_DOC_EXAMPLES) $(ALL_DOC_EXAMPLES_G) - $(RM) $(CLEANSUFFIXES:%=doc/examples/%) - -docclean: examplesclean - $(RM) $(CLEANSUFFIXES:%=doc/%) - $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 doc/*.3 doc/avoptions_*.texi +clean:: + $(RM) $(ALL_DOC_EXAMPLES) + $(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%) + $(RM) doc/*.html doc/*.pod doc/*.1 doc/avoptions_*.texi $(RM) -r doc/doxy/html -include $(wildcard $(DOCS:%=%.d)) -.PHONY: apidoc doc documentation +.PHONY: apidoc documentation diff --git a/doc/RELEASE_NOTES b/doc/RELEASE_NOTES index b3338b9fee..478bc1d20e 100644 --- a/doc/RELEASE_NOTES +++ b/doc/RELEASE_NOTES @@ -1,16 +1,84 @@ Release Notes ============= -* 2.2 "Muybridge" March, 2014 - +* 10 "Eks" General notes ------------- -See the Changelog file for a list of significant changes. Note, there -are many more new features and bugfixes than whats listed there. -Bugreports against FFmpeg git master or the most recent FFmpeg release are -accepted. If you are experiencing issues with any formally released version of -FFmpeg, please try git master to check if the issue still exists. If it does, -make your report against the development code following the usual bug reporting +One of the main features of this release is the addition of reference-counted +data buffers to Libav and their use in various structures. Specifically, the +data buffers used by AVPacket and AVFrame can now be reference counted, which +should allow to significantly simplify many use cases. In addition, +reference-counted AVFrames can now be used in libavfilter, avoiding the need +for a separate libavfilter-specific frame structure. Frames can now be passed +straight from the decoders into filters or from filters to encoders. + +These additions made it necessary to bump the major versions of libavcodec, +libavformat, libavdevice, libavfilter, and libavutil, which was accompanied by +dropping some old deprecated APIs. These libraries are thus not ABI- or API- +compatible with the previous release. All the other libraries (libavresample +and libswscale) should be both ABI- and API-compatible. + +Another major point is the inclusion of the HEVC (AKA H.265, the successor of +H.264) decoder in the main codebase. It was started in 2012 as a Libav Google +Summer of Code project by Guillaume Martres and subsequently completed with +the assistance of the OpenHEVC project and several Libav developers. + +As usual, this release also contains support for other new formats, many smaller +new features and countless bug fixes. We can highlight a native VP9 decoder, +with encoding provided through libvpx, native decoders for WebP, JPEG 2000, and +AIC, as well as improved WavPack support with encoding through libwavpack, +support for more AAC flavors (LD - low delay, ELD - enhanced low delay), slice +multithreading in libavfilter, or muxing chapters in ASF. Furthermore a few new +filters have been introduced, namely compand, to change audio dynamics, framepack, +to create stereoscopic videos, asetpts, to set audio pts, and interlace, to convert +progressive video to interlaced. Finally there is more fine-grained detection of +host and target libc, which should allow better portability to various cross +compilation scenarios. + +See the Changelog file for a fuller list of significant changes. + +Please note that our policy on bug reports has not changed. We still only accept +bug reports against HEAD of the Libav trunk repository. If you are experiencing +issues with any formally released version of Libav, please try a current version +of the development code to check if the issue still exists. If it does, make +your report against the development code following the usual bug reporting guidelines. + + +API changes +----------- + +A number of additional APIs have been introduced and some existing functions +have been deprecated and are scheduled for removal in the next release. +Significant API changes include: + +[libavutil] ++ added the reference-counted buffers API (buffers.h) ++ moved the AVFrame struct to libavutil and added a new API for working with + reference-counted AVFrames (frame.h) + +[libavcodec] ++ added an API for working with reference-counted AVPackets (av_packet_*) ++- converted VDPAU to the hwaccel framework; the old way of using VDPAU is no + longer supported +- old audio encoding and decoding APIs removed +- old video encoding API removed +- deprecated enum CodecID removed (enum AVCodecID should be used instead) +- deprecated audio resampling API removed (libavresample should be used + instead) + +[libavfilter] ++- replaced AVFilterBufferRef with AVFrame; AVFilterBufferRef and everything + related to it still exists, but is deprecated ++ converted all filters to use the AVOptions system for configuration, it is + now possible to query the supported options, their values and set them + directly with av_opt_* ++ added a slice multithreading framework ++- merged avfiltergraph.h to avfilter.h, using AVFilterGraph is now explicitly + mandatory (it was implicitly required even before); added new API for + allocating and initializing filters + +Please see the file doc/APIchanges for details along with similar +programmer-centric information. diff --git a/doc/authors.texi b/doc/authors.texi deleted file mode 100644 index 6c8c1d7efa..0000000000 --- a/doc/authors.texi +++ /dev/null @@ -1,11 +0,0 @@ -@chapter Authors - -The FFmpeg developers. - -For details about the authorship, see the Git history of the project -(git://source.ffmpeg.org/ffmpeg), e.g. by typing the command -@command{git log} in the FFmpeg source directory, or browsing the -online repository at @url{http://source.ffmpeg.org}. - -Maintainers for the specific components are listed in the file -@file{MAINTAINERS} in the source code tree. diff --git a/doc/ffmpeg.texi b/doc/avconv.texi similarity index 57% rename from doc/ffmpeg.texi rename to doc/avconv.texi index 0f6c093493..6efec55978 100644 --- a/doc/ffmpeg.texi +++ b/doc/avconv.texi @@ -1,8 +1,8 @@ \input texinfo @c -*- texinfo -*- -@settitle ffmpeg Documentation +@settitle avconv Documentation @titlepage -@center @titlefont{ffmpeg Documentation} +@center @titlefont{avconv Documentation} @end titlepage @top @@ -11,31 +11,37 @@ @chapter Synopsis -ffmpeg [@var{global_options}] @{[@var{input_file_options}] -i @file{input_file}@} ... @{[@var{output_file_options}] @file{output_file}@} ... +The generic syntax is: + +@example +@c man begin SYNOPSIS +avconv [global options] [[infile options][@option{-i} @var{infile}]]... @{[outfile options] @var{outfile}@}... +@c man end +@end example @chapter Description @c man begin DESCRIPTION -@command{ffmpeg} is a very fast video and audio converter that can also grab from +avconv 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. -@command{ffmpeg} reads from an arbitrary number of input "files" (which can be regular +avconv reads from an arbitrary number of input "files" (which can be regular files, pipes, network streams, grabbing devices, etc.), specified by the @code{-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). The allowed number and/or -types of streams may be limited by the container format. Selecting which -streams from which inputs will go into which output is either done automatically -or with the @code{-map} option (see the Stream selection chapter). +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 @code{-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 @code{0}, the second is @code{1}, etc. Similarly, streams +the first input file is @code{0}, the second is @code{1} etc. Similarly, streams within a file are referred to by their indices. E.g. @code{2:3} refers to the -fourth stream in the third input file. Also see the Stream specifiers chapter. +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 @@ -50,22 +56,22 @@ options apply ONLY to the next input or output file and are reset between files. @itemize @item -To set the video bitrate of the output file to 64 kbit/s: +To set the video bitrate of the output file to 64kbit/s: @example -ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi +avconv -i input.avi -b 64k output.avi @end example @item To force the frame rate of the output file to 24 fps: @example -ffmpeg -i input.avi -r 24 output.avi +avconv -i input.avi -r 24 output.avi @end example @item To force the frame rate of the input file (valid for raw formats only) to 1 fps and the frame rate of the output file to 24 fps: @example -ffmpeg -r 1 -i input.m2v -r 24 output.avi +avconv -r 1 -i input.m2v -r 24 output.avi @end example @end itemize @@ -76,7 +82,7 @@ The format option may be needed for raw input files. @chapter Detailed description @c man begin DETAILED DESCRIPTION -The transcoding process in @command{ffmpeg} for each output can be described by +The transcoding process in @command{avconv} for each output can be described by the following diagram: @example @@ -100,22 +106,22 @@ the following diagram: @end example -@command{ffmpeg} calls the libavformat library (containing demuxers) to read +@command{avconv} calls the libavformat library (containing demuxers) to read input files and get packets containing encoded data from them. When there are -multiple input files, @command{ffmpeg} tries to keep them synchronized by +multiple input files, @command{avconv} tries to keep them synchronized by tracking lowest timestamp on any active input stream. Encoded packets are then passed to the decoder (unless streamcopy is selected for the stream, see further for a description). The decoder produces uncompressed frames (raw video/PCM audio/...) which can be processed further by -filtering (see next section). After filtering, the frames are passed to the -encoder, which encodes them and outputs encoded packets. Finally those are +filtering (see next section). After filtering the frames are passed to the +encoder, which encodes them and outputs encoded packets again. Finally those are passed to the muxer, which writes the encoded packets to the output file. @section Filtering -Before encoding, @command{ffmpeg} can process raw audio and video frames using +Before encoding, @command{avconv} can process raw audio and video frames using filters from the libavfilter library. Several chained filters form a filter -graph. @command{ffmpeg} distinguishes between two types of filtergraphs: +graph. @command{avconv} distinguishes between two types of filtergraphs - simple and complex. @subsection Simple filtergraphs @@ -127,11 +133,11 @@ an additional step between decoding and encoding: _________ ______________ | | | | | decoded | | encoded data | -| frames |\ _ | packets | -|_________| \ /||______________| +| frames |\ /| packets | +|_________| \ / |______________| \ __________ / - simple _\|| | / encoder - filtergraph | filtered |/ + simple \ | | / encoder + filtergraph \| filtered |/ | frames | |__________| @@ -156,7 +162,7 @@ only sets timestamps and otherwise passes the frames unchanged. @subsection Complex filtergraphs Complex filtergraphs are those which cannot be described as simply a linear -processing chain applied to one stream. This is the case, for example, when the graph has +processing chain applied to one stream. This is the case e.g. when the graph has more than one input and/or output, or when output stream type is different from input. They can be represented with the following diagram: @@ -181,21 +187,19 @@ input. They can be represented with the following diagram: @end example Complex filtergraphs are configured with the @option{-filter_complex} option. -Note that this option is global, since a complex filtergraph, by its nature, +Note that this option is global, since a complex filtergraph by its nature cannot be unambiguously associated with a single stream or file. -The @option{-lavfi} option is equivalent to @option{-filter_complex}. - A trivial example of a complex filtergraph is the @code{overlay} filter, which has two video inputs and one video output, containing one video overlaid on top of the other. Its audio counterpart is the @code{amix} filter. @section Stream copy Stream copy is a mode selected by supplying the @code{copy} parameter to the -@option{-codec} option. It makes @command{ffmpeg} omit the decoding and encoding +@option{-codec} option. It makes @command{avconv} omit the decoding and encoding step for the specified stream, so it does only demuxing and muxing. It is useful for changing the container format or modifying container-level metadata. The -diagram above will, in this case, simplify to this: +diagram above will in this case simplify to this: @example _______ ______________ ________ @@ -207,7 +211,7 @@ diagram above will, in this case, simplify to this: @end example Since there is no decoding or encoding, it is very fast and there is no quality -loss. However, it might not work in some cases because of many factors. Applying +loss. However it might not work in some cases because of many factors. Applying filters is obviously also impossible, since filters work on uncompressed data. @c man end DETAILED DESCRIPTION @@ -215,14 +219,12 @@ filters is obviously also impossible, since filters work on uncompressed data. @chapter Stream selection @c man begin STREAM SELECTION -By default, @command{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, it is the stream with the most channels, for -subtitles, it is the first subtitle stream. In the case where several streams of -the same type rate equally, the stream with the lowest index is chosen. +By default avconv tries to pick the "best" stream of each type present in input +files and add them to each output file. For video, this means the highest +resolution, for audio the highest channel count. For subtitle it's simply the +first subtitle stream. -You can disable some of those defaults by using the @code{-vn/-an/-sn} options. For +You can disable some of those defaults by using @code{-vn/-an/-sn} options. For full manual control, use the @code{-map} option, which disables the defaults just described. @@ -231,15 +233,15 @@ described. @chapter Options @c man begin OPTIONS -@include fftools-common-opts.texi +@include avtools-common-opts.texi @section Main options @table @option @item -f @var{fmt} (@emph{input/output}) -Force input or output file format. The format is normally auto detected for input -files and guessed from the file extension for output files, so this option is not +Force input or output file format. The format is normally autodetected for input +files and guessed from file extension for output files, so this option is not needed in most cases. @item -i @var{filename} (@emph{input}) @@ -249,53 +251,39 @@ input file name Overwrite output files without asking. @item -n (@emph{global}) -Do not overwrite output files, and exit immediately if a specified -output file already exists. +Immediately exit when output files already exist. @item -c[:@var{stream_specifier}] @var{codec} (@emph{input/output,per-stream}) @itemx -codec[:@var{stream_specifier}] @var{codec} (@emph{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. @var{codec} is the name of a decoder/encoder or a special value @code{copy} (output only) to indicate that -the stream is not to be re-encoded. +the stream is not to be reencoded. For example @example -ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT +avconv -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT @end example encodes all video streams with libx264 and copies all audio streams. For each stream, the last matching @code{c} option is applied, so @example -ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT +avconv -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT @end example 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. -@item -t @var{duration} (@emph{input/output}) -When used as an input option (before @code{-i}), limit the @var{duration} of -data read from the input file. - -When used as an output option (before an output filename), stop writing the -output after its duration reaches @var{duration}. - +@item -t @var{duration} (@emph{output}) +Stop writing the output after its duration reaches @var{duration}. @var{duration} may be a number in seconds, or in @code{hh:mm:ss[.xxx]} form. --to and -t are mutually exclusive and -t has priority. - -@item -to @var{position} (@emph{output}) -Stop writing the output at @var{position}. -@var{position} may be a number in seconds, or in @code{hh:mm:ss[.xxx]} form. - --to and -t are mutually exclusive and -t has priority. - @item -fs @var{limit_size} (@emph{output}) -Set the file size limit, expressed in bytes. +Set the file size limit. @item -ss @var{position} (@emph{input/output}) When used as an input option (before @code{-i}), seeks in this input file to @var{position}. Note the in most formats it is not possible to seek exactly, so -@command{ffmpeg} will seek to the closest seek point before @var{position}. +@command{avconv} will seek to the closest seek point before @var{position}. When transcoding and @option{-accurate_seek} is enabled (the default), this extra segment between the seek point and @var{position} will be decoded and discarded. When doing stream copy or when @option{-noaccurate_seek} is used, it @@ -307,20 +295,11 @@ input until the timestamps reach @var{position}. @var{position} may be either in seconds or in @code{hh:mm:ss[.xxx]} form. @item -itsoffset @var{offset} (@emph{input}) -Set the input time offset. - -@var{offset} must be a time duration specification, -see @ref{time duration syntax,,the Time duration section in the ffmpeg-utils(1) manual,ffmpeg-utils}. - -The offset is added to the timestamps of the input files. Specifying -a positive offset means that the corresponding streams are delayed by -the time duration specified in @var{offset}. - -@item -timestamp @var{date} (@emph{output}) -Set the recording timestamp in the container. - -@var{date} must be a time duration specification, -see @ref{date syntax,,the Date section in the ffmpeg-utils(1) manual,ffmpeg-utils}. +Set the input time offset in seconds. +@code{[-]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 @var{offset} seconds. @item -metadata[:metadata_specifier] @var{key}=@var{value} (@emph{output,per-metadata}) Set a metadata key/value pair. @@ -334,12 +313,12 @@ also possible to delete metadata by using an empty value. For example, for setting the title in the output file: @example -ffmpeg -i in.avi -metadata title="my title" out.flv +avconv -i in.avi -metadata title="my title" out.flv @end example To set the language of the first audio stream: @example -ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT +avconv -i INPUT -metadata:s:a:0 language=eng OUTPUT @end example @item -target @var{type} (@emph{output}) @@ -349,14 +328,14 @@ Specify target file type (@code{vcd}, @code{svcd}, @code{dvd}, @code{dv}, (bitrate, codecs, buffer sizes) are then set automatically. You can just type: @example -ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg +avconv -i myfile.avi -target vcd /tmp/vcd.mpg @end example Nevertheless you can specify additional options as long as you know they do not conflict with the standard, as in: @example -ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg +avconv -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg @end example @item -dframes @var{number} (@emph{output}) @@ -367,28 +346,16 @@ Stop writing to the stream after @var{framecount} frames. @item -q[:@var{stream_specifier}] @var{q} (@emph{output,per-stream}) @itemx -qscale[:@var{stream_specifier}] @var{q} (@emph{output,per-stream}) -Use fixed quality scale (VBR). The meaning of @var{q}/@var{qscale} is +Use fixed quality scale (VBR). The meaning of @var{q} is codec-dependent. -If @var{qscale} is used without a @var{stream_specifier} then it applies only -to the video stream, this is to maintain compatibility with previous behavior -and as specifying the same codec specific value to 2 different codecs that is -audio and video generally is not what is intended when no stream_specifier is -used. -@anchor{filter_option} -@item -filter[:@var{stream_specifier}] @var{filtergraph} (@emph{output,per-stream}) -Create the filtergraph specified by @var{filtergraph} and use it to -filter the stream. +@item -filter[:@var{stream_specifier}] @var{filter_graph} (@emph{output,per-stream}) +@var{filter_graph} is a description of the filter graph to apply to +the stream. Use @code{-filters} to show all the available filters +(including also sources and sinks). -@var{filtergraph} is a description of the filtergraph to apply to -the stream, and must have a single input and a single output of the -same type of the stream. In the filtergraph, the input is associated -to the label @code{in}, and the output to the label @code{out}. See -the ffmpeg-filters manual for more information about the filtergraph -syntax. - -See the @ref{filter_complex_option,,-filter_complex option} if you -want to create filtergraphs with multiple inputs and/or outputs. +See also the @option{-filter_complex} option if you want to create filter graphs +with multiple inputs and/or outputs. @item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream}) This option is similar to @option{-filter}, the only difference is that its @@ -399,34 +366,7 @@ read. Specify the preset for matching stream(s). @item -stats (@emph{global}) -Print encoding progress/statistics. It is on by default, to explicitly -disable it you need to specify @code{-nostats}. - -@item -progress @var{url} (@emph{global}) -Send program-friendly progress information to @var{url}. - -Progress information is written approximately every second and at the end of -the encoding process. It is made of "@var{key}=@var{value}" lines. @var{key} -consists of only alphanumeric characters. The last key of a sequence of -progress information is always "progress". - -@item -stdin -Enable interaction on standard input. On by default unless standard input is -used as an input. To explicitly disable interaction you need to specify -@code{-nostdin}. - -Disabling interaction on standard input is useful, for example, if -ffmpeg is in the background process group. Roughly the same result can -be achieved with @code{ffmpeg ... < /dev/null} but it requires a -shell. - -@item -debug_ts (@emph{global}) -Print timestamp information. It is off by default. This option is -mostly useful for testing and debugging purposes, and the output -format may change from one version to another, so it should not be -employed by portable scripts. - -See also the option @code{-fdebug ts}. +Print encoding progress/statistics. On by default. @item -attach @var{filename} (@emph{output}) Add an attachment to the output file. This is supported by a few formats @@ -439,7 +379,7 @@ with @code{-map} or automatic mappings). Note that for Matroska you also have to set the mimetype metadata tag: @example -ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv +avconv -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv @end example (assuming that the attachment stream will be third in the output file). @@ -450,11 +390,11 @@ will be used. E.g. to extract the first attachment to a file named 'out.ttf': @example -ffmpeg -dump_attachment:t:0 out.ttf -i INPUT +avconv -dump_attachment:t:0 out.ttf INPUT @end example To extract all attachments to files determined by the @code{filename} tag: @example -ffmpeg -dump_attachment:t "" -i INPUT +avconv -dump_attachment:t "" INPUT @end example Technical note -- attachments are implemented as codec extradata, so this @@ -475,7 +415,8 @@ As an input option, ignore any timestamps stored in the file and instead generate timestamps assuming constant frame rate @var{fps}. As an output option, duplicate or drop input frames to achieve constant output -frame rate @var{fps}. +frame rate @var{fps} (note that this actually causes the @code{fps} filter to be +inserted to the end of the corresponding filtergraph). @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) Set frame size. @@ -488,7 +429,68 @@ As an output option, this inserts the @code{scale} video filter to the @emph{end} of the corresponding filtergraph. Please use the @code{scale} filter directly to insert it at the beginning or some other place. -The format is @samp{wxh} (default - same as source). +The format is @samp{wxh} (default - same as source). The following +abbreviations are recognized: +@table @samp +@item sqcif +128x96 +@item qcif +176x144 +@item cif +352x288 +@item 4cif +704x576 +@item 16cif +1408x1152 +@item qqvga +160x120 +@item qvga +320x240 +@item vga +640x480 +@item svga +800x600 +@item xga +1024x768 +@item uxga +1600x1200 +@item qxga +2048x1536 +@item sxga +1280x1024 +@item qsxga +2560x2048 +@item hsxga +5120x4096 +@item wvga +852x480 +@item wxga +1366x768 +@item wsxga +1600x1024 +@item wuxga +1920x1200 +@item woxga +2560x1600 +@item wqsxga +3200x2048 +@item wquxga +3840x2400 +@item whsxga +6400x4096 +@item whuxga +7680x4800 +@item cga +320x200 +@item ega +640x350 +@item hd480 +852x480 +@item hd720 +1280x720 +@item hd1080 +1920x1080 +@end table @item -aspect[:@var{stream_specifier}] @var{aspect} (@emph{output,per-stream}) Set the video display aspect ratio specified by @var{aspect}. @@ -498,10 +500,6 @@ form @var{num}:@var{den}, where @var{num} and @var{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. -If used together with @option{-vcodec copy}, it will affect the aspect ratio -stored at container level, but not the aspect ratio stored in encoded -frames, if it exists. - @item -vn (@emph{output}) Disable video recording. @@ -517,21 +515,22 @@ at the exact requested bitrate. On pass 1, you may just deactivate audio and set output to null, examples for Windows and Unix: @example -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 +avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL +avconv -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null @end example @item -passlogfile[:@var{stream_specifier}] @var{prefix} (@emph{output,per-stream}) Set two-pass log file name prefix to @var{prefix}, the default file name -prefix is ``ffmpeg2pass''. The complete file name will be +prefix is ``av2pass''. The complete file name will be @file{PREFIX-N.log}, where N is a number specific to the output -stream +stream. -@item -vf @var{filtergraph} (@emph{output}) -Create the filtergraph specified by @var{filtergraph} and use it to -filter the stream. +@item -vf @var{filter_graph} (@emph{output}) +@var{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 @code{-filter:v}. -This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter option}. @end table @section Advanced Video Options @@ -540,33 +539,14 @@ This is an alias for @code{-filter:v}, see the @ref{filter_option,,-filter optio @item -pix_fmt[:@var{stream_specifier}] @var{format} (@emph{input/output,per-stream}) Set pixel format. Use @code{-pix_fmts} to show all the supported pixel formats. -If the selected pixel format can not be selected, ffmpeg will print a -warning and select the best pixel format supported by the encoder. -If @var{pix_fmt} is prefixed by a @code{+}, ffmpeg will exit with an error -if the requested pixel format can not be selected, and automatic conversions -inside filtergraphs are disabled. -If @var{pix_fmt} is a single @code{+}, ffmpeg selects the same pixel format -as the input (or graph output) and automatic conversions are disabled. - @item -sws_flags @var{flags} (@emph{input/output}) Set SwScaler flags. @item -vdt @var{n} Discard threshold. @item -rc_override[:@var{stream_specifier}] @var{override} (@emph{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. +rate control override for specific intervals -@item -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 -@option{-deinterlace}, but deinterlacing introduces losses. -@item -psnr -Calculate PSNR of compressed frames. @item -vstats Dump video coding statistics to @file{vstats_HHMMSS.log}. @item -vstats_file @var{file} @@ -578,61 +558,13 @@ Intra_dc_precision. @item -vtag @var{fourcc/tag} (@emph{output}) Force video tag/fourcc. This is an alias for @code{-tag:v}. @item -qphist (@emph{global}) -Show QP histogram -@item -vbsf @var{bitstream_filter} -Deprecated see -bsf - +Show QP histogram. @item -force_key_frames[:@var{stream_specifier}] @var{time}[,@var{time}...] (@emph{output,per-stream}) -@item -force_key_frames[:@var{stream_specifier}] expr:@var{expr} (@emph{output,per-stream}) Force key frames at the specified timestamps, more precisely at the first frames after each specified time. - -If the argument is prefixed with @code{expr:}, the string @var{expr} -is interpreted like an expression and is evaluated for each frame. A -key frame is forced in case the evaluation is non-zero. - -If one of the times is "@code{chapters}[@var{delta}]", it is expanded into -the time of the beginning of all chapters in the file, shifted by -@var{delta}, expressed as a time in seconds. 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. - -For example, to insert a key frame at 5 minutes, plus key frames 0.1 second -before the beginning of every chapter: -@example --force_key_frames 0:05:00,chapters-0.1 -@end example - -The expression in @var{expr} can contain the following constants: -@table @option -@item n -the number of current processed frame, starting from 0 -@item n_forced -the number of forced frames -@item prev_forced_n -the number of the previous forced frame, it is @code{NAN} when no -keyframe was forced yet -@item prev_forced_t -the time of the previous forced frame, it is @code{NAN} when no -keyframe was forced yet -@item t -the time of the current processed frame -@end table - -For example to force a key frame every 5 seconds, you can specify: -@example --force_key_frames expr:gte(t,n_forced*5) -@end example - -To force a key frame 5 seconds after the time of the last forced one, -starting from second 13: -@example --force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5)) -@end example - -Note that forcing too many keyframes is very harmful for the lookahead -algorithms of certain encoders: using fixed-GOP options or similar -would be more efficient. +The timestamps must be specified in ascending order. @item -copyinkf[:@var{stream_specifier}] (@emph{output,per-stream}) When doing stream copy, copy also non-key frames found at the @@ -662,7 +594,7 @@ This option has no effect if the selected hwaccel is not available or not supported by the chosen decoder. Note that most acceleration methods are intended for playback and will not be -faster than software decoding on modern CPUs. Additionally, @command{ffmpeg} +faster than software decoding on modern CPUs. Additionally, @command{avconv} will usually need to copy the decoded frames from the GPU memory into the system memory, resulting in further performance loss. This option is thus mainly useful for testing. @@ -709,12 +641,11 @@ Set the audio codec. This is an alias for @code{-codec:a}. @item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream}) Set the audio sample format. Use @code{-sample_fmts} to get a list of supported sample formats. - -@item -af @var{filtergraph} (@emph{output}) -Create the filtergraph specified by @var{filtergraph} and use it to -filter the stream. - -This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter option}. +@item -af @var{filter_graph} (@emph{output}) +@var{filter_graph} is a description of the filter graph to apply to +the input audio. +Use the option "-filters" to show all the available filters (including +also sources and sinks). This is an alias for @code{-filter:a}. @end table @section Advanced Audio options: @@ -722,14 +653,6 @@ This is an alias for @code{-filter:a}, see the @ref{filter_option,,-filter optio @table @option @item -atag @var{fourcc/tag} (@emph{output}) Force audio tag/fourcc. This is an alias for @code{-tag:a}. -@item -absf @var{bitstream_filter} -Deprecated, see -bsf -@item -guess_layout_max @var{channels} (@emph{input,per-stream}) -If some input channel layout is not known, try to guess only if it -corresponds to at most the specified number of channels. For example, 2 -tells to @command{ffmpeg} to recognize 1 channel as mono and 2 channels as -stereo but not 6 channels as 5.1. The default is to always try to guess. Use -0 to disable all guessing. @end table @section Subtitle options: @@ -739,30 +662,6 @@ stereo but not 6 channels as 5.1. The default is to always try to guess. Use Set the subtitle codec. This is an alias for @code{-codec:s}. @item -sn (@emph{output}) Disable subtitle recording. -@item -sbsf @var{bitstream_filter} -Deprecated, see -bsf -@end table - -@section Advanced Subtitle options: - -@table @option - -@item -fix_sub_duration -Fix subtitles durations. For each subtitle, wait for the next packet in the -same stream and adjust the duration of the first to avoid overlap. This is -necessary with some subtitles codecs, especially DVB subtitles, because the -duration in the original packet is only a rough estimate and the end is -actually marked by an empty subtitle frame. Failing to use this option when -necessary can result in exaggerated durations or muxing failures due to -non-monotonic timestamps. - -Note that this option will delay the output of all data until the next -subtitle packet is decoded: it may increase memory consumption and latency a -lot. - -@item -canvas_size @var{size} -Set the size of the canvas used to render subtitles. - @end table @section Advanced options @@ -790,7 +689,7 @@ graphs (see the @option{-filter_complex} option) to the output file. For example, to map ALL streams from the first input file to output @example -ffmpeg -i INPUT -map 0 output +avconv -i INPUT -map 0 output @end example For example, if you have two audio streams in the first input file, @@ -798,7 +697,7 @@ these streams are identified by "0:0" and "0:1". You can use @code{-map} to select which streams to place in an output file. For example: @example -ffmpeg -i INPUT -map 0:1 out.wav +avconv -i INPUT -map 0:1 out.wav @end example will map the input stream in @file{INPUT} identified by "0:1" to the (single) output stream in @file{out.wav}. @@ -808,77 +707,21 @@ For example, to select the stream with index 2 from input file index 6 from input @file{b.mov} (specified by the identifier "1:6"), and copy them to the output file @file{out.mov}: @example -ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov +avconv -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov @end example To select all video and the third audio stream from an input file: @example -ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT +avconv -i INPUT -map 0:v -map 0:a:2 OUTPUT @end example To map all the streams except the second audio, use negative mappings @example -ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT +avconv -i INPUT -map 0 -map -0:a:1 OUTPUT @end example Note that using this option disables the default mappings for this output file. -@item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][:@var{output_file_id}.@var{stream_specifier}] -Map an audio channel from a given input to an output. If -@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will -be mapped on all the audio streams. - -Using "-1" instead of -@var{input_file_id}.@var{stream_specifier}.@var{channel_id} will map a muted -channel. - -For example, assuming @var{INPUT} is a stereo audio file, you can switch the -two audio channels with the following command: -@example -ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT -@end example - -If you want to mute the first channel and keep the second: -@example -ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT -@end example - -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 -input and output 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 extracts two channels of the @var{INPUT} audio stream (file 0, stream 0) -to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs: -@example -ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 -@end example - -The following example splits the channels of a stereo input into two separate -streams, which are put into the same output file: -@example -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 -@end example - -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 splitting a stereo stream into two single channel mono streams -is possible. - -If you need this feature, a possible workaround is to use the @emph{amerge} -filter. For example, if you need to merge a media (here @file{input.mkv}) with 2 -mono audio streams into one single stereo channel audio stream (and keep the -video stream), you can use the following command: -@example -ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv -@end example - @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) Set metadata information of the next output file from @var{infile}. Note that those are file indices (zero-based), not filenames. @@ -910,12 +753,12 @@ file index can be used to create a dummy mapping that just disables automatic co For example to copy metadata from the first stream of the input file to global metadata of the output file: @example -ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3 +avconv -i in.ogg -map_metadata 0:s:0 out.mp3 @end example To do the reverse, i.e. copy global metadata to all audio streams: @example -ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv +avconv -i in.mkv -map_metadata:s:a 0:g out.mkv @end example Note that simple @code{0} would work as well in this example, since global metadata is assumed by default. @@ -925,63 +768,41 @@ Copy chapters from input file with index @var{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. - +@item -debug +Print specific debug info. @item -benchmark (@emph{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. -@item -benchmark_all (@emph{global}) -Show benchmarking information during the encode. -Shows CPU time used in various steps (audio/video encode/decode). @item -timelimit @var{duration} (@emph{global}) -Exit after ffmpeg has been running for @var{duration} seconds. +Exit after avconv has been running for @var{duration} seconds. @item -dump (@emph{global}) Dump each input packet to stderr. @item -hex (@emph{global}) When dumping packets, also dump the payload. @item -re (@emph{input}) -Read input at native frame rate. Mainly used to simulate a grab device. +Read input at native frame rate. Mainly used to simulate a grab device or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). -By default @command{ffmpeg} attempts to read the input(s) as fast as possible. -This option will slow down the reading of the input(s) to the native frame rate -of the input(s). It is useful for real-time output (e.g. live streaming). -@item -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. -@item -loop_output @var{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. @item -vsync @var{parameter} Video sync method. -For compatibility reasons old values can be specified as numbers. -Newly added values will have to be specified as strings always. @table @option -@item 0, passthrough +@item passthrough Each frame is passed with its timestamp from the demuxer to the muxer. -@item 1, cfr +@item cfr Frames will be duplicated and dropped to achieve exactly the requested -constant frame rate. -@item 2, vfr +constant framerate. +@item vfr Frames are passed through with their timestamp or dropped so as to prevent 2 frames from having the same timestamp. -@item drop -As passthrough but destroys all timestamps, making the muxer generate -fresh timestamps based on frame-rate. -@item -1, auto +@item auto Chooses between 1 and 2 depending on muxer capabilities. This is the default method. @end table -Note that the timestamps may be further modified by the muxer, after this. -For example, in the case that the format option @option{avoid_negative_ts} -is enabled. - 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. @@ -991,47 +812,11 @@ 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. - -Note that the timestamps may be further modified by the muxer, after this. -For example, in the case that the format option @option{avoid_negative_ts} -is enabled. - -This option has been deprecated. Use the @code{aresample} audio filter instead. - +This option has been deprecated. Use the @code{asyncts} audio filter instead. @item -copyts -Do not process input timestamps, but keep their values without trying -to sanitize them. In particular, do not remove the initial start time -offset value. - -Note that, depending on the @option{vsync} option or on specific muxer -processing (e.g. in case the format option @option{avoid_negative_ts} -is enabled) the output timestamps may mismatch with the input -timestamps even when this option is selected. - -@item -copytb @var{mode} -Specify how to set the encoder timebase when stream copying. @var{mode} is an -integer numeric value, and can assume one of the following values: - -@table @option -@item 1 -Use the demuxer timebase. - -The time base is copied to the output encoder from the corresponding input -demuxer. This is sometimes required to avoid non monotonically increasing -timestamps when copying video streams with variable frame rate. - -@item 0 -Use the decoder timebase. - -The time base is copied to the output encoder from the corresponding input -decoder. - -@item -1 -Try to make the choice automatically, in order to generate a sane output. -@end table - -Default value is -1. - +Copy timestamps from input to output. +@item -copytb +Copy input stream time base from input to output when stream copying. @item -shortest (@emph{output}) Finish encoding when the shortest input stream ends. @item -dts_delta_threshold @@ -1049,37 +834,28 @@ 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: @example -ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts +avconv -i infile -streamid 0:33 -streamid 1:36 out.ts @end example @item -bsf[:@var{stream_specifier}] @var{bitstream_filters} (@emph{output,per-stream}) -Set bitstream filters for matching streams. @var{bitstream_filters} is +Set bitstream filters for matching streams. @var{bistream_filters} is a comma-separated list of bitstream filters. Use the @code{-bsfs} option to get the list of bitstream filters. @example -ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 +avconv -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 @end example @example -ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt +avconv -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt @end example @item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{input/output,per-stream}) Force a tag/fourcc for matching streams. -@item -timecode @var{hh}:@var{mm}:@var{ss}SEP@var{ff} -Specify Timecode for writing. @var{SEP} is ':' for non drop timecode and ';' -(or '.') for drop. -@example -ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg -@end example - -@anchor{filter_complex_option} @item -filter_complex @var{filtergraph} (@emph{global}) -Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or +Define a complex filter graph, i.e. one with arbitrary number of inputs and/or outputs. For simple graphs -- those with one input and one output of the same type -- see the @option{-filter} options. @var{filtergraph} is a description of -the filtergraph, as described in the ``Filtergraph syntax'' section of the -ffmpeg-filters manual. +the filter graph, as described in @ref{Filtergraph syntax}. Input link labels must refer to input streams using the @code{[file_index:stream_specifier]} syntax (i.e. the same as @option{-map} @@ -1095,7 +871,7 @@ normal input files. For example, to overlay an image over video @example -ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map +avconv -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map '[out]' out.mkv @end example Here @code{[0:v]} refers to the first video stream in the first input file, @@ -1106,25 +882,21 @@ of overlay. Assuming there is only one video stream in each input file, we can omit input labels, so the above is equivalent to @example -ffmpeg -i video.mkv -i image.png -filter_complex 'overlay[out]' -map +avconv -i video.mkv -i image.png -filter_complex 'overlay[out]' -map '[out]' out.mkv @end example Furthermore we can omit the output label and the single output from the filter graph will be added to the output file automatically, so we can simply write @example -ffmpeg -i video.mkv -i image.png -filter_complex 'overlay' out.mkv +avconv -i video.mkv -i image.png -filter_complex 'overlay' out.mkv @end example To generate 5 seconds of pure red video using lavfi @code{color} source: @example -ffmpeg -filter_complex 'color=c=red' -t 5 out.mkv +avconv -filter_complex 'color=red' -t 5 out.mkv @end example -@item -lavfi @var{filtergraph} (@emph{global}) -Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or -outputs. Equivalent to @option{-filter_complex}. - @item -filter_complex_script @var{filename} (@emph{global}) This option is similar to @option{-filter_complex}, the only difference is that its argument is the name of the file from which a complex filtergraph @@ -1136,66 +908,7 @@ This option enables or disables accurate seeking in input files with the transcoding. Use @option{-noaccurate_seek} to disable it, which may be useful e.g. when copying some streams and transcoding the others. -@item -override_ffserver (@emph{global}) -Overrides the input specifications from @command{ffserver}. Using this -option you can map any input stream to @command{ffserver} and control -many aspects of the encoding from @command{ffmpeg}. Without this -option @command{ffmpeg} will transmit to @command{ffserver} what is -requested by @command{ffserver}. - -The option is intended for cases where features are needed that cannot be -specified to @command{ffserver} but can be to @command{ffmpeg}. - @end table - -As a special exception, you can use a bitmap subtitle stream as input: it -will be converted into a video with the same size as the largest video in -the file, or 720x576 if no video is present. Note that this is an -experimental and temporary solution. It will be removed once libavfilter has -proper support for subtitles. - -For example, to hardcode subtitles on top of a DVB-T recording stored in -MPEG-TS format, delaying the subtitles by 1 second: -@example -ffmpeg -i input.ts -filter_complex \ - '[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay' \ - -sn -map '#0x2dc' output.mkv -@end example -(0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the video, -audio and subtitles streams; 0:0, 0:3 and 0:7 would have worked too) - -@section Preset files -A preset file contains a sequence of @var{option}=@var{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 @file{presets} directory in the FFmpeg source tree for examples. - -Preset files are specified with the @code{vpre}, @code{apre}, -@code{spre}, and @code{fpre} options. The @code{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 @code{vpre}, @code{apre}, and -@code{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 @code{vpre}, @code{apre}, and @code{spre} -preset options identifies the preset file to use according to the -following rules: - -First ffmpeg searches for a file named @var{arg}.ffpreset in the -directories @file{$FFMPEG_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in -the datadir defined at configuration time (usually @file{PREFIX/share/ffmpeg}) -or in a @file{ffpresets} folder along the executable on win32, -in that order. For example, if the argument is @code{libvpx-1080p}, it will -search for the file @file{libvpx-1080p.ffpreset}. - -If no such file is found, then ffmpeg will search for a file named -@var{codec_name}-@var{arg}.ffpreset in the above-mentioned -directories, where @var{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 @code{-vcodec libvpx} and use @code{-vpre 1080p}, -then it will search for the file @file{libvpx-1080p.ffpreset}. @c man end OPTIONS @chapter Tips @@ -1203,13 +916,13 @@ then it will search for the file @file{libvpx-1080p.ffpreset}. @itemize @item -For streaming at very low bitrates, use a low frame rate +For streaming at very low bitrate application, use a low frame rate and a small GOP size. This is especially true for RealVideo where the Linux player does not seem to be very fast, so it can miss frames. An example is: @example -ffmpeg -g 3 -r 3 -t 10 -b:v 50k -s qcif -f rv10 /tmp/b.rm +avconv -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm @end example @item @@ -1248,48 +961,43 @@ A preset file contains a sequence of @var{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 -@file{presets} directory in the FFmpeg source tree for examples. +@file{presets} directory in the Libav source tree for examples. Preset files are specified with the @code{pre} option, this option takes a -preset name as input. FFmpeg searches for a file named @var{preset_name}.avpreset in -the directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.ffmpeg}, and in -the data directory defined at configuration time (usually @file{$PREFIX/share/ffmpeg}) +preset name as input. Avconv searches for a file named @var{preset_name}.avpreset in +the directories @file{$AVCONV_DATADIR} (if set), and @file{$HOME/.avconv}, and in +the data directory defined at configuration time (usually @file{$PREFIX/share/avconv}) in that order. For example, if the argument is @code{libx264-max}, it will search for the file @file{libx264-max.avpreset}. @section Video and Audio grabbing -If you specify the input format and device then ffmpeg can grab video +If you specify the input format and device then avconv can grab video and audio directly. @example -ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg -@end example - -Or with an ALSA audio source (mono input, card id 1) instead of OSS: -@example -ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg +avconv -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg @end example Note that you must activate the right video source and channel before -launching ffmpeg with any TV viewer such as +launching avconv with any TV viewer such as @uref{http://linux.bytesex.org/xawtv/, xawtv} by Gerd Knorr. You also have to set the audio recording levels correctly with a standard mixer. @section X11 grabbing -Grab the X11 display with ffmpeg via +Grab the X11 display with avconv via @example -ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0 /tmp/out.mpg +avconv -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable. @example -ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0+10,20 /tmp/out.mpg +avconv -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg @end example 0.0 is display.screen number of your X11 server, same as the DISPLAY environment @@ -1297,7 +1005,7 @@ variable. 10 is the x-offset and 20 the y-offset for the grabbing. @section Video and Audio file format conversion -Any supported file format and protocol can serve as input to ffmpeg: +Any supported file format and protocol can serve as input to avconv: Examples: @itemize @@ -1305,7 +1013,7 @@ Examples: You can use YUV files as input: @example -ffmpeg -i /tmp/test%d.Y /tmp/out.mpg +avconv -i /tmp/test%d.Y /tmp/out.mpg @end example It will use the files: @@ -1317,13 +1025,13 @@ It will use the files: The Y files use twice the resolution of the U and V files. They are raw files, without header. They can be generated by all decent video decoders. You must specify the size of the image with the @option{-s} option -if ffmpeg cannot guess it. +if avconv cannot guess it. @item You can input from a raw YUV420P file: @example -ffmpeg -i /tmp/test.yuv /tmp/out.avi +avconv -i /tmp/test.yuv /tmp/out.avi @end example test.yuv is a file containing raw YUV planar data. Each frame is composed @@ -1334,14 +1042,14 @@ horizontal resolution. You can output to a raw YUV420P file: @example -ffmpeg -i mydivx.avi hugefile.yuv +avconv -i mydivx.avi hugefile.yuv @end example @item You can set several input files and output files: @example -ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg +avconv -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg @end example Converts the audio file a.wav and the raw YUV video file a.yuv @@ -1351,7 +1059,7 @@ to MPEG file a.mpg. You can also do audio and video conversions at the same time: @example -ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2 +avconv -i /tmp/a.wav -ar 22050 /tmp/a.mp2 @end example Converts a.wav to MPEG audio at 22050 Hz sample rate. @@ -1361,7 +1069,7 @@ You can encode to several formats at the same time and define a mapping from input stream to output streams: @example -ffmpeg -i /tmp/a.wav -map 0:a -b:a 64k /tmp/a.mp2 -map 0:a -b:a 128k /tmp/b.mp2 +avconv -i /tmp/a.wav -map 0:a -b 64k /tmp/a.mp2 -map 0:a -b 128k /tmp/b.mp2 @end example Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. '-map @@ -1372,7 +1080,7 @@ stream, in the order of the definition of output streams. You can transcode decrypted VOBs: @example -ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi +avconv -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi @end example This is a typical DVD ripping example; the input is a VOB file, the @@ -1384,14 +1092,14 @@ to enable LAME support by passing @code{--enable-libmp3lame} to configure. The mapping is particularly useful for DVD transcoding to get the desired audio language. -NOTE: To see the supported input formats, use @code{ffmpeg -formats}. +NOTE: To see the supported input formats, use @code{avconv -formats}. @item You can extract images from a video, or create a video from many images: For extracting images from a video: @example -ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg +avconv -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg @end example This will extract one video frame per second from the video and will @@ -1404,7 +1112,7 @@ combination with -ss to start extracting from a certain point in time. For creating a video from many images: @example -ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi +avconv -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi @end example The syntax @code{foo-%03d.jpeg} specifies to use a decimal number @@ -1412,21 +1120,11 @@ composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable. -When importing an image sequence, -i also supports expanding -shell-like wildcard patterns (globbing) internally, by selecting the -image2-specific @code{-pattern_type glob} option. - -For example, for creating a video from filenames matching the glob pattern -@code{foo-*.jpeg}: -@example -ffmpeg -f image2 -pattern_type glob -i 'foo-*.jpeg' -r 12 -s WxH foo.avi -@end example - @item You can put many streams of the same type in the output: @example -ffmpeg -i test1.avi -i test2.avi -map 0:3 -map 0:2 -map 0:1 -map 0:0 -c copy test12.nut +avconv -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy test12.nut @end example The resulting output file @file{test12.avi} will contain first four streams from @@ -1435,86 +1133,43 @@ the input file in reverse order. @item To force CBR video output: @example -ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v +avconv -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v @end example @item The four options lmin, lmax, mblmin and mblmax use 'lambda' units, but you may use the QP2LAMBDA constant to easily convert from 'q' units: @example -ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext +avconv -i src.ext -lmax 21*QP2LAMBDA dst.ext @end example @end itemize @c man end EXAMPLES -@include config.texi -@ifset config-all -@ifset config-avutil -@include utils.texi -@end ifset -@ifset config-avcodec -@include codecs.texi -@include bitstream_filters.texi -@end ifset -@ifset config-avformat -@include formats.texi +@include eval.texi +@include decoders.texi +@include encoders.texi +@include demuxers.texi +@include muxers.texi +@include indevs.texi +@include outdevs.texi @include protocols.texi -@end ifset -@ifset config-avdevice -@include devices.texi -@end ifset -@ifset config-swresample -@include resampler.texi -@end ifset -@ifset config-swscale -@include scaler.texi -@end ifset -@ifset config-avfilter +@include bitstream_filters.texi @include filters.texi -@end ifset -@end ifset - -@chapter See Also - -@ifhtml -@ifset config-all -@url{ffmpeg.html,ffmpeg} -@end ifset -@ifset config-not-all -@url{ffmpeg-all.html,ffmpeg-all}, -@end ifset -@url{ffplay.html,ffplay}, @url{ffprobe.html,ffprobe}, @url{ffserver.html,ffserver}, -@url{ffmpeg-utils.html,ffmpeg-utils}, -@url{ffmpeg-scaler.html,ffmpeg-scaler}, -@url{ffmpeg-resampler.html,ffmpeg-resampler}, -@url{ffmpeg-codecs.html,ffmpeg-codecs}, -@url{ffmpeg-bitstream-filters.html,ffmpeg-bitstream-filters}, -@url{ffmpeg-formats.html,ffmpeg-formats}, -@url{ffmpeg-devices.html,ffmpeg-devices}, -@url{ffmpeg-protocols.html,ffmpeg-protocols}, -@url{ffmpeg-filters.html,ffmpeg-filters} -@end ifhtml - -@ifnothtml -@ifset config-all -ffmpeg(1), -@end ifset -@ifset config-not-all -ffmpeg-all(1), -@end ifset -ffplay(1), ffprobe(1), ffserver(1), -ffmpeg-utils(1), ffmpeg-scaler(1), ffmpeg-resampler(1), -ffmpeg-codecs(1), ffmpeg-bitstream-filters(1), ffmpeg-formats(1), -ffmpeg-devices(1), ffmpeg-protocols(1), ffmpeg-filters(1) -@end ifnothtml - -@include authors.texi +@include metadata.texi @ignore -@setfilename ffmpeg -@settitle ffmpeg video converter +@setfilename avconv +@settitle avconv video converter + +@c man begin SEEALSO +avplay(1), avprobe(1) and the Libav HTML documentation +@c man end + +@c man begin AUTHORS +The Libav developers +@c man end @end ignore diff --git a/doc/avplay.texi b/doc/avplay.texi new file mode 100644 index 0000000000..71981f6d5d --- /dev/null +++ b/doc/avplay.texi @@ -0,0 +1,184 @@ +\input texinfo @c -*- texinfo -*- + +@settitle avplay Documentation +@titlepage +@center @titlefont{avplay Documentation} +@end titlepage + +@top + +@contents + +@chapter Synopsis + +@example +@c man begin SYNOPSIS +avplay [options] @file{input_file} +@c man end +@end example + +@chapter Description +@c man begin DESCRIPTION + +AVplay is a very simple and portable media player using the Libav +libraries and the SDL library. It is mostly used as a testbed for the +various Libav APIs. +@c man end + +@chapter Options +@c man begin OPTIONS + +@include avtools-common-opts.texi + +@section Main options + +@table @option +@item -x @var{width} +Force displayed width. +@item -y @var{height} +Force displayed height. +@item -s @var{size} +This option has been removed. Use private format options for specifying the +input video size. For example with the rawvideo demuxer you need to specify the +option @var{video_size}. +@item -an +Disable audio. +@item -vn +Disable video. +@item -ss @var{pos} +Seek to a given position in seconds. +@item -t @var{duration} +play seconds of audio/video +@item -bytes +Seek by bytes. +@item -nodisp +Disable graphical display. +@item -f @var{fmt} +Force format. +@item -window_title @var{title} +Set window title (default is the input filename). +@item -loop @var{number} +Loops movie playback times. 0 means forever. +@item -vf @var{filter_graph} +@var{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). + +@end table + +@section Advanced options +@table @option +@item -pix_fmt @var{format} +This option has been removed. Use private options for specifying the +input pixel format. For example with the rawvideo demuxer you need to specify +the option @var{pixel_format}. +@item -stats +Show the stream duration, the codec parameters, the current position in +the stream and the audio/video synchronisation drift. +@item -bug +Work around bugs. +@item -fast +Non-spec-compliant optimizations. +@item -genpts +Generate pts. +@item -rtp_tcp +Force RTP/TCP protocol usage instead of RTP/UDP. It is only meaningful +if you are streaming with the RTSP protocol. +@item -sync @var{type} +Set the master clock to audio (@code{type=audio}), video +(@code{type=video}) or external (@code{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. +@item -threads @var{count} +Set the thread count. +@item -ast @var{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. +@item -vst @var{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. +@item -sst @var{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. +@item -autoexit +Exit when video is done playing. +@item -exitonkeydown +Exit if any key is pressed. +@item -exitonmousedown +Exit if any mouse button is pressed. +@end table + +@section While playing + +@table @key +@item q, ESC +Quit. + +@item f +Toggle full screen. + +@item p, SPC +Pause. + +@item a +Cycle audio channel. + +@item v +Cycle video channel. + +@item t +Cycle subtitle channel. + +@item w +Show audio waves. + +@item left/right +Seek backward/forward 10 seconds. + +@item down/up +Seek backward/forward 1 minute. + +@item PGDOWN/PGUP +Seek to the previous/next chapter. + +@item mouse click +Seek to percentage in file corresponding to fraction of width. + +@end table + +@c man end + +@include eval.texi +@include decoders.texi +@include demuxers.texi +@include muxers.texi +@include indevs.texi +@include outdevs.texi +@include protocols.texi +@include filters.texi + +@ignore + +@setfilename avplay +@settitle AVplay media player + +@c man begin SEEALSO +avconv(1), avprobe(1) and the Libav HTML documentation +@c man end + +@c man begin AUTHORS +The Libav developers +@c man end + +@end ignore + +@bye diff --git a/doc/avprobe.texi b/doc/avprobe.texi new file mode 100644 index 0000000000..7e6fedf5c4 --- /dev/null +++ b/doc/avprobe.texi @@ -0,0 +1,141 @@ +\input texinfo @c -*- texinfo -*- + +@settitle avprobe Documentation +@titlepage +@center @titlefont{avprobe Documentation} +@end titlepage + +@top + +@contents + +@chapter Synopsis + +The generic syntax is: + +@example +@c man begin SYNOPSIS +avprobe [options] [@file{input_file}] +@c man end +@end example + +@chapter Description +@c man begin DESCRIPTION + +avprobe 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, avprobe 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. + +avprobe 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 avprobe or +for specifying which information to display, and for setting how +avprobe will show it. + +avprobe output is designed to be easily parsable by any INI or JSON +parsers. + +@c man end + +@chapter Options +@c man begin OPTIONS + +@include avtools-common-opts.texi + +@section Main options + +@table @option + +@item -f @var{format} +Force format to use. + +@item -of @var{formatter} +Use a specific formatter to output the document. The following +formatters are available +@table @option +@item ini + +@item json + +@item old +Pseudo-INI format that used to be the only one available in old +avprobe versions. +@end table + +@item -unit +Show the unit of the displayed values. + +@item -prefix +Use SI prefixes for the displayed values. +Unless the "-byte_binary_prefix" option is used all the prefixes +are decimal. + +@item -byte_binary_prefix +Force the use of binary prefixes for byte values. + +@item -sexagesimal +Use sexagesimal format HH:MM:SS.MICROSECONDS for time values. + +@item -pretty +Prettify the format of the displayed values, it corresponds to the +options "-unit -prefix -byte_binary_prefix -sexagesimal". + +@item -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". + +@item -show_format_entry @var{name} +Like @option{-show_format}, but only prints the specified entry of the +container format information, rather than all. This option may be given more +than once, then all specified entries will be shown. + +@item -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". + +@item -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". + +@end table +@c man end + +@include demuxers.texi +@include muxers.texi +@include protocols.texi +@include indevs.texi + +@ignore + +@setfilename avprobe +@settitle avprobe media prober + +@c man begin SEEALSO +avconv(1), avplay(1) and the Libav HTML documentation +@c man end + +@c man begin AUTHORS +The Libav developers +@c man end + +@end ignore + +@bye diff --git a/doc/ffserver.conf b/doc/avserver.conf similarity index 91% rename from doc/ffserver.conf rename to doc/avserver.conf index 094c093af2..e1cd9fb126 100644 --- a/doc/ffserver.conf +++ b/doc/avserver.conf @@ -12,7 +12,7 @@ BindAddress 0.0.0.0 # MaxClients maximum limit. MaxHTTPConnections 2000 -# Number of simultaneous requests that can be handled. Since FFServer +# Number of simultaneous requests that can be handled. Since AVServer # is very fast, it is more likely that you will want to leave this high # and use MaxBandwidth, below. MaxClients 1000 @@ -25,20 +25,21 @@ MaxBandwidth 1000 # '-' is the standard output. CustomLog - + ################################################################## # Definition of the live feeds. Each live feed contains one video -# and/or audio sequence coming from an ffmpeg encoder or another -# ffserver. This sequence may be encoded simultaneously with several +# and/or audio sequence coming from an avconv encoder or another +# avserver. This sequence may be encoded simultaneously with several # codecs at several resolutions. -# You must use 'ffmpeg' to send a live feed to ffserver. In this +# You must use 'avconv' to send a live feed to avserver. In this # example, you can type: # -# ffmpeg http://localhost:8090/feed1.ffm +# avconv http://localhost:8090/feed1.ffm -# ffserver can also do time shifting. It means that it can stream any +# avserver can also do time shifting. It means that it can stream any # previously recorded live stream. The request should contain: # "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify # a path where the feed is stored on disk. You also specify the @@ -51,10 +52,10 @@ FileMaxSize 200K # ReadOnlyFile /saved/specialvideo.ffm # This marks the file as readonly and it will not be deleted or updated. -# Specify launch in order to start ffmpeg automatically. -# First ffmpeg must be defined with an appropriate path if needed, +# Specify launch in order to start avconv automatically. +# First avconv must be defined with an appropriate path if needed, # after that options can follow, but avoid adding the http:// field -#Launch ffmpeg +#Launch avconv # Only allow connections from localhost to the feed. ACL allow 127.0.0.1 @@ -65,7 +66,7 @@ ACL allow 127.0.0.1 ################################################################## # Now you can define each stream which will be generated from the # original audio and video stream. Each format has a filename (here -# 'test1.mpg'). FFServer will send this stream when answering a +# 'test1.mpg'). AVServer will send this stream when answering a # request containing this filename. @@ -235,7 +236,7 @@ StartSendOnKey # #Feed feed1.ffm -#Metadata title "Stream title" +#Title "Stream title" #AudioBitRate 64 #AudioChannels 2 #AudioSampleRate 44100 @@ -280,10 +281,10 @@ StartSendOnKey # #File "/usr/local/httpd/htdocs/test.asf" #NoAudio -#Metadata author "Me" -#Metadata copyright "Super MegaCorp" -#Metadata title "Test stream from disk" -#Metadata comment "Test comment" +#Author "Me" +#Copyright "Super MegaCorp" +#Title "Test stream from disk" +#Comment "Test comment" # @@ -330,7 +331,7 @@ StartSendOnKey # multicast address with MulticastAddress. The port and the TTL can # also be set. # -# An SDP file is automatically generated by ffserver by adding the +# An SDP file is automatically generated by avserver by adding the # 'sdp' extension to the stream name (here # http://localhost:8090/test1-sdp.sdp). You should usually give this # file to your player to play the stream. @@ -367,5 +368,5 @@ ACL allow 192.168.0.0 192.168.255.255 # Redirect index.html to the appropriate site -URL http://www.ffmpeg.org/ +URL http://www.libav.org/ diff --git a/doc/avserver.texi b/doc/avserver.texi new file mode 100644 index 0000000000..88e6221f6a --- /dev/null +++ b/doc/avserver.texi @@ -0,0 +1,276 @@ +\input texinfo @c -*- texinfo -*- + +@settitle avserver Documentation +@titlepage +@center @titlefont{avserver Documentation} +@end titlepage + +@top + +@contents + +@chapter Synopsys + +The generic syntax is: + +@example +@c man begin SYNOPSIS +avserver [options] +@c man end +@end example + +@chapter Description +@c man begin DESCRIPTION + +WARNING: avserver is unmaintained, largely broken and in need of a +complete rewrite. It probably won't work for you. Use at your own +risk. + +avserver is a streaming server for both audio and video. It supports +several live feeds, streaming from files and time shifting on live feeds +(you can seek to positions in the past on each live feed, provided you +specify a big enough feed storage in avserver.conf). + +This documentation covers only the streaming aspects of avserver / +avconv. All questions about parameters for avconv, codec questions, +etc. are not covered here. Read @file{avconv.html} for more +information. + +@section How does it work? + +avserver receives prerecorded files or FFM streams from some avconv +instance as input, then streams them over RTP/RTSP/HTTP. + +An avserver instance will listen on some port as specified in the +configuration file. You can launch one or more instances of avconv and +send one or more FFM streams to the port where avserver is expecting +to receive them. Alternately, you can make avserver launch such avconv +instances at startup. + +Input streams are called feeds, and each one is specified by a +section in the configuration file. + +For each feed you can have different output streams in various +formats, each one specified by a section in the configuration +file. + +@section Status stream + +avserver supports an HTTP interface which exposes the current status +of the server. + +Simply point your browser to the address of the special status stream +specified in the configuration file. + +For example if you have: +@example + +Format status + +# Only allow local people to get the status +ACL allow localhost +ACL allow 192.168.0.0 192.168.255.255 + +@end example + +then the server will post a page with the status information when +the special stream @file{status.html} is requested. + +@section What can this do? + +When properly configured and running, you can capture video and audio in real +time from a suitable capture card, and stream it out over the Internet to +either Windows Media Player or RealAudio player (with some restrictions). + +It can also stream from files, though that is currently broken. Very often, a +web server can be used to serve up the files just as well. + +It can stream prerecorded video from .ffm files, though it is somewhat tricky +to make it work correctly. + +@section What do I need? + +I use Linux on a 900 MHz Duron with a cheapo Bt848 based TV capture card. I'm +using stock Linux 2.4.17 with the stock drivers. [Actually that isn't true, +I needed some special drivers for my motherboard-based sound card.] + +I understand that FreeBSD systems work just fine as well. + +@section How do I make it work? + +First, build the kit. It *really* helps to have installed LAME first. Then when +you run the avserver ./configure, make sure that you have the +@code{--enable-libmp3lame} flag turned on. + +LAME is important as it allows for streaming audio to Windows Media Player. +Don't ask why the other audio types do not work. + +As a simple test, just run the following two command lines where INPUTFILE +is some file which you can decode with avconv: + +@example +./avserver -f doc/avserver.conf & +./avconv -i INPUTFILE http://localhost:8090/feed1.ffm +@end example + +At this point you should be able to go to your Windows machine and fire up +Windows Media Player (WMP). Go to Open URL and enter + +@example + http://:8090/test.asf +@end example + +You should (after a short delay) see video and hear audio. + +WARNING: trying to stream test1.mpg doesn't work with WMP as it tries to +transfer the entire file before starting to play. +The same is true of AVI files. + +@section What happens next? + +You should edit the avserver.conf file to suit your needs (in terms of +frame rates etc). Then install avserver and avconv, write a script to start +them up, and off you go. + +@section Troubleshooting + +@subsection I don't hear any audio, but video is fine. + +Maybe you didn't install LAME, or got your ./configure statement wrong. Check +the avconv output to see if a line referring to MP3 is present. If not, then +your configuration was incorrect. If it is, then maybe your wiring is not +set up correctly. Maybe the sound card is not getting data from the right +input source. Maybe you have a really awful audio interface (like I do) +that only captures in stereo and also requires that one channel be flipped. +If you are one of these people, then export 'AUDIO_FLIP_LEFT=1' before +starting avconv. + +@subsection The audio and video lose sync after a while. + +Yes, they do. + +@subsection After a long while, the video update rate goes way down in WMP. + +Yes, it does. Who knows why? + +@subsection WMP 6.4 behaves differently to WMP 7. + +Yes, it does. Any thoughts on this would be gratefully received. These +differences extend to embedding WMP into a web page. [There are two +object IDs that you can use: The old one, which does not play well, and +the new one, which does (both tested on the same system). However, +I suspect that the new one is not available unless you have installed WMP 7]. + +@section What else can it do? + +You can replay video from .ffm files that was recorded earlier. +However, there are a number of caveats, including the fact that the +avserver parameters must match the original parameters used to record the +file. If they do not, then avserver deletes the file before recording into it. +(Now that I write this, it seems broken). + +You can fiddle with many of the codec choices and encoding parameters, and +there are a bunch more parameters that you cannot control. Post a message +to the mailing list if there are some 'must have' parameters. Look in +avserver.conf for a list of the currently available controls. + +It will automatically generate the ASX or RAM files that are often used +in browsers. These files are actually redirections to the underlying ASF +or RM file. The reason for this is that the browser often fetches the +entire file before starting up the external viewer. The redirection files +are very small and can be transferred quickly. [The stream itself is +often 'infinite' and thus the browser tries to download it and never +finishes.] + +@section Tips + +* When you connect to a live stream, most players (WMP, RA, etc) want to +buffer a certain number of seconds of material so that they can display the +signal continuously. However, avserver (by default) starts sending data +in realtime. This means that there is a pause of a few seconds while the +buffering is being done by the player. The good news is that this can be +cured by adding a '?buffer=5' to the end of the URL. This means that the +stream should start 5 seconds in the past -- and so the first 5 seconds +of the stream are sent as fast as the network will allow. It will then +slow down to real time. This noticeably improves the startup experience. + +You can also add a 'Preroll 15' statement into the avserver.conf that will +add the 15 second prebuffering on all requests that do not otherwise +specify a time. In addition, avserver will skip frames until a key_frame +is found. This further reduces the startup delay by not transferring data +that will be discarded. + +* You may want to adjust the MaxBandwidth in the avserver.conf to limit +the amount of bandwidth consumed by live streams. + +@section Why does the ?buffer / Preroll stop working after a time? + +It turns out that (on my machine at least) the number of frames successfully +grabbed is marginally less than the number that ought to be grabbed. This +means that the timestamp in the encoded data stream gets behind realtime. +This means that if you say 'Preroll 10', then when the stream gets 10 +or more seconds behind, there is no Preroll left. + +Fixing this requires a change in the internals of how timestamps are +handled. + +@section Does the @code{?date=} stuff work. + +Yes (subject to the limitation outlined above). Also note that whenever you +start avserver, it deletes the ffm file (if any parameters have changed), +thus wiping out what you had recorded before. + +The format of the @code{?date=xxxxxx} is fairly flexible. You should use one +of the following formats (the 'T' is literal): + +@example +* YYYY-MM-DDTHH:MM:SS (localtime) +* YYYY-MM-DDTHH:MM:SSZ (UTC) +@end example + +You can omit the YYYY-MM-DD, and then it refers to the current day. However +note that @samp{?date=16:00:00} refers to 16:00 on the current day -- this +may be in the future and so is unlikely to be useful. + +You use this by adding the ?date= to the end of the URL for the stream. +For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}. +@c man end + +@chapter Options +@c man begin OPTIONS + +@include avtools-common-opts.texi + +@section Main options + +@table @option +@item -f @var{configfile} +Use @file{configfile} instead of @file{/etc/avserver.conf}. +@item -n +Enable no-launch mode. This option disables all the Launch directives +within the various sections. Since avserver will not launch +any avconv instances, you will have to launch them manually. +@item -d +Enable debug mode. This option increases log verbosity, directs log +messages to stdout. +@end table +@c man end + +@ignore + +@setfilename avserver +@settitle avserver video server + +@c man begin SEEALSO + +avconv(1), avplay(1), avprobe(1), the @file{avserver.conf} +example and the Libav HTML documentation +@c man end + +@c man begin AUTHORS +The Libav developers +@c man end + +@end ignore + +@bye diff --git a/doc/avtools-common-opts.texi b/doc/avtools-common-opts.texi new file mode 100644 index 0000000000..3bf321f36d --- /dev/null +++ b/doc/avtools-common-opts.texi @@ -0,0 +1,186 @@ +All the numerical options, if not specified otherwise, accept in input +a string representing a number, which may contain one of the +SI unit prefixes, for example 'K', 'M', 'G'. +If 'i' is appended after the prefix, binary prefixes are used, +which are based on powers of 1024 instead of powers of 1000. +The 'B' postfix multiplies the value by 8, and can be +appended after a unit prefix or used alone. This allows using for +example 'KB', 'MiB', 'G' and 'B' as number 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". + +@anchor{Stream specifiers} +@section 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. @code{-codec:a:1 ac3} option contains +@code{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 @code{-b:a 128k} matches all audio +streams. + +An empty stream specifier matches all streams, for example @code{-codec copy} +or @code{-codec: copy} would copy all the streams without reencoding. + +Possible forms of stream specifiers are: +@table @option +@item @var{stream_index} +Matches the stream with this index. E.g. @code{-threads:1 4} would set the +thread count for the second stream to 4. +@item @var{stream_type}[:@var{stream_index}] +@var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle, +'d' for data and 't' for attachments. If @var{stream_index} is given, then +matches stream number @var{stream_index} of this type. Otherwise matches all +streams of this type. +@item p:@var{program_id}[:@var{stream_index}] +If @var{stream_index} is given, then matches stream number @var{stream_index} in +program with id @var{program_id}. Otherwise matches all streams in this program. +@item i:@var{stream_id} +Match the stream by stream id (e.g. PID in MPEG-TS container). +@end table +@section Generic options + +These options are shared amongst the av* tools. + +@table @option + +@item -L +Show license. + +@item -h, -?, -help, --help [@var{arg}] +Show help. An optional parameter may be specified to print help about a specific +item. + +Possible values of @var{arg} are: +@table @option +@item decoder=@var{decoder_name} +Print detailed information about the decoder named @var{decoder_name}. Use the +@option{-decoders} option to get a list of all decoders. + +@item encoder=@var{encoder_name} +Print detailed information about the encoder named @var{encoder_name}. Use the +@option{-encoders} option to get a list of all encoders. + +@item demuxer=@var{demuxer_name} +Print detailed information about the demuxer named @var{demuxer_name}. Use the +@option{-formats} option to get a list of all demuxers and muxers. + +@item muxer=@var{muxer_name} +Print detailed information about the muxer named @var{muxer_name}. Use the +@option{-formats} option to get a list of all muxers and demuxers. + +@item filter=@var{filter_name} +Print detailed information about the filter name @var{filter_name}. Use the +@option{-filters} option to get a list of all filters. + +@end table + +@item -version +Show version. + +@item -formats +Show available formats. + +The fields preceding the format names have the following meanings: +@table @samp +@item D +Decoding available +@item E +Encoding available +@end table + +@item -codecs +Show all codecs known to libavcodec. + +Note that the term 'codec' is used throughout this documentation as a shortcut +for what is more correctly called a media bitstream format. + +@item -decoders +Show available decoders. + +@item -encoders +Show all available encoders. + +@item -bsfs +Show available bitstream filters. + +@item -protocols +Show available protocols. + +@item -filters +Show available libavfilter filters. + +@item -pix_fmts +Show available pixel formats. + +@item -sample_fmts +Show available sample formats. + +@item -loglevel @var{loglevel} | -v @var{loglevel} +Set the logging level used by the library. +@var{loglevel} is a number or a string containing one of the following values: +@table @samp +@item quiet +@item panic +@item fatal +@item error +@item warning +@item info +@item verbose +@item debug +@end table + +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 +@env{AV_LOG_FORCE_NOCOLOR} or @env{NO_COLOR}, or can be forced setting +the environment variable @env{AV_LOG_FORCE_COLOR}. +The use of the environment variable @env{NO_COLOR} is deprecated and +will be dropped in a following Libav version. + +@item -cpuflags mask (@emph{global}) +Set a mask that's applied to autodetected CPU flags. This option is intended +for testing. Do not use it unless you know what you're doing. + +@end table + +@section AVOptions + +These options are provided directly by the libavformat, libavdevice and +libavcodec libraries. To see the list of available AVOptions, use the +@option{-help} option. They are separated into two categories: +@table @option +@item 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. +@item private +These options are specific to the given container, device or codec. Private +options are listed under their corresponding containers/devices/codecs. +@end table + +For example to write an ID3v2.3 header instead of a default ID3v2.4 to +an MP3 file, use the @option{id3v2_version} private option of the MP3 +muxer: +@example +avconv -i input.flac -id3v2_version 3 out.mp3 +@end example + +All codec AVOptions are obviously per-stream, so the chapter on stream +specifiers applies to them + +Note @option{-nooption} syntax cannot be used for boolean AVOptions, +use @option{-option 0}/@option{-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. + +@include avoptions_codec.texi +@include avoptions_format.texi diff --git a/doc/avutil.txt b/doc/avutil.txt new file mode 100644 index 0000000000..0847683d1d --- /dev/null +++ b/doc/avutil.txt @@ -0,0 +1,36 @@ +AVUtil +====== +libavutil is a small lightweight library of generally useful functions. +It is not a library for code needed by both libavcodec and libavformat. + + +Overview: +========= +adler32.c adler32 checksum +aes.c AES encryption and decryption +fifo.c resizeable first in first out buffer +intfloat_readwrite.c portable reading and writing of floating point values +log.c "printf" with context and level +md5.c MD5 Message-Digest Algorithm +rational.c code to perform exact calculations with rational numbers +tree.c generic AVL tree +crc.c generic CRC checksumming code +integer.c 128bit integer math +lls.c +mathematics.c greatest common divisor, integer sqrt, integer log2, ... +mem.c memory allocation routines with guaranteed alignment + +Headers: +bswap.h big/little/native-endian conversion code +x86_cpu.h a few useful macros for unifying x86-64 and x86-32 code +avutil.h +common.h +intreadwrite.h reading and writing of unaligned big/little/native-endian integers + + +Goals: +====== +* Modular (few interdependencies and the possibility of disabling individual parts during ./configure) +* Small (source and object) +* Efficient (low CPU and memory usage) +* Useful (avoid useless features almost no one needs) diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 9bcb12c734..6e7f8781ee 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -1,7 +1,7 @@ @chapter Bitstream Filters @c man begin BITSTREAM FILTERS -When you configure your FFmpeg build, all the supported bitstream +When you configure your Libav build, all the supported bitstream filters are enabled by default. You can list all available ones using the configure option @code{--list-bsfs}. @@ -10,70 +10,19 @@ You can disable all the bitstream filters using the configure option the option @code{--enable-bsf=BSF}, or you can disable a particular bitstream filter using the option @code{--disable-bsf=BSF}. -The option @code{-bsfs} of the ff* tools will display the list of +The option @code{-bsfs} of the av* 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. @section aac_adtstoasc -Convert MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration -bitstream filter. - -This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 -ADTS header and removes the ADTS header. - -This is required for example when copying an AAC stream from a raw -ADTS AAC container to a FLV or a MOV/MP4 file. - @section chomp -Remove zero padding at the end of a packet. - -@section dump_extra - -Add extradata to the beginning of the filtered packets. - -The additional argument specifies which packets should be filtered. -It accepts the values: -@table @samp -@item a -add extradata to all key packets, but only if @var{local_header} is -set in the @option{flags2} codec context field - -@item k -add extradata to all key packets - -@item e -add extradata to all packets -@end table - -If not specified it is assumed @samp{k}. - -For example the following @command{ffmpeg} command forces a global -header (thus disabling individual packet headers) in the H.264 packets -generated by the @code{libx264} encoder, but corrects them by adding -the header stored in extradata to the key packets: -@example -ffmpeg -i INPUT -map 0 -flags:v +global_header -c:v libx264 -bsf:v dump_extra out.ts -@end example +@section dump_extradata @section 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 @command{ffmpeg}, you can use the command: - -@example -ffmpeg -i INPUT.mp4 -codec copy -bsf:v h264_mp4toannexb OUTPUT.ts -@end example - @section imx_dump_header @section mjpeg2jpeg @@ -85,7 +34,7 @@ JPEG image. The individual frames can be extracted without loss, e.g. by @example -ffmpeg -i ../some_mjpeg.avi -c:v copy frames_%d.jpg +avconv -i ../some_mjpeg.avi -c:v copy frames_%d.jpg @end example Unfortunately, these chunks are incomplete JPEG images, because @@ -108,19 +57,21 @@ stream (carrying the AVI1 header ID and lacking a DHT segment) to produce fully qualified JPEG images. @example -ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg +avconv -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg exiftran -i -9 frame*.jpg -ffmpeg -i frame_%d.jpg -c:v copy rotated.avi +avconv -i frame_%d.jpg -c:v copy rotated.avi @end example @section mjpega_dump_header @section movsub +@section mp3_header_compress + @section mp3_header_decompress @section noise -@section remove_extra +@section remove_extradata @c man end BITSTREAM FILTERS diff --git a/doc/build_system.txt b/doc/build_system.txt index 36c141e9e4..c3dede7cde 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -1,4 +1,4 @@ -FFmpeg currently uses a custom build system, this text attempts to document +Libav currently uses a custom build system, this text attempts to document some of its obscure features and options. Makefile variables: @@ -9,19 +9,13 @@ V DESTDIR Destination directory for the install targets, useful to prepare packages - or install FFmpeg in cross-environments. + or install Libav in cross-environments. Makefile targets: all Default target, builds all the libraries and the executables. -fate - Run the fate test suite, note you must have installed it - -fate-list - Will list all fate/regression test targets - install Install headers, libraries and programs. @@ -33,18 +27,3 @@ libavcodec/api-example libswscale/swscale-test Build the swscale self-test (useful also as example). - - -Useful standard make commands: -make -t - Touch all files that otherwise would be build, this is useful to reduce - unneeded rebuilding when changing headers, but note you must force rebuilds - of files that actually need it by hand then. - -make -j - rebuild with multiple jobs at the same time. Faster on multi processor systems - -make -k - continue build in case of errors, this is useful for the regression tests - sometimes but note it will still not run all reg tests. - diff --git a/doc/codecs.texi b/doc/codecs.texi deleted file mode 100644 index ec69a581ba..0000000000 --- a/doc/codecs.texi +++ /dev/null @@ -1,1107 +0,0 @@ -@anchor{codec-options} -@chapter Codec Options -@c man begin CODEC OPTIONS - -libavcodec provides some generic global options, which can be set on -all the encoders and decoders. In addition each codec may support -so-called private options, which are specific for a given codec. - -Sometimes, a global option may only affect a specific kind of codec, -and may be unsensical or ignored by another, so you need to be aware -of the meaning of the specified options. Also some options are -meant only for decoding or encoding. - -Options may be set by specifying -@var{option} @var{value} in the -FFmpeg tools, or by setting the value explicitly in the -@code{AVCodecContext} options or using the @file{libavutil/opt.h} API -for programmatic use. - -The list of supported options follow: - -@table @option -@item b @var{integer} (@emph{encoding,audio,video}) -Set bitrate in bits/s. Default value is 200K. - -@item ab @var{integer} (@emph{encoding,audio}) -Set audio bitrate (in bits/s). Default value is 128K. - -@item bt @var{integer} (@emph{encoding,video}) -Set video bitrate tolerance (in bits/s). 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. - -@item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles}) -Set generic flags. - -Possible values: -@table @samp -@item mv4 -Use four motion vector by macroblock (mpeg4). -@item qpel -Use 1/4 pel motion compensation. -@item loop -Use loop filter. -@item qscale -Use fixed qscale. -@item gmc -Use gmc. -@item mv0 -Always try a mb with mv=<0,0>. -@item input_preserved - -@item pass1 -Use internal 2pass ratecontrol in first pass mode. -@item pass2 -Use internal 2pass ratecontrol in second pass mode. -@item gray -Only decode/encode grayscale. -@item emu_edge -Do not draw edges. -@item psnr -Set error[?] variables during encoding. -@item truncated - -@item naq -Normalize adaptive quantization. -@item ildct -Use interlaced DCT. -@item low_delay -Force low delay. -@item global_header -Place global headers in extradata instead of every keyframe. -@item bitexact -Use only bitexact stuff (except (I)DCT). -@item aic -Apply H263 advanced intra coding / mpeg4 ac prediction. -@item cbp -Deprecated, use mpegvideo private options instead. -@item qprd -Deprecated, use mpegvideo private options instead. -@item ilme -Apply interlaced motion estimation. -@item cgop -Use closed gop. -@end table - -@item me_method @var{integer} (@emph{encoding,video}) -Set motion estimation method. - -Possible values: -@table @samp -@item zero -zero motion estimation (fastest) -@item full -full motion estimation (slowest) -@item epzs -EPZS motion estimation (default) -@item esa -esa motion estimation (alias for full) -@item tesa -tesa motion estimation -@item dia -dia motion estimation (alias for epzs) -@item log -log motion estimation -@item phods -phods motion estimation -@item x1 -X1 motion estimation -@item hex -hex motion estimation -@item umh -umh motion estimation -@item iter -iter motion estimation -@end table - -@item extradata_size @var{integer} -Set extradata size. - -@item time_base @var{rational number} -Set codec time base. - -It is the fundamental unit of time (in seconds) in terms of which -frame timestamps are represented. For fixed-fps content, timebase -should be @code{1 / frame_rate} and timestamp increments should be -identically 1. - -@item g @var{integer} (@emph{encoding,video}) -Set the group of picture size. Default value is 12. - -@item ar @var{integer} (@emph{decoding/encoding,audio}) -Set audio sampling rate (in Hz). - -@item ac @var{integer} (@emph{decoding/encoding,audio}) -Set number of audio channels. - -@item cutoff @var{integer} (@emph{encoding,audio}) -Set cutoff bandwidth. - -@item frame_size @var{integer} (@emph{encoding,audio}) -Set audio frame size. - -Each submitted frame except the last must contain exactly frame_size -samples per channel. May be 0 when the codec has -CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not -restricted. It is set by some decoders to indicate constant frame -size. - -@item frame_number @var{integer} -Set the frame number. - -@item delay @var{integer} - -@item qcomp @var{float} (@emph{encoding,video}) -Set video quantizer scale compression (VBR). It is used as a constant -in the ratecontrol equation. Recommended range for default rc_eq: -0.0-1.0. - -@item qblur @var{float} (@emph{encoding,video}) -Set video quantizer scale blur (VBR). - -@item qmin @var{integer} (@emph{encoding,video}) -Set min video quantizer scale (VBR). Must be included between -1 and -69, default value is 2. - -@item qmax @var{integer} (@emph{encoding,video}) -Set max video quantizer scale (VBR). Must be included between -1 and -1024, default value is 31. - -@item qdiff @var{integer} (@emph{encoding,video}) -Set max difference between the quantizer scale (VBR). - -@item bf @var{integer} (@emph{encoding,video}) -Set max number of B frames between non-B-frames. - -Must be an integer between -1 and 16. 0 means that B-frames are -disabled. If a value of -1 is used, it will choose an automatic value -depending on the encoder. - -Default value is 0. - -@item b_qfactor @var{float} (@emph{encoding,video}) -Set qp factor between P and B frames. - -@item rc_strategy @var{integer} (@emph{encoding,video}) -Set ratecontrol method. - -@item b_strategy @var{integer} (@emph{encoding,video}) -Set strategy to choose between I/P/B-frames. - -@item ps @var{integer} (@emph{encoding,video}) -Set RTP payload size in bytes. - -@item mv_bits @var{integer} -@item header_bits @var{integer} -@item i_tex_bits @var{integer} -@item p_tex_bits @var{integer} -@item i_count @var{integer} -@item p_count @var{integer} -@item skip_count @var{integer} -@item misc_bits @var{integer} -@item frame_bits @var{integer} -@item codec_tag @var{integer} -@item bug @var{flags} (@emph{decoding,video}) -Workaround not auto detected encoder bugs. - -Possible values: -@table @samp -@item autodetect - -@item old_msmpeg4 -some old lavc generated msmpeg4v3 files (no autodetection) -@item xvid_ilace -Xvid interlacing bug (autodetected if fourcc==XVIX) -@item ump4 -(autodetected if fourcc==UMP4) -@item no_padding -padding bug (autodetected) -@item amv - -@item ac_vlc -illegal vlc bug (autodetected per fourcc) -@item qpel_chroma - -@item std_qpel -old standard qpel (autodetected per fourcc/version) -@item qpel_chroma2 - -@item direct_blocksize -direct-qpel-blocksize bug (autodetected per fourcc/version) -@item edge -edge padding bug (autodetected per fourcc/version) -@item hpel_chroma - -@item dc_clip - -@item ms -Workaround various bugs in microsoft broken decoders. -@item trunc -trancated frames -@end table - -@item lelim @var{integer} (@emph{encoding,video}) -Set single coefficient elimination threshold for luminance (negative -values also consider DC coefficient). - -@item celim @var{integer} (@emph{encoding,video}) -Set single coefficient elimination threshold for chrominance (negative -values also consider dc coefficient) - -@item strict @var{integer} (@emph{decoding/encoding,audio,video}) -Specify how strictly to follow the standards. - -Possible values: -@table @samp -@item very -strictly conform to a older more strict version of the spec or reference software -@item strict -strictly conform to all the things in the spec no matter what consequences -@item normal - -@item unofficial -allow unofficial extensions -@item experimental -allow non standardized experimental things, experimental -(unfinished/work in progress/not well tested) decoders and encoders. -Note: experimental decoders can pose a security risk, do not use this for -decoding untrusted input. -@end table - -@item b_qoffset @var{float} (@emph{encoding,video}) -Set QP offset between P and B frames. - -@item err_detect @var{flags} (@emph{decoding,audio,video}) -Set error detection flags. - -Possible values: -@table @samp -@item crccheck -verify embedded CRCs -@item bitstream -detect bitstream specification deviations -@item buffer -detect improper bitstream length -@item explode -abort decoding on minor error detection -@item ignore_err -ignore decoding errors, and continue decoding. -This is useful if you want to analyze the content of a video and thus want -everything to be decoded no matter what. This option will not result in a video -that is pleasing to watch in case of errors. -@item careful -consider things that violate the spec and have not been seen in the wild as errors -@item compliant -consider all spec non compliancies as errors -@item aggressive -consider things that a sane encoder should not do as an error -@end table - -@item has_b_frames @var{integer} - -@item block_align @var{integer} - -@item mpeg_quant @var{integer} (@emph{encoding,video}) -Use MPEG quantizers instead of H.263. - -@item qsquish @var{float} (@emph{encoding,video}) -How to keep quantizer between qmin and qmax (0 = clip, 1 = use -differentiable function). - -@item rc_qmod_amp @var{float} (@emph{encoding,video}) -Set experimental quantizer modulation. - -@item rc_qmod_freq @var{integer} (@emph{encoding,video}) -Set experimental quantizer modulation. - -@item rc_override_count @var{integer} - -@item rc_eq @var{string} (@emph{encoding,video}) -Set rate control equation. When computing the expression, besides the -standard functions defined in the section 'Expression Evaluation', the -following functions are available: bits2qp(bits), qp2bits(qp). Also -the following constants are available: iTex pTex tex mv fCode iCount -mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex -avgTex. - -@item maxrate @var{integer} (@emph{encoding,audio,video}) -Set max bitrate tolerance (in bits/s). Requires bufsize to be set. - -@item minrate @var{integer} (@emph{encoding,audio,video}) -Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR -encode. It is of little use elsewise. - -@item bufsize @var{integer} (@emph{encoding,audio,video}) -Set ratecontrol buffer size (in bits). - -@item rc_buf_aggressivity @var{float} (@emph{encoding,video}) -Currently useless. - -@item i_qfactor @var{float} (@emph{encoding,video}) -Set QP factor between P and I frames. - -@item i_qoffset @var{float} (@emph{encoding,video}) -Set QP offset between P and I frames. - -@item rc_init_cplx @var{float} (@emph{encoding,video}) -Set initial complexity for 1-pass encoding. - -@item dct @var{integer} (@emph{encoding,video}) -Set DCT algorithm. - -Possible values: -@table @samp -@item auto -autoselect a good one (default) -@item fastint -fast integer -@item int -accurate integer -@item mmx - -@item altivec - -@item faan -floating point AAN DCT -@end table - -@item lumi_mask @var{float} (@emph{encoding,video}) -Compress bright areas stronger than medium ones. - -@item tcplx_mask @var{float} (@emph{encoding,video}) -Set temporal complexity masking. - -@item scplx_mask @var{float} (@emph{encoding,video}) -Set spatial complexity masking. - -@item p_mask @var{float} (@emph{encoding,video}) -Set inter masking. - -@item dark_mask @var{float} (@emph{encoding,video}) -Compress dark areas stronger than medium ones. - -@item idct @var{integer} (@emph{decoding/encoding,video}) -Select IDCT implementation. - -Possible values: -@table @samp -@item auto - -@item int - -@item simple - -@item simplemmx - -@item arm - -@item altivec - -@item sh4 - -@item simplearm - -@item simplearmv5te - -@item simplearmv6 - -@item simpleneon - -@item simplealpha - -@item ipp - -@item xvidmmx - -@item faani -floating point AAN IDCT -@end table - -@item slice_count @var{integer} - -@item ec @var{flags} (@emph{decoding,video}) -Set error concealment strategy. - -Possible values: -@table @samp -@item guess_mvs -iterative motion vector (MV) search (slow) -@item deblock -use strong deblock filter for damaged MBs -@item favor_inter -favor predicting from the previous frame instead of the current -@end table - -@item bits_per_coded_sample @var{integer} - -@item pred @var{integer} (@emph{encoding,video}) -Set prediction method. - -Possible values: -@table @samp -@item left - -@item plane - -@item median - -@end table - -@item aspect @var{rational number} (@emph{encoding,video}) -Set sample aspect ratio. - -@item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles}) -Print specific debug info. - -Possible values: -@table @samp -@item pict -picture info -@item rc -rate control -@item bitstream - -@item mb_type -macroblock (MB) type -@item qp -per-block quantization parameter (QP) -@item mv -motion vector -@item dct_coeff - -@item skip - -@item startcode - -@item pts - -@item er -error recognition -@item mmco -memory management control operations (H.264) -@item bugs - -@item vis_qp -visualize quantization parameter (QP), lower QP are tinted greener -@item vis_mb_type -visualize block types -@item buffers -picture buffer allocations -@item thread_ops -threading operations -@end table - -@item vismv @var{integer} (@emph{decoding,video}) -Visualize motion vectors (MVs). - -Possible values: -@table @samp -@item pf -forward predicted MVs of P-frames -@item bf -forward predicted MVs of B-frames -@item bb -backward predicted MVs of B-frames -@end table - -@item cmp @var{integer} (@emph{encoding,video}) -Set full pel me compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item subcmp @var{integer} (@emph{encoding,video}) -Set sub pel me compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item mbcmp @var{integer} (@emph{encoding,video}) -Set macroblock compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item ildctcmp @var{integer} (@emph{encoding,video}) -Set interlaced dct compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item dia_size @var{integer} (@emph{encoding,video}) -Set diamond type & size for motion estimation. - -@item last_pred @var{integer} (@emph{encoding,video}) -Set amount of motion predictors from the previous frame. - -@item preme @var{integer} (@emph{encoding,video}) -Set pre motion estimation. - -@item precmp @var{integer} (@emph{encoding,video}) -Set pre motion estimation compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item pre_dia_size @var{integer} (@emph{encoding,video}) -Set diamond type & size for motion estimation pre-pass. - -@item subq @var{integer} (@emph{encoding,video}) -Set sub pel motion estimation quality. - -@item dtg_active_format @var{integer} - -@item me_range @var{integer} (@emph{encoding,video}) -Set limit motion vectors range (1023 for DivX player). - -@item ibias @var{integer} (@emph{encoding,video}) -Set intra quant bias. - -@item pbias @var{integer} (@emph{encoding,video}) -Set inter quant bias. - -@item color_table_id @var{integer} - -@item global_quality @var{integer} (@emph{encoding,audio,video}) - -@item coder @var{integer} (@emph{encoding,video}) - -Possible values: -@table @samp -@item vlc -variable length coder / huffman coder -@item ac -arithmetic coder -@item raw -raw (no encoding) -@item rle -run-length coder -@item deflate -deflate-based coder -@end table - -@item context @var{integer} (@emph{encoding,video}) -Set context model. - -@item slice_flags @var{integer} - -@item xvmc_acceleration @var{integer} - -@item mbd @var{integer} (@emph{encoding,video}) -Set macroblock decision algorithm (high quality mode). - -Possible values: -@table @samp -@item simple -use mbcmp (default) -@item bits -use fewest bits -@item rd -use best rate distortion -@end table - -@item stream_codec_tag @var{integer} - -@item sc_threshold @var{integer} (@emph{encoding,video}) -Set scene change threshold. - -@item lmin @var{integer} (@emph{encoding,video}) -Set min lagrange factor (VBR). - -@item lmax @var{integer} (@emph{encoding,video}) -Set max lagrange factor (VBR). - -@item nr @var{integer} (@emph{encoding,video}) -Set noise reduction. - -@item rc_init_occupancy @var{integer} (@emph{encoding,video}) -Set number of bits which should be loaded into the rc buffer before -decoding starts. - -@item flags2 @var{flags} (@emph{decoding/encoding,audio,video}) - -Possible values: -@table @samp -@item fast -Allow non spec compliant speedup tricks. -@item sgop -Deprecated, use mpegvideo private options instead. -@item noout -Skip bitstream encoding. -@item ignorecrop -Ignore cropping information from sps. -@item local_header -Place global headers at every keyframe instead of in extradata. -@item chunks -Frame data might be split into multiple chunks. -@item showall -Show all frames before the first keyframe. -@item skiprd -Deprecated, use mpegvideo private options instead. -@end table - -@item error @var{integer} (@emph{encoding,video}) - -@item qns @var{integer} (@emph{encoding,video}) -Deprecated, use mpegvideo private options instead. - -@item threads @var{integer} (@emph{decoding/encoding,video}) - -Possible values: -@table @samp -@item auto -detect a good number of threads -@end table - -@item me_threshold @var{integer} (@emph{encoding,video}) -Set motion estimation threshold. - -@item mb_threshold @var{integer} (@emph{encoding,video}) -Set macroblock threshold. - -@item dc @var{integer} (@emph{encoding,video}) -Set intra_dc_precision. - -@item nssew @var{integer} (@emph{encoding,video}) -Set nsse weight. - -@item skip_top @var{integer} (@emph{decoding,video}) -Set number of macroblock rows at the top which are skipped. - -@item skip_bottom @var{integer} (@emph{decoding,video}) -Set number of macroblock rows at the bottom which are skipped. - -@item profile @var{integer} (@emph{encoding,audio,video}) - -Possible values: -@table @samp -@item unknown - -@item aac_main - -@item aac_low - -@item aac_ssr - -@item aac_ltp - -@item aac_he - -@item aac_he_v2 - -@item aac_ld - -@item aac_eld - -@item mpeg2_aac_low - -@item mpeg2_aac_he - -@item dts - -@item dts_es - -@item dts_96_24 - -@item dts_hd_hra - -@item dts_hd_ma - -@end table - -@item level @var{integer} (@emph{encoding,audio,video}) - -Possible values: -@table @samp -@item unknown - -@end table - -@item lowres @var{integer} (@emph{decoding,audio,video}) -Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions. - -@item skip_threshold @var{integer} (@emph{encoding,video}) -Set frame skip threshold. - -@item skip_factor @var{integer} (@emph{encoding,video}) -Set frame skip factor. - -@item skip_exp @var{integer} (@emph{encoding,video}) -Set frame skip exponent. -Negative values behave identical to the corresponding positive ones, except -that the score is normalized. -Positive values exist primarly for compatibility reasons and are not so useful. - -@item skipcmp @var{integer} (@emph{encoding,video}) -Set frame skip compare function. - -Possible values: -@table @samp -@item sad -sum of absolute differences, fast (default) -@item sse -sum of squared errors -@item satd -sum of absolute Hadamard transformed differences -@item dct -sum of absolute DCT transformed differences -@item psnr -sum of squared quantization errors (avoid, low quality) -@item bit -number of bits needed for the block -@item rd -rate distortion optimal, slow -@item zero -0 -@item vsad -sum of absolute vertical differences -@item vsse -sum of squared vertical differences -@item nsse -noise preserving sum of squared differences -@item w53 -5/3 wavelet, only used in snow -@item w97 -9/7 wavelet, only used in snow -@item dctmax - -@item chroma - -@end table - -@item border_mask @var{float} (@emph{encoding,video}) -Increase the quantizer for macroblocks close to borders. - -@item mblmin @var{integer} (@emph{encoding,video}) -Set min macroblock lagrange factor (VBR). - -@item mblmax @var{integer} (@emph{encoding,video}) -Set max macroblock lagrange factor (VBR). - -@item mepc @var{integer} (@emph{encoding,video}) -Set motion estimation bitrate penalty compensation (1.0 = 256). - -@item skip_loop_filter @var{integer} (@emph{decoding,video}) -@item skip_idct @var{integer} (@emph{decoding,video}) -@item skip_frame @var{integer} (@emph{decoding,video}) - -Make decoder discard processing depending on the frame type selected -by the option value. - -@option{skip_loop_filter} skips frame loop filtering, @option{skip_idct} -skips frame IDCT/dequantization, @option{skip_frame} skips decoding. - -Possible values: -@table @samp -@item none -Discard no frame. - -@item default -Discard useless frames like 0-sized frames. - -@item noref -Discard all non-reference frames. - -@item bidir -Discard all bidirectional frames. - -@item nokey -Discard all frames excepts keyframes. - -@item all -Discard all frames. -@end table - -Default value is @samp{default}. - -@item bidir_refine @var{integer} (@emph{encoding,video}) -Refine the two motion vectors used in bidirectional macroblocks. - -@item brd_scale @var{integer} (@emph{encoding,video}) -Downscale frames for dynamic B-frame decision. - -@item keyint_min @var{integer} (@emph{encoding,video}) -Set minimum interval between IDR-frames. - -@item refs @var{integer} (@emph{encoding,video}) -Set reference frames to consider for motion compensation. - -@item chromaoffset @var{integer} (@emph{encoding,video}) -Set chroma qp offset from luma. - -@item trellis @var{integer} (@emph{encoding,audio,video}) -Set rate-distortion optimal quantization. - -@item sc_factor @var{integer} (@emph{encoding,video}) -Set value multiplied by qscale for each frame and added to -scene_change_score. - -@item mv0_threshold @var{integer} (@emph{encoding,video}) -@item b_sensitivity @var{integer} (@emph{encoding,video}) -Adjust sensitivity of b_frame_strategy 1. - -@item compression_level @var{integer} (@emph{encoding,audio,video}) -@item min_prediction_order @var{integer} (@emph{encoding,audio}) -@item max_prediction_order @var{integer} (@emph{encoding,audio}) -@item timecode_frame_start @var{integer} (@emph{encoding,video}) -Set GOP timecode frame start number, in non drop frame format. - -@item request_channels @var{integer} (@emph{decoding,audio}) -Set desired number of audio channels. - -@item bits_per_raw_sample @var{integer} -@item channel_layout @var{integer} (@emph{decoding/encoding,audio}) - -Possible values: -@table @samp -@end table -@item request_channel_layout @var{integer} (@emph{decoding,audio}) - -Possible values: -@table @samp -@end table -@item rc_max_vbv_use @var{float} (@emph{encoding,video}) -@item rc_min_vbv_use @var{float} (@emph{encoding,video}) -@item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video}) -@item color_primaries @var{integer} (@emph{decoding/encoding,video}) -@item color_trc @var{integer} (@emph{decoding/encoding,video}) -@item colorspace @var{integer} (@emph{decoding/encoding,video}) -@item color_range @var{integer} (@emph{decoding/encoding,video}) -@item chroma_sample_location @var{integer} (@emph{decoding/encoding,video}) - -@item log_level_offset @var{integer} -Set the log level offset. - -@item slices @var{integer} (@emph{encoding,video}) -Number of slices, used in parallelized encoding. - -@item thread_type @var{flags} (@emph{decoding/encoding,video}) -Select multithreading type. - -Possible values: -@table @samp -@item slice - -@item frame - -@end table -@item audio_service_type @var{integer} (@emph{encoding,audio}) -Set audio service type. - -Possible values: -@table @samp -@item ma -Main Audio Service -@item ef -Effects -@item vi -Visually Impaired -@item hi -Hearing Impaired -@item di -Dialogue -@item co -Commentary -@item em -Emergency -@item vo -Voice Over -@item ka -Karaoke -@end table - -@item request_sample_fmt @var{sample_fmt} (@emph{decoding,audio}) -Set sample format audio decoders should prefer. Default value is -@code{none}. - -@item pkt_timebase @var{rational number} - -@item sub_charenc @var{encoding} (@emph{decoding,subtitles}) -Set the input subtitles character encoding. - -@item field_order @var{field_order} (@emph{video}) -Set/override the field order of the video. -Possible values: -@table @samp -@item progressive -Progressive video -@item tt -Interlaced video, top field coded and displayed first -@item bb -Interlaced video, bottom field coded and displayed first -@item tb -Interlaced video, top coded first, bottom displayed first -@item bt -Interlaced video, bottom coded first, top displayed first -@end table - -@item skip_alpha @var{integer} (@emph{decoding,video}) -Set to 1 to disable processing alpha (transparency). This works like the -@samp{gray} flag in the @option{flags} option which skips chroma information -instead of alpha. Default is 0. -@end table - -@c man end CODEC OPTIONS - -@ifclear config-writeonly -@include decoders.texi -@end ifclear -@ifclear config-readonly -@include encoders.texi -@end ifclear diff --git a/doc/decoders.texi b/doc/decoders.texi index 9309b82a58..c3573a6315 100644 --- a/doc/decoders.texi +++ b/doc/decoders.texi @@ -1,10 +1,10 @@ @chapter Decoders @c man begin DECODERS -Decoders are configured elements in FFmpeg which allow the decoding of +Decoders are configured elements in Libav which allow the decoding of multimedia streams. -When you configure your FFmpeg build, all the supported native decoders +When you configure your Libav build, all the supported native decoders are enabled by default. Decoders requiring an external library must be enabled manually via the corresponding @code{--enable-lib} option. You can list all available decoders using the configure option @code{--list-decoders}. @@ -14,41 +14,11 @@ You can disable all the decoders with the configure option with the options @code{--enable-decoder=@var{DECODER}} / @code{--disable-decoder=@var{DECODER}}. -The option @code{-decoders} of the ff* tools will display the list of +The option @code{-decoders} of the av* tools will display the list of enabled decoders. @c man end DECODERS -@chapter Video Decoders -@c man begin VIDEO DECODERS - -A description of some of the currently available video decoders -follows. - -@section rawvideo - -Raw video decoder. - -This decoder decodes rawvideo streams. - -@subsection Options - -@table @option -@item top @var{top_field_first} -Specify the assumed field type of the input video. -@table @option -@item -1 -the video is assumed to be progressive (default) -@item 0 -bottom-field-first is assumed -@item 1 -top-field-first is assumed -@end table - -@end table - -@c man end VIDEO DECODERS - @chapter Audio Decoders @c man begin AUDIO DECODERS @@ -62,7 +32,7 @@ AC-3 audio decoder. This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as the undocumented RealAudio 3 (a.k.a. dnet). -@subsection AC-3 Decoder Options +@subsubsection AC-3 Decoder Options @table @option @@ -83,151 +53,4 @@ Loud sounds are fully compressed. Soft sounds are enhanced. @end table -@section 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. - -@section libcelt - -libcelt decoder wrapper. - -libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. -Requires the presence of the libcelt headers and library during configuration. -You need to explicitly configure the build with @code{--enable-libcelt}. - -@section libgsm - -libgsm decoder wrapper. - -libgsm allows libavcodec to decode the GSM full rate audio codec. Requires -the presence of the libgsm headers and library during configuration. You need -to explicitly configure the build with @code{--enable-libgsm}. - -This decoder supports both the ordinary GSM and the Microsoft variant. - -@section libilbc - -libilbc decoder wrapper. - -libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC) -audio codec. Requires the presence of the libilbc headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libilbc}. - -@subsection Options - -The following option is supported by the libilbc wrapper. - -@table @option -@item enhance - -Enable the enhancement of the decoded audio when set to 1. The default -value is 0 (disabled). - -@end table - -@section libopencore-amrnb - -libopencore-amrnb decoder wrapper. - -libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate -Narrowband audio codec. Using it requires the presence of the -libopencore-amrnb headers and library during configuration. You need to -explicitly configure the build with @code{--enable-libopencore-amrnb}. - -An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB -without this library. - -@section libopencore-amrwb - -libopencore-amrwb decoder wrapper. - -libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate -Wideband audio codec. Using it requires the presence of the -libopencore-amrwb headers and library during configuration. You need to -explicitly configure the build with @code{--enable-libopencore-amrwb}. - -An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB -without this library. - -@section libopus - -libopus decoder wrapper. - -libopus allows libavcodec to decode the Opus Interactive Audio Codec. -Requires the presence of the libopus headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libopus}. - @c man end AUDIO DECODERS - -@chapter Subtitles Decoders -@c man begin SUBTILES DECODERS - -@section dvdsub - -This codec decodes the bitmap subtitles used in DVDs; the same subtitles can -also be found in VobSub file pairs and in some Matroska files. - -@subsection Options - -@table @option -@item palette -Specify the global palette used by the bitmaps. When stored in VobSub, the -palette is normally specified in the index file; in Matroska, the palette is -stored in the codec extra-data in the same format as in VobSub. In DVDs, the -palette is stored in the IFO file, and therefore not available when reading -from dumped VOB files. - -The format for this option is a string containing 16 24-bits hexadecimal -numbers (without 0x prefix) separated by comas, for example @code{0d00ee, -ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, -7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}. -@end table - -@section libzvbi-teletext - -Libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext -subtitles. Requires the presence of the libzvbi headers and library during -configuration. You need to explicitly configure the build with -@code{--enable-libzvbi}. - -@subsection Options - -@table @option -@item txt_page -List of teletext page numbers to decode. You may use the special * string to -match all pages. Pages that do not match the specified list are dropped. -Default value is *. -@item txt_chop_top -Discards the top teletext line. Default value is 1. -@item txt_format -Specifies the format of the decoded subtitles. The teletext decoder is capable -of decoding the teletext pages to bitmaps or to simple text, you should use -"bitmap" for teletext pages, because certain graphics and colors cannot be -expressed in simple text. You might use "text" for teletext based subtitles if -your application can handle simple text based subtitles. Default value is -bitmap. -@item txt_left -X offset of generated bitmaps, default is 0. -@item txt_top -Y offset of generated bitmaps, default is 0. -@item txt_chop_spaces -Chops leading and trailing spaces and removes empty lines from the generated -text. This option is useful for teletext based subtitles where empty spaces may -be present at the start or at the end of the lines or empty lines may be -present between the subtitle lines because of double-sized teletext charactes. -Default value is 1. -@item txt_duration -Sets the display duration of the decoded teletext pages or subtitles in -miliseconds. Default value is 30000 which is 30 seconds. -@item txt_transparent -Force transparent background of the generated teletext bitmaps. Default value -is 0 which means an opaque (black) background. -@end table - -@c man end SUBTILES DECODERS diff --git a/doc/default.css b/doc/default.css deleted file mode 100644 index bf50200c28..0000000000 --- a/doc/default.css +++ /dev/null @@ -1,165 +0,0 @@ -a.summary-letter { - text-decoration: none; -} - -a { - color: #2D6198; -} - -a:visited { - color: #884488; -} - -#banner { - background-color: white; - position: relative; - text-align: center; -} - -#banner img { - margin-bottom: 1px; - margin-top: 5px; -} - -#body { - margin-left: 1em; - margin-right: 1em; -} - -body { - background-color: #313131; - margin: 0; - text-align: justify; -} - -.center { - margin-left: auto; - margin-right: auto; - text-align: center; -} - -#container { - background-color: white; - color: #202020; - margin-left: 1em; - margin-right: 1em; -} - -#footer { - text-align: center; -} - -h1 a, h2 a, h3 a, h4 a { - text-decoration: inherit; - color: inherit; -} - -h1, h2, h3, h4 { - padding-left: 0.4em; - border-radius: 4px; - padding-bottom: 0.25em; - padding-top: 0.25em; - border: 1px solid #6A996A; -} - -h1 { - background-color: #7BB37B; - color: #151515; - font-size: 1.2em; - padding-bottom: 0.3em; - padding-top: 0.3em; -} - -h2 { - color: #313131; - font-size: 1.0em; - background-color: #ABE3AB; -} - -h3 { - color: #313131; - font-size: 0.9em; - margin-bottom: -6px; - background-color: #BBF3BB; -} - -h4 { - color: #313131; - font-size: 0.8em; - margin-bottom: -8px; - background-color: #D1FDD1; -} - -img { - border: 0; -} - -#navbar { - background-color: #738073; - border-bottom: 1px solid #5C665C; - border-top: 1px solid #5C665C; - margin-top: 12px; - padding: 0.3em; - position: relative; - text-align: center; -} - -#navbar a, #navbar_secondary a { - color: white; - padding: 0.3em; - text-decoration: none; -} - -#navbar a:hover, #navbar_secondary a:hover { - background-color: #313131; - color: white; - text-decoration: none; -} - -#navbar_secondary { - background-color: #738073; - border-bottom: 1px solid #5C665C; - border-left: 1px solid #5C665C; - border-right: 1px solid #5C665C; - padding: 0.3em; - position: relative; - text-align: center; -} - -p { - margin-left: 1em; - margin-right: 1em; -} - -pre { - margin-left: 3em; - margin-right: 3em; - padding: 0.3em; - border: 1px solid #bbb; - background-color: #f7f7f7; -} - -dl dt { - font-weight: bold; -} - -#proj_desc { - font-size: 1.2em; -} - -#repos { - margin-left: 1em; - margin-right: 1em; - border-collapse: collapse; - border: solid 1px #6A996A; -} - -#repos th { - background-color: #7BB37B; - border: solid 1px #6A996A; -} - -#repos td { - padding: 0.2em; - border: solid 1px #6A996A; -} diff --git a/doc/demuxers.texi b/doc/demuxers.texi index d51b9d0748..2f2f464404 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -1,143 +1,93 @@ @chapter Demuxers @c man begin DEMUXERS -Demuxers are configured elements in FFmpeg that can read the +Demuxers are configured elements in Libav which allow to read the multimedia streams from a particular type of file. -When you configure your FFmpeg build, all the supported demuxers +When you configure your Libav build, all the supported demuxers are enabled by default. You can list all available ones using the -configure option @code{--list-demuxers}. +configure option "--list-demuxers". You can disable all the demuxers using the configure option -@code{--disable-demuxers}, and selectively enable a single demuxer with -the option @code{--enable-demuxer=@var{DEMUXER}}, or disable it -with the option @code{--disable-demuxer=@var{DEMUXER}}. +"--disable-demuxers", and selectively enable a single demuxer with +the option "--enable-demuxer=@var{DEMUXER}", or disable it +with the option "--disable-demuxer=@var{DEMUXER}". -The option @code{-formats} of the ff* tools will display the list of +The option "-formats" of the av* tools will display the list of enabled demuxers. The description of some of the currently available demuxers follows. +@section 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 "%0@var{N}d", which +specifies the position of the characters representing a sequential +number in each filename matched by the pattern. If the form +"%d0@var{N}d" is used, the string representing the number in each +filename is 0-padded and @var{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 "%0@var{N}d", 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 @file{img-001.bmp}, @file{img-002.bmp}, ..., +@file{img-010.bmp}, etc.; the pattern "i%%m%%g-%d.jpg" will match a +sequence of filenames of the form @file{i%m%g-1.jpg}, +@file{i%m%g-2.jpg}, ..., @file{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 @command{avconv} for creating a +video from the images in the file sequence @file{img-001.jpeg}, +@file{img-002.jpeg}, ..., assuming an input framerate of 10 frames per +second: +@example +avconv -i 'img-%03d.jpeg' -r 10 out.mkv +@end example + +Note that the pattern must not necessarily contain "%d" or +"%0@var{N}d", for example to convert a single image file +@file{img.jpeg} you can employ the command: +@example +avconv -i img.jpeg img.png +@end example + +@table @option +@item -pixel_format @var{format} +Set the pixel format (for raw image) +@item -video_size @var{size} +Set the frame size (for raw image) +@item -framerate @var{rate} +Set the frame rate +@item -loop @var{bool} +Loop over the images +@item -start_number @var{start} +Specify the first number in the sequence +@end table + @section 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 discard flags on AVStreams (by pressing 'a' or 'v' in avplay), 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". -@section asf - -Advanced Systems Format demuxer. - -This demuxer is used to demux ASF files and MMS network streams. - -@table @option -@item -no_resync_search @var{bool} -Do not try to resynchronize by looking for a certain optional start code. -@end table - -@anchor{concat} -@section concat - -Virtual concatenation script demuxer. - -This demuxer reads a list of files and other directives from a text file and -demuxes them one after the other, as if all their packet had been muxed -together. - -The timestamps in the files are adjusted so that the first file starts at 0 -and each next file starts where the previous one finishes. Note that it is -done globally and may cause gaps if all streams do not have exactly the same -length. - -All files must have the same streams (same codecs, same time base, etc.). - -The duration of each file is used to adjust the timestamps of the next file: -if the duration is incorrect (because it was computed using the bit-rate or -because the file is truncated, for example), it can cause artifacts. The -@code{duration} directive can be used to override the duration stored in -each file. - -@subsection Syntax - -The script is a text file in extended-ASCII, with one directive per line. -Empty lines, leading spaces and lines starting with '#' are ignored. The -following directive is recognized: - -@table @option - -@item @code{file @var{path}} -Path to a file to read; special characters and spaces must be escaped with -backslash or single quotes. - -All subsequent file-related directives apply to that file. - -@item @code{ffconcat version 1.0} -Identify the script type and version. It also sets the @option{safe} option -to 1 if it was to its default -1. - -To make FFmpeg recognize the format automatically, this directive must -appears exactly as is (no extra space or byte-order-mark) on the very first -line of the script. - -@item @code{duration @var{dur}} -Duration of the file. This information can be specified from the file; -specifying it here may be more efficient or help if the information from the -file is not available or accurate. - -If the duration is set for all files, then it is possible to seek in the -whole concatenated video. - -@item @code{stream} -Introduce a stream in the virtual file. -All subsequent stream-related directives apply to the last introduced -stream. -Some streams properties must be set in order to allow identifying the -matching streams in the subfiles. -If no streams are defined in the script, the streams from the first file are -copied. - -@item @code{exact_stream_id @var{id}} -Set the id of the stream. -If this directive is given, the string with the corresponding id in the -subfiles will be used. -This is especially useful for MPEG-PS (VOB) files, where the order of the -streams is not reliable. - -@end table - -@subsection Options - -This demuxer accepts the following option: - -@table @option - -@item safe -If set to 1, reject unsafe file paths. A file path is considered safe if it -does not contain a protocol specification and is relative and all components -only contain characters from the portable character set (letters, digits, -period, underscore and hyphen) and have no period at the beginning of a -component. - -If set to 0, any file name is accepted. - -The default is -1, it is equivalent to 1 if the format was automatically -probed and 0 otherwise. - -@item auto_convert -If set to 1, try to perform automatic conversions on packet data to make the -streams concatenable. - -Currently, the only conversion is adding the h264_mp4toannexb bitstream -filter to H.264 streams in MP4 format. This is necessary in particular if -there are resolution changes. - -@end table - @section flv Adobe Flash Video Format demuxer. @@ -149,253 +99,15 @@ This demuxer is used to demux FLV files and RTMP network streams. Allocate the streams according to the onMetaData array content. @end table -@section libgme +@section asf -The Game Music Emu library is a collection of video game music file emulators. +Advanced Systems Format demuxer. -See @url{http://code.google.com/p/game-music-emu/} for more information. - -Some files have multiple tracks. The demuxer will pick the first track by -default. The @option{track_index} option can be used to select a different -track. Track indexes start at 0. The demuxer exports the number of tracks as -@var{tracks} meta data entry. - -For very large files, the @option{max_size} option may have to be adjusted. - -@section libquvi - -Play media from Internet services using the quvi project. - -The demuxer accepts a @option{format} option to request a specific quality. It -is by default set to @var{best}. - -See @url{http://quvi.sourceforge.net/} for more information. - -FFmpeg needs to be built with @code{--enable-libquvi} for this demuxer to be -enabled. - -@section image2 - -Image file demuxer. - -This demuxer reads from a list of image files specified by a pattern. -The syntax and meaning of the pattern is specified by the -option @var{pattern_type}. - -The pattern may contain a suffix which is used to automatically -determine the format of the images contained in the files. - -The size, the pixel format, and the format of each image must be the -same for all the files in the sequence. - -This demuxer accepts the following options: -@table @option -@item framerate -Set the frame rate for the video stream. It defaults to 25. -@item loop -If set to 1, loop over the input. Default value is 0. -@item pattern_type -Select the pattern type used to interpret the provided filename. - -@var{pattern_type} accepts one of the following values. -@table @option -@item sequence -Select a sequence pattern type, used to specify a sequence of files -indexed by sequential numbers. - -A sequence pattern may contain the string "%d" or "%0@var{N}d", which -specifies the position of the characters representing a sequential -number in each filename matched by the pattern. If the form -"%d0@var{N}d" is used, the string representing the number in each -filename is 0-padded and @var{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 sequence pattern contains "%d" or "%0@var{N}d", the first filename of -the file list specified by the pattern must contain a number -inclusively contained between @var{start_number} and -@var{start_number}+@var{start_number_range}-1, and all the following -numbers must be sequential. - -For example the pattern "img-%03d.bmp" will match a sequence of -filenames of the form @file{img-001.bmp}, @file{img-002.bmp}, ..., -@file{img-010.bmp}, etc.; the pattern "i%%m%%g-%d.jpg" will match a -sequence of filenames of the form @file{i%m%g-1.jpg}, -@file{i%m%g-2.jpg}, ..., @file{i%m%g-10.jpg}, etc. - -Note that the pattern must not necessarily contain "%d" or -"%0@var{N}d", for example to convert a single image file -@file{img.jpeg} you can employ the command: -@example -ffmpeg -i img.jpeg img.png -@end example - -@item glob -Select a glob wildcard pattern type. - -The pattern is interpreted like a @code{glob()} pattern. This is only -selectable if libavformat was compiled with globbing support. - -@item glob_sequence @emph{(deprecated, will be removed)} -Select a mixed glob wildcard/sequence pattern. - -If your version of libavformat was compiled with globbing support, and -the provided pattern contains at least one glob meta character among -@code{%*?[]@{@}} that is preceded by an unescaped "%", the pattern is -interpreted like a @code{glob()} pattern, otherwise it is interpreted -like a sequence pattern. - -All glob special characters @code{%*?[]@{@}} must be prefixed -with "%". To escape a literal "%" you shall use "%%". - -For example the pattern @code{foo-%*.jpeg} will match all the -filenames prefixed by "foo-" and terminating with ".jpeg", and -@code{foo-%?%?%?.jpeg} will match all the filenames prefixed with -"foo-", followed by a sequence of three characters, and terminating -with ".jpeg". - -This pattern type is deprecated in favor of @var{glob} and -@var{sequence}. -@end table - -Default value is @var{glob_sequence}. -@item pixel_format -Set the pixel format of the images to read. If not specified the pixel -format is guessed from the first image file in the sequence. -@item start_number -Set the index of the file matched by the image file pattern to start -to read from. Default value is 0. -@item start_number_range -Set the index interval range to check when looking for the first image -file in the sequence, starting from @var{start_number}. Default value -is 5. -@item ts_from_file -If set to 1, will set frame timestamp to modification time of image file. Note -that monotonity of timestamps is not provided: images go in the same order as -without this option. Default value is 0. -If set to 2, will set frame timestamp to the modification time of the image file in -nanosecond precision. -@item video_size -Set the video size of the images to read. If not specified the video -size is guessed from the first image file in the sequence. -@end table - -@subsection Examples - -@itemize -@item -Use @command{ffmpeg} for creating a video from the images in the file -sequence @file{img-001.jpeg}, @file{img-002.jpeg}, ..., assuming an -input frame rate of 10 frames per second: -@example -ffmpeg -framerate 10 -i 'img-%03d.jpeg' out.mkv -@end example - -@item -As above, but start by reading from a file with index 100 in the sequence: -@example -ffmpeg -framerate 10 -start_number 100 -i 'img-%03d.jpeg' out.mkv -@end example - -@item -Read images matching the "*.png" glob pattern , that is all the files -terminating with the ".png" suffix: -@example -ffmpeg -framerate 10 -pattern_type glob -i "*.png" out.mkv -@end example -@end itemize - -@section mpegts - -MPEG-2 transport stream demuxer. +This demuxer is used to demux ASF files and MMS network streams. @table @option - -@item fix_teletext_pts -Overrides teletext packet PTS and DTS values with the timestamps calculated -from the PCR of the first program which the teletext stream is part of and is -not discarded. Default value is 1, set this option to 0 if you want your -teletext packet PTS and DTS values untouched. +@item -no_resync_search @var{bool} +Do not try to resynchronize by looking for a certain optional start code. @end table -@section rawvideo - -Raw video demuxer. - -This demuxer allows one to read raw video data. Since there is no header -specifying the assumed video parameters, the user must specify them -in order to be able to decode the data correctly. - -This demuxer accepts the following options: -@table @option - -@item framerate -Set input video frame rate. Default value is 25. - -@item pixel_format -Set the input video pixel format. Default value is @code{yuv420p}. - -@item video_size -Set the input video size. This value must be specified explicitly. -@end table - -For example to read a rawvideo file @file{input.raw} with -@command{ffplay}, assuming a pixel format of @code{rgb24}, a video -size of @code{320x240}, and a frame rate of 10 images per second, use -the command: -@example -ffplay -f rawvideo -pixel_format rgb24 -video_size 320x240 -framerate 10 input.raw -@end example - -@section sbg - -SBaGen script demuxer. - -This demuxer reads the script language used by SBaGen -@url{http://uazu.net/sbagen/} to generate binaural beats sessions. A SBG -script looks like that: -@example --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 -@end example - -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 @var{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. - -@section tedcaptions - -JSON captions used for @url{http://www.ted.com/, TED Talks}. - -TED does not provide links to the captions, but they can be guessed from the -page. The file @file{tools/bookmarklets.html} from the FFmpeg source tree -contains a bookmarklet to expose them. - -This demuxer accepts the following option: -@table @option -@item start_time -Set the start time of the TED talk, in milliseconds. The default is 15000 -(15s). It is used to sync the captions with the downloadable videos, because -they include a 15s intro. -@end table - -Example: convert the captions to a format most players understand: -@example -ffmpeg -i http://www.ted.com/talks/subtitles/id/1/lang/en talk1-en.srt -@end example - -@c man end DEMUXERS +@c man end INPUT DEVICES diff --git a/doc/developer.texi b/doc/developer.texi index 1e1d3b8c8f..1ffdff10c9 100644 --- a/doc/developer.texi +++ b/doc/developer.texi @@ -11,44 +11,87 @@ @chapter Developers Guide -@section Notes for external developers +@section API -This document is mostly useful for internal FFmpeg developers. -External developers who need to use the API in their application should -refer to the API doxygen documentation in the public headers, and -check the examples in @file{doc/examples} and in the source code to -see how the public API is employed. - -You can use the FFmpeg libraries in your commercial program, but you -are encouraged to @emph{publish any patch you make}. In this case the -best way to proceed is to send your patches to the ffmpeg-devel -mailing list following the guidelines illustrated in the remainder of -this document. - -For more detailed legal information about the use of FFmpeg in -external programs read the @file{LICENSE} file in the source tree and -consult @url{http://ffmpeg.org/legal.html}. - -@section Contributing - -There are 3 ways by which code gets into ffmpeg. @itemize @bullet -@item Submitting Patches to the main developer mailing list - see @ref{Submitting patches} for details. -@item Directly committing changes to the main tree. -@item Committing changes to a git clone, for example on github.com or - gitorious.org. And asking us to merge these changes. +@item libavcodec is the library containing the codecs (both encoding and +decoding). Look at @file{libavcodec/apiexample.c} to see how to use it. + +@item libavformat is the library containing the file format handling (mux and +demux code for several formats). Look at @file{avplay.c} to use it in a +player. See @file{libavformat/output-example.c} to use it to generate +audio or video streams. @end itemize -Whichever way, changes should be reviewed by the maintainer of the code -before they are committed. And they should follow the @ref{Coding Rules}. -The developer making the commit and the author are responsible for their changes -and should try to fix issues their commit causes. +@section Integrating libav in your program + +Shared libraries should be used whenever is possible in order to reduce +the effort distributors have to pour to support programs and to ensure +only the public API is used. + +You can use Libav in your commercial program, but you must abide to the +license, LGPL or GPL depending on the specific features used, please refer +to @uref{http://libav.org/legal.html, our legal page} for a quick checklist and to +the following links for the exact text of each license: +@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv2, GPL version 2}, +@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.GPLv3, GPL version 3}, +@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv2.1, LGPL version 2.1}, +@uref{http://git.libav.org/?p=libav.git;a=blob;f=COPYING.LGPLv3, LGPL version 3}. +Any modification to the source code can be suggested for inclusion. +The best way to proceed is to send your patches to the +@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} +mailing list. @anchor{Coding Rules} @section Coding Rules @subsection Code formatting conventions +The code is written in K&R C style. That means the following: + +@itemize @bullet +@item +The control statements are formatted by putting space between the statement +and parenthesis in the following way: +@example +for (i = 0; i < filter->input_count; i++) @{ +@end example + +@item +The case statement is always located at the same level as the switch itself: +@example +switch (link->init_state) @{ +case AVLINK_INIT: + continue; +case AVLINK_STARTINIT: + av_log(filter, AV_LOG_INFO, "circular filter chain detected"); + return 0; +@end example + +@item +Braces in function declarations are written on the new line: +@example +const char *avfilter_configuration(void) +@{ + return LIBAV_CONFIGURATION; +@} +@end example + +@item +Do not check for NULL values by comparison, @samp{if (p)} and +@samp{if (!p)} are correct; @samp{if (p == NULL)} and @samp{if (p != NULL)} +are not. + +@item +In case of a single-statement if, no curly braces are required: +@example +if (!pic || !picref) + goto fail; +@end example + +@item +Do not put spaces immediately inside parentheses. @samp{if (ret)} is +a valid style; @samp{if ( ret )} is not. +@end itemize There are the following guidelines regarding the indentation in files: @@ -67,7 +110,7 @@ and only if this improves readability. @end itemize The presentation is one inspired by 'indent -i4 -kr -nut'. -The main priority in FFmpeg is simplicity and small code size in order to +The main priority in Libav is simplicity and small code size in order to minimize the bug count. @subsection Comments @@ -112,7 +155,7 @@ int myfunc(int my_parameter) @subsection C language features -FFmpeg is programmed in the ISO C90 language with a few additional +Libav is programmed in the ISO C90 language with a few additional features from ISO C99, namely: @itemize @bullet @@ -154,8 +197,8 @@ GCC statement expressions (@samp{(x = (@{ int y = 4; y; @})}). @subsection Naming conventions All names should be composed with underscores (_), not CamelCase. For example, @samp{avfilter_get_video_buffer} is an acceptable function name and -@samp{AVFilterGetVideo} is not. The exception from this are type names, like -for example structs and enums; they should always be in the CamelCase +@samp{AVFilterGetVideo} is not. The only exception are structure +names; they should always be CamelCase. There are the following conventions for naming variables and functions: @@ -178,13 +221,8 @@ across multiple libraries, use @code{avpriv_} as prefix, for example, @samp{avpriv_aac_parse_header}. @item -Each library has its own prefix for public symbols, in addition to the -commonly used @code{av_} (@code{avformat_} for libavformat, -@code{avcodec_} for libavcodec, @code{swr_} for libswresample, etc). -Check the existing code and choose names accordingly. -Note that some symbols without these prefixes are also exported for -retro-compatibility reasons. These exceptions are declared in the -@code{lib/lib.v} files. +For externally visible symbols, each library has its own prefix. Check +the existing code and choose names accordingly. @end itemize Furthermore, name space reserved for the system should not be invaded. @@ -208,10 +246,10 @@ should also be avoided if they don't make the code easier to understand. @end itemize @subsection Editor configuration -In order to configure Vim to follow FFmpeg formatting conventions, paste +In order to configure Vim to follow Libav formatting conventions, paste the following snippet into your @file{.vimrc}: @example -" indentation rules for FFmpeg: 4 spaces, no tabs +" Indentation rules for Libav: 4 spaces, no tabs. set expandtab set shiftwidth=4 set softtabstop=4 @@ -228,7 +266,7 @@ autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@ 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 - -@item -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. - -@item -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. +Patches that change behavior of the programs (renaming options etc) or +public API or ABI should be discussed in depth and possible few days should +pass between discussion and commit. +Changes to the build system (Makefiles, configure script) which alter +the expected behavior should be considered in the same regard. @item When applying patches that have been discussed (at length) on the mailing list, reference the thread in the log message. @item -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! - -@item -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. +Subscribe to the +@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} and +@uref{https://lists.libav.org/mailman/listinfo/libav-commits, libav-commits} +mailing lists. +Bugs and possible improvements or general questions regarding commits +are discussed on libav-devel. We expect you to react if problems with +your code are uncovered. @item 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. +unsure how best to do this, send an [RFC] patch to libav-devel. @item -Try to keep important discussions and requests (also) on the public -developer mailing list, so that all developers can benefit from them. +All discussions and decisions should be reported on the public developer +mailing list, so that there is a reference to them. +Other media (e.g. IRC) should be used for coordination and immediate +collaboration. @item 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. +as array index or other risky things. Always use valgrind to double-check. @item -Remember to check if you need to bump versions for the specific libav* +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 @@ -374,59 +385,52 @@ 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). The third -component always starts at 100 to distinguish FFmpeg from Libav. +change (e.g. encoder bug fix that matters for the decoder). @item -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. +Compiler warnings indicate potential bugs or code with bad style. 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. +If a type of warning leads to too many false positives, that warning +should be disabled, not the code changed. @item -Make sure that no parts of the codebase that you maintain are missing from the -@file{MAINTAINERS} file. If something that you want to maintain is missing add it with -your name after it. -If at some point you no longer want to maintain some code, then please help -finding a new maintainer and also don't forget updating the @file{MAINTAINERS} file. +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. @end enumerate We think our rules are not too hard. If you have comments, contact us. -@anchor{Submitting patches} @section Submitting patches First, read the @ref{Coding Rules} above if you did not yet, in particular the rules regarding patch submission. -When you submit your patch, please use @code{git format-patch} or -@code{git send-email}. We cannot read other diffs :-) - -Also please do not submit a patch which contains several unrelated changes. +As stated already, 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. +Use the patcheck tool of Libav to check your patch. The tool is located in the tools directory. -Run the @ref{Regression tests} before submitting a patch in order to verify +Run the @ref{Regression Tests} before submitting a patch in order to verify it does not cause unexpected problems. 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()') +and has no lrint()'). This kind of explanation should be the body of the +commit message. Also please if you send several patches, send each patch as a separate mail, do not attach several unrelated patches to the same mail. Patches should be posted to the -@uref{http://lists.ffmpeg.org/mailman/listinfo/ffmpeg-devel, ffmpeg-devel} +@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} mailing list. Use @code{git send-email} when possible since it will properly send patches without requiring extra care. If you cannot, then send patches as base64-encoded attachments, so your patch is not trashed during @@ -435,8 +439,8 @@ transmission. 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. +several iterations. Once your patch is deemed good enough, it will be +committed to the official Libav 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. @@ -470,8 +474,8 @@ even if it is only a decoder? @item 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. +Remember to do this even if you are just adding a format to a file that +is already being compiled by some other rule, like a raw demuxer. @item Did you add an entry to the table of supported formats or codecs in @@ -498,25 +502,15 @@ Did you make sure it compiles standalone, i.e. with @enumerate @item -Does @code{make fate} pass with the patch applied? +Does @code{make check} pass with the patch applied? @item -Was the patch generated with git format-patch or send-email? +Is the patch against latest Libav git master branch? @item -Did you sign off your patch? (git commit -s) -See @url{http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob_plain;f=Documentation/SubmittingPatches} for the meaning -of sign off. - -@item -Did you provide a clear git commit log message? - -@item -Is the patch against latest FFmpeg git master branch? - -@item -Are you subscribed to ffmpeg-devel? -(the list is subscribers only due to spam) +Are you subscribed to the +@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} +mailing list? (Only list subscribers are allowed to post.) @item Have you checked that the changes are minimal, so that the same cannot be @@ -559,7 +553,7 @@ If the patch fixes a bug, did you provide a verbose analysis of the bug? 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 +URL, you can upload to ftp://upload.libav.org @item Did you provide a verbose summary about what the patch does change? @@ -577,7 +571,7 @@ patch easily? @item 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. +taken from Libav, not randomly copied and pasted from somewhere else. @item You should maintain alphabetical order in alphabetically ordered lists as @@ -587,25 +581,17 @@ long as doing so does not break API/ABI compatibility. Lines with similar content should be aligned vertically when doing so improves readability. -@item -Consider to add a regression test for your code. - -@item -If you added YASM code please check that things still work with --disable-yasm - @item Make sure you check the return values of function and return appropriate -error codes. Especially memory allocation functions like @code{av_malloc()} +error codes. Especially memory allocation functions like @code{malloc()} are notoriously left unchecked, which is a serious problem. - -@item -Test your code with valgrind and or Address Sanitizer to ensure it's free -of leaks, out of array accesses, etc. @end enumerate @section Patch review process -All patches posted to ffmpeg-devel will be reviewed, unless they contain a +All patches posted to the +@uref{https://lists.libav.org/mailman/listinfo/libav-devel, libav-devel} +mailing list 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, @@ -619,43 +605,27 @@ 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, if their size grew or during the review different +issues arisen please split the patch so each issue has a specific patch. -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. +@anchor{Regression Tests} +@section Regression Tests -@anchor{Regression tests} -@section Regression tests +Before submitting a patch (or committing to the repository), you should at +least make sure that it does not break anything. -Before submitting a patch (or committing to the repository), you should at least -test that you did not break anything. +If the code changed has already a test present in FATE you should run it, +otherwise it is advised to add it. -Running 'make fate' accomplishes this, please see @url{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]. - -@subsection Adding files to the fate-suite dataset - -When there is no muxer or encoder available to generate test media for a -specific test then the media has to be inlcuded in the fate-suite. -First please make sure that the sample file is as small as possible to test the -respective decoder or demuxer sufficiently. Large files increase network -bandwidth and disk space requirements. -Once you have a working fate test and fate sample, provide in the commit -message or introductionary message for the patch series that you post to -the ffmpeg-devel mailing list, a direct link to download the sample media. +Improvements to codec or demuxer might change the FATE results. Make sure +to commit the update reference with the change and to explain in the comment +why the expected result changed. +Please refer to @url{fate.html}. @subsection Visualizing Test Coverage -The FFmpeg build system allows visualizing the test coverage in an easy +The Libav build system allows visualizing the test coverage in an easy manner with the coverage tools @code{gcov}/@code{lcov}. This involves the following steps: @@ -667,7 +637,7 @@ the following steps: @item Run your test case, either manually or via FATE. This can be either the full FATE regression suite, or any arbitrary invocation of any - front-end tool provided by FFmpeg, in any combination. + front-end tool provided by Libav, in any combination. @item Run @code{make lcov} to generate coverage data in HTML format. @@ -696,11 +666,11 @@ your configure line instead. @anchor{Release process} @section Release process -FFmpeg maintains a set of @strong{release branches}, which are the +Libav maintains a set of @strong{release branches}, which are the recommended deliverable for system integrators and distributors (such as -Linux distributions, etc.). At regular times, a @strong{release +Linux distributions, etc.). At irregular times, a @strong{release manager} prepares, tests and publishes tarballs on the -@url{http://ffmpeg.org} website. +@url{http://libav.org} website. There are two kinds of releases: @@ -715,7 +685,7 @@ which are named @code{release/X}, with @code{X} being the release version number. @end enumerate -Note that we promise to our users that shared libraries from any FFmpeg +Note that we promise to our users that shared libraries from any Libav release never break programs that have been @strong{compiled} against previous versions of @strong{the same release series} in any case! @@ -723,7 +693,7 @@ However, from time to time, we do make API changes that require adaptations in applications. Such changes are only allowed in (new) major releases and require further steps such as bumping library version numbers and/or adjustments to the symbol versioning file. Please discuss such changes -on the @strong{ffmpeg-devel} mailing list in time to allow forward planning. +on the @strong{libav-devel} mailing list in time to allow forward planning. @anchor{Criteria for Point Releases} @subsection Criteria for Point Releases @@ -737,7 +707,7 @@ Fixes a security issue, preferably identified by a @strong{CVE number} issued by @url{http://cve.mitre.org/}. @item -Fixes a documented bug in @url{https://trac.ffmpeg.org}. +Fixes a documented bug in @url{http://bugzilla.libav.org}. @item Improves the included documentation. @@ -749,6 +719,11 @@ point releases of the same release branch. The order for checking the rules is (1 OR 2 OR 3) AND 4. +All Libav developers are welcome to nominate commits that they push to +@code{master} by mailing the @strong{libav-stable} mailing list. The +easiest way to do so is to include @code{CC: libav-stable@@libav.org} in +the commit message. + @subsection Release Checklist @@ -760,31 +735,43 @@ Ensure that the @file{RELEASE} file contains the version number for the upcoming release. @item -Add the release at @url{https://trac.ffmpeg.org/admin/ticket/versions}. +File a release tracking bug in @url{http://bugzilla.libav.org}. Make +sure that the bug has an alias named @code{ReleaseX.Y} for the +@code{X.Y} release. @item Announce the intent to do a release to the mailing list. @item -Make sure all relevant security fixes have been backported. See -@url{https://ffmpeg.org/security.html}. +Reassign unresolved blocking bugs from previous release +tracking bugs to the new bug. + +@item +Review patch nominations that reach the @strong{libav-stable} +mailing list, and push patches that fulfill the stable release +criteria to the release branch. @item Ensure that the FATE regression suite still passes in the release branch on at least @strong{i386} and @strong{amd64} -(cf. @ref{Regression tests}). +(cf. @ref{Regression Tests}). @item -Prepare the release tarballs in @code{bz2} and @code{gz} formats, and -supplementing files that contain @code{gpg} signatures +Prepare the release tarballs in @code{xz} and @code{gz} formats, and +supplementing files that contain @code{md5} and @code{sha1} +checksums. @item -Publish the tarballs at @url{http://ffmpeg.org/releases}. Create and -push an annotated tag in the form @code{nX}, with @code{X} +Publish the tarballs at @url{http://libav.org/releases}. Create and +push an annotated tag in the form @code{vX}, with @code{X} containing the version number. @item -Propose and send a patch to the @strong{ffmpeg-devel} mailing list +Build the tarballs with the Windows binaries, and publish them at +@url{http://win32.libav.org/releases}. + +@item +Propose and send a patch to the @strong{libav-devel} mailing list with a news entry for the website. @item diff --git a/doc/devices.texi b/doc/devices.texi deleted file mode 100644 index 5e74a962d7..0000000000 --- a/doc/devices.texi +++ /dev/null @@ -1,25 +0,0 @@ -@chapter Device Options -@c man begin DEVICE OPTIONS - -The libavdevice library provides the same interface as -libavformat. Namely, an input device is considered like a demuxer, and -an output device like a muxer, and the interface and generic device -options are the same provided by libavformat (see the ffmpeg-formats -manual). - -In addition each input or output device may support so-called private -options, which are specific for that component. - -Options may be set by specifying -@var{option} @var{value} in the -FFmpeg tools, or by setting the value explicitly in the device -@code{AVFormatContext} options or using the @file{libavutil/opt.h} API -for programmatic use. - -@c man end DEVICE OPTIONS - -@ifclear config-writeonly -@include indevs.texi -@end ifclear -@ifclear config-readonly -@include outdevs.texi -@end ifclear diff --git a/doc/doxy-wrapper.sh b/doc/doxy-wrapper.sh index 13be8cb950..d38dd0bcdd 100755 --- a/doc/doxy-wrapper.sh +++ b/doc/doxy-wrapper.sh @@ -9,4 +9,7 @@ doxygen - < li > a { + display: block; +} +.tablist > li > a:hover { + text-decoration: none; + background-color: #eeeeee; +} +.tablist > .pull-right { + float: right; +} +.tablist-header { + display: block; + padding: 3px 15px; + font-size: 11px; + font-weight: bold; + line-height: 20px; + color: #999999; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); + text-transform: uppercase; +} +.tablist li + .tablist-header { + margin-top: 9px; +} +.tablist-list { + padding-left: 15px; + padding-right: 15px; + margin-bottom: 0; +} +.tablist-list > li > a, +.tablist-list .tablist-header { + margin-left: -15px; + margin-right: -15px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); +} +.tablist-list > li > a { + padding: 3px 15px; +} +.tablist-list > .current > a, +.tablist-list > .current > a:hover { + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2); + background-color: #0088cc; +} +.tablist-list [class^="icon-"] { + margin-right: 2px; +} +.tablist-list .divider { + *width: 100%; + height: 1px; + margin: 9px 1px; + *margin: -5px 0 5px; + overflow: hidden; + background-color: #e5e5e5; + border-bottom: 1px solid #ffffff; +} +.tablist-tabs, +.tablist { + *zoom: 1; +} +.tablist-tabs:before, +.tablist:before, +.tablist-tabs:after, +.tablist:after { + display: table; + content: ""; + line-height: 0; +} +.tablist-tabs:after, +.tablist:after { + clear: both; +} +.tablist-tabs > li, +.tablist > li { + float: left; +} +.tablist-tabs > li > a, +.tablist > li > a { + padding-right: 12px; + padding-left: 12px; + margin-right: 2px; + line-height: 14px; +} +.tablist-tabs { + border-bottom: 1px solid #ddd; +} +.tablist-tabs > li { + margin-bottom: -1px; +} +.tablist-tabs > li > a { + padding-top: 8px; + padding-bottom: 8px; + line-height: 20px; + border: 1px solid transparent; + -webkit-border-radius: 4px 4px 0 0; + -moz-border-radius: 4px 4px 0 0; + border-radius: 4px 4px 0 0; +} +.tablist-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #dddddd; +} +.tablist-tabs > .current > a, +.tablist-tabs > .current > a:hover { + color: #555555; + background-color: #ffffff; + border: 1px solid #ddd; + border-bottom-color: transparent; + cursor: default; +} +.tablist > li > a { + padding-top: 8px; + padding-bottom: 8px; + margin-top: 2px; + margin-bottom: 2px; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; +} +.tablist > .current > a, +.tablist > .current > a:hover { + color: #ffffff; + background-color: #0088cc; +} +.tablist-stacked > li { + float: none; +} +.tablist-stacked > li > a { + margin-right: 0; +} +.tablist-tabs.tablist-stacked { + border-bottom: 0; +} +.tablist-tabs.tablist-stacked > li > a { + border: 1px solid #ddd; + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; +} +.tablist-tabs.tablist-stacked > li:first-child > a { + -webkit-border-top-right-radius: 4px; + -moz-border-radius-topright: 4px; + border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; + -moz-border-radius-topleft: 4px; + border-top-left-radius: 4px; +} +.tablist-tabs.tablist-stacked > li:last-child > a { + -webkit-border-bottom-right-radius: 4px; + -moz-border-radius-bottomright: 4px; + border-bottom-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -moz-border-radius-bottomleft: 4px; + border-bottom-left-radius: 4px; +} +.tablist-tabs.tablist-stacked > li > a:hover { + border-color: #ddd; + z-index: 2; +} +.tablist.tablist-stacked > li > a { + margin-bottom: 3px; +} +.tablist.tablist-stacked > li:last-child > a { + margin-bottom: 1px; +} +.tablist-tabs .dropdown-menu { + -webkit-border-radius: 0 0 6px 6px; + -moz-border-radius: 0 0 6px 6px; + border-radius: 0 0 6px 6px; +} +.tablist .dropdown-menu { + -webkit-border-radius: 6px; + -moz-border-radius: 6px; + border-radius: 6px; +} +.tablist .dropdown-toggle .caret { + border-top-color: #0088cc; + border-bottom-color: #0088cc; + margin-top: 6px; +} +.tablist .dropdown-toggle:hover .caret { + border-top-color: #005580; + border-bottom-color: #005580; +} +/* move down carets for tabs */ +.tablist-tabs .dropdown-toggle .caret { + margin-top: 8px; +} +.tablist .current .dropdown-toggle .caret { + border-top-color: #fff; + border-bottom-color: #fff; +} +.tablist-tabs .current .dropdown-toggle .caret { + border-top-color: #555555; + border-bottom-color: #555555; +} +.tablist > .dropdown.current > a:hover { + cursor: pointer; +} +.tablist-tabs .open .dropdown-toggle, +.tablist .open .dropdown-toggle, +.tablist > li.dropdown.open.current > a:hover { + color: #ffffff; + background-color: #999999; + border-color: #999999; +} +.tablist li.dropdown.open .caret, +.tablist li.dropdown.open.current .caret, +.tablist li.dropdown.open a:hover .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; + opacity: 1; + filter: alpha(opacity=100); +} +.tabs-stacked .open > a:hover { + border-color: #999999; +} +.tab-content > .tab-pane, +.pill-content > .pill-pane { + display: none; +} +.tab-content > .current, +.pill-content > .current { + display: block; +} +.tabs-below > .tablist-tabs { + border-top: 1px solid #ddd; +} +.tabs-below > .tablist-tabs > li { + margin-top: -1px; + margin-bottom: 0; +} +.tabs-below > .tablist-tabs > li > a { + -webkit-border-radius: 0 0 4px 4px; + -moz-border-radius: 0 0 4px 4px; + border-radius: 0 0 4px 4px; +} +.tabs-below > .tablist-tabs > li > a:hover { + border-bottom-color: transparent; + border-top-color: #ddd; +} +.tabs-below > .tablist-tabs > .current > a, +.tabs-below > .tablist-tabs > .current > a:hover { + border-color: transparent #ddd #ddd #ddd; +} +.tabs-left > .tablist-tabs > li, +.tabs-right > .tablist-tabs > li { + float: none; +} +.tabs-left > .tablist-tabs > li > a, +.tabs-right > .tablist-tabs > li > a { + min-width: 74px; + margin-right: 0; + margin-bottom: 3px; +} +.tabs-left > .tablist-tabs { + float: left; + margin-right: 19px; + border-right: 1px solid #ddd; +} +.tabs-left > .tablist-tabs > li > a { + margin-right: -1px; + -webkit-border-radius: 4px 0 0 4px; + -moz-border-radius: 4px 0 0 4px; + border-radius: 4px 0 0 4px; +} +.tabs-left > .tablist-tabs > li > a:hover { + border-color: #eeeeee #dddddd #eeeeee #eeeeee; +} +.tabs-left > .tablist-tabs .current > a, +.tabs-left > .tablist-tabs .current > a:hover { + border-color: #ddd transparent #ddd #ddd; + *border-right-color: #ffffff; +} +.tabs-right > .tablist-tabs { + float: right; + margin-left: 19px; + border-left: 1px solid #ddd; +} +.tabs-right > .tablist-tabs > li > a { + margin-left: -1px; + -webkit-border-radius: 0 4px 4px 0; + -moz-border-radius: 0 4px 4px 0; + border-radius: 0 4px 4px 0; +} +.tabs-right > .tablist-tabs > li > a:hover { + border-color: #eeeeee #eeeeee #eeeeee #dddddd; +} +.tabs-right > .tablist-tabs .current > a, +.tabs-right > .tablist-tabs .current > a:hover { + border-color: #ddd #ddd #ddd transparent; + *border-left-color: #ffffff; +} +.tablist > .disabled > a { + color: #999999; +} +.tablist > .disabled > a:hover { + text-decoration: none; + background-color: transparent; + cursor: default; +} +.tablistbar { + overflow: visible; + margin-bottom: 20px; + color: #ffffff; + *position: relative; + *z-index: 2; +} +.tablistbar-inner { + min-height: 40px; + padding-left: 20px; + padding-right: 20px; + background-color: #034c03; + background-image: -moz-linear-gradient(top, #024002, #045f04); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#024002), to(#045f04)); + background-image: -webkit-linear-gradient(top, #024002, #045f04); + background-image: -o-linear-gradient(top, #024002, #045f04); + background-image: linear-gradient(to bottom, #024002, #045f04); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff024002', endColorstr='#ff045f04', GradientType=0); + border: 1px solid #022402; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; + -webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + -moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065); + *zoom: 1; +} +.tablistbar-inner:before, +.tablistbar-inner:after { + display: table; + content: ""; + line-height: 0; +} +.tablistbar-inner:after { + clear: both; +} +.tablistbar .container { + width: auto; +} +.tablist-collapse.collapse { + height: auto; +} +.tablistbar .brand { + float: left; + display: block; + padding: 10px 20px 10px; + margin-left: -20px; + font-size: 20px; + font-weight: 200; + color: #ffffff; + text-shadow: 0 1px 0 #024002; +} +.tablistbar .brand:hover { + text-decoration: none; +} +.tablistbar-text { + margin-bottom: 0; + line-height: 40px; +} +.tablistbar-link { + color: #ffffff; +} +.tablistbar-link:hover { + color: #333333; +} +.tablistbar .tablist { + position: relative; + left: 0; + display: block; + float: left; + margin: 0 10px 0 0; +} +.tablistbar .tablist.pull-right { + float: right; + margin-right: 0; +} +.tablistbar .tablist > li { + float: left; +} +.tablistbar .tablist > li > a { + float: none; + padding: 10px 15px 10px; + color: #ffffff; + text-decoration: none; + text-shadow: 0 1px 0 #024002; +} +.tablistbar .tablist .dropdown-toggle .caret { + margin-top: 8px; +} +.tablistbar .tablist > li > a:focus, +.tablistbar .tablist > li > a:hover { + background-color: transparent; + color: white; + text-decoration: none; +} +.tablistbar .tablist > .current > a, +.tablistbar .tablist > .current > a:hover, +.tablistbar .tablist > .current > a:focus { + color: #555555; + text-decoration: none; + background-color: #034703; + -webkit-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); + -moz-box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); + box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.125); +} +.tablistbar .btn-navbar { + display: none; + float: right; + padding: 7px 10px; + margin-left: 5px; + margin-right: 5px; + color: #ffffff; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #023402; + background-image: -moz-linear-gradient(top, #012701, #034703); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#012701), to(#034703)); + background-image: -webkit-linear-gradient(top, #012701, #034703); + background-image: -o-linear-gradient(top, #012701, #034703); + background-image: linear-gradient(to bottom, #012701, #034703); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff012701', endColorstr='#ff034703', GradientType=0); + border-color: #034703 #034703 #000000; + border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); + *background-color: #034703; + /* Darken IE7 buttons by default so they stand out more given they won't have borders */ + + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); + -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); + box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.075); +} +.tablistbar .tablist > li > .dropdown-menu:before { + content: ''; + display: inline-block; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-bottom: 7px solid #ccc; + border-bottom-color: rgba(0, 0, 0, 0.2); + position: absolute; + top: -7px; + left: 9px; +} +.tablistbar .tablist > li > .dropdown-menu:after { + content: ''; + display: inline-block; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #ffffff; + position: absolute; + top: -6px; + left: 10px; +} +.tablistbar .tablist li.dropdown.open > .dropdown-toggle, +.tablistbar .tablist li.dropdown.current > .dropdown-toggle, +.tablistbar .tablist li.dropdown.open.current > .dropdown-toggle { + background-color: #034703; + color: #555555; +} +.tablistbar .tablist li.dropdown > .dropdown-toggle .caret { + border-top-color: #ffffff; + border-bottom-color: #ffffff; +} +.tablistbar .tablist li.dropdown.open > .dropdown-toggle .caret, +.tablistbar .tablist li.dropdown.current > .dropdown-toggle .caret, +.tablistbar .tablist li.dropdown.open.current > .dropdown-toggle .caret { + border-top-color: #555555; + border-bottom-color: #555555; +} +.tablistbar .pull-right > li > .dropdown-menu, +.tablistbar .tablist > li > .dropdown-menu.pull-right { + left: auto; + right: 0; +} +.tablistbar .pull-right > li > .dropdown-menu:before, +.tablistbar .tablist > li > .dropdown-menu.pull-right:before { + left: auto; + right: 12px; +} +.tablistbar .pull-right > li > .dropdown-menu:after, +.tablistbar .tablist > li > .dropdown-menu.pull-right:after { + left: auto; + right: 13px; +} +.tablistbar .pull-right > li > .dropdown-menu .dropdown-menu, +.tablistbar .tablist > li > .dropdown-menu.pull-right .dropdown-menu { + left: auto; + right: 100%; + margin-left: 0; + margin-right: -1px; + -webkit-border-radius: 6px 0 6px 6px; + -moz-border-radius: 6px 0 6px 6px; + border-radius: 6px 0 6px 6px; +} +.breadcrumb { + padding: 8px 15px; + margin: 0 0 20px; + list-style: none; + background-color: #f5f5f5; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.breadcrumb li { + display: inline-block; + *display: inline; + /* IE7 inline-block hack */ + + *zoom: 1; + text-shadow: 0 1px 0 #ffffff; +} +.breadcrumb .divider { + padding: 0 5px; + color: #ccc; +} +.breadcrumb .current { + color: #999999; +} +.pagination-right { + text-align: right; +} +.fade { + opacity: 0; + -webkit-transition: opacity 0.15s linear; + -moz-transition: opacity 0.15s linear; + -o-transition: opacity 0.15s linear; + transition: opacity 0.15s linear; +} +.fade.in { + opacity: 1; +} +.collapse { + position: relative; + height: 0; + overflow: hidden; + -webkit-transition: height 0.35s ease; + -moz-transition: height 0.35s ease; + -o-transition: height 0.35s ease; + transition: height 0.35s ease; +} +.collapse.in { + height: auto; +} +.hidden { + display: none; + visibility: hidden; +} +.visible-phone { + display: none !important; +} +.visible-tablet { + display: none !important; +} +.hidden-desktop { + display: none !important; +} +.visible-desktop { + display: inherit !important; +} +@media (min-width: 768px) and (max-width: 979px) { + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important ; + } + .visible-tablet { + display: inherit !important; + } + .hidden-tablet { + display: none !important; + } +} +@media (max-width: 767px) { + .hidden-desktop { + display: inherit !important; + } + .visible-desktop { + display: none !important; + } + .visible-phone { + display: inherit !important; + } + .hidden-phone { + display: none !important; + } +} +@media (max-width: 767px) { + body { + padding-left: 20px; + padding-right: 20px; + } + .container { + width: auto; + } + .row, + .thumbnails { + margin-left: 0; + } +} +@media (max-width: 480px) { + .tablist-collapse { + -webkit-transform: translate3d(0, 0, 0); + } + .page-header h1 small { + display: block; + line-height: 20px; + } +} +@media (min-width: 768px) and (max-width: 979px) { + .row { + margin-left: -20px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + content: ""; + line-height: 0; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + min-height: 1px; + margin-left: 20px; + } + .container { + width: 724px; + } +} +@media (min-width: 1200px) { + .row { + margin-left: -30px; + *zoom: 1; + } + .row:before, + .row:after { + display: table; + content: ""; + line-height: 0; + } + .row:after { + clear: both; + } + [class*="span"] { + float: left; + min-height: 1px; + margin-left: 30px; + } + .container { + width: 1070px; + } +} +@media (max-width: 979px) { + body { + padding-top: 0; + } +} +@media (min-width: 980px) { + .tablist-collapse.collapse { + height: auto !important; + overflow: visible !important; + } +} +.tablistbar .brand { + padding: 5px; + margin-left: 0; +} +.tablistbar .brand img { + width: 30px; + vertical-align: middle; +} + +h1 small { + font-size: 18px; +} + +h1 small, +h2 small, +h3 small, +h4 small, +h5 small, +h6 small, +.page-header small { + line-height: 0.8; + font-weight: normal; + color: #999999; + display:block; + vertical-align: middle; +} + +.page-header h1, h1:first-child { + font-size: 40px; + padding-bottom: 5px; +} + +.page-header h1 { + border-bottom: 1px solid #999999; + padding-bottom: 9px; +} + +.page-header img { + height: 80px; + padding-bottom: 5px; +} + +.page-header small { + line-height: 1.1; + font-size: 18px; +} + +h2, +h3, +h4, +div.ah, +.title { + border-color: #D6E9C6; + color: #468847; + border-style: solid; + border-width: 0 0 1px; + padding-left: 0.5em; +} + + +.google { + color: white; +} + +.breadcrumb { + font-size: 11px; + padding-top: 2px; + padding-bottom: 2px; +} + +h1 a, +h2 a, +h3 a, +h4 a { + color: inherit; +} + +.tablistbar-inner a { + font-weight: bold; +} + +.list-2panes:before, +.list-2panes:after { + display: table; + content: ""; + line-height: 0; +} + +.list-2panes:after { + clear:both; +} + +.list-2panes li { + width: 470px; + width: 470px; + float: left; + margin-left: 30px; + min-height: 1px; +} +/* The standard CSS for doxygen */ + +/* @group Heading Levels */ + + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.tablisttab{ + background-color: #EBF6EB; + border: 1px solid #A3D7A3; + text-align: center; +} + +div.qindex, div.tablistpath { + width: 100%; + line-height: 140%; +} + +div.tablisttab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D8C3D; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #46A246; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CD49C; + color: #ffffff; + border: 1px double #86CA86; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code { + color: #4665A2; +} + +a.codeRef { + color: #4665A2; +} + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +.fragment { + font-family: monospace, fixed; + font-size: 105%; +} + +pre.fragment { + border: 1px solid #C4E5C4; + background-color: #FBFDFB; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +div.contents { + margin-top: 10px; + margin-left: 8px; + margin-right: 8px; +} + +td.indexkey { + white-space: nowrap; + vertical-align: top; +} + + +tr.memlist { + background-color: #EEF7EE; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +#footer { + margin: -10px 1em 0; + padding-top: 20px; + text-align: center; + font-size: small; +} + +address.footer { + background-color: #ffffff; + text-align: center; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3D7A3; +} + +th.dirtab { + background: #EBF6EB; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4AAA4A; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FCF9; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4E5C4; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #46A246; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #46A246; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBF6EB; + border: 1px solid #A3D7A3; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8D9A8; + border-left: 1px solid #A8D9A8; + border-right: 1px solid #A8D9A8; + padding: 6px 0px 6px 0px; + color: #255525; + font-weight: bold; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 8px; + border-top-left-radius: 8px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 8px; + -moz-border-radius-topleft: 8px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 8px; + -webkit-border-top-left-radius: 8px; + background-repeat:repeat-x; + background-color: #E2F2E2; + +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8D9A8; + border-left: 1px solid #A8D9A8; + border-right: 1px solid #A8D9A8; + padding: 2px 5px; + background-color: #FBFDFB; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + /* firefox specific markup */ + -moz-border-radius-bottomleft: 8px; + -moz-border-radius-bottomright: 8px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7FBF7 95%, #EEF7EE); + /* webkit specific markup */ + -webkit-border-bottom-left-radius: 8px; + -webkit-border-bottom-right-radius: 8px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7FBF7), to(#EEF7EE)); +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +The following two styles can be used to replace the root node title +with an image of your choice. Simply uncomment the next two styles, +specify the name of your image and be sure to set 'height' to the +proper pixel height of your image. +*/ + +/* +.directory h3.swap { + height: 61px; + background-repeat: no-repeat; + background-image: url("yourimage.gif"); +} +.directory h3.swap span { + display: none; +} +*/ + +.directory > h3 { + margin-top: 0; +} + +.directory p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.directory img { + vertical-align: -30%; +} + +/* these are for tree view when not used as main index */ + +.directory-alt { + font-size: 100%; + font-weight: bold; +} + +.directory-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A612A; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D682D; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #377F37; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +table.fieldtable { + width: 100%; + margin-bottom: 10px; + border: 1px solid #A8D9A8; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8D9A8; + border-bottom: 1px solid #A8D9A8; + vertical-align: top; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8D9A8; + width: 100%; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-repeat:repeat-x; + background-color: #E2F2E2; + font-size: 90%; + color: #255525; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8D9A8; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.tablistpath ul +{ + font-size: 11px; + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8ACC8A; + border:solid 1px #C2E4C2; + overflow:hidden; + margin:0px; + padding:0px; +} + +.tablistpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-repeat:no-repeat; + background-position:right; + color:#367C36; +} + +.tablistpath li.tablistelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.tablistpath li.tablistelem a:hover +{ + color:#68BD68; +} + +.tablistpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#367C36; + font-size: 8pt; +} + + +div.summary +{ + margin-top: 12px; + text-align: center; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + margin-left: 5px; + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.headertitle +{ + padding: 5px 5px 5px 7px; +} + +dl +{ + padding: 0 0 0 10px; +} + +dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; +} + +dl.todo +{ + border-color: #00C0E0; +} + +dl.test +{ + border-color: #3030E0; +} + +dl.bug +{ + border-color: #C08050; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #53B453; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90CE90; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#337533; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } + pre.fragment + { + overflow: visible; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + } +} + +#proj_desc { + font-size: 1.2em; +} diff --git a/doc/doxy/footer.html b/doc/doxy/footer.html new file mode 100644 index 0000000000..101e6fe70b --- /dev/null +++ b/doc/doxy/footer.html @@ -0,0 +1,9 @@ + +
+ + Generated on $datetime for $projectname by doxygen $doxygenversion + +
+ + + diff --git a/doc/doxy/header.html b/doc/doxy/header.html new file mode 100644 index 0000000000..312990cdbc --- /dev/null +++ b/doc/doxy/header.html @@ -0,0 +1,16 @@ + + + + + +$projectname: $title +$title + + + + + +
+ + +'; $SMALL_RULE = ''; $BODYTEXT = ''; -$print_page_foot = \&FFmpeg_print_page_foot; -sub FFmpeg_print_page_foot($$) +$print_page_foot = \&Libav_print_page_foot; +sub Libav_print_page_foot($$) { my $fh = shift; my $program_string = defined &T2H_DEFAULT_program_string ? T2H_DEFAULT_program_string() : program_string(); print $fh '
' . "\n"; print $fh '' . $program_string; - print $fh "
\n"; + print $fh "\n"; } -$float = \&FFmpeg_float; +$float = \&Libav_float; -sub FFmpeg_float($$$$) +sub Libav_float($$$$) { my $text = shift; my $float = shift; @@ -65,8 +181,8 @@ sub FFmpeg_float($$$$) return '
' . "$label\n" . $text . '
'; } -$print_page_head = \&FFmpeg_print_page_head; -sub FFmpeg_print_page_head($$) +$print_page_head = \&Libav_print_page_head; +sub Libav_print_page_head($$) { my $fh = shift; my $longtitle = "$Texi2HTML::THISDOC{'fulltitle_no_texi'}"; @@ -79,7 +195,7 @@ sub FFmpeg_print_page_head($$) my $encoding = ''; $encoding = "" if (defined($ENCODING) and ($ENCODING ne '')); $longtitle =~ s/Documentation.*//g; - $longtitle = "FFmpeg documentation : " . $longtitle; + $longtitle = "Libav documentation : " . $longtitle; print $fh < @@ -93,6 +209,8 @@ $Texi2HTML::THISDOC{program_authors} $description + + $encoding $CSS_LINES @@ -100,9 +218,6 @@ $TEMPLATE_HEADER EOT } -# declare encoding in header -$IN_ENCODING = $ENCODING = "utf-8"; - # no navigation elements $SECTION_NAVIGATION = 0; # the same for texi2html 5.0 diff --git a/doc/texi2pod.pl b/doc/texi2pod.pl old mode 100644 new mode 100755 index 94e011e42b..54d57172d5 --- a/doc/texi2pod.pl +++ b/doc/texi2pod.pl @@ -27,9 +27,9 @@ use warnings; $output = 0; $skipping = 0; -%chapters = (); -@chapters_sequence = (); -$chapter = ""; +%sects = (); +@sects_sequence = (); +$section = ""; @icstack = (); @endwstack = (); @skstack = (); @@ -116,24 +116,18 @@ INF: while(<$inf>) { die "cannot open $1: $!\n"; }; - /^\@chapter\s+([A-Za-z ]+)/ and do { - # close old chapter - $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); - - # start new chapter - $chapter_name = $1, push (@chapters_sequence, $chapter_name) unless $skipping; - $chapters{$chapter_name} = "" unless exists $chapters{$chapter_name}; - $chapter = ""; - $output = 1; + # Look for blocks surrounded by @c man begin SECTION ... @c man end. + # This really oughta be @ifman ... @end ifman and the like, but such + # would require rev'ing all other Texinfo translators. + /^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next; + /^\@c\s+man\s+end/ and do { + $sects{$sect} = "" unless exists $sects{$sect}; + $sects{$sect} .= postprocess($section); + $section = ""; + $output = 0; next; }; - /^\@bye/ and do { - # close old chapter - $chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); - last INF; - }; - # handle variables /^\@set\s+([a-zA-Z0-9_-]+)\s*(.*)$/ and do { $defs{$1} = $2; @@ -156,14 +150,14 @@ INF: while(<$inf>) { # Ignore @end foo, where foo is not an operation which may # cause us to skip, if we are presently skipping. my $ended = $1; - next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/; + next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/; die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; $endw = pop @endwstack; - if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/) { + if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) { $skipping = pop @skstack; next; } elsif ($ended =~ /^(?:example|smallexample|display)$/) { @@ -196,11 +190,11 @@ INF: while(<$inf>) { next; }; - /^\@(ignore|menu|iftex|ifhtml|ifnothtml)\b/ and do { + /^\@(ignore|menu|iftex)\b/ and do { push @endwstack, $endw; push @skstack, $skipping; $endw = $1; - $skipping = $endw !~ /ifnothtml/; + $skipping = 1; next; }; @@ -217,6 +211,7 @@ INF: while(<$inf>) { s/\@TeX\{\}/TeX/g; s/\@pounds\{\}/\#/g; s/\@minus(?:\{\})?/-/g; + s/\\,/,/g; # Now the ones that have to be replaced by special escapes # (which will be turned back into text by unmunge()) @@ -274,7 +269,7 @@ INF: while(<$inf>) { push @icstack, $ic; $endw = $1; $ic = $2; - $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env|command)/B/; + $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/; $ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:file)/F/; @@ -309,7 +304,7 @@ INF: while(<$inf>) { $columns =~ s/\@tab//; $_ = $columns; - $chapter =~ s/$//; + $section =~ s/$//; }; /^\@itemx?\s*(.+)?$/ and do { @@ -323,7 +318,7 @@ INF: while(<$inf>) { } }; - $chapter .= $shift.$_."\n"; + $section .= $shift.$_."\n"; } # End of current file. close($inf); @@ -332,18 +327,18 @@ $inf = pop @instack; die "No filename or title\n" unless defined $fn && defined $tl; -$chapters{NAME} = "$fn \- $tl\n"; -$chapters{FOOTNOTES} .= "=back\n" if exists $chapters{FOOTNOTES}; +$sects{NAME} = "$fn \- $tl\n"; +$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES}; -# always use utf8 -print "=encoding utf8\n\n"; - -unshift @chapters_sequence, "NAME"; -for $chapter (@chapters_sequence) { - if (exists $chapters{$chapter}) { - $head = uc($chapter); +unshift @sects_sequence, "NAME"; +for $sect (@sects_sequence) { + # always use utf8 + print "=encoding utf8\n"; + if(exists $sects{$sect}) { + $head = $sect; + $head =~ s/SEEALSO/SEE ALSO/; print "=head1 $head\n\n"; - print scalar unmunge ($chapters{$chapter}); + print scalar unmunge ($sects{$sect}); print "\n"; } } @@ -388,8 +383,7 @@ sub postprocess s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g; - s/\@ref\{(?:[^,\}]*,)(?:[^,\}]*,)([^,\}]*).*\}/B<$1>/g; - s/\@ref\{([^\}]*)\}/B<$1>/g; + s/\@ref\{([^\}]*)\}/$1/g; s/\@noindent\s*//g; s/\@refill//g; s/\@gol//g; @@ -398,7 +392,7 @@ sub postprocess # @uref can take one, two, or three arguments, with different # semantics each time. @url and @email are just like @uref with # one argument, for our purposes. - s/\@(?:uref|url|email)\{([^\},]*),?[^\}]*\}/<B<$1>>/g; + s/\@(?:uref|url|email)\{([^\},]*)\}/<B<$1>>/g; s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; @@ -442,13 +436,13 @@ sub unmunge sub add_footnote { - unless (exists $chapters{FOOTNOTES}) { - $chapters{FOOTNOTES} = "\n=over 4\n\n"; + unless (exists $sects{FOOTNOTES}) { + $sects{FOOTNOTES} = "\n=over 4\n\n"; } - $chapters{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; - $chapters{FOOTNOTES} .= $_[0]; - $chapters{FOOTNOTES} .= "\n\n"; + $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; + $sects{FOOTNOTES} .= $_[0]; + $sects{FOOTNOTES} .= "\n\n"; } # stolen from Symbol.pm diff --git a/doc/texidep.pl b/doc/texidep.pl deleted file mode 100644 index 099690378e..0000000000 --- a/doc/texidep.pl +++ /dev/null @@ -1,32 +0,0 @@ -#! /usr/bin/env perl - -# This script will print the dependency of a Texinfo file to stdout. -# texidep.pl - -use warnings; -use strict; - -die unless @ARGV == 3; - -my ($src_path, $root, $target) = @ARGV; - -sub print_deps { - my ($file, $deps) = @_; - $deps->{$file} = 1; - - open(my $fh, "<", "$file") or die "Cannot open file '$file': $!"; - while (<$fh>) { - if (my ($i) = /^\@(?:verbatim)?include\s+(\S+)/) { - die "Circular dependency found in file $root\n" if exists $deps->{"doc/$1"}; - print "$target: doc/$1\n"; - - # skip looking for config.texi dependencies, since it has - # none, and is not located in the source tree - if ("$1" ne "config.texi") { - print_deps("$src_path/doc/$1", {%$deps}); - } - } - } -} - -print_deps($root, {}); diff --git a/doc/utils.texi b/doc/utils.texi deleted file mode 100644 index 5abfb0ccc6..0000000000 --- a/doc/utils.texi +++ /dev/null @@ -1,1064 +0,0 @@ -@chapter Syntax -@c man begin SYNTAX - -This section documents the syntax and formats employed by the FFmpeg -libraries and tools. - -@anchor{quoting_and_escaping} -@section Quoting and escaping - -FFmpeg adopts the following quoting and escaping mechanism, unless -explicitly specified. The following rules are applied: - -@itemize -@item -@code{'} and @code{\} are special characters (respectively used for -quoting and escaping). In addition to them, there might be other -special characters depending on the specific syntax where the escaping -and quoting are employed. - -@item -A special character is escaped by prefixing it with a '\'. - -@item -All characters enclosed between '' are included literally in the -parsed string. The quote character @code{'} itself cannot be quoted, -so you may need to close the quote and escape it. - -@item -Leading and trailing whitespaces, unless escaped or quoted, are -removed from the parsed string. -@end itemize - -Note that you may need to add a second level of escaping when using -the command line or a script, which depends on the syntax of the -adopted shell language. - -The function @code{av_get_token} defined in -@file{libavutil/avstring.h} can be used to parse a token quoted or -escaped according to the rules defined above. - -The tool @file{tools/ffescape} in the FFmpeg source tree can be used -to automatically quote or escape a string in a script. - -@subsection Examples - -@itemize -@item -Escape the string @code{Crime d'Amour} containing the @code{'} special -character: -@example -Crime d\'Amour -@end example - -@item -The string above contains a quote, so the @code{'} needs to be escaped -when quoting it: -@example -'Crime d'\''Amour' -@end example - -@item -Include leading or trailing whitespaces using quoting: -@example -' this string starts and ends with whitespaces ' -@end example - -@item -Escaping and quoting can be mixed together: -@example -' The string '\'string\'' is a string ' -@end example - -@item -To include a literal @code{\} you can use either escaping or quoting: -@example -'c:\foo' can be written as c:\\foo -@end example -@end itemize - -@anchor{date syntax} -@section Date - -The accepted syntax is: -@example -[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z] -now -@end example - -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. - -@anchor{time duration syntax} -@section Time duration - -There are two accepted syntaxes for expressing time duration. - -@example -[-][@var{HH}:]@var{MM}:@var{SS}[.@var{m}...] -@end example - -@var{HH} expresses the number of hours, @var{MM} the number of minutes -for a maximum of 2 digits, and @var{SS} the number of seconds for a -maximum of 2 digits. The @var{m} at the end expresses decimal value for -@var{SS}. - -@emph{or} - -@example -[-]@var{S}+[.@var{m}...] -@end example - -@var{S} expresses the number of seconds, with the optional decimal part -@var{m}. - -In both expressions, the optional @samp{-} indicates negative duration. - -@subsection Examples - -The following examples are all valid time duration: - -@table @samp -@item 55 -55 seconds - -@item 12:03:45 -12 hours, 03 minutes and 45 seconds - -@item 23.189 -23.189 seconds -@end table - -@anchor{video size syntax} -@section Video size -Specify the size of the sourced video, it may be a string of the form -@var{width}x@var{height}, or the name of a size abbreviation. - -The following abbreviations are recognized: -@table @samp -@item ntsc -720x480 -@item pal -720x576 -@item qntsc -352x240 -@item qpal -352x288 -@item sntsc -640x480 -@item spal -768x576 -@item film -352x240 -@item ntsc-film -352x240 -@item sqcif -128x96 -@item qcif -176x144 -@item cif -352x288 -@item 4cif -704x576 -@item 16cif -1408x1152 -@item qqvga -160x120 -@item qvga -320x240 -@item vga -640x480 -@item svga -800x600 -@item xga -1024x768 -@item uxga -1600x1200 -@item qxga -2048x1536 -@item sxga -1280x1024 -@item qsxga -2560x2048 -@item hsxga -5120x4096 -@item wvga -852x480 -@item wxga -1366x768 -@item wsxga -1600x1024 -@item wuxga -1920x1200 -@item woxga -2560x1600 -@item wqsxga -3200x2048 -@item wquxga -3840x2400 -@item whsxga -6400x4096 -@item whuxga -7680x4800 -@item cga -320x200 -@item ega -640x350 -@item hd480 -852x480 -@item hd720 -1280x720 -@item hd1080 -1920x1080 -@item 2k -2048x1080 -@item 2kflat -1998x1080 -@item 2kscope -2048x858 -@item 4k -4096x2160 -@item 4kflat -3996x2160 -@item 4kscope -4096x1716 -@item nhd -640x360 -@item hqvga -240x160 -@item wqvga -400x240 -@item fwqvga -432x240 -@item hvga -480x320 -@item qhd -960x540 -@end table - -@anchor{video rate syntax} -@section Video rate - -Specify the frame rate of a video, expressed as the number of frames -generated per second. It has to be a string in the format -@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float -number or a valid video frame rate abbreviation. - -The following abbreviations are recognized: -@table @samp -@item ntsc -30000/1001 -@item pal -25/1 -@item qntsc -30000/1001 -@item qpal -25/1 -@item sntsc -30000/1001 -@item spal -25/1 -@item film -24/1 -@item ntsc-film -24000/1001 -@end table - -@anchor{ratio syntax} -@section Ratio - -A ratio can be expressed as an expression, or in the form -@var{numerator}:@var{denominator}. - -Note that a ratio with infinite (1/0) or negative value is -considered valid, so you should check on the returned value if you -want to exclude those values. - -The undefined value can be expressed using the "0:0" string. - -@anchor{color syntax} -@section Color - -It can be the name of a color as defined below (case insensitive match) or a -@code{[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 (@samp{0x00} or @samp{0.0} means completely -transparent, @samp{0xff} or @samp{1.0} completely opaque). If the alpha -component is not specified then @samp{0xff} is assumed. - -The string @samp{random} will result in a random color. - -The following names of colors are recognized: -@table @samp -@item AliceBlue -0xF0F8FF -@item AntiqueWhite -0xFAEBD7 -@item Aqua -0x00FFFF -@item Aquamarine -0x7FFFD4 -@item Azure -0xF0FFFF -@item Beige -0xF5F5DC -@item Bisque -0xFFE4C4 -@item Black -0x000000 -@item BlanchedAlmond -0xFFEBCD -@item Blue -0x0000FF -@item BlueViolet -0x8A2BE2 -@item Brown -0xA52A2A -@item BurlyWood -0xDEB887 -@item CadetBlue -0x5F9EA0 -@item Chartreuse -0x7FFF00 -@item Chocolate -0xD2691E -@item Coral -0xFF7F50 -@item CornflowerBlue -0x6495ED -@item Cornsilk -0xFFF8DC -@item Crimson -0xDC143C -@item Cyan -0x00FFFF -@item DarkBlue -0x00008B -@item DarkCyan -0x008B8B -@item DarkGoldenRod -0xB8860B -@item DarkGray -0xA9A9A9 -@item DarkGreen -0x006400 -@item DarkKhaki -0xBDB76B -@item DarkMagenta -0x8B008B -@item DarkOliveGreen -0x556B2F -@item Darkorange -0xFF8C00 -@item DarkOrchid -0x9932CC -@item DarkRed -0x8B0000 -@item DarkSalmon -0xE9967A -@item DarkSeaGreen -0x8FBC8F -@item DarkSlateBlue -0x483D8B -@item DarkSlateGray -0x2F4F4F -@item DarkTurquoise -0x00CED1 -@item DarkViolet -0x9400D3 -@item DeepPink -0xFF1493 -@item DeepSkyBlue -0x00BFFF -@item DimGray -0x696969 -@item DodgerBlue -0x1E90FF -@item FireBrick -0xB22222 -@item FloralWhite -0xFFFAF0 -@item ForestGreen -0x228B22 -@item Fuchsia -0xFF00FF -@item Gainsboro -0xDCDCDC -@item GhostWhite -0xF8F8FF -@item Gold -0xFFD700 -@item GoldenRod -0xDAA520 -@item Gray -0x808080 -@item Green -0x008000 -@item GreenYellow -0xADFF2F -@item HoneyDew -0xF0FFF0 -@item HotPink -0xFF69B4 -@item IndianRed -0xCD5C5C -@item Indigo -0x4B0082 -@item Ivory -0xFFFFF0 -@item Khaki -0xF0E68C -@item Lavender -0xE6E6FA -@item LavenderBlush -0xFFF0F5 -@item LawnGreen -0x7CFC00 -@item LemonChiffon -0xFFFACD -@item LightBlue -0xADD8E6 -@item LightCoral -0xF08080 -@item LightCyan -0xE0FFFF -@item LightGoldenRodYellow -0xFAFAD2 -@item LightGreen -0x90EE90 -@item LightGrey -0xD3D3D3 -@item LightPink -0xFFB6C1 -@item LightSalmon -0xFFA07A -@item LightSeaGreen -0x20B2AA -@item LightSkyBlue -0x87CEFA -@item LightSlateGray -0x778899 -@item LightSteelBlue -0xB0C4DE -@item LightYellow -0xFFFFE0 -@item Lime -0x00FF00 -@item LimeGreen -0x32CD32 -@item Linen -0xFAF0E6 -@item Magenta -0xFF00FF -@item Maroon -0x800000 -@item MediumAquaMarine -0x66CDAA -@item MediumBlue -0x0000CD -@item MediumOrchid -0xBA55D3 -@item MediumPurple -0x9370D8 -@item MediumSeaGreen -0x3CB371 -@item MediumSlateBlue -0x7B68EE -@item MediumSpringGreen -0x00FA9A -@item MediumTurquoise -0x48D1CC -@item MediumVioletRed -0xC71585 -@item MidnightBlue -0x191970 -@item MintCream -0xF5FFFA -@item MistyRose -0xFFE4E1 -@item Moccasin -0xFFE4B5 -@item NavajoWhite -0xFFDEAD -@item Navy -0x000080 -@item OldLace -0xFDF5E6 -@item Olive -0x808000 -@item OliveDrab -0x6B8E23 -@item Orange -0xFFA500 -@item OrangeRed -0xFF4500 -@item Orchid -0xDA70D6 -@item PaleGoldenRod -0xEEE8AA -@item PaleGreen -0x98FB98 -@item PaleTurquoise -0xAFEEEE -@item PaleVioletRed -0xD87093 -@item PapayaWhip -0xFFEFD5 -@item PeachPuff -0xFFDAB9 -@item Peru -0xCD853F -@item Pink -0xFFC0CB -@item Plum -0xDDA0DD -@item PowderBlue -0xB0E0E6 -@item Purple -0x800080 -@item Red -0xFF0000 -@item RosyBrown -0xBC8F8F -@item RoyalBlue -0x4169E1 -@item SaddleBrown -0x8B4513 -@item Salmon -0xFA8072 -@item SandyBrown -0xF4A460 -@item SeaGreen -0x2E8B57 -@item SeaShell -0xFFF5EE -@item Sienna -0xA0522D -@item Silver -0xC0C0C0 -@item SkyBlue -0x87CEEB -@item SlateBlue -0x6A5ACD -@item SlateGray -0x708090 -@item Snow -0xFFFAFA -@item SpringGreen -0x00FF7F -@item SteelBlue -0x4682B4 -@item Tan -0xD2B48C -@item Teal -0x008080 -@item Thistle -0xD8BFD8 -@item Tomato -0xFF6347 -@item Turquoise -0x40E0D0 -@item Violet -0xEE82EE -@item Wheat -0xF5DEB3 -@item White -0xFFFFFF -@item WhiteSmoke -0xF5F5F5 -@item Yellow -0xFFFF00 -@item YellowGreen -0x9ACD32 -@end table - -@anchor{channel layout syntax} -@section Channel Layout - -A channel layout specifies the spatial disposition of the channels in -a multi-channel audio stream. To specify a channel layout, FFmpeg -makes use of a special syntax. - -Individual channels are identified by an id, as given by the table -below: -@table @samp -@item FL -front left -@item FR -front right -@item FC -front center -@item LFE -low frequency -@item BL -back left -@item BR -back right -@item FLC -front left-of-center -@item FRC -front right-of-center -@item BC -back center -@item SL -side left -@item SR -side right -@item TC -top center -@item TFL -top front left -@item TFC -top front center -@item TFR -top front right -@item TBL -top back left -@item TBC -top back center -@item TBR -top back right -@item DL -downmix left -@item DR -downmix right -@item WL -wide left -@item WR -wide right -@item SDL -surround direct left -@item SDR -surround direct right -@item LFE2 -low frequency 2 -@end table - -Standard channel layout compositions can be specified by using the -following identifiers: -@table @samp -@item mono -FC -@item stereo -FL+FR -@item 2.1 -FL+FR+LFE -@item 3.0 -FL+FR+FC -@item 3.0(back) -FL+FR+BC -@item 4.0 -FL+FR+FC+BC -@item quad -FL+FR+BL+BR -@item quad(side) -FL+FR+SL+SR -@item 3.1 -FL+FR+FC+LFE -@item 5.0 -FL+FR+FC+BL+BR -@item 5.0(side) -FL+FR+FC+SL+SR -@item 4.1 -FL+FR+FC+LFE+BC -@item 5.1 -FL+FR+FC+LFE+BL+BR -@item 5.1(side) -FL+FR+FC+LFE+SL+SR -@item 6.0 -FL+FR+FC+BC+SL+SR -@item 6.0(front) -FL+FR+FLC+FRC+SL+SR -@item hexagonal -FL+FR+FC+BL+BR+BC -@item 6.1 -FL+FR+FC+LFE+BC+SL+SR -@item 6.1 -FL+FR+FC+LFE+BL+BR+BC -@item 6.1(front) -FL+FR+LFE+FLC+FRC+SL+SR -@item 7.0 -FL+FR+FC+BL+BR+SL+SR -@item 7.0(front) -FL+FR+FC+FLC+FRC+SL+SR -@item 7.1 -FL+FR+FC+LFE+BL+BR+SL+SR -@item 7.1(wide) -FL+FR+FC+LFE+BL+BR+FLC+FRC -@item 7.1(wide-side) -FL+FR+FC+LFE+FLC+FRC+SL+SR -@item octagonal -FL+FR+FC+BL+BR+BC+SL+SR -@item downmix -DL+DR -@end table - -A custom channel layout can be specified as a sequence of terms, separated by -'+' or '|'. Each term can be: -@itemize -@item -the name of a standard channel layout (e.g. @samp{mono}, -@samp{stereo}, @samp{4.0}, @samp{quad}, @samp{5.0}, etc.) - -@item -the name of a single channel (e.g. @samp{FL}, @samp{FR}, @samp{FC}, @samp{LFE}, etc.) - -@item -a number of channels, in decimal, optionally followed by 'c', yielding -the default channel layout for that number of channels (see the -function @code{av_get_default_channel_layout}) - -@item -a channel layout mask, in hexadecimal starting with "0x" (see the -@code{AV_CH_*} macros in @file{libavutil/channel_layout.h}. -@end itemize - -Starting from libavutil version 53 the trailing character "c" to -specify a number of channels will be required, while a channel layout -mask could also be specified as a decimal number (if and only if not -followed by "c"). - -See also the function @code{av_get_channel_layout} defined in -@file{libavutil/channel_layout.h}. -@c man end SYNTAX - -@chapter Expression Evaluation -@c man begin EXPRESSION EVALUATION - -When evaluating an arithmetic expression, FFmpeg uses an internal -formula evaluator, implemented through the @file{libavutil/eval.h} -interface. - -An expression may contain unary, binary operators, constants, and -functions. - -Two expressions @var{expr1} and @var{expr2} can be combined to form -another expression "@var{expr1};@var{expr2}". -@var{expr1} and @var{expr2} are evaluated in turn, and the new -expression evaluates to the value of @var{expr2}. - -The following binary operators are available: @code{+}, @code{-}, -@code{*}, @code{/}, @code{^}. - -The following unary operators are available: @code{+}, @code{-}. - -The following functions are available: -@table @option -@item abs(x) -Compute absolute value of @var{x}. - -@item acos(x) -Compute arccosine of @var{x}. - -@item asin(x) -Compute arcsine of @var{x}. - -@item atan(x) -Compute arctangent of @var{x}. - -@item between(x, min, max) -Return 1 if @var{x} is greater than or equal to @var{min} and lesser than or -equal to @var{max}, 0 otherwise. - -@item bitand(x, y) -@item bitor(x, y) -Compute bitwise and/or operation on @var{x} and @var{y}. - -The results of the evaluation of @var{x} and @var{y} are converted to -integers before executing the bitwise operation. - -Note that both the conversion to integer and the conversion back to -floating point can lose precision. Beware of unexpected results for -large numbers (usually 2^53 and larger). - -@item ceil(expr) -Round the value of expression @var{expr} upwards to the nearest -integer. For example, "ceil(1.5)" is "2.0". - -@item cos(x) -Compute cosine of @var{x}. - -@item cosh(x) -Compute hyperbolic cosine of @var{x}. - -@item eq(x, y) -Return 1 if @var{x} and @var{y} are equivalent, 0 otherwise. - -@item exp(x) -Compute exponential of @var{x} (with base @code{e}, the Euler's number). - -@item floor(expr) -Round the value of expression @var{expr} downwards to the nearest -integer. For example, "floor(-1.5)" is "-2.0". - -@item gauss(x) -Compute Gauss function of @var{x}, corresponding to -@code{exp(-x*x/2) / sqrt(2*PI)}. - -@item gcd(x, y) -Return the greatest common divisor of @var{x} and @var{y}. If both @var{x} and -@var{y} are 0 or either or both are less than zero then behavior is undefined. - -@item gt(x, y) -Return 1 if @var{x} is greater than @var{y}, 0 otherwise. - -@item gte(x, y) -Return 1 if @var{x} is greater than or equal to @var{y}, 0 otherwise. - -@item hypot(x, y) -This function is similar to the C function with the same name; it returns -"sqrt(@var{x}*@var{x} + @var{y}*@var{y})", the length of the hypotenuse of a -right triangle with sides of length @var{x} and @var{y}, or the distance of the -point (@var{x}, @var{y}) from the origin. - -@item if(x, y) -Evaluate @var{x}, and if the result is non-zero return the result of -the evaluation of @var{y}, return 0 otherwise. - -@item if(x, y, z) -Evaluate @var{x}, and if the result is non-zero return the evaluation -result of @var{y}, otherwise the evaluation result of @var{z}. - -@item ifnot(x, y) -Evaluate @var{x}, and if the result is zero return the result of the -evaluation of @var{y}, return 0 otherwise. - -@item ifnot(x, y, z) -Evaluate @var{x}, and if the result is zero return the evaluation -result of @var{y}, otherwise the evaluation result of @var{z}. - -@item isinf(x) -Return 1.0 if @var{x} is +/-INFINITY, 0.0 otherwise. - -@item isnan(x) -Return 1.0 if @var{x} is NAN, 0.0 otherwise. - -@item ld(var) -Allow to load the value of the internal variable with number -@var{var}, which was previously stored with st(@var{var}, @var{expr}). -The function returns the loaded value. - -@item log(x) -Compute natural logarithm of @var{x}. - -@item lt(x, y) -Return 1 if @var{x} is lesser than @var{y}, 0 otherwise. - -@item lte(x, y) -Return 1 if @var{x} is lesser than or equal to @var{y}, 0 otherwise. - -@item max(x, y) -Return the maximum between @var{x} and @var{y}. - -@item min(x, y) -Return the maximum between @var{x} and @var{y}. - -@item mod(x, y) -Compute the remainder of division of @var{x} by @var{y}. - -@item not(expr) -Return 1.0 if @var{expr} is zero, 0.0 otherwise. - -@item pow(x, y) -Compute the power of @var{x} elevated @var{y}, it is equivalent to -"(@var{x})^(@var{y})". - -@item print(t) -@item print(t, l) -Print the value of expression @var{t} with loglevel @var{l}. If -@var{l} is not specified then a default log level is used. -Returns the value of the expression printed. - -Prints t with loglevel l - -@item random(x) -Return a pseudo random value between 0.0 and 1.0. @var{x} is the index of the -internal variable which will be used to save the seed/state. - -@item root(expr, max) -Find an input value for which the function represented by @var{expr} -with argument @var{ld(0)} is 0 in the interval 0..@var{max}. - -The expression in @var{expr} must denote a continuous function or the -result is undefined. - -@var{ld(0)} is used to represent the function input value, which means -that the given expression will be evaluated multiple times with -various input values that the expression can access through -@code{ld(0)}. When the expression evaluates to 0 then the -corresponding input value will be returned. - -@item sin(x) -Compute sine of @var{x}. - -@item sinh(x) -Compute hyperbolic sine of @var{x}. - -@item sqrt(expr) -Compute the square root of @var{expr}. This is equivalent to -"(@var{expr})^.5". - -@item squish(x) -Compute expression @code{1/(1 + exp(4*x))}. - -@item st(var, expr) -Allow to store the value of the expression @var{expr} in an internal -variable. @var{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. - -@item tan(x) -Compute tangent of @var{x}. - -@item tanh(x) -Compute hyperbolic tangent of @var{x}. - -@item taylor(expr, x) -@item taylor(expr, x, id) -Evaluate a Taylor series at @var{x}, given an expression representing -the @code{ld(id)}-th derivative of a function at 0. - -When the series does not converge the result is undefined. - -@var{ld(id)} is used to represent the derivative order in @var{expr}, -which means that the given expression will be evaluated multiple times -with various input values that the expression can access through -@code{ld(id)}. If @var{id} is not specified then 0 is assumed. - -Note, when you have the derivatives at y instead of 0, -@code{taylor(expr, x-y)} can be used. - -@item time(0) -Return the current (wallclock) time in seconds. - -@item trunc(expr) -Round the value of expression @var{expr} towards zero to the nearest -integer. For example, "trunc(-1.5)" is "-1.0". - -@item while(cond, expr) -Evaluate expression @var{expr} while the expression @var{cond} is -non-zero, and returns the value of the last @var{expr} evaluation, or -NAN if @var{cond} was always false. -@end table - -The following constants are available: -@table @option -@item PI -area of the unit disc, approximately 3.14 -@item E -exp(1) (Euler's number), approximately 2.718 -@item PHI -golden ratio (1+sqrt(5))/2, approximately 1.618 -@end table - -Assuming that an expression is considered "true" if it has a non-zero -value, note that: - -@code{*} works like AND - -@code{+} works like OR - -For example the construct: -@example -if (A AND B) then C -@end example -is equivalent to: -@example -if(A*B, C) -@end example - -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 unit prefixes. -If 'i' is appended after the prefix, binary prefixes are used, which -are based on powers of 1024 instead of powers of 1000. -The 'B' postfix multiplies the value by 8, and can be appended after a -unit prefix or used alone. This allows using for example 'KB', 'MiB', -'G' and 'B' as number postfix. - -The list of available International System prefixes follows, with -indication of the corresponding powers of 10 and of 2. -@table @option -@item y -10^-24 / 2^-80 -@item z -10^-21 / 2^-70 -@item a -10^-18 / 2^-60 -@item f -10^-15 / 2^-50 -@item p -10^-12 / 2^-40 -@item n -10^-9 / 2^-30 -@item u -10^-6 / 2^-20 -@item m -10^-3 / 2^-10 -@item c -10^-2 -@item d -10^-1 -@item h -10^2 -@item k -10^3 / 2^10 -@item K -10^3 / 2^10 -@item M -10^6 / 2^20 -@item G -10^9 / 2^30 -@item T -10^12 / 2^40 -@item P -10^15 / 2^40 -@item E -10^18 / 2^50 -@item Z -10^21 / 2^60 -@item Y -10^24 / 2^70 -@end table - -@c man end - -@chapter OpenCL Options -@c man begin OPENCL OPTIONS - -When FFmpeg is configured with @code{--enable-opencl}, it is possible -to set the options for the global OpenCL context. - -The list of supported options follows: - -@table @option -@item build_options -Set build options used to compile the registered kernels. - -See reference "OpenCL Specification Version: 1.2 chapter 5.6.4". - -@item platform_idx -Select the index of the platform to run OpenCL code. - -The specified index must be one of the indexes in the device list -which can be obtained with @code{ffmpeg -opencl_bench} or @code{av_opencl_get_device_list()}. - -@item device_idx -Select the index of the device used to run OpenCL code. - -The specified index must be one of the indexes in the device list which -can be obtained with @code{ffmpeg -opencl_bench} or @code{av_opencl_get_device_list()}. - -@end table - -@c man end OPENCL OPTIONS diff --git a/doc/viterbi.txt b/doc/viterbi.txt new file mode 100644 index 0000000000..97825462cc --- /dev/null +++ b/doc/viterbi.txt @@ -0,0 +1,109 @@ +This is a quick description of the viterbi aka dynamic programing +algorthm. + +Its reason for existence is that wikipedia has become very poor on +describing algorithms in a way that makes it useable for understanding +them or anything else actually. It tends now to describe the very same +algorithm under 50 different names and pages with few understandable +by even people who fully understand the algorithm and the theory behind. + +Problem description: (that is what it can solve) +assume we have a 2d table, or you could call it a graph or matrix if you +prefer + + O O O O O O O + + O O O O O O O + + O O O O O O O + + O O O O O O O + + +That table has edges connecting points from each column to the next column +and each edge has a score like: (only some edge and scores shown to keep it +readable) + + + O--5--O-----O-----O-----O-----O + 2 / 7 / \ / \ / \ / + \ / \ / \ / \ / \ / + O7-/--O--/--O--/--O--/--O--/--O + \/ \/ 1/ \/ \/ \/ \/ \/ \/ \/ + /\ /\ 2\ /\ /\ /\ /\ /\ /\ /\ + O3-/--O--/--O--/--O--/--O--/--O + / \ / \ / \ / \ / \ + 1 \ 9 \ / \ / \ / \ + O--2--O--1--O--5--O--3--O--8--O + + + +Our goal is to find a path from left to right through it which +minimizes the sum of the score of all edges. +(and of course left/right is just a convention here it could be top down too) +Similarly the minimum could be the maximum by just fliping the sign, +Example of a path with scores: + + O O O O O O O + +>---O. O O .O-2-O O O + 5. .7 . + O O-1-O O O 8 O O + . + O O O O O O-1-O---> (sum here is 24) + + +The viterbi algorthm now solves this simply column by column +For the previous column each point has a best path and a associated +score: + + O-----5 O + \ + \ + O \ 1 O + \/ + /\ + O / 2 O + / + / + O-----2 O + + +To move one column forward we just need to find the best path and associated +scores for the next column +here are some edges we could choose from: + + + O-----5--3--O + \ \8 + \ \ + O \ 1--9--O + \/ \3 + /\ \ + O / 2--1--O + / \2 + / \ + O-----2--4--O + +Finding the new best paths and scores for each point of our new column is +trivial given we know the previous column best paths and scores: + + O-----0-----8 + \ + \ + O \ 0----10 + \/ + /\ + O / 0-----3 + / \ + / \ + O 0 4 + + +the viterbi algorthm continues exactly like this column for column until the +end and then just picks the path with the best score (above that would be the +one with score 3) + + +Author: Michael niedermayer +Copyright LGPL diff --git a/doc/writing_filters.txt b/doc/writing_filters.txt deleted file mode 100644 index c7923e884f..0000000000 --- a/doc/writing_filters.txt +++ /dev/null @@ -1,424 +0,0 @@ -This document is a tutorial/initiation for writing simple filters in -libavfilter. - -Foreword: just like everything else in FFmpeg, libavfilter is monolithic, which -means that it is highly recommended that you submit your filters to the FFmpeg -development mailing-list and make sure it is applied. Otherwise, your filter is -likely to have a very short lifetime due to more a less regular internal API -changes, and a limited distribution, review, and testing. - -Bootstrap -========= - -Let's say you want to write a new simple video filter called "foobar" which -takes one frame in input, changes the pixels in whatever fashion you fancy, and -outputs the modified frame. The most simple way of doing this is to take a -similar filter. We'll pick edgedetect, but any other should do. You can look -for others using the `./ffmpeg -v 0 -filters|grep ' V->V '` command. - - - cp libavfilter/vf_{edgedetect,foobar}.c - - sed -i s/edgedetect/foobar/g -i libavfilter/vf_foobar.c - - sed -i s/EdgeDetect/Foobar/g -i libavfilter/vf_foobar.c - - edit libavfilter/Makefile, and add an entry for "foobar" following the - pattern of the other filters. - - edit libavfilter/allfilters.c, and add an entry for "foobar" following the - pattern of the other filters. - - ./configure ... - - make -j ffmpeg - - ./ffmpeg -i tests/lena.pnm -vf foobar foobar.png - -If everything went right, you should get a foobar.png with Lena edge-detected. - -That's it, your new playground is ready. - -Some little details about what's going on: -libavfilter/allfilters.c:avfilter_register_all() is called at runtime to create -a list of the available filters, but it's important to know that this file is -also parsed by the configure script, which in turn will define variables for -the build system and the C: - - --- after running configure --- - - $ grep FOOBAR config.mak - CONFIG_FOOBAR_FILTER=yes - $ grep FOOBAR config.h - #define CONFIG_FOOBAR_FILTER 1 - -CONFIG_FOOBAR_FILTER=yes from the config.mak is later used to enable the filter in -libavfilter/Makefile and CONFIG_FOOBAR_FILTER=1 from the config.h will be used -for registering the filter in libavfilter/allfilters.c. - -Filter code layout -================== - -You now need some theory about the general code layout of a filter. Open your -libavfilter/vf_foobar.c. This section will detail the important parts of the -code you need to understand before messing with it. - -Copyright ---------- - -First chunk is the copyright. Most filters are LGPL, and we are assuming -vf_foobar is as well. We are also assuming vf_foobar is not an edge detector -filter, so you can update the boilerplate with your credits. - -Doxy ----- - -Next chunk is the Doxygen about the file. See http://ffmpeg.org/doxygen/trunk/. -Detail here what the filter is, does, and add some references if you feel like -it. - -Context -------- - -Skip the headers and scroll down to the definition of FoobarContext. This is -your local state context. It is already filled with 0 when you get it so do not -worry about uninitialized read into this context. This is where you put every -"global" information you need, typically the variable storing the user options. -You'll notice the first field "const AVClass *class"; it's the only field you -need to keep assuming you have a context. There are some magic you don't care -about around this field, just let it be (in first position) for now. - -Options -------- - -Then comes the options array. This is what will define the user accessible -options. For example, -vf foobar=mode=colormix:high=0.4:low=0.1. Most options -have the following pattern: - name, description, offset, type, default value, minimum value, maximum value, flags - - - name is the option name, keep it simple, lowercase - - description are short, in lowercase, without period, and describe what they - do, for example "set the foo of the bar" - - offset is the offset of the field in your local context, see the OFFSET() - macro; the option parser will use that information to fill the fields - according to the user input - - type is any of AV_OPT_TYPE_* defined in libavutil/opt.h - - default value is an union where you pick the appropriate type; "{.dbl=0.3}", - "{.i64=0x234}", "{.str=NULL}", ... - - min and max values define the range of available values, inclusive - - flags are AVOption generic flags. See AV_OPT_FLAG_* definitions - -In doubt, just look at the other AVOption definitions all around the codebase, -there are tons of examples. - -Class ------ - -AVFILTER_DEFINE_CLASS(foobar) will define a unique foobar_class with some kind -of signature referencing the options, etc. which will be referenced in the -definition of the AVFilter. - -Filter definition ------------------ - -At the end of the file, you will find foobar_inputs, foobar_outputs and -the AVFilter ff_vf_foobar. Don't forget to update the AVFilter.description with -a description of what the filter does, starting with a capitalized letter and -ending with a period. You'd better drop the AVFilter.flags entry for now, and -re-add them later depending on the capabilities of your filter. - -Callbacks ---------- - -Let's now study the common callbacks. Before going into details, note that all -these callbacks are explained in details in libavfilter/avfilter.h, so in -doubt, refer to the doxy in that file. - -init() -~~~~~~ - -First one to be called is init(). It's flagged as cold because not called -often. Look for "cold" on -http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html for more -information. - -As the name suggests, init() is where you eventually initialize and allocate -your buffers, pre-compute your data, etc. Note that at this point, your local -context already has the user options initialized, but you still haven't any -clue about the kind of data input you will get, so this function is often -mainly used to sanitize the user options. - -Some init()s will also define the number of inputs or outputs dynamically -according to the user options. A good example of this is the split filter, but -we won't cover this here since vf_foobar is just a simple 1:1 filter. - -uninit() -~~~~~~~~ - -Similarly, there is the uninit() callback, doing what the name suggest. Free -everything you allocated here. - -query_formats() -~~~~~~~~~~~~~~~ - -This is following the init() and is used for the format negotiation, basically -where you say what pixel format(s) (gray, rgb 32, yuv 4:2:0, ...) you accept -for your inputs, and what you can output. All pixel formats are defined in -libavutil/pixfmt.h. If you don't change the pixel format between the input and -the output, you just have to define a pixel formats array and call -ff_set_common_formats(). For more complex negotiation, you can refer to other -filters such as vf_scale. - -config_props() -~~~~~~~~~~~~~~ - -This callback is not necessary, but you will probably have one or more -config_props() anyway. It's not a callback for the filter itself but for its -inputs or outputs (they're called "pads" - AVFilterPad - in libavfilter's -lexicon). - -Inside the input config_props(), you are at a point where you know which pixel -format has been picked after query_formats(), and more information such as the -video width and height (inlink->{w,h}). So if you need to update your internal -context state depending on your input you can do it here. In edgedetect you can -see that this callback is used to allocate buffers depending on these -information. They will be destroyed in uninit(). - -Inside the output config_props(), you can define what you want to change in the -output. Typically, if your filter is going to double the size of the video, you -will update outlink->w and outlink->h. - -filter_frame() -~~~~~~~~~~~~~~ - -This is the callback you are waiting from the beginning: it is where you -process the received frames. Along with the frame, you get the input link from -where the frame comes from. - - static int filter_frame(AVFilterLink *inlink, AVFrame *in) { ... } - -You can get the filter context through that input link: - - AVFilterContext *ctx = inlink->dst; - -Then access your internal state context: - - FoobarContext *foobar = ctx->priv; - -And also the output link where you will send your frame when you are done: - - AVFilterLink *outlink = ctx->outputs[0]; - -Here, we are picking the first output. You can have several, but in our case we -only have one since we are in a 1:1 input-output situation. - -If you want to define a simple pass-through filter, you can just do: - - return ff_filter_frame(outlink, in); - -But of course, you probably want to change the data of that frame. - -This can be done by accessing frame->data[] and frame->linesize[]. Important -note here: the width does NOT match the linesize. The linesize is always -greater or equal to the width. The padding created should not be changed or -even read. Typically, keep in mind that a previous filter in your chain might -have altered the frame dimension but not the linesize. Imagine a crop filter -that halves the video size: the linesizes won't be changed, just the width. - - <-------------- linesize ------------------------> - +-------------------------------+----------------+ ^ - | | | | - | | | | - | picture | padding | | height - | | | | - | | | | - +-------------------------------+----------------+ v - <----------- width -------------> - -Before modifying the "in" frame, you have to make sure it is writable, or get a -new one. Multiple scenarios are possible here depending on the kind of -processing you are doing. - -Let's say you want to change one pixel depending on multiple pixels (typically -the surrounding ones) of the input. In that case, you can't do an in-place -processing of the input so you will need to allocate a new frame, with the same -properties as the input one, and send that new frame to the next filter: - - AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - - // out->data[...] = foobar(in->data[...]) - - av_frame_free(&in); - return ff_filter_frame(outlink, out); - -In-place processing -~~~~~~~~~~~~~~~~~~~ - -If you can just alter the input frame, you probably just want to do that -instead: - - av_frame_make_writable(in); - // in->data[...] = foobar(in->data[...]) - return ff_filter_frame(outlink, in); - -You may wonder why a frame might not be writable. The answer is that for -example a previous filter might still own the frame data: imagine a filter -prior to yours in the filtergraph that needs to cache the frame. You must not -alter that frame, otherwise it will make that previous filter buggy. This is -where av_frame_make_writable() helps (it won't have any effect if the frame -already is writable). - -The problem with using av_frame_make_writable() is that in the worst case it -will copy the whole input frame before you change it all over again with your -filter: if the frame is not writable, av_frame_make_writable() will allocate -new buffers, and copy the input frame data. You don't want that, and you can -avoid it by just allocating a new buffer if necessary, and process from in to -out in your filter, saving the memcpy. Generally, this is done following this -scheme: - - int direct = 0; - AVFrame *out; - - if (av_frame_is_writable(in)) { - direct = 1; - out = in; - } else { - out = ff_get_video_buffer(outlink, outlink->w, outlink->h); - if (!out) { - av_frame_free(&in); - return AVERROR(ENOMEM); - } - av_frame_copy_props(out, in); - } - - // out->data[...] = foobar(in->data[...]) - - if (!direct) - av_frame_free(&in); - return ff_filter_frame(outlink, out); - -Of course, this will only work if you can do in-place processing. To test if -your filter handles well the permissions, you can use the perms filter. For -example with: - - -vf perms=random,foobar - -Make sure no automatic pixel conversion is inserted between perms and foobar, -otherwise the frames permissions might change again and the test will be -meaningless: add av_log(0,0,"direct=%d\n",direct) in your code to check that. -You can avoid the issue with something like: - - -vf format=rgb24,perms=random,foobar - -...assuming your filter accepts rgb24 of course. This will make sure the -necessary conversion is inserted before the perms filter. - -Timeline -~~~~~~~~ - -Adding timeline support -(http://ffmpeg.org/ffmpeg-filters.html#Timeline-editing) is often an easy -feature to add. In the most simple case, you just have to add -AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC to the AVFilter.flags. You can typically -do this when your filter does not need to save the previous context frames, or -basically if your filter just alter whatever goes in and doesn't need -previous/future information. See for instance commit 86cb986ce that adds -timeline support to the fieldorder filter. - -In some cases, you might need to reset your context somehow. This is handled by -the AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL flag which is used if the filter -must not process the frames but still wants to keep track of the frames going -through (to keep them in cache for when it's enabled again). See for example -commit 69d72140a that adds timeline support to the phase filter. - -Threading -~~~~~~~~~ - -libavfilter does not yet support frame threading, but you can add slice -threading to your filters. - -Let's say the foobar filter has the following frame processing function: - - dst = out->data[0]; - src = in ->data[0]; - - for (y = 0; y < inlink->h; y++) { - for (x = 0; x < inlink->w; x++) - dst[x] = foobar(src[x]); - dst += out->linesize[0]; - src += in ->linesize[0]; - } - -The first thing is to make this function work into slices. The new code will -look like this: - - for (y = slice_start; y < slice_end; y++) { - for (x = 0; x < inlink->w; x++) - dst[x] = foobar(src[x]); - dst += out->linesize[0]; - src += in ->linesize[0]; - } - -The source and destination pointers, and slice_start/slice_end will be defined -according to the number of jobs. Generally, it looks like this: - - const int slice_start = (in->height * jobnr ) / nb_jobs; - const int slice_end = (in->height * (jobnr+1)) / nb_jobs; - uint8_t *dst = out->data[0] + slice_start * out->linesize[0]; - const uint8_t *src = in->data[0] + slice_start * in->linesize[0]; - -This new code will be isolated in a new filter_slice(): - - static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) { ... } - -Note that we need our input and output frame to define slice_{start,end} and -dst/src, which are not available in that callback. They will be transmitted -through the opaque void *arg. You have to define a structure which contains -everything you need: - - typedef struct ThreadData { - AVFrame *in, *out; - } ThreadData; - -If you need some more information from your local context, put them here. - -In you filter_slice function, you access it like that: - - const ThreadData *td = arg; - -Then in your filter_frame() callback, you need to call the threading -distributor with something like this: - - ThreadData td; - - // ... - - td.in = in; - td.out = out; - ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); - - // ... - - return ff_filter_frame(outlink, out); - -Last step is to add AVFILTER_FLAG_SLICE_THREADS flag to AVFilter.flags. - -For more example of slice threading additions, you can try to run git log -p ---grep 'slice threading' libavfilter/ - -Finalization -~~~~~~~~~~~~ - -When your awesome filter is finished, you have a few more steps before you're -done: - - - write its documentation in doc/filters.texi, and test the output with make - doc/ffmpeg-filters.html. - - add a FATE test, generally by adding an entry in - tests/fate/filter-video.mak, add running make fate-filter-foobar GEN=1 to - generate the data. - - add an entry in the Changelog - - edit libavfilter/version.h and increase LIBAVFILTER_VERSION_MINOR by one - (and reset LIBAVFILTER_VERSION_MICRO to 100) - - git add ... && git commit -m "avfilter: add foobar filter." && git format-patch -1 - -When all of this is done, you can submit your patch to the ffmpeg-devel -mailing-list for review. If you need any help, feel free to come on our IRC -channel, #ffmpeg-devel on irc.freenode.net. diff --git a/ffmpeg.c b/ffmpeg.c deleted file mode 100644 index a0e2be294f..0000000000 --- a/ffmpeg.c +++ /dev/null @@ -1,3771 +0,0 @@ -/* - * Copyright (c) 2000-2003 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 - */ - -/** - * @file - * multimedia converter based on the FFmpeg libraries - */ - -#include "config.h" -#include -#include -#include -#include -#include -#include -#include - -#if HAVE_ISATTY -#if HAVE_IO_H -#include -#endif -#if HAVE_UNISTD_H -#include -#endif -#endif - -#include "libavformat/avformat.h" -#include "libavdevice/avdevice.h" -#include "libswresample/swresample.h" -#include "libavutil/opt.h" -#include "libavutil/channel_layout.h" -#include "libavutil/parseutils.h" -#include "libavutil/samplefmt.h" -#include "libavutil/fifo.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/dict.h" -#include "libavutil/mathematics.h" -#include "libavutil/pixdesc.h" -#include "libavutil/avstring.h" -#include "libavutil/libm.h" -#include "libavutil/imgutils.h" -#include "libavutil/timestamp.h" -#include "libavutil/bprint.h" -#include "libavutil/time.h" -#include "libavutil/threadmessage.h" -#include "libavformat/os_support.h" - -#include "libavformat/ffm.h" // not public API - -# include "libavfilter/avcodec.h" -# include "libavfilter/avfilter.h" -# include "libavfilter/buffersrc.h" -# include "libavfilter/buffersink.h" - -#if HAVE_SYS_RESOURCE_H -#include -#include -#include -#elif HAVE_GETPROCESSTIMES -#include -#endif -#if HAVE_GETPROCESSMEMORYINFO -#include -#include -#endif - -#if HAVE_SYS_SELECT_H -#include -#endif - -#if HAVE_TERMIOS_H -#include -#include -#include -#include -#elif HAVE_KBHIT -#include -#endif - -#if HAVE_PTHREADS -#include -#endif - -#include - -#include "ffmpeg.h" -#include "cmdutils.h" - -#include "libavutil/avassert.h" - -const char program_name[] = "ffmpeg"; -const int program_birth_year = 2000; - -static FILE *vstats_file; - -const char *const forced_keyframes_const_names[] = { - "n", - "n_forced", - "prev_forced_n", - "prev_forced_t", - "t", - NULL -}; - -static void do_video_stats(OutputStream *ost, int frame_size); -static int64_t getutime(void); -static int64_t getmaxrss(void); - -static int run_as_daemon = 0; -static int nb_frames_dup = 0; -static int nb_frames_drop = 0; -static int64_t decode_error_stat[2]; - -static int current_time; -AVIOContext *progress_avio = NULL; - -static uint8_t *subtitle_out; - -#define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass" - -InputStream **input_streams = NULL; -int nb_input_streams = 0; -InputFile **input_files = NULL; -int nb_input_files = 0; - -OutputStream **output_streams = NULL; -int nb_output_streams = 0; -OutputFile **output_files = NULL; -int nb_output_files = 0; - -FilterGraph **filtergraphs; -int nb_filtergraphs; - -#if HAVE_TERMIOS_H - -/* init terminal so that we can grab keys */ -static struct termios oldtty; -static int restore_tty; -#endif - -static void free_input_threads(void); - - -/* sub2video hack: - Convert subtitles to video with alpha to insert them in filter graphs. - This is a temporary solution until libavfilter gets real subtitles support. - */ - -static int sub2video_get_blank_frame(InputStream *ist) -{ - int ret; - AVFrame *frame = ist->sub2video.frame; - - av_frame_unref(frame); - ist->sub2video.frame->width = ist->sub2video.w; - ist->sub2video.frame->height = ist->sub2video.h; - ist->sub2video.frame->format = AV_PIX_FMT_RGB32; - if ((ret = av_frame_get_buffer(frame, 32)) < 0) - return ret; - memset(frame->data[0], 0, frame->height * frame->linesize[0]); - return 0; -} - -static void sub2video_copy_rect(uint8_t *dst, int dst_linesize, int w, int h, - AVSubtitleRect *r) -{ - uint32_t *pal, *dst2; - uint8_t *src, *src2; - int x, y; - - if (r->type != SUBTITLE_BITMAP) { - av_log(NULL, AV_LOG_WARNING, "sub2video: non-bitmap subtitle\n"); - return; - } - if (r->x < 0 || r->x + r->w > w || r->y < 0 || r->y + r->h > h) { - av_log(NULL, AV_LOG_WARNING, "sub2video: rectangle overflowing\n"); - return; - } - - dst += r->y * dst_linesize + r->x * 4; - src = r->pict.data[0]; - pal = (uint32_t *)r->pict.data[1]; - for (y = 0; y < r->h; y++) { - dst2 = (uint32_t *)dst; - src2 = src; - for (x = 0; x < r->w; x++) - *(dst2++) = pal[*(src2++)]; - dst += dst_linesize; - src += r->pict.linesize[0]; - } -} - -static void sub2video_push_ref(InputStream *ist, int64_t pts) -{ - AVFrame *frame = ist->sub2video.frame; - int i; - - av_assert1(frame->data[0]); - ist->sub2video.last_pts = frame->pts = pts; - for (i = 0; i < ist->nb_filters; i++) - av_buffersrc_add_frame_flags(ist->filters[i]->filter, frame, - AV_BUFFERSRC_FLAG_KEEP_REF | - AV_BUFFERSRC_FLAG_PUSH); -} - -static void sub2video_update(InputStream *ist, AVSubtitle *sub) -{ - int w = ist->sub2video.w, h = ist->sub2video.h; - AVFrame *frame = ist->sub2video.frame; - int8_t *dst; - int dst_linesize; - int num_rects, i; - int64_t pts, end_pts; - - if (!frame) - return; - if (sub) { - pts = av_rescale_q(sub->pts + sub->start_display_time * 1000, - AV_TIME_BASE_Q, ist->st->time_base); - end_pts = av_rescale_q(sub->pts + sub->end_display_time * 1000, - AV_TIME_BASE_Q, ist->st->time_base); - num_rects = sub->num_rects; - } else { - pts = ist->sub2video.end_pts; - end_pts = INT64_MAX; - num_rects = 0; - } - if (sub2video_get_blank_frame(ist) < 0) { - av_log(ist->st->codec, AV_LOG_ERROR, - "Impossible to get a blank canvas.\n"); - return; - } - dst = frame->data [0]; - dst_linesize = frame->linesize[0]; - for (i = 0; i < num_rects; i++) - sub2video_copy_rect(dst, dst_linesize, w, h, sub->rects[i]); - sub2video_push_ref(ist, pts); - ist->sub2video.end_pts = end_pts; -} - -static void sub2video_heartbeat(InputStream *ist, int64_t pts) -{ - InputFile *infile = input_files[ist->file_index]; - int i, j, nb_reqs; - int64_t pts2; - - /* When a frame is read from a file, examine all sub2video streams in - the same file and send the sub2video frame again. Otherwise, decoded - video frames could be accumulating in the filter graph while a filter - (possibly overlay) is desperately waiting for a subtitle frame. */ - for (i = 0; i < infile->nb_streams; i++) { - InputStream *ist2 = input_streams[infile->ist_index + i]; - if (!ist2->sub2video.frame) - continue; - /* subtitles seem to be usually muxed ahead of other streams; - if not, substracting a larger time here is necessary */ - pts2 = av_rescale_q(pts, ist->st->time_base, ist2->st->time_base) - 1; - /* do not send the heartbeat frame if the subtitle is already ahead */ - if (pts2 <= ist2->sub2video.last_pts) - continue; - if (pts2 >= ist2->sub2video.end_pts || !ist2->sub2video.frame->data[0]) - sub2video_update(ist2, NULL); - for (j = 0, nb_reqs = 0; j < ist2->nb_filters; j++) - nb_reqs += av_buffersrc_get_nb_failed_requests(ist2->filters[j]->filter); - if (nb_reqs) - sub2video_push_ref(ist2, pts2); - } -} - -static void sub2video_flush(InputStream *ist) -{ - int i; - - if (ist->sub2video.end_pts < INT64_MAX) - sub2video_update(ist, NULL); - for (i = 0; i < ist->nb_filters; i++) - av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0); -} - -/* end of sub2video hack */ - -static void term_exit_sigsafe(void) -{ -#if HAVE_TERMIOS_H - if(restore_tty) - tcsetattr (0, TCSANOW, &oldtty); -#endif -} - -void term_exit(void) -{ - av_log(NULL, AV_LOG_QUIET, "%s", ""); - term_exit_sigsafe(); -} - -static volatile int received_sigterm = 0; -static volatile int received_nb_signals = 0; -static volatile int transcode_init_done = 0; -static int main_return_code = 0; - -static void -sigterm_handler(int sig) -{ - received_sigterm = sig; - received_nb_signals++; - term_exit_sigsafe(); - if(received_nb_signals > 3) - exit(123); -} - -void term_init(void) -{ -#if HAVE_TERMIOS_H - if(!run_as_daemon){ - struct termios tty; - int istty = 1; -#if HAVE_ISATTY - istty = isatty(0) && isatty(2); -#endif - if (istty && tcgetattr (0, &tty) == 0) { - oldtty = tty; - restore_tty = 1; - - tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP - |INLCR|IGNCR|ICRNL|IXON); - tty.c_oflag |= OPOST; - tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); - tty.c_cflag &= ~(CSIZE|PARENB); - tty.c_cflag |= CS8; - tty.c_cc[VMIN] = 1; - tty.c_cc[VTIME] = 0; - - tcsetattr (0, TCSANOW, &tty); - } - signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */ - } -#endif - avformat_network_deinit(); - - signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */ - signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */ -#ifdef SIGXCPU - signal(SIGXCPU, sigterm_handler); -#endif -} - -/* read a key without blocking */ -static int read_key(void) -{ - unsigned char ch; -#if HAVE_TERMIOS_H - int n = 1; - struct timeval tv; - fd_set rfds; - - FD_ZERO(&rfds); - FD_SET(0, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 0; - n = select(1, &rfds, NULL, NULL, &tv); - if (n > 0) { - n = read(0, &ch, 1); - if (n == 1) - return ch; - - return n; - } -#elif HAVE_KBHIT -# if HAVE_PEEKNAMEDPIPE - static int is_pipe; - static HANDLE input_handle; - DWORD dw, nchars; - if(!input_handle){ - input_handle = GetStdHandle(STD_INPUT_HANDLE); - is_pipe = !GetConsoleMode(input_handle, &dw); - } - - if (stdin->_cnt > 0) { - read(0, &ch, 1); - return ch; - } - if (is_pipe) { - /* When running under a GUI, you will end here. */ - if (!PeekNamedPipe(input_handle, NULL, 0, NULL, &nchars, NULL)) { - // input pipe may have been closed by the program that ran ffmpeg - return -1; - } - //Read it - if(nchars != 0) { - read(0, &ch, 1); - return ch; - }else{ - return -1; - } - } -# endif - if(kbhit()) - return(getch()); -#endif - return -1; -} - -static int decode_interrupt_cb(void *ctx) -{ - return received_nb_signals > transcode_init_done; -} - -const AVIOInterruptCB int_cb = { decode_interrupt_cb, NULL }; - -static void ffmpeg_cleanup(int ret) -{ - int i, j; - - if (do_benchmark) { - int maxrss = getmaxrss() / 1024; - printf("bench: maxrss=%ikB\n", maxrss); - } - - for (i = 0; i < nb_filtergraphs; i++) { - FilterGraph *fg = filtergraphs[i]; - avfilter_graph_free(&fg->graph); - for (j = 0; j < fg->nb_inputs; j++) { - av_freep(&fg->inputs[j]->name); - av_freep(&fg->inputs[j]); - } - av_freep(&fg->inputs); - for (j = 0; j < fg->nb_outputs; j++) { - av_freep(&fg->outputs[j]->name); - av_freep(&fg->outputs[j]); - } - av_freep(&fg->outputs); - av_freep(&fg->graph_desc); - - av_freep(&filtergraphs[i]); - } - av_freep(&filtergraphs); - - av_freep(&subtitle_out); - - /* close files */ - for (i = 0; i < nb_output_files; i++) { - OutputFile *of = output_files[i]; - AVFormatContext *s = of->ctx; - if (s && s->oformat && !(s->oformat->flags & AVFMT_NOFILE) && s->pb) - avio_close(s->pb); - avformat_free_context(s); - av_dict_free(&of->opts); - - av_freep(&output_files[i]); - } - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - AVBitStreamFilterContext *bsfc = ost->bitstream_filters; - while (bsfc) { - AVBitStreamFilterContext *next = bsfc->next; - av_bitstream_filter_close(bsfc); - bsfc = next; - } - ost->bitstream_filters = NULL; - av_frame_free(&ost->filtered_frame); - - av_parser_close(ost->parser); - - av_freep(&ost->forced_keyframes); - av_expr_free(ost->forced_keyframes_pexpr); - av_freep(&ost->avfilter); - av_freep(&ost->logfile_prefix); - - av_freep(&output_streams[i]); - } -#if HAVE_PTHREADS - free_input_threads(); -#endif - for (i = 0; i < nb_input_files; i++) { - avformat_close_input(&input_files[i]->ctx); - av_freep(&input_files[i]); - } - for (i = 0; i < nb_input_streams; i++) { - InputStream *ist = input_streams[i]; - - av_frame_free(&ist->decoded_frame); - av_frame_free(&ist->filter_frame); - av_dict_free(&ist->decoder_opts); - avsubtitle_free(&ist->prev_sub.subtitle); - av_frame_free(&ist->sub2video.frame); - av_freep(&ist->filters); - av_freep(&ist->hwaccel_device); - - av_freep(&input_streams[i]); - } - - if (vstats_file) - fclose(vstats_file); - av_free(vstats_filename); - - av_freep(&input_streams); - av_freep(&input_files); - av_freep(&output_streams); - av_freep(&output_files); - - uninit_opts(); - - avformat_network_deinit(); - - if (received_sigterm) { - av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n", - (int) received_sigterm); - } else if (ret && transcode_init_done) { - av_log(NULL, AV_LOG_INFO, "Conversion failed!\n"); - } - term_exit(); -} - -void assert_avoptions(AVDictionary *m) -{ - AVDictionaryEntry *t; - if ((t = av_dict_get(m, "", NULL, AV_DICT_IGNORE_SUFFIX))) { - av_log(NULL, AV_LOG_FATAL, "Option %s not found.\n", t->key); - exit_program(1); - } -} - -static void abort_codec_experimental(AVCodec *c, int encoder) -{ - exit_program(1); -} - -static void update_benchmark(const char *fmt, ...) -{ - if (do_benchmark_all) { - int64_t t = getutime(); - va_list va; - char buf[1024]; - - if (fmt) { - va_start(va, fmt); - vsnprintf(buf, sizeof(buf), fmt, va); - va_end(va); - printf("bench: %8"PRIu64" %s \n", t - current_time, buf); - } - current_time = t; - } -} - -static void close_all_output_streams(OutputStream *ost, OSTFinished this_stream, OSTFinished others) -{ - int i; - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost2 = output_streams[i]; - ost2->finished |= ost == ost2 ? this_stream : others; - } -} - -static void write_frame(AVFormatContext *s, AVPacket *pkt, OutputStream *ost) -{ - AVBitStreamFilterContext *bsfc = ost->bitstream_filters; - AVCodecContext *avctx = ost->st->codec; - int ret; - - if ((avctx->codec_type == AVMEDIA_TYPE_VIDEO && video_sync_method == VSYNC_DROP) || - (avctx->codec_type == AVMEDIA_TYPE_AUDIO && audio_sync_method < 0)) - pkt->pts = pkt->dts = AV_NOPTS_VALUE; - - /* - * Audio encoders may split the packets -- #frames in != #packets out. - * But there is no reordering, so we can limit the number of output packets - * by simply dropping them here. - * Counting encoded video frames needs to be done separately because of - * reordering, see do_video_out() - */ - if (!(avctx->codec_type == AVMEDIA_TYPE_VIDEO && avctx->codec)) { - if (ost->frame_number >= ost->max_frames) { - av_free_packet(pkt); - return; - } - ost->frame_number++; - } - - if (bsfc) - av_packet_split_side_data(pkt); - - while (bsfc) { - AVPacket new_pkt = *pkt; - int a = av_bitstream_filter_filter(bsfc, avctx, NULL, - &new_pkt.data, &new_pkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY); - if(a == 0 && new_pkt.data != pkt->data && new_pkt.destruct) { - uint8_t *t = av_malloc(new_pkt.size + FF_INPUT_BUFFER_PADDING_SIZE); //the new should be a subset of the old so cannot overflow - if(t) { - memcpy(t, new_pkt.data, new_pkt.size); - memset(t + new_pkt.size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - new_pkt.data = t; - new_pkt.buf = NULL; - a = 1; - } else - a = AVERROR(ENOMEM); - } - if (a > 0) { - av_free_packet(pkt); - new_pkt.buf = av_buffer_create(new_pkt.data, new_pkt.size, - av_buffer_default_free, NULL, 0); - if (!new_pkt.buf) - exit_program(1); - } else if (a < 0) { - av_log(NULL, AV_LOG_ERROR, "Failed to open bitstream filter %s for stream %d with codec %s", - bsfc->filter->name, pkt->stream_index, - avctx->codec ? avctx->codec->name : "copy"); - print_error("", a); - if (exit_on_error) - exit_program(1); - } - *pkt = new_pkt; - - bsfc = bsfc->next; - } - - if (!(s->oformat->flags & AVFMT_NOTIMESTAMPS) && - (avctx->codec_type == AVMEDIA_TYPE_AUDIO || avctx->codec_type == AVMEDIA_TYPE_VIDEO) && - pkt->dts != AV_NOPTS_VALUE && - ost->last_mux_dts != AV_NOPTS_VALUE) { - int64_t max = ost->last_mux_dts + !(s->oformat->flags & AVFMT_TS_NONSTRICT); - if (pkt->dts < max) { - int loglevel = max - pkt->dts > 2 || avctx->codec_type == AVMEDIA_TYPE_VIDEO ? AV_LOG_WARNING : AV_LOG_DEBUG; - av_log(s, loglevel, "Non-monotonous DTS in output stream " - "%d:%d; previous: %"PRId64", current: %"PRId64"; ", - ost->file_index, ost->st->index, ost->last_mux_dts, pkt->dts); - if (exit_on_error) { - av_log(NULL, AV_LOG_FATAL, "aborting.\n"); - exit_program(1); - } - av_log(s, loglevel, "changing to %"PRId64". This may result " - "in incorrect timestamps in the output file.\n", - max); - if(pkt->pts >= pkt->dts) - pkt->pts = FFMAX(pkt->pts, max); - pkt->dts = max; - } - } - ost->last_mux_dts = pkt->dts; - - ost->data_size += pkt->size; - ost->packets_written++; - - pkt->stream_index = ost->index; - - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "muxer <- type:%s " - "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n", - av_get_media_type_string(ost->st->codec->codec_type), - av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &ost->st->time_base), - av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &ost->st->time_base), - pkt->size - ); - } - - ret = av_interleaved_write_frame(s, pkt); - if (ret < 0) { - print_error("av_interleaved_write_frame()", ret); - main_return_code = 1; - close_all_output_streams(ost, MUXER_FINISHED | ENCODER_FINISHED, ENCODER_FINISHED); - } - av_free_packet(pkt); -} - -static void close_output_stream(OutputStream *ost) -{ - OutputFile *of = output_files[ost->file_index]; - - ost->finished |= ENCODER_FINISHED; - if (of->shortest) { - int64_t end = av_rescale_q(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, AV_TIME_BASE_Q); - of->recording_time = FFMIN(of->recording_time, end); - } -} - -static int check_recording_time(OutputStream *ost) -{ - OutputFile *of = output_files[ost->file_index]; - - if (of->recording_time != INT64_MAX && - av_compare_ts(ost->sync_opts - ost->first_pts, ost->st->codec->time_base, of->recording_time, - AV_TIME_BASE_Q) >= 0) { - close_output_stream(ost); - return 0; - } - return 1; -} - -static void do_audio_out(AVFormatContext *s, OutputStream *ost, - AVFrame *frame) -{ - AVCodecContext *enc = ost->st->codec; - AVPacket pkt; - int got_packet = 0; - - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; - - if (!check_recording_time(ost)) - return; - - if (frame->pts == AV_NOPTS_VALUE || audio_sync_method < 0) - frame->pts = ost->sync_opts; - ost->sync_opts = frame->pts + frame->nb_samples; - ost->samples_encoded += frame->nb_samples; - ost->frames_encoded++; - - av_assert0(pkt.size || !pkt.data); - update_benchmark(NULL); - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "encoder <- type:audio " - "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n", - av_ts2str(frame->pts), av_ts2timestr(frame->pts, &enc->time_base), - enc->time_base.num, enc->time_base.den); - } - - if (avcodec_encode_audio2(enc, &pkt, frame, &got_packet) < 0) { - av_log(NULL, AV_LOG_FATAL, "Audio encoding failed (avcodec_encode_audio2)\n"); - exit_program(1); - } - update_benchmark("encode_audio %d.%d", ost->file_index, ost->index); - - if (got_packet) { - if (pkt.pts != AV_NOPTS_VALUE) - pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); - if (pkt.dts != AV_NOPTS_VALUE) - pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); - if (pkt.duration > 0) - pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); - - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "encoder -> type:audio " - "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", - av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), - av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); - } - - write_frame(s, &pkt, ost); - } -} - -static void do_subtitle_out(AVFormatContext *s, - OutputStream *ost, - InputStream *ist, - AVSubtitle *sub) -{ - int subtitle_out_max_size = 1024 * 1024; - int subtitle_out_size, nb, i; - AVCodecContext *enc; - AVPacket pkt; - int64_t pts; - - if (sub->pts == AV_NOPTS_VALUE) { - av_log(NULL, AV_LOG_ERROR, "Subtitle packets must have a pts\n"); - if (exit_on_error) - exit_program(1); - return; - } - - enc = ost->st->codec; - - if (!subtitle_out) { - subtitle_out = av_malloc(subtitle_out_max_size); - } - - /* Note: DVB subtitle need one packet to draw them and one other - packet to clear them */ - /* XXX: signal it in the codec context ? */ - if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) - nb = 2; - else - nb = 1; - - /* shift timestamp to honor -ss and make check_recording_time() work with -t */ - pts = sub->pts; - if (output_files[ost->file_index]->start_time != AV_NOPTS_VALUE) - pts -= output_files[ost->file_index]->start_time; - for (i = 0; i < nb; i++) { - ost->sync_opts = av_rescale_q(pts, AV_TIME_BASE_Q, enc->time_base); - if (!check_recording_time(ost)) - return; - - sub->pts = pts; - // start_display_time is required to be 0 - sub->pts += av_rescale_q(sub->start_display_time, (AVRational){ 1, 1000 }, AV_TIME_BASE_Q); - sub->end_display_time -= sub->start_display_time; - sub->start_display_time = 0; - if (i == 1) - sub->num_rects = 0; - - ost->frames_encoded++; - - subtitle_out_size = avcodec_encode_subtitle(enc, subtitle_out, - subtitle_out_max_size, sub); - if (subtitle_out_size < 0) { - av_log(NULL, AV_LOG_FATAL, "Subtitle encoding failed\n"); - exit_program(1); - } - - av_init_packet(&pkt); - pkt.data = subtitle_out; - pkt.size = subtitle_out_size; - pkt.pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, ost->st->time_base); - pkt.duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, ost->st->time_base); - if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) { - /* XXX: the pts correction is handled here. Maybe handling - it in the codec would be better */ - if (i == 0) - pkt.pts += 90 * sub->start_display_time; - else - pkt.pts += 90 * sub->end_display_time; - } - pkt.dts = pkt.pts; - write_frame(s, &pkt, ost); - } -} - -static void do_video_out(AVFormatContext *s, - OutputStream *ost, - AVFrame *in_picture) -{ - int ret, format_video_sync; - AVPacket pkt; - AVCodecContext *enc = ost->st->codec; - int nb_frames, i; - double sync_ipts, delta; - double duration = 0; - int frame_size = 0; - InputStream *ist = NULL; - - if (ost->source_index >= 0) - ist = input_streams[ost->source_index]; - - if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) - duration = 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base)); - - sync_ipts = in_picture->pts; - delta = sync_ipts - ost->sync_opts + duration; - - /* by default, we output a single frame */ - nb_frames = 1; - - format_video_sync = video_sync_method; - if (format_video_sync == VSYNC_AUTO) { - if(!strcmp(s->oformat->name, "avi")) { - format_video_sync = VSYNC_VFR; - } else - format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR; - if ( ist - && format_video_sync == VSYNC_CFR - && input_files[ist->file_index]->ctx->nb_streams == 1 - && input_files[ist->file_index]->input_ts_offset == 0) { - format_video_sync = VSYNC_VSCFR; - } - if (format_video_sync == VSYNC_CFR && copy_ts) { - format_video_sync = VSYNC_VSCFR; - } - } - - switch (format_video_sync) { - case VSYNC_VSCFR: - if (ost->frame_number == 0 && delta - duration >= 0.5) { - av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta - duration)); - delta = duration; - ost->sync_opts = lrint(sync_ipts); - } - case VSYNC_CFR: - // FIXME set to 0.5 after we fix some dts/pts bugs like in avidec.c - if (delta < -1.1) - nb_frames = 0; - else if (delta > 1.1) - nb_frames = lrintf(delta); - break; - case VSYNC_VFR: - if (delta <= -0.6) - nb_frames = 0; - else if (delta > 0.6) - ost->sync_opts = lrint(sync_ipts); - break; - case VSYNC_DROP: - case VSYNC_PASSTHROUGH: - ost->sync_opts = lrint(sync_ipts); - break; - default: - av_assert0(0); - } - - nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number); - if (nb_frames == 0) { - nb_frames_drop++; - av_log(NULL, AV_LOG_VERBOSE, - "*** dropping frame %d from stream %d at ts %"PRId64"\n", - ost->frame_number, ost->st->index, in_picture->pts); - return; - } else if (nb_frames > 1) { - if (nb_frames > dts_error_threshold * 30) { - av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skipping\n", nb_frames - 1); - nb_frames_drop++; - return; - } - nb_frames_dup += nb_frames - 1; - av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); - } - - /* duplicates frame if needed */ - for (i = 0; i < nb_frames; i++) { - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; - - in_picture->pts = ost->sync_opts; - -#if 1 - if (!check_recording_time(ost)) -#else - if (ost->frame_number >= ost->max_frames) -#endif - return; - - if (s->oformat->flags & AVFMT_RAWPICTURE && - enc->codec->id == AV_CODEC_ID_RAWVIDEO) { - /* raw pictures are written as AVPicture structure to - avoid any copies. We support temporarily the older - method. */ - enc->coded_frame->interlaced_frame = in_picture->interlaced_frame; - enc->coded_frame->top_field_first = in_picture->top_field_first; - if (enc->coded_frame->interlaced_frame) - enc->field_order = enc->coded_frame->top_field_first ? AV_FIELD_TB:AV_FIELD_BT; - else - enc->field_order = AV_FIELD_PROGRESSIVE; - pkt.data = (uint8_t *)in_picture; - pkt.size = sizeof(AVPicture); - pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); - pkt.flags |= AV_PKT_FLAG_KEY; - - write_frame(s, &pkt, ost); - } else { - int got_packet, forced_keyframe = 0; - double pts_time; - - if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME) && - ost->top_field_first >= 0) - in_picture->top_field_first = !!ost->top_field_first; - - if (in_picture->interlaced_frame) { - if (enc->codec->id == AV_CODEC_ID_MJPEG) - enc->field_order = in_picture->top_field_first ? AV_FIELD_TT:AV_FIELD_BB; - else - enc->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT; - } else - enc->field_order = AV_FIELD_PROGRESSIVE; - - in_picture->quality = ost->st->codec->global_quality; - if (!enc->me_threshold) - in_picture->pict_type = 0; - - pts_time = in_picture->pts != AV_NOPTS_VALUE ? - in_picture->pts * av_q2d(enc->time_base) : NAN; - if (ost->forced_kf_index < ost->forced_kf_count && - in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { - ost->forced_kf_index++; - forced_keyframe = 1; - } else if (ost->forced_keyframes_pexpr) { - double res; - ost->forced_keyframes_expr_const_values[FKF_T] = pts_time; - res = av_expr_eval(ost->forced_keyframes_pexpr, - ost->forced_keyframes_expr_const_values, NULL); - av_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n", - ost->forced_keyframes_expr_const_values[FKF_N], - ost->forced_keyframes_expr_const_values[FKF_N_FORCED], - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N], - ost->forced_keyframes_expr_const_values[FKF_T], - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T], - res); - if (res) { - forced_keyframe = 1; - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = - ost->forced_keyframes_expr_const_values[FKF_N]; - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = - ost->forced_keyframes_expr_const_values[FKF_T]; - ost->forced_keyframes_expr_const_values[FKF_N_FORCED] += 1; - } - - ost->forced_keyframes_expr_const_values[FKF_N] += 1; - } - - if (forced_keyframe) { - in_picture->pict_type = AV_PICTURE_TYPE_I; - av_log(NULL, AV_LOG_DEBUG, "Forced keyframe at time %f\n", pts_time); - } - - update_benchmark(NULL); - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "encoder <- type:video " - "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n", - av_ts2str(in_picture->pts), av_ts2timestr(in_picture->pts, &enc->time_base), - enc->time_base.num, enc->time_base.den); - } - - ost->frames_encoded++; - - ret = avcodec_encode_video2(enc, &pkt, in_picture, &got_packet); - update_benchmark("encode_video %d.%d", ost->file_index, ost->index); - if (ret < 0) { - av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); - exit_program(1); - } - - if (got_packet) { - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "encoder -> type:video " - "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", - av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &enc->time_base), - av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &enc->time_base)); - } - - if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & CODEC_CAP_DELAY)) - pkt.pts = ost->sync_opts; - - if (pkt.pts != AV_NOPTS_VALUE) - pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); - if (pkt.dts != AV_NOPTS_VALUE) - pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); - - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "encoder -> type:video " - "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", - av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), - av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); - } - - frame_size = pkt.size; - write_frame(s, &pkt, ost); - - /* if two pass, output log */ - if (ost->logfile && enc->stats_out) { - fprintf(ost->logfile, "%s", enc->stats_out); - } - } - } - ost->sync_opts++; - /* - * For video, number of frames in == number of packets out. - * But there may be reordering, so we can't throw away frames on encoder - * flush, we need to limit them here, before they go into encoder. - */ - ost->frame_number++; - - if (vstats_filename && frame_size) - do_video_stats(ost, frame_size); - } -} - -static double psnr(double d) -{ - return -10.0 * log(d) / log(10.0); -} - -static void do_video_stats(OutputStream *ost, int frame_size) -{ - AVCodecContext *enc; - int frame_number; - double ti1, bitrate, avg_bitrate; - - /* this is executed just the first time do_video_stats is called */ - if (!vstats_file) { - vstats_file = fopen(vstats_filename, "w"); - if (!vstats_file) { - perror("fopen"); - exit_program(1); - } - } - - enc = ost->st->codec; - if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { - frame_number = ost->st->nb_frames; - fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); - if (enc->flags&CODEC_FLAG_PSNR) - fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); - - fprintf(vstats_file,"f_size= %6d ", frame_size); - /* compute pts value */ - ti1 = av_stream_get_end_pts(ost->st) * av_q2d(ost->st->time_base); - if (ti1 < 0.01) - ti1 = 0.01; - - bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; - avg_bitrate = (double)(ost->data_size * 8) / ti1 / 1000.0; - fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", - (double)ost->data_size / 1024, ti1, bitrate, avg_bitrate); - fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); - } -} - -/** - * Get and encode new output from any of the filtergraphs, without causing - * activity. - * - * @return 0 for success, <0 for severe errors - */ -static int reap_filters(void) -{ - AVFrame *filtered_frame = NULL; - int i; - int64_t frame_pts; - - /* Reap all buffers present in the buffer sinks */ - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - OutputFile *of = output_files[ost->file_index]; - AVFilterContext *filter; - AVCodecContext *enc = ost->st->codec; - int ret = 0; - - if (!ost->filter) - continue; - filter = ost->filter->filter; - - if (!ost->filtered_frame && !(ost->filtered_frame = av_frame_alloc())) { - return AVERROR(ENOMEM); - } - filtered_frame = ost->filtered_frame; - - while (1) { - ret = av_buffersink_get_frame_flags(filter, filtered_frame, - AV_BUFFERSINK_FLAG_NO_REQUEST); - if (ret < 0) { - if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) { - av_log(NULL, AV_LOG_WARNING, - "Error in av_buffersink_get_frame_flags(): %s\n", av_err2str(ret)); - } - break; - } - if (ost->finished) { - av_frame_unref(filtered_frame); - continue; - } - frame_pts = AV_NOPTS_VALUE; - if (filtered_frame->pts != AV_NOPTS_VALUE) { - int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; - filtered_frame->pts = frame_pts = - av_rescale_q(filtered_frame->pts, filter->inputs[0]->time_base, enc->time_base) - - av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base); - } - //if (ost->source_index >= 0) - // *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold - - switch (filter->inputs[0]->type) { - case AVMEDIA_TYPE_VIDEO: - filtered_frame->pts = frame_pts; - if (!ost->frame_aspect_ratio.num) - enc->sample_aspect_ratio = filtered_frame->sample_aspect_ratio; - - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "filter -> pts:%s pts_time:%s time_base:%d/%d\n", - av_ts2str(filtered_frame->pts), av_ts2timestr(filtered_frame->pts, &enc->time_base), - enc->time_base.num, enc->time_base.den); - } - - do_video_out(of->ctx, ost, filtered_frame); - break; - case AVMEDIA_TYPE_AUDIO: - filtered_frame->pts = frame_pts; - if (!(enc->codec->capabilities & CODEC_CAP_PARAM_CHANGE) && - enc->channels != av_frame_get_channels(filtered_frame)) { - av_log(NULL, AV_LOG_ERROR, - "Audio filter graph output is not normalized and encoder does not support parameter changes\n"); - break; - } - do_audio_out(of->ctx, ost, filtered_frame); - break; - default: - // TODO support subtitle filters - av_assert0(0); - } - - av_frame_unref(filtered_frame); - } - } - - return 0; -} - -static void print_final_stats(int64_t total_size) -{ - uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0; - uint64_t subtitle_size = 0; - uint64_t data_size = 0; - float percent = -1.0; - int i, j; - - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - switch (ost->st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: video_size += ost->data_size; break; - case AVMEDIA_TYPE_AUDIO: audio_size += ost->data_size; break; - case AVMEDIA_TYPE_SUBTITLE: subtitle_size += ost->data_size; break; - default: other_size += ost->data_size; break; - } - extra_size += ost->st->codec->extradata_size; - data_size += ost->data_size; - } - - if (data_size && total_size >= data_size) - percent = 100.0 * (total_size - data_size) / data_size; - - av_log(NULL, AV_LOG_INFO, "\n"); - av_log(NULL, AV_LOG_INFO, "video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ", - video_size / 1024.0, - audio_size / 1024.0, - subtitle_size / 1024.0, - other_size / 1024.0, - extra_size / 1024.0); - if (percent >= 0.0) - av_log(NULL, AV_LOG_INFO, "%f%%", percent); - else - av_log(NULL, AV_LOG_INFO, "unknown"); - av_log(NULL, AV_LOG_INFO, "\n"); - - /* print verbose per-stream stats */ - for (i = 0; i < nb_input_files; i++) { - InputFile *f = input_files[i]; - uint64_t total_packets = 0, total_size = 0; - - av_log(NULL, AV_LOG_VERBOSE, "Input file #%d (%s):\n", - i, f->ctx->filename); - - for (j = 0; j < f->nb_streams; j++) { - InputStream *ist = input_streams[f->ist_index + j]; - enum AVMediaType type = ist->st->codec->codec_type; - - total_size += ist->data_size; - total_packets += ist->nb_packets; - - av_log(NULL, AV_LOG_VERBOSE, " Input stream #%d:%d (%s): ", - i, j, media_type_string(type)); - av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets read (%"PRIu64" bytes); ", - ist->nb_packets, ist->data_size); - - if (ist->decoding_needed) { - av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames decoded", - ist->frames_decoded); - if (type == AVMEDIA_TYPE_AUDIO) - av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ist->samples_decoded); - av_log(NULL, AV_LOG_VERBOSE, "; "); - } - - av_log(NULL, AV_LOG_VERBOSE, "\n"); - } - - av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) demuxed\n", - total_packets, total_size); - } - - for (i = 0; i < nb_output_files; i++) { - OutputFile *of = output_files[i]; - uint64_t total_packets = 0, total_size = 0; - - av_log(NULL, AV_LOG_VERBOSE, "Output file #%d (%s):\n", - i, of->ctx->filename); - - for (j = 0; j < of->ctx->nb_streams; j++) { - OutputStream *ost = output_streams[of->ost_index + j]; - enum AVMediaType type = ost->st->codec->codec_type; - - total_size += ost->data_size; - total_packets += ost->packets_written; - - av_log(NULL, AV_LOG_VERBOSE, " Output stream #%d:%d (%s): ", - i, j, media_type_string(type)); - if (ost->encoding_needed) { - av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" frames encoded", - ost->frames_encoded); - if (type == AVMEDIA_TYPE_AUDIO) - av_log(NULL, AV_LOG_VERBOSE, " (%"PRIu64" samples)", ost->samples_encoded); - av_log(NULL, AV_LOG_VERBOSE, "; "); - } - - av_log(NULL, AV_LOG_VERBOSE, "%"PRIu64" packets muxed (%"PRIu64" bytes); ", - ost->packets_written, ost->data_size); - - av_log(NULL, AV_LOG_VERBOSE, "\n"); - } - - av_log(NULL, AV_LOG_VERBOSE, " Total: %"PRIu64" packets (%"PRIu64" bytes) muxed\n", - total_packets, total_size); - } - if(video_size + data_size + audio_size + subtitle_size + extra_size == 0){ - av_log(NULL, AV_LOG_WARNING, "Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)\n"); - } -} - -static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) -{ - char buf[1024]; - AVBPrint buf_script; - OutputStream *ost; - AVFormatContext *oc; - int64_t total_size; - AVCodecContext *enc; - int frame_number, vid, i; - double bitrate; - int64_t pts = INT64_MIN; - static int64_t last_time = -1; - static int qp_histogram[52]; - int hours, mins, secs, us; - - if (!print_stats && !is_last_report && !progress_avio) - return; - - if (!is_last_report) { - if (last_time == -1) { - last_time = cur_time; - return; - } - if ((cur_time - last_time) < 500000) - return; - last_time = cur_time; - } - - - oc = output_files[0]->ctx; - - total_size = avio_size(oc->pb); - if (total_size <= 0) // FIXME improve avio_size() so it works with non seekable output too - total_size = avio_tell(oc->pb); - - buf[0] = '\0'; - vid = 0; - av_bprint_init(&buf_script, 0, 1); - for (i = 0; i < nb_output_streams; i++) { - float q = -1; - ost = output_streams[i]; - enc = ost->st->codec; - if (!ost->stream_copy && enc->coded_frame) - q = enc->coded_frame->quality / (float)FF_QP2LAMBDA; - if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); - av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", - ost->file_index, ost->index, q); - } - if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { - float fps, t = (cur_time-timer_start) / 1000000.0; - - frame_number = ost->frame_number; - fps = t > 1 ? frame_number / t : 0; - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", - frame_number, fps < 9.95, fps, q); - av_bprintf(&buf_script, "frame=%d\n", frame_number); - av_bprintf(&buf_script, "fps=%.1f\n", fps); - av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", - ost->file_index, ost->index, q); - if (is_last_report) - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); - if (qp_hist) { - int j; - int qp = lrintf(q); - if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) - qp_histogram[qp]++; - for (j = 0; j < 32; j++) - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); - } - if ((enc->flags&CODEC_FLAG_PSNR) && (enc->coded_frame || is_last_report)) { - int j; - double error, error_sum = 0; - double scale, scale_sum = 0; - double p; - char type[3] = { 'Y','U','V' }; - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); - for (j = 0; j < 3; j++) { - if (is_last_report) { - error = enc->error[j]; - scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; - } else { - error = enc->coded_frame->error[j]; - scale = enc->width * enc->height * 255.0 * 255.0; - } - if (j) - scale /= 4; - error_sum += error; - scale_sum += scale; - p = psnr(error / scale); - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); - av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", - ost->file_index, ost->index, type[j] | 32, p); - } - p = psnr(error_sum / scale_sum); - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); - av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", - ost->file_index, ost->index, p); - } - vid = 1; - } - /* compute min output value */ - if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) - pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), - ost->st->time_base, AV_TIME_BASE_Q)); - } - - secs = pts / AV_TIME_BASE; - us = pts % AV_TIME_BASE; - mins = secs / 60; - secs %= 60; - hours = mins / 60; - mins %= 60; - - bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; - - if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=N/A time="); - else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "size=%8.0fkB time=", total_size / 1024.0); - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "%02d:%02d:%02d.%02d ", hours, mins, secs, - (100 * us) / AV_TIME_BASE); - if (bitrate < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "bitrate=N/A"); - else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), - "bitrate=%6.1fkbits/s", bitrate); - if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); - else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); - av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); - av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", - hours, mins, secs, us); - - if (nb_frames_dup || nb_frames_drop) - snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", - nb_frames_dup, nb_frames_drop); - av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); - av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); - - if (print_stats || is_last_report) { - if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { - fprintf(stderr, "%s \r", buf); - } else - av_log(NULL, AV_LOG_INFO, "%s \r", buf); - - fflush(stderr); - } - - if (progress_avio) { - av_bprintf(&buf_script, "progress=%s\n", - is_last_report ? "end" : "continue"); - avio_write(progress_avio, buf_script.str, - FFMIN(buf_script.len, buf_script.size - 1)); - avio_flush(progress_avio); - av_bprint_finalize(&buf_script, NULL); - if (is_last_report) { - avio_close(progress_avio); - progress_avio = NULL; - } - } - - if (is_last_report) - print_final_stats(total_size); -} - -static void flush_encoders(void) -{ - int i, ret; - - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - AVCodecContext *enc = ost->st->codec; - AVFormatContext *os = output_files[ost->file_index]->ctx; - int stop_encoding = 0; - - if (!ost->encoding_needed) - continue; - - if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) - continue; - if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == AV_CODEC_ID_RAWVIDEO) - continue; - - for (;;) { - int (*encode)(AVCodecContext*, AVPacket*, const AVFrame*, int*) = NULL; - const char *desc; - - switch (ost->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - encode = avcodec_encode_audio2; - desc = "Audio"; - break; - case AVMEDIA_TYPE_VIDEO: - encode = avcodec_encode_video2; - desc = "Video"; - break; - default: - stop_encoding = 1; - } - - if (encode) { - AVPacket pkt; - int pkt_size; - int got_packet; - av_init_packet(&pkt); - pkt.data = NULL; - pkt.size = 0; - - update_benchmark(NULL); - ret = encode(enc, &pkt, NULL, &got_packet); - update_benchmark("flush %s %d.%d", desc, ost->file_index, ost->index); - if (ret < 0) { - av_log(NULL, AV_LOG_FATAL, "%s encoding failed\n", desc); - exit_program(1); - } - if (ost->logfile && enc->stats_out) { - fprintf(ost->logfile, "%s", enc->stats_out); - } - if (!got_packet) { - stop_encoding = 1; - break; - } - if (ost->finished & MUXER_FINISHED) { - av_free_packet(&pkt); - continue; - } - if (pkt.pts != AV_NOPTS_VALUE) - pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); - if (pkt.dts != AV_NOPTS_VALUE) - pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); - if (pkt.duration > 0) - pkt.duration = av_rescale_q(pkt.duration, enc->time_base, ost->st->time_base); - pkt_size = pkt.size; - write_frame(os, &pkt, ost); - if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && vstats_filename) { - do_video_stats(ost, pkt_size); - } - } - - if (stop_encoding) - break; - } - } -} - -/* - * Check whether a packet from ist should be written into ost at this time - */ -static int check_output_constraints(InputStream *ist, OutputStream *ost) -{ - OutputFile *of = output_files[ost->file_index]; - int ist_index = input_files[ist->file_index]->ist_index + ist->st->index; - - if (ost->source_index != ist_index) - return 0; - - if (ost->finished) - return 0; - - if (of->start_time != AV_NOPTS_VALUE && ist->pts < of->start_time) - return 0; - - return 1; -} - -static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt) -{ - OutputFile *of = output_files[ost->file_index]; - InputFile *f = input_files [ist->file_index]; - int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; - int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base); - int64_t ist_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ist->st->time_base); - AVPicture pict; - AVPacket opkt; - - av_init_packet(&opkt); - - if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && - !ost->copy_initial_nonkeyframes) - return; - - if (pkt->pts == AV_NOPTS_VALUE) { - if (!ost->frame_number && ist->pts < start_time && - !ost->copy_prior_start) - return; - } else { - if (!ost->frame_number && pkt->pts < ist_tb_start_time && - !ost->copy_prior_start) - return; - } - - if (of->recording_time != INT64_MAX && - ist->pts >= of->recording_time + start_time) { - close_output_stream(ost); - return; - } - - if (f->recording_time != INT64_MAX) { - start_time = f->ctx->start_time; - if (f->start_time != AV_NOPTS_VALUE) - start_time += f->start_time; - if (ist->pts >= f->recording_time + start_time) { - close_output_stream(ost); - return; - } - } - - /* force the input stream PTS */ - if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - ost->sync_opts++; - - if (pkt->pts != AV_NOPTS_VALUE) - opkt.pts = av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time; - else - opkt.pts = AV_NOPTS_VALUE; - - if (pkt->dts == AV_NOPTS_VALUE) - opkt.dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ost->st->time_base); - else - opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base); - opkt.dts -= ost_tb_start_time; - - if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->dts != AV_NOPTS_VALUE) { - int duration = av_get_audio_frame_duration(ist->st->codec, pkt->size); - if(!duration) - duration = ist->st->codec->frame_size; - opkt.dts = opkt.pts = av_rescale_delta(ist->st->time_base, pkt->dts, - (AVRational){1, ist->st->codec->sample_rate}, duration, &ist->filter_in_rescale_delta_last, - ost->st->time_base) - ost_tb_start_time; - } - - opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base); - opkt.flags = pkt->flags; - - // FIXME remove the following 2 lines they shall be replaced by the bitstream filters - if ( ost->st->codec->codec_id != AV_CODEC_ID_H264 - && ost->st->codec->codec_id != AV_CODEC_ID_MPEG1VIDEO - && ost->st->codec->codec_id != AV_CODEC_ID_MPEG2VIDEO - && ost->st->codec->codec_id != AV_CODEC_ID_VC1 - ) { - if (av_parser_change(ost->parser, ost->st->codec, - &opkt.data, &opkt.size, - pkt->data, pkt->size, - pkt->flags & AV_PKT_FLAG_KEY)) { - opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0); - if (!opkt.buf) - exit_program(1); - } - } else { - opkt.data = pkt->data; - opkt.size = pkt->size; - } - av_copy_packet_side_data(&opkt, pkt); - - if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (of->ctx->oformat->flags & AVFMT_RAWPICTURE)) { - /* store AVPicture in AVPacket, as expected by the output format */ - avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height); - opkt.data = (uint8_t *)&pict; - opkt.size = sizeof(AVPicture); - opkt.flags |= AV_PKT_FLAG_KEY; - } - - write_frame(of->ctx, &opkt, ost); -} - -int guess_input_channel_layout(InputStream *ist) -{ - AVCodecContext *dec = ist->st->codec; - - if (!dec->channel_layout) { - char layout_name[256]; - - if (dec->channels > ist->guess_layout_max) - return 0; - dec->channel_layout = av_get_default_channel_layout(dec->channels); - if (!dec->channel_layout) - return 0; - av_get_channel_layout_string(layout_name, sizeof(layout_name), - dec->channels, dec->channel_layout); - av_log(NULL, AV_LOG_WARNING, "Guessed Channel Layout for Input Stream " - "#%d.%d : %s\n", ist->file_index, ist->st->index, layout_name); - } - return 1; -} - -static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) -{ - AVFrame *decoded_frame, *f; - AVCodecContext *avctx = ist->st->codec; - int i, ret, err = 0, resample_changed; - AVRational decoded_frame_tb; - - if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) - return AVERROR(ENOMEM); - if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) - return AVERROR(ENOMEM); - decoded_frame = ist->decoded_frame; - - update_benchmark(NULL); - ret = avcodec_decode_audio4(avctx, decoded_frame, got_output, pkt); - update_benchmark("decode_audio %d.%d", ist->file_index, ist->st->index); - - if (ret >= 0 && avctx->sample_rate <= 0) { - av_log(avctx, AV_LOG_ERROR, "Sample rate %d invalid\n", avctx->sample_rate); - ret = AVERROR_INVALIDDATA; - } - - if (*got_output || ret<0 || pkt->size) - decode_error_stat[ret<0] ++; - - if (!*got_output || ret < 0) { - if (!pkt->size) { - for (i = 0; i < ist->nb_filters; i++) -#if 1 - av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0); -#else - av_buffersrc_add_frame(ist->filters[i]->filter, NULL); -#endif - } - return ret; - } - - ist->samples_decoded += decoded_frame->nb_samples; - ist->frames_decoded++; - -#if 1 - /* increment next_dts to use for the case where the input stream does not - have timestamps or there are multiple frames in the packet */ - ist->next_pts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / - avctx->sample_rate; - ist->next_dts += ((int64_t)AV_TIME_BASE * decoded_frame->nb_samples) / - avctx->sample_rate; -#endif - - resample_changed = ist->resample_sample_fmt != decoded_frame->format || - ist->resample_channels != avctx->channels || - ist->resample_channel_layout != decoded_frame->channel_layout || - ist->resample_sample_rate != decoded_frame->sample_rate; - if (resample_changed) { - char layout1[64], layout2[64]; - - if (!guess_input_channel_layout(ist)) { - av_log(NULL, AV_LOG_FATAL, "Unable to find default channel " - "layout for Input Stream #%d.%d\n", ist->file_index, - ist->st->index); - exit_program(1); - } - decoded_frame->channel_layout = avctx->channel_layout; - - av_get_channel_layout_string(layout1, sizeof(layout1), ist->resample_channels, - ist->resample_channel_layout); - av_get_channel_layout_string(layout2, sizeof(layout2), avctx->channels, - decoded_frame->channel_layout); - - av_log(NULL, AV_LOG_INFO, - "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n", - ist->file_index, ist->st->index, - ist->resample_sample_rate, av_get_sample_fmt_name(ist->resample_sample_fmt), - ist->resample_channels, layout1, - decoded_frame->sample_rate, av_get_sample_fmt_name(decoded_frame->format), - avctx->channels, layout2); - - ist->resample_sample_fmt = decoded_frame->format; - ist->resample_sample_rate = decoded_frame->sample_rate; - ist->resample_channel_layout = decoded_frame->channel_layout; - ist->resample_channels = avctx->channels; - - for (i = 0; i < nb_filtergraphs; i++) - if (ist_in_filtergraph(filtergraphs[i], ist)) { - FilterGraph *fg = filtergraphs[i]; - int j; - if (configure_filtergraph(fg) < 0) { - av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n"); - exit_program(1); - } - for (j = 0; j < fg->nb_outputs; j++) { - OutputStream *ost = fg->outputs[j]->ost; - if (ost->enc->type == AVMEDIA_TYPE_AUDIO && - !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) - av_buffersink_set_frame_size(ost->filter->filter, - ost->st->codec->frame_size); - } - } - } - - /* if the decoder provides a pts, use it instead of the last packet pts. - the decoder could be delaying output by a packet or more. */ - if (decoded_frame->pts != AV_NOPTS_VALUE) { - ist->dts = ist->next_dts = ist->pts = ist->next_pts = av_rescale_q(decoded_frame->pts, avctx->time_base, AV_TIME_BASE_Q); - decoded_frame_tb = avctx->time_base; - } else if (decoded_frame->pkt_pts != AV_NOPTS_VALUE) { - decoded_frame->pts = decoded_frame->pkt_pts; - decoded_frame_tb = ist->st->time_base; - } else if (pkt->pts != AV_NOPTS_VALUE) { - decoded_frame->pts = pkt->pts; - decoded_frame_tb = ist->st->time_base; - }else { - decoded_frame->pts = ist->dts; - decoded_frame_tb = AV_TIME_BASE_Q; - } - pkt->pts = AV_NOPTS_VALUE; - if (decoded_frame->pts != AV_NOPTS_VALUE) - decoded_frame->pts = av_rescale_delta(decoded_frame_tb, decoded_frame->pts, - (AVRational){1, ist->st->codec->sample_rate}, decoded_frame->nb_samples, &ist->filter_in_rescale_delta_last, - (AVRational){1, ist->st->codec->sample_rate}); - for (i = 0; i < ist->nb_filters; i++) { - if (i < ist->nb_filters - 1) { - f = ist->filter_frame; - err = av_frame_ref(f, decoded_frame); - if (err < 0) - break; - } else - f = decoded_frame; - err = av_buffersrc_add_frame_flags(ist->filters[i]->filter, f, - AV_BUFFERSRC_FLAG_PUSH); - if (err == AVERROR_EOF) - err = 0; /* ignore */ - if (err < 0) - break; - } - decoded_frame->pts = AV_NOPTS_VALUE; - - av_frame_unref(ist->filter_frame); - av_frame_unref(decoded_frame); - return err < 0 ? err : ret; -} - -static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output) -{ - AVFrame *decoded_frame, *f; - int i, ret = 0, err = 0, resample_changed; - int64_t best_effort_timestamp; - AVRational *frame_sample_aspect; - - if (!ist->decoded_frame && !(ist->decoded_frame = av_frame_alloc())) - return AVERROR(ENOMEM); - if (!ist->filter_frame && !(ist->filter_frame = av_frame_alloc())) - return AVERROR(ENOMEM); - decoded_frame = ist->decoded_frame; - pkt->dts = av_rescale_q(ist->dts, AV_TIME_BASE_Q, ist->st->time_base); - - update_benchmark(NULL); - ret = avcodec_decode_video2(ist->st->codec, - decoded_frame, got_output, pkt); - update_benchmark("decode_video %d.%d", ist->file_index, ist->st->index); - - if (*got_output || ret<0 || pkt->size) - decode_error_stat[ret<0] ++; - - if (!*got_output || ret < 0) { - if (!pkt->size) { - for (i = 0; i < ist->nb_filters; i++) -#if 1 - av_buffersrc_add_ref(ist->filters[i]->filter, NULL, 0); -#else - av_buffersrc_add_frame(ist->filters[i]->filter, NULL); -#endif - } - return ret; - } - - if(ist->top_field_first>=0) - decoded_frame->top_field_first = ist->top_field_first; - - ist->frames_decoded++; - - if (ist->hwaccel_retrieve_data && decoded_frame->format == ist->hwaccel_pix_fmt) { - err = ist->hwaccel_retrieve_data(ist->st->codec, decoded_frame); - if (err < 0) - goto fail; - } - ist->hwaccel_retrieved_pix_fmt = decoded_frame->format; - - best_effort_timestamp= av_frame_get_best_effort_timestamp(decoded_frame); - if(best_effort_timestamp != AV_NOPTS_VALUE) - ist->next_pts = ist->pts = av_rescale_q(decoded_frame->pts = best_effort_timestamp, ist->st->time_base, AV_TIME_BASE_Q); - - if (debug_ts) { - av_log(NULL, AV_LOG_INFO, "decoder -> ist_index:%d type:video " - "frame_pts:%s frame_pts_time:%s best_effort_ts:%"PRId64" best_effort_ts_time:%s keyframe:%d frame_type:%d time_base:%d/%d\n", - ist->st->index, av_ts2str(decoded_frame->pts), - av_ts2timestr(decoded_frame->pts, &ist->st->time_base), - best_effort_timestamp, - av_ts2timestr(best_effort_timestamp, &ist->st->time_base), - decoded_frame->key_frame, decoded_frame->pict_type, - ist->st->time_base.num, ist->st->time_base.den); - } - - pkt->size = 0; - - if (ist->st->sample_aspect_ratio.num) - decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; - - resample_changed = ist->resample_width != decoded_frame->width || - ist->resample_height != decoded_frame->height || - ist->resample_pix_fmt != decoded_frame->format; - if (resample_changed) { - av_log(NULL, AV_LOG_INFO, - "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n", - ist->file_index, ist->st->index, - ist->resample_width, ist->resample_height, av_get_pix_fmt_name(ist->resample_pix_fmt), - decoded_frame->width, decoded_frame->height, av_get_pix_fmt_name(decoded_frame->format)); - - ist->resample_width = decoded_frame->width; - ist->resample_height = decoded_frame->height; - ist->resample_pix_fmt = decoded_frame->format; - - for (i = 0; i < nb_filtergraphs; i++) { - if (ist_in_filtergraph(filtergraphs[i], ist) && ist->reinit_filters && - configure_filtergraph(filtergraphs[i]) < 0) { - av_log(NULL, AV_LOG_FATAL, "Error reinitializing filters!\n"); - exit_program(1); - } - } - } - - frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); - for (i = 0; i < ist->nb_filters; i++) { - if (!frame_sample_aspect->num) - *frame_sample_aspect = ist->st->sample_aspect_ratio; - - if (i < ist->nb_filters - 1) { - f = ist->filter_frame; - err = av_frame_ref(f, decoded_frame); - if (err < 0) - break; - } else - f = decoded_frame; - ret = av_buffersrc_add_frame_flags(ist->filters[i]->filter, f, AV_BUFFERSRC_FLAG_PUSH); - if (ret == AVERROR_EOF) { - ret = 0; /* ignore */ - } else if (ret < 0) { - av_log(NULL, AV_LOG_FATAL, - "Failed to inject frame into filter network: %s\n", av_err2str(ret)); - exit_program(1); - } - } - -fail: - av_frame_unref(ist->filter_frame); - av_frame_unref(decoded_frame); - return err < 0 ? err : ret; -} - -static int transcode_subtitles(InputStream *ist, AVPacket *pkt, int *got_output) -{ - AVSubtitle subtitle; - int i, ret = avcodec_decode_subtitle2(ist->st->codec, - &subtitle, got_output, pkt); - - if (*got_output || ret<0 || pkt->size) - decode_error_stat[ret<0] ++; - - if (ret < 0 || !*got_output) { - if (!pkt->size) - sub2video_flush(ist); - return ret; - } - - if (ist->fix_sub_duration) { - int end = 1; - if (ist->prev_sub.got_output) { - end = av_rescale(subtitle.pts - ist->prev_sub.subtitle.pts, - 1000, AV_TIME_BASE); - if (end < ist->prev_sub.subtitle.end_display_time) { - av_log(ist->st->codec, AV_LOG_DEBUG, - "Subtitle duration reduced from %d to %d%s\n", - ist->prev_sub.subtitle.end_display_time, end, - end <= 0 ? ", dropping it" : ""); - ist->prev_sub.subtitle.end_display_time = end; - } - } - FFSWAP(int, *got_output, ist->prev_sub.got_output); - FFSWAP(int, ret, ist->prev_sub.ret); - FFSWAP(AVSubtitle, subtitle, ist->prev_sub.subtitle); - if (end <= 0) - goto out; - } - - if (!*got_output) - return ret; - - sub2video_update(ist, &subtitle); - - if (!subtitle.num_rects) - goto out; - - ist->frames_decoded++; - - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - - if (!check_output_constraints(ist, ost) || !ost->encoding_needed - || ost->enc->type != AVMEDIA_TYPE_SUBTITLE) - continue; - - do_subtitle_out(output_files[ost->file_index]->ctx, ost, ist, &subtitle); - } - -out: - avsubtitle_free(&subtitle); - return ret; -} - -/* pkt = NULL means EOF (needed to flush decoder buffers) */ -static int output_packet(InputStream *ist, const AVPacket *pkt) -{ - int ret = 0, i; - int got_output = 0; - - AVPacket avpkt; - if (!ist->saw_first_ts) { - ist->dts = ist->st->avg_frame_rate.num ? - ist->st->codec->has_b_frames * AV_TIME_BASE / av_q2d(ist->st->avg_frame_rate) : 0; - ist->pts = 0; - if (pkt != NULL && pkt->pts != AV_NOPTS_VALUE && !ist->decoding_needed) { - ist->dts += av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); - ist->pts = ist->dts; //unused but better to set it to a value thats not totally wrong - } - ist->saw_first_ts = 1; - } - - if (ist->next_dts == AV_NOPTS_VALUE) - ist->next_dts = ist->dts; - if (ist->next_pts == AV_NOPTS_VALUE) - ist->next_pts = ist->pts; - - if (pkt == NULL) { - /* EOF handling */ - av_init_packet(&avpkt); - avpkt.data = NULL; - avpkt.size = 0; - goto handle_eof; - } else { - avpkt = *pkt; - } - - if (pkt->dts != AV_NOPTS_VALUE) { - ist->next_dts = ist->dts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); - if (ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO || !ist->decoding_needed) - ist->next_pts = ist->pts = ist->dts; - } - - // while we have more to decode or while the decoder did output something on EOF - while (ist->decoding_needed && (avpkt.size > 0 || (!pkt && got_output))) { - int duration; - handle_eof: - - ist->pts = ist->next_pts; - ist->dts = ist->next_dts; - - if (avpkt.size && avpkt.size != pkt->size && - !(ist->dec->capabilities & CODEC_CAP_SUBFRAMES)) { - av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING, - "Multiple frames in a packet from stream %d\n", pkt->stream_index); - ist->showed_multi_packet_warning = 1; - } - - switch (ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - ret = decode_audio (ist, &avpkt, &got_output); - break; - case AVMEDIA_TYPE_VIDEO: - ret = decode_video (ist, &avpkt, &got_output); - if (avpkt.duration) { - duration = av_rescale_q(avpkt.duration, ist->st->time_base, AV_TIME_BASE_Q); - } else if(ist->st->codec->time_base.num != 0 && ist->st->codec->time_base.den != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; - duration = ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } else - duration = 0; - - if(ist->dts != AV_NOPTS_VALUE && duration) { - ist->next_dts += duration; - }else - ist->next_dts = AV_NOPTS_VALUE; - - if (got_output) - ist->next_pts += duration; //FIXME the duration is not correct in some cases - break; - case AVMEDIA_TYPE_SUBTITLE: - ret = transcode_subtitles(ist, &avpkt, &got_output); - break; - default: - return -1; - } - - if (ret < 0) - return ret; - - avpkt.dts= - avpkt.pts= AV_NOPTS_VALUE; - - // touch data and size only if not EOF - if (pkt) { - if(ist->st->codec->codec_type != AVMEDIA_TYPE_AUDIO) - ret = avpkt.size; - avpkt.data += ret; - avpkt.size -= ret; - } - if (!got_output) { - continue; - } - } - - /* handle stream copy */ - if (!ist->decoding_needed) { - ist->dts = ist->next_dts; - switch (ist->st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - ist->next_dts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) / - ist->st->codec->sample_rate; - break; - case AVMEDIA_TYPE_VIDEO: - if (ist->framerate.num) { - // TODO: Remove work-around for c99-to-c89 issue 7 - AVRational time_base_q = AV_TIME_BASE_Q; - int64_t next_dts = av_rescale_q(ist->next_dts, time_base_q, av_inv_q(ist->framerate)); - ist->next_dts = av_rescale_q(next_dts + 1, av_inv_q(ist->framerate), time_base_q); - } else if (pkt->duration) { - ist->next_dts += av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); - } else if(ist->st->codec->time_base.num != 0) { - int ticks= ist->st->parser ? ist->st->parser->repeat_pict + 1 : ist->st->codec->ticks_per_frame; - ist->next_dts += ((int64_t)AV_TIME_BASE * - ist->st->codec->time_base.num * ticks) / - ist->st->codec->time_base.den; - } - break; - } - ist->pts = ist->dts; - ist->next_pts = ist->next_dts; - } - for (i = 0; pkt && i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - - if (!check_output_constraints(ist, ost) || ost->encoding_needed) - continue; - - do_streamcopy(ist, ost, pkt); - } - - return 0; -} - -static void print_sdp(void) -{ - char sdp[16384]; - int i; - AVFormatContext **avc = av_malloc_array(nb_output_files, sizeof(*avc)); - - if (!avc) - exit_program(1); - for (i = 0; i < nb_output_files; i++) - avc[i] = output_files[i]->ctx; - - av_sdp_create(avc, nb_output_files, sdp, sizeof(sdp)); - printf("SDP:\n%s\n", sdp); - fflush(stdout); - av_freep(&avc); -} - -static const HWAccel *get_hwaccel(enum AVPixelFormat pix_fmt) -{ - int i; - for (i = 0; hwaccels[i].name; i++) - if (hwaccels[i].pix_fmt == pix_fmt) - return &hwaccels[i]; - return NULL; -} - -static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) -{ - InputStream *ist = s->opaque; - const enum AVPixelFormat *p; - int ret; - - for (p = pix_fmts; *p != -1; p++) { - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); - const HWAccel *hwaccel; - - if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) - break; - - hwaccel = get_hwaccel(*p); - if (!hwaccel || - (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || - (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) - continue; - - ret = hwaccel->init(s); - if (ret < 0) { - if (ist->hwaccel_id == hwaccel->id) { - av_log(NULL, AV_LOG_FATAL, - "%s hwaccel requested for input stream #%d:%d, " - "but cannot be initialized.\n", hwaccel->name, - ist->file_index, ist->st->index); - exit_program(1); - } - continue; - } - ist->active_hwaccel_id = hwaccel->id; - ist->hwaccel_pix_fmt = *p; - break; - } - - return *p; -} - -static int get_buffer(AVCodecContext *s, AVFrame *frame, int flags) -{ - InputStream *ist = s->opaque; - - if (ist->hwaccel_get_buffer && frame->format == ist->hwaccel_pix_fmt) - return ist->hwaccel_get_buffer(s, frame, flags); - - return avcodec_default_get_buffer2(s, frame, flags); -} - -static int init_input_stream(int ist_index, char *error, int error_len) -{ - int ret; - InputStream *ist = input_streams[ist_index]; - - if (ist->decoding_needed) { - AVCodec *codec = ist->dec; - if (!codec) { - snprintf(error, error_len, "Decoder (codec %s) not found for input stream #%d:%d", - avcodec_get_name(ist->st->codec->codec_id), ist->file_index, ist->st->index); - return AVERROR(EINVAL); - } - - ist->st->codec->opaque = ist; - ist->st->codec->get_format = get_format; - ist->st->codec->get_buffer2 = get_buffer; - ist->st->codec->thread_safe_callbacks = 1; - - av_opt_set_int(ist->st->codec, "refcounted_frames", 1, 0); - - if (!av_dict_get(ist->decoder_opts, "threads", NULL, 0)) - av_dict_set(&ist->decoder_opts, "threads", "auto", 0); - if ((ret = avcodec_open2(ist->st->codec, codec, &ist->decoder_opts)) < 0) { - if (ret == AVERROR_EXPERIMENTAL) - abort_codec_experimental(codec, 0); - - snprintf(error, error_len, - "Error while opening decoder for input stream " - "#%d:%d : %s", - ist->file_index, ist->st->index, av_err2str(ret)); - return ret; - } - assert_avoptions(ist->decoder_opts); - } - - ist->next_pts = AV_NOPTS_VALUE; - ist->next_dts = AV_NOPTS_VALUE; - - return 0; -} - -static InputStream *get_input_stream(OutputStream *ost) -{ - if (ost->source_index >= 0) - return input_streams[ost->source_index]; - return NULL; -} - -static int compare_int64(const void *a, const void *b) -{ - int64_t va = *(int64_t *)a, vb = *(int64_t *)b; - return va < vb ? -1 : va > vb ? +1 : 0; -} - -static void parse_forced_key_frames(char *kf, OutputStream *ost, - AVCodecContext *avctx) -{ - char *p; - int n = 1, i, size, index = 0; - int64_t t, *pts; - - for (p = kf; *p; p++) - if (*p == ',') - n++; - size = n; - pts = av_malloc_array(size, sizeof(*pts)); - if (!pts) { - av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); - exit_program(1); - } - - p = kf; - for (i = 0; i < n; i++) { - char *next = strchr(p, ','); - - if (next) - *next++ = 0; - - if (!memcmp(p, "chapters", 8)) { - - AVFormatContext *avf = output_files[ost->file_index]->ctx; - int j; - - if (avf->nb_chapters > INT_MAX - size || - !(pts = av_realloc_f(pts, size += avf->nb_chapters - 1, - sizeof(*pts)))) { - av_log(NULL, AV_LOG_FATAL, - "Could not allocate forced key frames array.\n"); - exit_program(1); - } - t = p[8] ? parse_time_or_die("force_key_frames", p + 8, 1) : 0; - t = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); - - for (j = 0; j < avf->nb_chapters; j++) { - AVChapter *c = avf->chapters[j]; - av_assert1(index < size); - pts[index++] = av_rescale_q(c->start, c->time_base, - avctx->time_base) + t; - } - - } else { - - t = parse_time_or_die("force_key_frames", p, 1); - av_assert1(index < size); - pts[index++] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); - - } - - p = next; - } - - av_assert0(index == size); - qsort(pts, size, sizeof(*pts), compare_int64); - ost->forced_kf_count = size; - ost->forced_kf_pts = pts; -} - -static void report_new_stream(int input_index, AVPacket *pkt) -{ - InputFile *file = input_files[input_index]; - AVStream *st = file->ctx->streams[pkt->stream_index]; - - if (pkt->stream_index < file->nb_streams_warn) - return; - av_log(file->ctx, AV_LOG_WARNING, - "New %s stream %d:%d at pos:%"PRId64" and DTS:%ss\n", - av_get_media_type_string(st->codec->codec_type), - input_index, pkt->stream_index, - pkt->pos, av_ts2timestr(pkt->dts, &st->time_base)); - file->nb_streams_warn = pkt->stream_index + 1; -} - -static void set_encoder_id(OutputFile *of, OutputStream *ost) -{ - AVDictionaryEntry *e; - - uint8_t *encoder_string; - int encoder_string_len; - int format_flags = 0; - int codec_flags = 0; - - if (av_dict_get(ost->st->metadata, "encoder", NULL, 0)) - return; - - e = av_dict_get(of->opts, "fflags", NULL, 0); - if (e) { - const AVOption *o = av_opt_find(of->ctx, "fflags", NULL, 0, 0); - if (!o) - return; - av_opt_eval_flags(of->ctx, o, e->value, &format_flags); - } - e = av_dict_get(ost->encoder_opts, "flags", NULL, 0); - if (e) { - const AVOption *o = av_opt_find(ost->st->codec, "flags", NULL, 0, 0); - if (!o) - return; - av_opt_eval_flags(ost->st->codec, o, e->value, &codec_flags); - } - - encoder_string_len = sizeof(LIBAVCODEC_IDENT) + strlen(ost->enc->name) + 2; - encoder_string = av_mallocz(encoder_string_len); - if (!encoder_string) - exit_program(1); - - if (!(format_flags & AVFMT_FLAG_BITEXACT) && !(codec_flags & CODEC_FLAG_BITEXACT)) - av_strlcpy(encoder_string, LIBAVCODEC_IDENT " ", encoder_string_len); - else - av_strlcpy(encoder_string, "Lavc ", encoder_string_len); - av_strlcat(encoder_string, ost->enc->name, encoder_string_len); - av_dict_set(&ost->st->metadata, "encoder", encoder_string, - AV_DICT_DONT_STRDUP_VAL | AV_DICT_DONT_OVERWRITE); -} - -static int transcode_init(void) -{ - int ret = 0, i, j, k; - AVFormatContext *oc; - OutputStream *ost; - InputStream *ist; - char error[1024]; - int want_sdp = 1; - - for (i = 0; i < nb_filtergraphs; i++) { - FilterGraph *fg = filtergraphs[i]; - for (j = 0; j < fg->nb_outputs; j++) { - OutputFilter *ofilter = fg->outputs[j]; - if (!ofilter->ost || ofilter->ost->source_index >= 0) - continue; - if (fg->nb_inputs != 1) - continue; - for (k = nb_input_streams-1; k >= 0 ; k--) - if (fg->inputs[0]->ist == input_streams[k]) - break; - ofilter->ost->source_index = k; - } - } - - /* init framerate emulation */ - for (i = 0; i < nb_input_files; i++) { - InputFile *ifile = input_files[i]; - if (ifile->rate_emu) - for (j = 0; j < ifile->nb_streams; j++) - input_streams[j + ifile->ist_index]->start = av_gettime_relative(); - } - - /* output stream init */ - for (i = 0; i < nb_output_files; i++) { - oc = output_files[i]->ctx; - if (!oc->nb_streams && !(oc->oformat->flags & AVFMT_NOSTREAMS)) { - av_dump_format(oc, i, oc->filename, 1); - av_log(NULL, AV_LOG_ERROR, "Output file #%d does not contain any stream\n", i); - return AVERROR(EINVAL); - } - } - - /* init complex filtergraphs */ - for (i = 0; i < nb_filtergraphs; i++) - if ((ret = avfilter_graph_config(filtergraphs[i]->graph, NULL)) < 0) - return ret; - - /* for each output stream, we compute the right encoding parameters */ - for (i = 0; i < nb_output_streams; i++) { - AVCodecContext *enc_ctx; - AVCodecContext *dec_ctx = NULL; - ost = output_streams[i]; - oc = output_files[ost->file_index]->ctx; - ist = get_input_stream(ost); - - if (ost->attachment_filename) - continue; - - enc_ctx = ost->st->codec; - - if (ist) { - dec_ctx = ist->st->codec; - - ost->st->disposition = ist->st->disposition; - enc_ctx->bits_per_raw_sample = dec_ctx->bits_per_raw_sample; - enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location; - } else { - for (j=0; jnb_streams; j++) { - AVStream *st = oc->streams[j]; - if (st != ost->st && st->codec->codec_type == enc_ctx->codec_type) - break; - } - if (j == oc->nb_streams) - if (enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO || enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) - ost->st->disposition = AV_DISPOSITION_DEFAULT; - } - - if (ost->stream_copy) { - AVRational sar; - uint64_t extra_size; - - av_assert0(ist && !ost->filter); - - extra_size = (uint64_t)dec_ctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; - - if (extra_size > INT_MAX) { - return AVERROR(EINVAL); - } - - /* if stream_copy is selected, no need to decode or encode */ - enc_ctx->codec_id = dec_ctx->codec_id; - enc_ctx->codec_type = dec_ctx->codec_type; - - if (!enc_ctx->codec_tag) { - unsigned int codec_tag; - if (!oc->oformat->codec_tag || - av_codec_get_id (oc->oformat->codec_tag, dec_ctx->codec_tag) == enc_ctx->codec_id || - !av_codec_get_tag2(oc->oformat->codec_tag, dec_ctx->codec_id, &codec_tag)) - enc_ctx->codec_tag = dec_ctx->codec_tag; - } - - enc_ctx->bit_rate = dec_ctx->bit_rate; - enc_ctx->rc_max_rate = dec_ctx->rc_max_rate; - enc_ctx->rc_buffer_size = dec_ctx->rc_buffer_size; - enc_ctx->field_order = dec_ctx->field_order; - enc_ctx->extradata = av_mallocz(extra_size); - if (!enc_ctx->extradata) { - return AVERROR(ENOMEM); - } - memcpy(enc_ctx->extradata, dec_ctx->extradata, dec_ctx->extradata_size); - enc_ctx->extradata_size= dec_ctx->extradata_size; - enc_ctx->bits_per_coded_sample = dec_ctx->bits_per_coded_sample; - - enc_ctx->time_base = ist->st->time_base; - /* - * Avi is a special case here because it supports variable fps but - * having the fps and timebase differe significantly adds quite some - * overhead - */ - if(!strcmp(oc->oformat->name, "avi")) { - if ( copy_tb<0 && av_q2d(ist->st->r_frame_rate) >= av_q2d(ist->st->avg_frame_rate) - && 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(ist->st->time_base) - && 0.5/av_q2d(ist->st->r_frame_rate) > av_q2d(dec_ctx->time_base) - && av_q2d(ist->st->time_base) < 1.0/500 && av_q2d(dec_ctx->time_base) < 1.0/500 - || copy_tb==2){ - enc_ctx->time_base.num = ist->st->r_frame_rate.den; - enc_ctx->time_base.den = 2*ist->st->r_frame_rate.num; - enc_ctx->ticks_per_frame = 2; - } else if ( copy_tb<0 && av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > 2*av_q2d(ist->st->time_base) - && av_q2d(ist->st->time_base) < 1.0/500 - || copy_tb==0){ - enc_ctx->time_base = dec_ctx->time_base; - enc_ctx->time_base.num *= dec_ctx->ticks_per_frame; - enc_ctx->time_base.den *= 2; - enc_ctx->ticks_per_frame = 2; - } - } else if(!(oc->oformat->flags & AVFMT_VARIABLE_FPS) - && strcmp(oc->oformat->name, "mov") && strcmp(oc->oformat->name, "mp4") && strcmp(oc->oformat->name, "3gp") - && strcmp(oc->oformat->name, "3g2") && strcmp(oc->oformat->name, "psp") && strcmp(oc->oformat->name, "ipod") - && strcmp(oc->oformat->name, "f4v") - ) { - if( copy_tb<0 && dec_ctx->time_base.den - && av_q2d(dec_ctx->time_base)*dec_ctx->ticks_per_frame > av_q2d(ist->st->time_base) - && av_q2d(ist->st->time_base) < 1.0/500 - || copy_tb==0){ - enc_ctx->time_base = dec_ctx->time_base; - enc_ctx->time_base.num *= dec_ctx->ticks_per_frame; - } - } - if ( enc_ctx->codec_tag == AV_RL32("tmcd") - && dec_ctx->time_base.num < dec_ctx->time_base.den - && dec_ctx->time_base.num > 0 - && 121LL*dec_ctx->time_base.num > dec_ctx->time_base.den) { - enc_ctx->time_base = dec_ctx->time_base; - } - - if (ist && !ost->frame_rate.num) - ost->frame_rate = ist->framerate; - if(ost->frame_rate.num) - enc_ctx->time_base = av_inv_q(ost->frame_rate); - - av_reduce(&enc_ctx->time_base.num, &enc_ctx->time_base.den, - enc_ctx->time_base.num, enc_ctx->time_base.den, INT_MAX); - - ost->parser = av_parser_init(enc_ctx->codec_id); - - switch (enc_ctx->codec_type) { - case AVMEDIA_TYPE_AUDIO: - if (audio_volume != 256) { - av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); - exit_program(1); - } - enc_ctx->channel_layout = dec_ctx->channel_layout; - enc_ctx->sample_rate = dec_ctx->sample_rate; - enc_ctx->channels = dec_ctx->channels; - enc_ctx->frame_size = dec_ctx->frame_size; - enc_ctx->audio_service_type = dec_ctx->audio_service_type; - enc_ctx->block_align = dec_ctx->block_align; - enc_ctx->delay = dec_ctx->delay; - if((enc_ctx->block_align == 1 || enc_ctx->block_align == 1152 || enc_ctx->block_align == 576) && enc_ctx->codec_id == AV_CODEC_ID_MP3) - enc_ctx->block_align= 0; - if(enc_ctx->codec_id == AV_CODEC_ID_AC3) - enc_ctx->block_align= 0; - break; - case AVMEDIA_TYPE_VIDEO: - enc_ctx->pix_fmt = dec_ctx->pix_fmt; - enc_ctx->width = dec_ctx->width; - enc_ctx->height = dec_ctx->height; - enc_ctx->has_b_frames = dec_ctx->has_b_frames; - if (ost->frame_aspect_ratio.num) { // overridden by the -aspect cli option - sar = - av_mul_q(ost->frame_aspect_ratio, - (AVRational){ enc_ctx->height, enc_ctx->width }); - av_log(NULL, AV_LOG_WARNING, "Overriding aspect ratio " - "with stream copy may produce invalid files\n"); - } - else if (ist->st->sample_aspect_ratio.num) - sar = ist->st->sample_aspect_ratio; - else - sar = dec_ctx->sample_aspect_ratio; - ost->st->sample_aspect_ratio = enc_ctx->sample_aspect_ratio = sar; - ost->st->avg_frame_rate = ist->st->avg_frame_rate; - break; - case AVMEDIA_TYPE_SUBTITLE: - enc_ctx->width = dec_ctx->width; - enc_ctx->height = dec_ctx->height; - break; - case AVMEDIA_TYPE_DATA: - case AVMEDIA_TYPE_ATTACHMENT: - break; - default: - abort(); - } - } else { - if (!ost->enc) - ost->enc = avcodec_find_encoder(enc_ctx->codec_id); - if (!ost->enc) { - /* should only happen when a default codec is not present. */ - snprintf(error, sizeof(error), "Encoder (codec %s) not found for output stream #%d:%d", - avcodec_get_name(ost->st->codec->codec_id), ost->file_index, ost->index); - ret = AVERROR(EINVAL); - goto dump_format; - } - - if (ist) - ist->decoding_needed++; - ost->encoding_needed = 1; - - set_encoder_id(output_files[ost->file_index], ost); - - if (!ost->filter && - (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO || - enc_ctx->codec_type == AVMEDIA_TYPE_AUDIO)) { - FilterGraph *fg; - fg = init_simple_filtergraph(ist, ost); - if (configure_filtergraph(fg)) { - av_log(NULL, AV_LOG_FATAL, "Error opening filters!\n"); - exit_program(1); - } - } - - if (enc_ctx->codec_type == AVMEDIA_TYPE_VIDEO) { - if (ost->filter && !ost->frame_rate.num) - ost->frame_rate = av_buffersink_get_frame_rate(ost->filter->filter); - if (ist && !ost->frame_rate.num) - ost->frame_rate = ist->framerate; - if (ist && !ost->frame_rate.num) - ost->frame_rate = ist->st->r_frame_rate; - if (ist && !ost->frame_rate.num) { - ost->frame_rate = (AVRational){25, 1}; - av_log(NULL, AV_LOG_WARNING, - "No information " - "about the input framerate is available. Falling " - "back to a default value of 25fps for output stream #%d:%d. Use the -r option " - "if you want a different framerate.\n", - ost->file_index, ost->index); - } -// ost->frame_rate = ist->st->avg_frame_rate.num ? ist->st->avg_frame_rate : (AVRational){25, 1}; - if (ost->enc && ost->enc->supported_framerates && !ost->force_fps) { - int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); - ost->frame_rate = ost->enc->supported_framerates[idx]; - } - if (enc_ctx->codec_id == AV_CODEC_ID_MPEG4) { - av_reduce(&ost->frame_rate.num, &ost->frame_rate.den, - ost->frame_rate.num, ost->frame_rate.den, 65535); - } - } - - switch (enc_ctx->codec_type) { - case AVMEDIA_TYPE_AUDIO: - enc_ctx->sample_fmt = ost->filter->filter->inputs[0]->format; - enc_ctx->sample_rate = ost->filter->filter->inputs[0]->sample_rate; - enc_ctx->channel_layout = ost->filter->filter->inputs[0]->channel_layout; - enc_ctx->channels = avfilter_link_get_channels(ost->filter->filter->inputs[0]); - enc_ctx->time_base = (AVRational){ 1, enc_ctx->sample_rate }; - break; - case AVMEDIA_TYPE_VIDEO: - enc_ctx->time_base = av_inv_q(ost->frame_rate); - if (ost->filter && !(enc_ctx->time_base.num && enc_ctx->time_base.den)) - enc_ctx->time_base = ost->filter->filter->inputs[0]->time_base; - if ( av_q2d(enc_ctx->time_base) < 0.001 && video_sync_method != VSYNC_PASSTHROUGH - && (video_sync_method == VSYNC_CFR || video_sync_method == VSYNC_VSCFR || (video_sync_method == VSYNC_AUTO && !(oc->oformat->flags & AVFMT_VARIABLE_FPS)))){ - av_log(oc, AV_LOG_WARNING, "Frame rate very high for a muxer not efficiently supporting it.\n" - "Please consider specifying a lower framerate, a different muxer or -vsync 2\n"); - } - for (j = 0; j < ost->forced_kf_count; j++) - ost->forced_kf_pts[j] = av_rescale_q(ost->forced_kf_pts[j], - AV_TIME_BASE_Q, - enc_ctx->time_base); - - enc_ctx->width = ost->filter->filter->inputs[0]->w; - enc_ctx->height = ost->filter->filter->inputs[0]->h; - enc_ctx->sample_aspect_ratio = ost->st->sample_aspect_ratio = - ost->frame_aspect_ratio.num ? // overridden by the -aspect cli option - av_mul_q(ost->frame_aspect_ratio, (AVRational){ enc_ctx->height, enc_ctx->width }) : - ost->filter->filter->inputs[0]->sample_aspect_ratio; - if (!strncmp(ost->enc->name, "libx264", 7) && - enc_ctx->pix_fmt == AV_PIX_FMT_NONE && - ost->filter->filter->inputs[0]->format != AV_PIX_FMT_YUV420P) - av_log(NULL, AV_LOG_WARNING, - "No pixel format specified, %s for H.264 encoding chosen.\n" - "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", - av_get_pix_fmt_name(ost->filter->filter->inputs[0]->format)); - if (!strncmp(ost->enc->name, "mpeg2video", 10) && - enc_ctx->pix_fmt == AV_PIX_FMT_NONE && - ost->filter->filter->inputs[0]->format != AV_PIX_FMT_YUV420P) - av_log(NULL, AV_LOG_WARNING, - "No pixel format specified, %s for MPEG-2 encoding chosen.\n" - "Use -pix_fmt yuv420p for compatibility with outdated media players.\n", - av_get_pix_fmt_name(ost->filter->filter->inputs[0]->format)); - enc_ctx->pix_fmt = ost->filter->filter->inputs[0]->format; - - ost->st->avg_frame_rate = ost->frame_rate; - - if (!dec_ctx || - enc_ctx->width != dec_ctx->width || - enc_ctx->height != dec_ctx->height || - enc_ctx->pix_fmt != dec_ctx->pix_fmt) { - enc_ctx->bits_per_raw_sample = frame_bits_per_raw_sample; - } - - if (ost->forced_keyframes) { - if (!strncmp(ost->forced_keyframes, "expr:", 5)) { - ret = av_expr_parse(&ost->forced_keyframes_pexpr, ost->forced_keyframes+5, - forced_keyframes_const_names, NULL, NULL, NULL, NULL, 0, NULL); - if (ret < 0) { - av_log(NULL, AV_LOG_ERROR, - "Invalid force_key_frames expression '%s'\n", ost->forced_keyframes+5); - return ret; - } - ost->forced_keyframes_expr_const_values[FKF_N] = 0; - ost->forced_keyframes_expr_const_values[FKF_N_FORCED] = 0; - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = NAN; - ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = NAN; - } else { - parse_forced_key_frames(ost->forced_keyframes, ost, ost->st->codec); - } - } - break; - case AVMEDIA_TYPE_SUBTITLE: - enc_ctx->time_base = (AVRational){1, 1000}; - if (!enc_ctx->width) { - enc_ctx->width = input_streams[ost->source_index]->st->codec->width; - enc_ctx->height = input_streams[ost->source_index]->st->codec->height; - } - break; - default: - abort(); - break; - } - /* two pass mode */ - if (enc_ctx->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) { - char logfilename[1024]; - FILE *f; - - snprintf(logfilename, sizeof(logfilename), "%s-%d.log", - ost->logfile_prefix ? ost->logfile_prefix : - DEFAULT_PASS_LOGFILENAME_PREFIX, - i); - if (!strcmp(ost->enc->name, "libx264")) { - av_dict_set(&ost->encoder_opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE); - } else { - if (enc_ctx->flags & CODEC_FLAG_PASS2) { - char *logbuffer; - size_t logbuffer_size; - if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { - av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n", - logfilename); - exit_program(1); - } - enc_ctx->stats_in = logbuffer; - } - if (enc_ctx->flags & CODEC_FLAG_PASS1) { - f = av_fopen_utf8(logfilename, "wb"); - if (!f) { - av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n", - logfilename, strerror(errno)); - exit_program(1); - } - ost->logfile = f; - } - } - } - } - } - - /* open each encoder */ - for (i = 0; i < nb_output_streams; i++) { - ost = output_streams[i]; - if (ost->encoding_needed) { - AVCodec *codec = ost->enc; - AVCodecContext *dec = NULL; - - if ((ist = get_input_stream(ost))) - dec = ist->st->codec; - if (dec && dec->subtitle_header) { - /* ASS code assumes this buffer is null terminated so add extra byte. */ - ost->st->codec->subtitle_header = av_mallocz(dec->subtitle_header_size + 1); - if (!ost->st->codec->subtitle_header) { - ret = AVERROR(ENOMEM); - goto dump_format; - } - memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size); - ost->st->codec->subtitle_header_size = dec->subtitle_header_size; - } - if (!av_dict_get(ost->encoder_opts, "threads", NULL, 0)) - av_dict_set(&ost->encoder_opts, "threads", "auto", 0); - if ((ret = avcodec_open2(ost->st->codec, codec, &ost->encoder_opts)) < 0) { - if (ret == AVERROR_EXPERIMENTAL) - abort_codec_experimental(codec, 1); - snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height", - ost->file_index, ost->index); - goto dump_format; - } - if (ost->enc->type == AVMEDIA_TYPE_AUDIO && - !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) - av_buffersink_set_frame_size(ost->filter->filter, - ost->st->codec->frame_size); - assert_avoptions(ost->encoder_opts); - if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000) - av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low." - " It takes bits/s as argument, not kbits/s\n"); - } else { - av_opt_set_dict(ost->st->codec, &ost->encoder_opts); - } - } - - /* init input streams */ - for (i = 0; i < nb_input_streams; i++) - if ((ret = init_input_stream(i, error, sizeof(error))) < 0) { - for (i = 0; i < nb_output_streams; i++) { - ost = output_streams[i]; - avcodec_close(ost->st->codec); - } - goto dump_format; - } - - /* discard unused programs */ - for (i = 0; i < nb_input_files; i++) { - InputFile *ifile = input_files[i]; - for (j = 0; j < ifile->ctx->nb_programs; j++) { - AVProgram *p = ifile->ctx->programs[j]; - int discard = AVDISCARD_ALL; - - for (k = 0; k < p->nb_stream_indexes; k++) - if (!input_streams[ifile->ist_index + p->stream_index[k]]->discard) { - discard = AVDISCARD_DEFAULT; - break; - } - p->discard = discard; - } - } - - /* open files and write file headers */ - for (i = 0; i < nb_output_files; i++) { - oc = output_files[i]->ctx; - oc->interrupt_callback = int_cb; - if ((ret = avformat_write_header(oc, &output_files[i]->opts)) < 0) { - snprintf(error, sizeof(error), - "Could not write header for output file #%d " - "(incorrect codec parameters ?): %s", - i, av_err2str(ret)); - ret = AVERROR(EINVAL); - goto dump_format; - } -// assert_avoptions(output_files[i]->opts); - if (strcmp(oc->oformat->name, "rtp")) { - want_sdp = 0; - } - } - - dump_format: - /* dump the file output parameters - cannot be done before in case - of stream copy */ - for (i = 0; i < nb_output_files; i++) { - av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1); - } - - /* dump the stream mapping */ - av_log(NULL, AV_LOG_INFO, "Stream mapping:\n"); - for (i = 0; i < nb_input_streams; i++) { - ist = input_streams[i]; - - for (j = 0; j < ist->nb_filters; j++) { - if (ist->filters[j]->graph->graph_desc) { - av_log(NULL, AV_LOG_INFO, " Stream #%d:%d (%s) -> %s", - ist->file_index, ist->st->index, ist->dec ? ist->dec->name : "?", - ist->filters[j]->name); - if (nb_filtergraphs > 1) - av_log(NULL, AV_LOG_INFO, " (graph %d)", ist->filters[j]->graph->index); - av_log(NULL, AV_LOG_INFO, "\n"); - } - } - } - - for (i = 0; i < nb_output_streams; i++) { - ost = output_streams[i]; - - if (ost->attachment_filename) { - /* an attached file */ - av_log(NULL, AV_LOG_INFO, " File %s -> Stream #%d:%d\n", - ost->attachment_filename, ost->file_index, ost->index); - continue; - } - - if (ost->filter && ost->filter->graph->graph_desc) { - /* output from a complex graph */ - av_log(NULL, AV_LOG_INFO, " %s", ost->filter->name); - if (nb_filtergraphs > 1) - av_log(NULL, AV_LOG_INFO, " (graph %d)", ost->filter->graph->index); - - av_log(NULL, AV_LOG_INFO, " -> Stream #%d:%d (%s)\n", ost->file_index, - ost->index, ost->enc ? ost->enc->name : "?"); - continue; - } - - av_log(NULL, AV_LOG_INFO, " Stream #%d:%d -> #%d:%d", - input_streams[ost->source_index]->file_index, - input_streams[ost->source_index]->st->index, - ost->file_index, - ost->index); - if (ost->sync_ist != input_streams[ost->source_index]) - av_log(NULL, AV_LOG_INFO, " [sync #%d:%d]", - ost->sync_ist->file_index, - ost->sync_ist->st->index); - if (ost->stream_copy) - av_log(NULL, AV_LOG_INFO, " (copy)"); - else - av_log(NULL, AV_LOG_INFO, " (%s -> %s)", input_streams[ost->source_index]->dec ? - input_streams[ost->source_index]->dec->name : "?", - ost->enc ? ost->enc->name : "?"); - av_log(NULL, AV_LOG_INFO, "\n"); - } - - if (ret) { - av_log(NULL, AV_LOG_ERROR, "%s\n", error); - return ret; - } - - if (want_sdp) { - print_sdp(); - } - - transcode_init_done = 1; - - return 0; -} - -/* Return 1 if there remain streams where more output is wanted, 0 otherwise. */ -static int need_output(void) -{ - int i; - - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - OutputFile *of = output_files[ost->file_index]; - AVFormatContext *os = output_files[ost->file_index]->ctx; - - if (ost->finished || - (os->pb && avio_tell(os->pb) >= of->limit_filesize)) - continue; - if (ost->frame_number >= ost->max_frames) { - int j; - for (j = 0; j < of->ctx->nb_streams; j++) - close_output_stream(output_streams[of->ost_index + j]); - continue; - } - - return 1; - } - - return 0; -} - -/** - * Select the output stream to process. - * - * @return selected output stream, or NULL if none available - */ -static OutputStream *choose_output(void) -{ - int i; - int64_t opts_min = INT64_MAX; - OutputStream *ost_min = NULL; - - for (i = 0; i < nb_output_streams; i++) { - OutputStream *ost = output_streams[i]; - int64_t opts = av_rescale_q(ost->st->cur_dts, ost->st->time_base, - AV_TIME_BASE_Q); - if (!ost->unavailable && !ost->finished && opts < opts_min) { - opts_min = opts; - ost_min = ost; - } - } - return ost_min; -} - -static int check_keyboard_interaction(int64_t cur_time) -{ - int i, ret, key; - static int64_t last_time; - if (received_nb_signals) - return AVERROR_EXIT; - /* read_key() returns 0 on EOF */ - if(cur_time - last_time >= 100000 && !run_as_daemon){ - key = read_key(); - last_time = cur_time; - }else - key = -1; - if (key == 'q') - return AVERROR_EXIT; - if (key == '+') av_log_set_level(av_log_get_level()+10); - if (key == '-') av_log_set_level(av_log_get_level()-10); - if (key == 's') qp_hist ^= 1; - if (key == 'h'){ - if (do_hex_dump){ - do_hex_dump = do_pkt_dump = 0; - } else if(do_pkt_dump){ - do_hex_dump = 1; - } else - do_pkt_dump = 1; - av_log_set_level(AV_LOG_DEBUG); - } - if (key == 'c' || key == 'C'){ - char buf[4096], target[64], command[256], arg[256] = {0}; - double time; - int k, n = 0; - fprintf(stderr, "\nEnter command: |all