├── .gitignore ├── ffmpeg-version ├── README.md ├── LICENSE ├── FFmpeg-Android.sh ├── COPYING.LGPLv3 ├── MAINTAINERS └── FFmpeg-VPlayer.patch /.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ffmpeg-version: -------------------------------------------------------------------------------- 1 | 5e99df019a850e9ffa96d73e72b8a47a93a61de8 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The FFmpeg code used in VPlayer for Android 2 | =========================================== 3 | 4 | 5 | Build 6 | ----- 7 | 8 | 0. Install git, Android ndk 9 | 1. `$ export ANDROID_NDK=/path/to/your/android-ndk` 10 | 2. `$ ./FFmpeg-Android.sh` 11 | 3. libffmpeg.so will be built to `build/ffmpeg/{neon,armv7,vfp,armv6}/` 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | FFmpeg: 2 | ------- 3 | 4 | Most files in FFmpeg are under the GNU Lesser General Public License version 2.1 5 | or later (LGPL v2.1+). Read the file COPYING.LGPLv2.1 for details. Some other 6 | files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to 7 | FFmpeg. 8 | 9 | Some optional parts of FFmpeg are licensed under the GNU General Public License 10 | version 2 or later (GPL v2+). See the file COPYING.GPLv2 for details. None of 11 | these parts are used by default, you have to explicitly pass --enable-gpl to 12 | configure to activate them. In this case, FFmpeg's license changes to GPL v2+. 13 | 14 | Specifically, the GPL parts of FFmpeg are 15 | 16 | - libpostproc 17 | - optional x86 optimizations in the files 18 | libavcodec/x86/idct_mmx.c 19 | - the X11 grabber in libavdevice/x11grab.c 20 | 21 | There are a handful of files under other licensing terms, namely: 22 | 23 | * The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and 24 | libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for 25 | licensing details. Specifically note that you must credit the IJG in the 26 | documentation accompanying your program if you only distribute executables. 27 | You must also indicate any changes including additions and deletions to 28 | those three files in the documentation. 29 | 30 | Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then 31 | the configure parameter --enable-version3 will activate this licensing option 32 | for you. Read the file COPYING.LGPLv3 or, if you have enabled GPL parts, 33 | COPYING.GPLv3 to learn the exact legal terms that apply in this case. 34 | 35 | 36 | external libraries: 37 | ------------------- 38 | 39 | Some external libraries, e.g. libx264, are under GPL and can be used in 40 | conjunction with FFmpeg. They require --enable-gpl to be passed to configure 41 | as well. 42 | 43 | The OpenCORE external libraries are under the Apache License 2.0. That license 44 | is incompatible with the LGPL v2.1 and the GPL v2, but not with version 3 of 45 | those licenses. So to combine the OpenCORE libraries with FFmpeg, the license 46 | version needs to be upgraded by passing --enable-version3 to configure. 47 | 48 | The nonfree external libraries libfaac and libaacplus can be hooked up in FFmpeg. 49 | You need to pass --enable-nonfree to configure to enable it. Employ this option 50 | with care as FFmpeg then becomes nonfree and unredistributable. 51 | -------------------------------------------------------------------------------- /FFmpeg-Android.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DEST=`pwd`/build/ffmpeg && rm -rf $DEST 4 | SOURCE=`pwd`/ffmpeg 5 | 6 | if [ -d ffmpeg ]; then 7 | cd ffmpeg 8 | else 9 | git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg 10 | cd ffmpeg 11 | fi 12 | 13 | git reset --hard 14 | git clean -f -d 15 | git checkout `cat ../ffmpeg-version` 16 | patch -p1 <../FFmpeg-VPlayer.patch 17 | [ $PIPESTATUS == 0 ] || exit 1 18 | 19 | git log --pretty=format:%H -1 > ../ffmpeg-version 20 | 21 | TOOLCHAIN=/tmp/vplayer 22 | SYSROOT=$TOOLCHAIN/sysroot/ 23 | $ANDROID_NDK/build/tools/make-standalone-toolchain.sh --platform=android-14 --install-dir=$TOOLCHAIN 24 | 25 | export PATH=$TOOLCHAIN/bin:$PATH 26 | export CC="ccache arm-linux-androideabi-gcc" 27 | export LD=arm-linux-androideabi-ld 28 | export AR=arm-linux-androideabi-ar 29 | 30 | CFLAGS="-O3 -Wall -mthumb -pipe -fpic -fasm \ 31 | -finline-limit=300 -ffast-math \ 32 | -fstrict-aliasing -Werror=strict-aliasing \ 33 | -fmodulo-sched -fmodulo-sched-allow-regmoves \ 34 | -Wno-psabi -Wa,--noexecstack \ 35 | -D__ARM_ARCH_5__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5TE__ \ 36 | -DANDROID -DNDEBUG" 37 | 38 | FFMPEG_FLAGS="--target-os=linux \ 39 | --arch=arm \ 40 | --enable-cross-compile \ 41 | --cross-prefix=arm-linux-androideabi- \ 42 | --enable-shared \ 43 | --disable-symver \ 44 | --disable-doc \ 45 | --disable-ffplay \ 46 | --disable-ffmpeg \ 47 | --disable-ffprobe \ 48 | --disable-ffserver \ 49 | --disable-avdevice \ 50 | --disable-avfilter \ 51 | --disable-encoders \ 52 | --disable-muxers \ 53 | --disable-filters \ 54 | --disable-devices \ 55 | --disable-everything \ 56 | --enable-protocols \ 57 | --enable-parsers \ 58 | --enable-demuxers \ 59 | --enable-decoders \ 60 | --enable-bsfs \ 61 | --enable-network \ 62 | --enable-swscale \ 63 | --disable-demuxer=sbg \ 64 | --disable-demuxer=dts \ 65 | --disable-parser=dca \ 66 | --disable-decoder=dca \ 67 | --enable-asm \ 68 | --enable-version3" 69 | 70 | 71 | for version in neon armv7 vfp armv6; do 72 | 73 | cd $SOURCE 74 | 75 | case $version in 76 | neon) 77 | EXTRA_CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=softfp -mvectorize-with-neon-quad" 78 | EXTRA_LDFLAGS="-Wl,--fix-cortex-a8" 79 | ;; 80 | armv7) 81 | EXTRA_CFLAGS="-march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp" 82 | EXTRA_LDFLAGS="-Wl,--fix-cortex-a8" 83 | ;; 84 | vfp) 85 | EXTRA_CFLAGS="-march=armv6 -mfpu=vfp -mfloat-abi=softfp" 86 | EXTRA_LDFLAGS="" 87 | ;; 88 | armv6) 89 | EXTRA_CFLAGS="-march=armv6" 90 | EXTRA_LDFLAGS="" 91 | ;; 92 | *) 93 | EXTRA_CFLAGS="" 94 | EXTRA_LDFLAGS="" 95 | ;; 96 | esac 97 | 98 | PREFIX="$DEST/$version" && mkdir -p $PREFIX 99 | FFMPEG_FLAGS="$FFMPEG_FLAGS --prefix=$PREFIX" 100 | 101 | ./configure $FFMPEG_FLAGS --extra-cflags="$CFLAGS $EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" | tee $PREFIX/configuration.txt 102 | cp config.* $PREFIX 103 | [ $PIPESTATUS == 0 ] || exit 1 104 | 105 | make clean 106 | make -j4 || exit 1 107 | make install || exit 1 108 | 109 | rm libavcodec/inverse.o 110 | $CC -lm -lz -shared --sysroot=$SYSROOT -Wl,--no-undefined -Wl,-z,noexecstack $EXTRA_LDFLAGS libavutil/*.o libavutil/arm/*.o libavcodec/*.o libavcodec/arm/*.o libavformat/*.o libswresample/*.o libswscale/*.o -o $PREFIX/libffmpeg.so 111 | 112 | cp $PREFIX/libffmpeg.so $PREFIX/libffmpeg-debug.so 113 | arm-linux-androideabi-strip --strip-unneeded $PREFIX/libffmpeg.so 114 | 115 | done 116 | -------------------------------------------------------------------------------- /COPYING.LGPLv3: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /MAINTAINERS: -------------------------------------------------------------------------------- 1 | FFmpeg maintainers 2 | ================== 3 | 4 | Below is a list of the people maintaining different parts of the 5 | FFmpeg code. 6 | 7 | Please try to keep entries where you are the maintainer up to date! 8 | 9 | Names in () mean that the maintainer currently has no time to maintain the code. 10 | A CC after the name means that the maintainer prefers to be CC-ed on patches 11 | and related discussions. 12 | 13 | 14 | Project Leader 15 | ============== 16 | 17 | Michael Niedermayer 18 | final design decisions 19 | 20 | 21 | Applications 22 | ============ 23 | 24 | ffmpeg: 25 | ffmpeg.c Michael Niedermayer 26 | 27 | ffplay: 28 | ffplay.c Marton Balint 29 | 30 | ffprobe: 31 | ffprobe.c Stefano Sabatini 32 | 33 | ffserver: 34 | ffserver.c, ffserver.h Baptiste Coudurier 35 | 36 | Commandline utility code: 37 | cmdutils.c, cmdutils.h Michael Niedermayer 38 | 39 | QuickTime faststart: 40 | tools/qt-faststart.c Baptiste Coudurier 41 | 42 | 43 | Miscellaneous Areas 44 | =================== 45 | 46 | documentation Mike Melanson 47 | website Robert Swain, Lou Logan 48 | build system (configure,Makefiles) Diego Biurrun, Mans Rullgard 49 | project server Árpád Gereöffy, Michael Niedermayer, Reimar Döffinger 50 | mailinglists Michael Niedermayer, Baptiste Coudurier, Lou Logan 51 | presets Robert Swain 52 | metadata subsystem Aurelien Jacobs 53 | release management Michael Niedermayer 54 | FFmpeg-Android.sh Cedric Fung 55 | 56 | 57 | libavutil 58 | ========= 59 | 60 | External Interfaces: 61 | libavutil/avutil.h Michael Niedermayer 62 | Internal Interfaces: 63 | libavutil/common.h Michael Niedermayer 64 | 65 | Other: 66 | intfloat* Michael Niedermayer 67 | rational.c, rational.h Michael Niedermayer 68 | mathematics.c, mathematics.h Michael Niedermayer 69 | integer.c, integer.h Michael Niedermayer 70 | bswap.h 71 | 72 | 73 | libavcodec 74 | ========== 75 | 76 | Generic Parts: 77 | External Interfaces: 78 | avcodec.h Michael Niedermayer 79 | utility code: 80 | utils.c Michael Niedermayer 81 | mem.c Michael Niedermayer 82 | opt.c, opt.h Michael Niedermayer 83 | arithmetic expression evaluator: 84 | eval.c Michael Niedermayer 85 | audio and video frame extraction: 86 | parser.c Michael Niedermayer 87 | bitstream reading: 88 | bitstream.c, bitstream.h Michael Niedermayer 89 | CABAC: 90 | cabac.h, cabac.c Michael Niedermayer 91 | codec names: 92 | codec_names.sh Nicolas George 93 | DSP utilities: 94 | dsputils.c, dsputils.h Michael Niedermayer 95 | entropy coding: 96 | rangecoder.c, rangecoder.h Michael Niedermayer 97 | lzw.* Michael Niedermayer 98 | floating point AAN DCT: 99 | faandct.c, faandct.h Michael Niedermayer 100 | Golomb coding: 101 | golomb.c, golomb.h Michael Niedermayer 102 | LPC: 103 | lpc.c, lpc.h Justin Ruggles 104 | motion estimation: 105 | motion* Michael Niedermayer 106 | rate control: 107 | ratecontrol.c Michael Niedermayer 108 | libxvid_rc.c Michael Niedermayer 109 | simple IDCT: 110 | simple_idct.c, simple_idct.h Michael Niedermayer 111 | postprocessing: 112 | libpostproc/* Michael Niedermayer 113 | table generation: 114 | tableprint.c, tableprint.h Reimar Doeffinger 115 | 116 | Codecs: 117 | 4xm.c Michael Niedermayer 118 | 8bps.c Roberto Togni 119 | 8svx.c Jaikrishnan Menon 120 | aasc.c Kostya Shishkov 121 | ac3* Justin Ruggles 122 | alacenc.c Jaikrishnan Menon 123 | alsdec.c Thilo Borgmann 124 | apedec.c Kostya Shishkov 125 | ass* Aurelien Jacobs 126 | asv* Michael Niedermayer 127 | atrac3* Benjamin Larsson 128 | bgmc.c, bgmc.h Thilo Borgmann 129 | bink.c Kostya Shishkov 130 | binkaudio.c Peter Ross 131 | bmp.c Mans Rullgard, Kostya Shishkov 132 | cavs* Stefan Gehrer 133 | celp_filters.* Vitor Sessak 134 | cinepak.c Roberto Togni 135 | cljr Alex Beregszaszi 136 | cook.c, cookdata.h Benjamin Larsson 137 | crystalhd.c Philip Langdale 138 | cscd.c Reimar Doeffinger 139 | dca.c Kostya Shishkov, Benjamin Larsson 140 | dnxhd* Baptiste Coudurier 141 | dpcm.c Mike Melanson 142 | dxa.c Kostya Shishkov 143 | dv.c Roman Shaposhnik 144 | eacmv*, eaidct*, eat* Peter Ross 145 | ffv1.c Michael Niedermayer 146 | ffwavesynth.c Nicolas George 147 | flac* Justin Ruggles 148 | flashsv* Benjamin Larsson 149 | flicvideo.c Mike Melanson 150 | g722.c Martin Storsjo 151 | g726.c Roman Shaposhnik 152 | gifdec.c Baptiste Coudurier 153 | h264* Loren Merritt, Michael Niedermayer 154 | h261* Michael Niedermayer 155 | h263* Michael Niedermayer 156 | huffyuv.c Michael Niedermayer 157 | idcinvideo.c Mike Melanson 158 | imc* Benjamin Larsson 159 | indeo2* Kostya Shishkov 160 | indeo5* Kostya Shishkov 161 | interplayvideo.c Mike Melanson 162 | ivi* Kostya Shishkov 163 | jacosub* Clément Bœsch 164 | jpeg_ls.c Kostya Shishkov 165 | jvdec.c Peter Ross 166 | kmvc.c Kostya Shishkov 167 | lcl*.c Roberto Togni, Reimar Doeffinger 168 | libcelt_dec.c Nicolas George 169 | libgsm.c Michel Bardiaux 170 | libdirac* David Conrad 171 | libopenjpeg.c Jaikrishnan Menon 172 | libopenjpegenc.c Michael Bradshaw 173 | libschroedinger* David Conrad 174 | libspeexdec.c Justin Ruggles 175 | libtheoraenc.c David Conrad 176 | libutvideo* Derek Buitenhuis 177 | libvorbis.c David Conrad 178 | libxavs.c Stefan Gehrer 179 | libx264.c Mans Rullgard, Jason Garrett-Glaser 180 | loco.c Kostya Shishkov 181 | lzo.h, lzo.c Reimar Doeffinger 182 | mdec.c Michael Niedermayer 183 | mimic.c Ramiro Polla 184 | mjpeg.c Michael Niedermayer 185 | mlp* Ramiro Polla 186 | mmvideo.c Peter Ross 187 | mpc* Kostya Shishkov 188 | mpeg12.c, mpeg12data.h Michael Niedermayer 189 | mpegvideo.c, mpegvideo.h Michael Niedermayer 190 | msmpeg4.c, msmpeg4data.h Michael Niedermayer 191 | msrle.c Mike Melanson 192 | msvideo1.c Mike Melanson 193 | nellymoserdec.c Benjamin Larsson 194 | nuv.c Reimar Doeffinger 195 | pcx.c Ivo van Poorten 196 | pgssubdec.c Reimar Doeffinger 197 | ptx.c Ivo van Poorten 198 | qcelp* Reynaldo H. Verdejo Pinochet 199 | qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson 200 | qdrw.c Kostya Shishkov 201 | qpeg.c Kostya Shishkov 202 | qtrle.c Mike Melanson 203 | ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni 204 | resample2.c Michael Niedermayer 205 | rl2.c Sascha Sommer 206 | rpza.c Roberto Togni 207 | rtjpeg.c, rtjpeg.h Reimar Doeffinger 208 | rv10.c Michael Niedermayer 209 | rv3* Kostya Shishkov 210 | rv4* Kostya Shishkov 211 | s3tc* Ivo van Poorten 212 | smacker.c Kostya Shishkov 213 | smc.c Mike Melanson 214 | snow.c Michael Niedermayer, Loren Merritt 215 | sonic.c Alex Beregszaszi 216 | srt* Aurelien Jacobs 217 | sunrast.c Ivo van Poorten 218 | svq3.c Michael Niedermayer 219 | targa.c Kostya Shishkov 220 | tiff.c Kostya Shishkov 221 | truemotion1* Mike Melanson 222 | truemotion2* Kostya Shishkov 223 | truespeech.c Kostya Shishkov 224 | tscc.c Kostya Shishkov 225 | tta.c Alex Beregszaszi, Jaikrishnan Menon 226 | txd.c Ivo van Poorten 227 | ulti* Kostya Shishkov 228 | v410*.c Derek Buitenhuis 229 | vb.c Kostya Shishkov 230 | vble.c Derek Buitenhuis 231 | vc1* Kostya Shishkov 232 | vcr1.c Michael Niedermayer 233 | vmnc.c Kostya Shishkov 234 | vorbis_enc.c Oded Shimon 235 | vorbis_dec.c Denes Balatoni, David Conrad 236 | vp3* Mike Melanson 237 | vp5 Aurelien Jacobs 238 | vp6 Aurelien Jacobs 239 | vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje 240 | vqavideo.c Mike Melanson 241 | wavpack.c Kostya Shishkov 242 | wmaprodec.c Sascha Sommer 243 | wmavoice.c Ronald S. Bultje 244 | wmv2.c Michael Niedermayer 245 | wnv1.c Kostya Shishkov 246 | xan.c Mike Melanson 247 | xl.c Kostya Shishkov 248 | xvmc.c Ivan Kalvachev 249 | zerocodec.c Derek Buitenhuis 250 | zmbv* Kostya Shishkov 251 | 252 | Hardware acceleration: 253 | crystalhd.c Philip Langdale 254 | dxva2* Laurent Aimar 255 | libstagefright.cpp Mohamed Naufal 256 | vaapi* Gwenole Beauchesne 257 | vda* Sebastien Zwickert 258 | vdpau* Carl Eugen Hoyos 259 | 260 | 261 | libavdevice 262 | =========== 263 | External Interface: 264 | libavdevice/avdevice.h 265 | 266 | 267 | iec61883.c Georg Lippitsch 268 | libdc1394.c Roman Shaposhnik 269 | v4l2.c Luca Abeni 270 | vfwcap.c Ramiro Polla 271 | 272 | 273 | libavfilter 274 | =========== 275 | 276 | Generic parts: 277 | graphdump.c Nicolas George 278 | 279 | Filters: 280 | af_amerge.c Nicolas George 281 | af_astreamsync.c Nicolas George 282 | af_atempo.c Pavel Koshevoy 283 | af_pan.c Nicolas George 284 | vf_yadif.c Michael Niedermayer 285 | 286 | Sources: 287 | vsrc_mandelbrot.c Michael Niedermayer 288 | 289 | libavformat 290 | =========== 291 | 292 | Generic parts: 293 | External Interface: 294 | libavformat/avformat.h Michael Niedermayer 295 | Utility Code: 296 | libavformat/utils.c Michael Niedermayer 297 | 298 | 299 | Muxers/Demuxers: 300 | 4xm.c Mike Melanson 301 | adtsenc.c Robert Swain 302 | aiff.c Baptiste Coudurier 303 | ape.c Kostya Shishkov 304 | ass* Aurelien Jacobs 305 | avi* Michael Niedermayer 306 | bink.c Peter Ross 307 | caf* Peter Ross 308 | crc.c Michael Niedermayer 309 | daud.c Reimar Doeffinger 310 | dv.c Roman Shaposhnik 311 | dxa.c Kostya Shishkov 312 | electronicarts.c Peter Ross 313 | ffm* Baptiste Coudurier 314 | flac* Justin Ruggles 315 | flic.c Mike Melanson 316 | flvdec.c, flvenc.c Michael Niedermayer 317 | gxf.c Reimar Doeffinger 318 | gxfenc.c Baptiste Coudurier 319 | idcin.c Mike Melanson 320 | idroqdec.c Mike Melanson 321 | iff.c Jaikrishnan Menon 322 | ipmovie.c Mike Melanson 323 | img2.c Michael Niedermayer 324 | iss.c Stefan Gehrer 325 | jacosub* Clément Bœsch 326 | jvdec.c Peter Ross 327 | libmodplug.c Clément Bœsch 328 | libnut.c Oded Shimon 329 | lmlm4.c Ivo van Poorten 330 | lxfdec.c Tomas Härdin 331 | matroska.c Aurelien Jacobs 332 | matroskadec.c Aurelien Jacobs 333 | matroskaenc.c David Conrad 334 | metadata* Aurelien Jacobs 335 | microdvd* Aurelien Jacobs 336 | mm.c Peter Ross 337 | mov.c Michael Niedermayer, Baptiste Coudurier 338 | movenc.c Michael Niedermayer, Baptiste Coudurier 339 | mpc.c Kostya Shishkov 340 | mpeg.c Michael Niedermayer 341 | mpegenc.c Michael Niedermayer 342 | mpegts* Baptiste Coudurier 343 | msnwc_tcp.c Ramiro Polla 344 | mtv.c Reynaldo H. Verdejo Pinochet 345 | mxf* Baptiste Coudurier 346 | mxfdec.c Tomas Härdin 347 | nsvdec.c Francois Revol 348 | nut.c Michael Niedermayer 349 | nuv.c Reimar Doeffinger 350 | oggdec.c, oggdec.h David Conrad 351 | oggenc.c Baptiste Coudurier 352 | oggparse*.c David Conrad 353 | oma.c Maxim Poliakovski 354 | psxstr.c Mike Melanson 355 | pva.c Ivo van Poorten 356 | r3d.c Baptiste Coudurier 357 | raw.c Michael Niedermayer 358 | rdt.c Ronald S. Bultje 359 | rl2.c Sascha Sommer 360 | rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov 361 | rtmp* Kostya Shishkov 362 | rtp.c, rtpenc.c Martin Storsjo 363 | rtpdec_asf.* Ronald S. Bultje 364 | rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo 365 | rtsp.c Luca Barbato 366 | sbgdec.c Nicolas George 367 | sdp.c Martin Storsjo 368 | segafilm.c Mike Melanson 369 | siff.c Kostya Shishkov 370 | smacker.c Kostya Shishkov 371 | srtdec.c Aurelien Jacobs 372 | swf.c Baptiste Coudurier 373 | tta.c Alex Beregszaszi 374 | txd.c Ivo van Poorten 375 | voc.c Aurelien Jacobs 376 | wav.c Michael Niedermayer 377 | wc3movie.c Mike Melanson 378 | westwood.c Mike Melanson 379 | wtv.c Peter Ross 380 | wv.c Kostya Shishkov 381 | 382 | Protocols: 383 | bluray.c Petri Hintukainen 384 | http.c Ronald S. Bultje 385 | mms*.c Ronald S. Bultje 386 | udp.c Luca Abeni 387 | 388 | 389 | Operating systems / CPU architectures 390 | ===================================== 391 | 392 | Alpha Mans Rullgard, Falk Hueffner 393 | ARM Mans Rullgard 394 | AVR32 Mans Rullgard 395 | MIPS Mans Rullgard 396 | Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier 397 | Amiga / PowerPC Colin Ward 398 | Linux / PowerPC Luca Barbato 399 | Windows MinGW Alex Beregszaszi, Ramiro Polla 400 | Windows Cygwin Victor Paesa 401 | ADI/Blackfin DSP Marc Hoffman 402 | Sparc Roman Shaposhnik 403 | x86 Michael Niedermayer 404 | 405 | 406 | Releases 407 | ======== 408 | 409 | 0.11 Michael Niedermayer 410 | 0.10 Michael Niedermayer 411 | 412 | 413 | 414 | GnuPG Fingerprints of maintainers and contributors 415 | ================================================== 416 | 417 | Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB 418 | Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB 419 | Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765 420 | Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA 421 | Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C 422 | Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8 423 | Bœsch Clément 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9 424 | Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7 425 | Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5 426 | Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4 427 | Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368 428 | Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF 429 | Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE 430 | Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A 431 | Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34 432 | Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB 433 | Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93 434 | Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029 435 | Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B 436 | Reimar Döffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7 437 | Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4 438 | Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A 439 | Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71 440 | Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C 441 | Stefano Sabatini 9A43 10F8 D32C D33C 48E7 C52C 5DF2 8E4D B2EE 066B 442 | Tomas Härdin D133 29CA 4EEC 9DB4 7076 F697 B04B 7403 3313 41FD 443 | -------------------------------------------------------------------------------- /FFmpeg-VPlayer.patch: -------------------------------------------------------------------------------- 1 | diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c 2 | index 28426d1..1464a19 100644 3 | --- a/libavcodec/dvbsubdec.c 4 | +++ b/libavcodec/dvbsubdec.c 5 | @@ -1,6 +1,7 @@ 6 | /* 7 | * DVB subtitle decoding 8 | * Copyright (c) 2005 Ian Caulfield 9 | + * Copyright (c) 2012 Cedric Fung 10 | * 11 | * This file is part of FFmpeg. 12 | * 13 | @@ -370,6 +371,8 @@ static av_cold int dvbsub_init_decoder(AVCodecContext *avctx) 14 | int i, r, g, b, a = 0; 15 | DVBSubContext *ctx = avctx->priv_data; 16 | 17 | + avctx->pix_fmt = PIX_FMT_PAL8; 18 | + 19 | if (!avctx->extradata || avctx->extradata_size != 4) { 20 | av_log(avctx, AV_LOG_WARNING, "Invalid extradata, subtitle streams may be combined!\n"); 21 | ctx->composition_id = -1; 22 | diff --git a/libavcodec/dvdsubdec.c b/libavcodec/dvdsubdec.c 23 | index ec86b25..7adf18b 100644 24 | --- a/libavcodec/dvdsubdec.c 25 | +++ b/libavcodec/dvdsubdec.c 26 | @@ -1,6 +1,7 @@ 27 | /* 28 | * DVD subtitle decoding 29 | * Copyright (c) 2005 Fabrice Bellard 30 | + * Copyright (c) 2012 Cedric Fung 31 | * 32 | * This file is part of FFmpeg. 33 | * 34 | @@ -517,6 +518,8 @@ static int dvdsub_init(AVCodecContext *avctx) 35 | DVDSubContext *ctx = (DVDSubContext*) avctx->priv_data; 36 | char *dataorig, *data; 37 | 38 | + avctx->pix_fmt = PIX_FMT_PAL8; 39 | + 40 | if (!avctx->extradata || !avctx->extradata_size) 41 | return 1; 42 | 43 | diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c 44 | index 62619b3..dab19e8 100644 45 | --- a/libavcodec/rv34.c 46 | +++ b/libavcodec/rv34.c 47 | @@ -1444,7 +1444,7 @@ static int rv34_decode_slice(RV34DecContext *r, int end, const uint8_t* buf, int 48 | memmove(r->intra_types_hist, r->intra_types, r->intra_types_stride * 4 * sizeof(*r->intra_types_hist)); 49 | memset(r->intra_types, -1, r->intra_types_stride * 4 * sizeof(*r->intra_types_hist)); 50 | 51 | - if(r->loop_filter && s->mb_y >= 2) 52 | + if(s->avctx->skip_loop_filter != AVDISCARD_ALL && r->loop_filter && s->mb_y >= 2) 53 | r->loop_filter(r, s->mb_y - 2); 54 | 55 | if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) 56 | @@ -1770,7 +1770,7 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, 57 | 58 | if (s->current_picture_ptr) { 59 | if (last) { 60 | - if(r->loop_filter) 61 | + if(s->avctx->skip_loop_filter != AVDISCARD_ALL && r->loop_filter) 62 | r->loop_filter(r, s->mb_height - 1); 63 | 64 | *got_picture_ptr = finish_frame(avctx, pict); 65 | diff --git a/libavcodec/utils.c b/libavcodec/utils.c 66 | index 63aa862..acba3cc 100644 67 | --- a/libavcodec/utils.c 68 | +++ b/libavcodec/utils.c 69 | @@ -2040,6 +2040,8 @@ void avcodec_flush_buffers(AVCodecContext *avctx) 70 | static void video_free_buffers(AVCodecContext *s) 71 | { 72 | AVCodecInternal *avci = s->internal; 73 | + if (!avci) return; 74 | + 75 | int i, j; 76 | 77 | if (!avci->buffer) 78 | diff --git a/libavformat/Makefile b/libavformat/Makefile 79 | index 45ae6ea..4387ff1 100644 80 | --- a/libavformat/Makefile 81 | +++ b/libavformat/Makefile 82 | @@ -375,6 +375,7 @@ OBJS-$(CONFIG_CONCAT_PROTOCOL) += concat.o 83 | OBJS-$(CONFIG_CRYPTO_PROTOCOL) += crypto.o 84 | OBJS-$(CONFIG_FFRTMPHTTP_PROTOCOL) += rtmphttp.o 85 | OBJS-$(CONFIG_FILE_PROTOCOL) += file.o 86 | +OBJS-$(CONFIG_FD_PROTOCOL) += fd.o 87 | OBJS-$(CONFIG_GOPHER_PROTOCOL) += gopher.o 88 | OBJS-$(CONFIG_HLS_PROTOCOL) += hlsproto.o 89 | OBJS-$(CONFIG_HTTP_PROTOCOL) += http.o httpauth.o 90 | @@ -382,6 +383,7 @@ OBJS-$(CONFIG_HTTPPROXY_PROTOCOL) += http.o httpauth.o 91 | OBJS-$(CONFIG_HTTPS_PROTOCOL) += http.o httpauth.o 92 | OBJS-$(CONFIG_MMSH_PROTOCOL) += mmsh.o mms.o asf.o 93 | OBJS-$(CONFIG_MMST_PROTOCOL) += mmst.o mms.o asf.o 94 | +OBJS-$(CONFIG_MMSU_PROTOCOL) += mmsu.o mmsh.o mmst.o mms.o asf.o 95 | OBJS-$(CONFIG_MD5_PROTOCOL) += md5proto.o 96 | OBJS-$(CONFIG_PIPE_PROTOCOL) += file.o 97 | OBJS-$(CONFIG_RTMP_PROTOCOL) += rtmpproto.o rtmppkt.o 98 | diff --git a/libavformat/allformats.c b/libavformat/allformats.c 99 | index 94dc347..68e5525 100644 100 | --- a/libavformat/allformats.c 101 | +++ b/libavformat/allformats.c 102 | @@ -274,6 +274,7 @@ void av_register_all(void) 103 | REGISTER_PROTOCOL (CRYPTO, crypto); 104 | REGISTER_PROTOCOL (FFRTMPHTTP, ffrtmphttp); 105 | REGISTER_PROTOCOL (FILE, file); 106 | + REGISTER_PROTOCOL (FD, fd); 107 | REGISTER_PROTOCOL (GOPHER, gopher); 108 | REGISTER_PROTOCOL (HLS, hls); 109 | REGISTER_PROTOCOL (HTTP, http); 110 | @@ -281,6 +282,7 @@ void av_register_all(void) 111 | REGISTER_PROTOCOL (HTTPS, https); 112 | REGISTER_PROTOCOL (MMSH, mmsh); 113 | REGISTER_PROTOCOL (MMST, mmst); 114 | + REGISTER_PROTOCOL (MMSU, mmsu); 115 | REGISTER_PROTOCOL (MD5, md5); 116 | REGISTER_PROTOCOL (PIPE, pipe); 117 | REGISTER_PROTOCOL (RTMP, rtmp); 118 | diff --git a/libavformat/avformat.h b/libavformat/avformat.h 119 | index 3bbc683..327edbc 100644 120 | --- a/libavformat/avformat.h 121 | +++ b/libavformat/avformat.h 122 | @@ -912,7 +912,7 @@ typedef struct AVFormatContext { 123 | unsigned int nb_streams; 124 | AVStream **streams; 125 | 126 | - char filename[1024]; /**< input or output filename */ 127 | + char filename[10240]; /**< input or output filename */ 128 | 129 | /** 130 | * Decoding: position of the first frame of the component, in 131 | diff --git a/libavformat/fd.c b/libavformat/fd.c 132 | new file mode 100644 133 | index 0000000..d8d2e41 134 | --- /dev/null 135 | +++ b/libavformat/fd.c 136 | @@ -0,0 +1,95 @@ 137 | +/* 138 | + * Copyright (c) 2010 Cedric Fung (wolfplanet@gmail.com) 139 | + * 140 | + * This file is part of FFmpeg. 141 | + * 142 | + * FFmpeg is free software; you can redistribute it and/or 143 | + * modify it under the terms of the GNU Lesser General Public 144 | + * License as published by the Free Software Foundation; either 145 | + * version 2.1 of the License, or (at your option) any later version. 146 | + * 147 | + * FFmpeg is distributed in the hope that it will be useful, 148 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 149 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 150 | + * Lesser General Public License for more details. 151 | + * 152 | + * You should have received a copy of the GNU Lesser General Public 153 | + * License along with FFmpeg; if not, write to the Free Software 154 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 155 | + */ 156 | + 157 | +#include "libavutil/avstring.h" 158 | +#include "avformat.h" 159 | +#include 160 | +#if HAVE_SETMODE 161 | +#include 162 | +#endif 163 | +#include 164 | +#include 165 | +#include 166 | +#include "os_support.h" 167 | +#include "url.h" 168 | + 169 | + 170 | +static int file_read(URLContext *h, unsigned char *buf, int size) { 171 | + int fd = (intptr_t) h->priv_data; 172 | + return read(fd, buf, size); 173 | +} 174 | + 175 | +static int file_write(URLContext *h, const unsigned char *buf, int size) { 176 | + int fd = (intptr_t) h->priv_data; 177 | + return write(fd, buf, size); 178 | +} 179 | + 180 | +static int file_get_handle(URLContext *h) { 181 | + return (intptr_t) h->priv_data; 182 | +} 183 | + 184 | +/* XXX: use llseek */ 185 | +static int64_t file_seek(URLContext *h, int64_t pos, int whence) { 186 | + int fd = (intptr_t) h->priv_data; 187 | + if (whence == AVSEEK_SIZE) { 188 | + struct stat st; 189 | + int ret = fstat(fd, &st); 190 | + return ret < 0 ? AVERROR(errno) : st.st_size; 191 | + } 192 | + return lseek64(fd, pos, whence); 193 | +} 194 | + 195 | + 196 | +static int fd_open(URLContext *h, const char *filename, int flags) { 197 | + int fd; 198 | + struct stat st; 199 | + char *final; 200 | + av_strstart(filename, "fd:", &filename); 201 | + 202 | + fd = strtol(filename, &final, 10); 203 | + if((filename == final) || *final ) {/* No digits found, or something like 10ab */ 204 | + if (flags & O_WRONLY) { 205 | + fd = 1; 206 | + } else { 207 | + fd = 0; 208 | + } 209 | + } 210 | +#if HAVE_SETMODE 211 | + setmode(fd, O_BINARY | O_RDONLY); 212 | +#endif 213 | + h->priv_data = (void *) (intptr_t) fd; 214 | + h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode); 215 | + return 0; 216 | +} 217 | + 218 | +static int file_close(URLContext *h) { 219 | + int fd = (intptr_t) h->priv_data; 220 | + return close(fd); 221 | +} 222 | + 223 | +URLProtocol ff_fd_protocol = { 224 | + .name = "fd", 225 | + .url_open = fd_open, 226 | + .url_read = file_read, 227 | + .url_write = file_write, 228 | + .url_seek = file_seek, 229 | + .url_close = file_close, 230 | + .url_get_file_handle = file_get_handle, 231 | +}; 232 | diff --git a/libavformat/file.c b/libavformat/file.c 233 | index c54ec28..c85362c 100644 234 | --- a/libavformat/file.c 235 | +++ b/libavformat/file.c 236 | @@ -105,7 +105,7 @@ static int64_t file_seek(URLContext *h, int64_t pos, int whence) 237 | int ret = fstat(fd, &st); 238 | return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size); 239 | } 240 | - return lseek(fd, pos, whence); 241 | + return lseek64(fd, pos, whence); 242 | } 243 | 244 | static int file_close(URLContext *h) 245 | diff --git a/libavformat/hls.c b/libavformat/hls.c 246 | index a51a616..bf4c7f5 100644 247 | --- a/libavformat/hls.c 248 | +++ b/libavformat/hls.c 249 | @@ -1,6 +1,7 @@ 250 | /* 251 | * Apple HTTP Live Streaming demuxer 252 | * Copyright (c) 2010 Martin Storsjo 253 | + * Copyright (c) 2011 Cedirc Fung (wolfplanet@gmail.com) 254 | * 255 | * This file is part of FFmpeg. 256 | * 257 | @@ -56,7 +57,8 @@ enum KeyType { 258 | }; 259 | 260 | struct segment { 261 | - int duration; 262 | + int previous_duration; // in seconds 263 | + int duration; // in seconds 264 | char url[MAX_URL_SIZE]; 265 | char key[MAX_URL_SIZE]; 266 | enum KeyType key_type; 267 | @@ -202,7 +204,7 @@ static void handle_key_args(struct key_info *info, const char *key, 268 | static int parse_playlist(HLSContext *c, const char *url, 269 | struct variant *var, AVIOContext *in) 270 | { 271 | - int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0; 272 | + int ret = 0, duration = 0, is_segment = 0, is_variant = 0, bandwidth = 0, previous_duration1 = 0, previous_duration = 0; 273 | enum KeyType key_type = KEY_NONE; 274 | uint8_t iv[16] = ""; 275 | int has_iv = 0; 276 | @@ -270,6 +272,8 @@ static int parse_playlist(HLSContext *c, const char *url, 277 | } else if (av_strstart(line, "#EXT-X-ENDLIST", &ptr)) { 278 | if (var) 279 | var->finished = 1; 280 | + } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) { 281 | + previous_duration = previous_duration1; 282 | } else if (av_strstart(line, "#EXTINF:", &ptr)) { 283 | is_segment = 1; 284 | duration = atoi(ptr); 285 | @@ -298,6 +302,8 @@ static int parse_playlist(HLSContext *c, const char *url, 286 | ret = AVERROR(ENOMEM); 287 | goto fail; 288 | } 289 | + previous_duration1 += duration; 290 | + seg->previous_duration = previous_duration; 291 | seg->duration = duration; 292 | seg->key_type = key_type; 293 | if (has_iv) { 294 | @@ -654,9 +660,16 @@ start: 295 | } 296 | /* If we got a packet, return it */ 297 | if (minvariant >= 0) { 298 | - *pkt = c->variants[minvariant]->pkt; 299 | - pkt->stream_index += c->variants[minvariant]->stream_offset; 300 | - reset_packet(&c->variants[minvariant]->pkt); 301 | + struct variant *v = c->variants[minvariant]; 302 | + *pkt = v->pkt; 303 | + pkt->stream_index += v->stream_offset; 304 | + int seq_no = v->cur_seq_no - v->start_seq_no; 305 | + if (seq_no < v->n_segments && s->streams[pkt->stream_index]) { 306 | + int64_t pred = v->segments[seq_no]->previous_duration / av_q2d(s->streams[pkt->stream_index]->time_base); 307 | + if (pkt->dts != AV_NOPTS_VALUE && pkt->dts < pred) pkt->dts += pred; 308 | + if (pkt->pts != AV_NOPTS_VALUE && pkt->pts < pred) pkt->pts += pred; 309 | + } 310 | + reset_packet(&v->pkt); 311 | return 0; 312 | } 313 | return AVERROR_EOF; 314 | diff --git a/libavformat/http.c b/libavformat/http.c 315 | index 5355bdc..0472cf3 100644 316 | --- a/libavformat/http.c 317 | +++ b/libavformat/http.c 318 | @@ -1,6 +1,7 @@ 319 | /* 320 | * HTTP protocol for ffmpeg client 321 | * Copyright (c) 2000, 2001 Fabrice Bellard 322 | + * Copyright (c) 2012 Cedric Fung (wolfplanet@gmail.com) 323 | * 324 | * This file is part of FFmpeg. 325 | * 326 | @@ -33,9 +34,11 @@ 327 | only a subset of it. */ 328 | 329 | /* used for protocol handling */ 330 | -#define BUFFER_SIZE 1024 331 | +#define BUFFER_SIZE 10240 332 | #define MAX_REDIRECTS 8 333 | 334 | +#define DEFAULT_UA "Mozilla/5.0 (iPad; U; CPU OS 4_2_1 like Mac OS X; zh-cn) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C148 Safari/6533.18.5" 335 | + 336 | typedef struct { 337 | const AVClass *class; 338 | URLContext *hd; 339 | @@ -99,11 +102,11 @@ void ff_http_init_auth_state(URLContext *dest, const URLContext *src) 340 | static int http_open_cnx(URLContext *h) 341 | { 342 | const char *path, *proxy_path, *lower_proto = "tcp", *local_path; 343 | - char hostname[1024], hoststr[1024], proto[10]; 344 | - char auth[1024], proxyauth[1024] = ""; 345 | - char path1[1024]; 346 | - char buf[1024], urlbuf[1024]; 347 | - int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0; 348 | + char hostname[10240], hoststr[10240], proto[10]; 349 | + char auth[10240], proxyauth[10240] = ""; 350 | + char path1[10240]; 351 | + char buf[10240], urlbuf[10240]; 352 | + int port, use_proxy, err, location_changed = 0, redirects = 0, attempts = 0, change_ua = 0; 353 | HTTPAuthType cur_auth_type, cur_proxy_auth_type; 354 | HTTPContext *s = h->priv_data; 355 | 356 | @@ -165,6 +168,15 @@ static int http_open_cnx(URLContext *h) 357 | } else 358 | goto fail; 359 | } 360 | + if (s->http_code == 403 && !change_ua) { 361 | + av_opt_set(s, "user-agent", DEFAULT_UA, 0); 362 | + ffurl_closep(&s->hd); 363 | + memset(&s->auth_state, 0, sizeof(s->auth_state)); 364 | + attempts = 0; 365 | + location_changed = 0; 366 | + change_ua = 1; 367 | + goto redo; 368 | + } 369 | if (s->http_code == 407) { 370 | if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && 371 | s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { 372 | @@ -285,9 +297,9 @@ static int process_line(URLContext *h, char *line, int line_count, 373 | 374 | /* error codes are 4xx and 5xx, but regard 401 as a success, so we 375 | * don't abort until all headers have been parsed. */ 376 | - if (s->http_code >= 400 && s->http_code < 600 && (s->http_code != 401 377 | - || s->auth_state.auth_type != HTTP_AUTH_NONE) && 378 | - (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) { 379 | + if (s->http_code >= 400 && s->http_code < 600 && s->http_code != 403 380 | + && (s->http_code != 401 || s->auth_state.auth_type != HTTP_AUTH_NONE) 381 | + && (s->http_code != 407 || s->proxy_auth_state.auth_type != HTTP_AUTH_NONE)) { 382 | end += strspn(end, SPACE_CHARS); 383 | av_log(h, AV_LOG_WARNING, "HTTP error %d %s\n", 384 | s->http_code, end); 385 | @@ -352,7 +364,7 @@ static inline int has_header(const char *str, const char *header) 386 | static int http_read_header(URLContext *h, int *new_location) 387 | { 388 | HTTPContext *s = h->priv_data; 389 | - char line[1024]; 390 | + char line[10240]; 391 | int err = 0; 392 | 393 | s->chunksize = -1; 394 | @@ -380,13 +392,12 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, 395 | { 396 | HTTPContext *s = h->priv_data; 397 | int post, err; 398 | - char headers[1024] = ""; 399 | + char headers[10240] = ""; 400 | char *authstr = NULL, *proxyauthstr = NULL; 401 | int64_t off = s->off; 402 | int len = 0; 403 | const char *method; 404 | 405 | - 406 | /* send http header */ 407 | post = h->flags & AVIO_FLAG_WRITE; 408 | 409 | @@ -411,7 +422,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, 410 | if (!has_header(s->headers, "\r\nAccept: ")) 411 | len += av_strlcpy(headers + len, "Accept: */*\r\n", 412 | sizeof(headers) - len); 413 | - if (!has_header(s->headers, "\r\nRange: ") && !post) 414 | + if (!has_header(s->headers, "\r\nRange: ") && !post && !strstr(hoststr, "youku.com")) 415 | len += av_strlcatf(headers + len, sizeof(headers) - len, 416 | "Range: bytes=%"PRId64"-\r\n", s->off); 417 | 418 | @@ -450,6 +461,8 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, 419 | authstr ? authstr : "", 420 | proxyauthstr ? "Proxy-" : "", proxyauthstr ? proxyauthstr : ""); 421 | 422 | + 423 | + av_dlog(h, "HTTP HEADERS: \n%s\n", s->buffer); 424 | av_freep(&authstr); 425 | av_freep(&proxyauthstr); 426 | if ((err = ffurl_write(s->hd, s->buffer, strlen(s->buffer))) < 0) 427 | @@ -479,7 +492,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path, 428 | /* wait for header */ 429 | err = http_read_header(h, new_location); 430 | if (err < 0) 431 | - return err; 432 | + return err; 433 | 434 | return (off == s->off) ? 0 : -1; 435 | } 436 | @@ -691,8 +704,8 @@ static int http_proxy_close(URLContext *h) 437 | static int http_proxy_open(URLContext *h, const char *uri, int flags) 438 | { 439 | HTTPContext *s = h->priv_data; 440 | - char hostname[1024], hoststr[1024]; 441 | - char auth[1024], pathbuf[1024], *path; 442 | + char hostname[10240], hoststr[10240]; 443 | + char auth[10240], pathbuf[10240], *path; 444 | char lower_url[100]; 445 | int port, ret = 0, attempts = 0; 446 | HTTPAuthType cur_auth_type; 447 | diff --git a/libavformat/isom.h b/libavformat/isom.h 448 | index f1cbe8c..9f6645a 100644 449 | --- a/libavformat/isom.h 450 | +++ b/libavformat/isom.h 451 | @@ -3,6 +3,7 @@ 452 | * copyright (c) 2001 Fabrice Bellard 453 | * copyright (c) 2002 Francois Revol 454 | * copyright (c) 2006 Baptiste Coudurier 455 | + * Copyright (c) 2011 Cedirc Fung (wolfplanet@gmail.com) 456 | * 457 | * This file is part of FFmpeg. 458 | * 459 | @@ -155,6 +156,8 @@ typedef struct MOVContext { 460 | int chapter_track; 461 | int use_absolute_path; 462 | int64_t next_root_atom; ///< offset of the next root atom 463 | + uint8_t esds_data[256]; 464 | + int64_t esds_size; 465 | } MOVContext; 466 | 467 | int ff_mp4_read_descr_len(AVIOContext *pb); 468 | diff --git a/libavformat/mmsh.c b/libavformat/mmsh.c 469 | index d6e3982..b786a54 100644 470 | --- a/libavformat/mmsh.c 471 | +++ b/libavformat/mmsh.c 472 | @@ -69,6 +69,7 @@ static int mmsh_close(URLContext *h) 473 | ffurl_close(mms->mms_hd); 474 | av_free(mms->streams); 475 | av_free(mms->asf_header); 476 | + av_freep(&h->priv_data); 477 | return 0; 478 | } 479 | 480 | @@ -217,9 +218,12 @@ static int mmsh_open_internal(URLContext *h, const char *uri, int flags, int tim 481 | char httpname[256], path[256], host[128]; 482 | char *stream_selection = NULL; 483 | char headers[1024]; 484 | - MMSHContext *mmsh = h->priv_data; 485 | + MMSHContext *mmsh; 486 | MMSContext *mms; 487 | 488 | + mmsh = h->priv_data = av_mallocz(sizeof(MMSHContext)); 489 | + if (!h->priv_data) 490 | + return AVERROR(ENOMEM); 491 | mmsh->request_seq = h->is_streamed = 1; 492 | mms = &mmsh->mms; 493 | av_strlcpy(mmsh->location, uri, sizeof(mmsh->location)); 494 | @@ -405,6 +409,6 @@ URLProtocol ff_mmsh_protocol = { 495 | .url_seek = mmsh_seek, 496 | .url_close = mmsh_close, 497 | .url_read_seek = mmsh_read_seek, 498 | - .priv_data_size = sizeof(MMSHContext), 499 | + .priv_data_size = 0, // I manage the mmsh and mmst with mms:// , set to 0 to prevent utils.c 500 | .flags = URL_PROTOCOL_FLAG_NETWORK, 501 | }; 502 | diff --git a/libavformat/mmst.c b/libavformat/mmst.c 503 | index c3d2ebb..92ab703 100644 504 | --- a/libavformat/mmst.c 505 | +++ b/libavformat/mmst.c 506 | @@ -470,6 +470,7 @@ static int mms_close(URLContext *h) 507 | /* free all separately allocated pointers in mms */ 508 | av_free(mms->streams); 509 | av_free(mms->asf_header); 510 | + av_freep(&h->priv_data); 511 | 512 | return 0; 513 | } 514 | @@ -501,12 +502,15 @@ static void clear_stream_buffers(MMSContext *mms) 515 | 516 | static int mms_open(URLContext *h, const char *uri, int flags) 517 | { 518 | - MMSTContext *mmst = h->priv_data; 519 | + MMSTContext *mmst; 520 | MMSContext *mms; 521 | int port, err; 522 | char tcpname[256]; 523 | 524 | h->is_streamed = 1; 525 | + mmst = h->priv_data = av_mallocz(sizeof(MMSTContext)); 526 | + if (!h->priv_data) 527 | + return AVERROR(ENOMEM); 528 | mms = &mmst->mms; 529 | 530 | // only for MMS over TCP, so set proto = NULL 531 | @@ -624,6 +628,6 @@ URLProtocol ff_mmst_protocol = { 532 | .url_open = mms_open, 533 | .url_read = mms_read, 534 | .url_close = mms_close, 535 | - .priv_data_size = sizeof(MMSTContext), 536 | + .priv_data_size = 0, // I manage the mmsh and mmst with mms:// , set to 0 to prevent utils.c 537 | .flags = URL_PROTOCOL_FLAG_NETWORK, 538 | }; 539 | diff --git a/libavformat/mmsu.c b/libavformat/mmsu.c 540 | new file mode 100644 541 | index 0000000..33e96e6 542 | --- /dev/null 543 | +++ b/libavformat/mmsu.c 544 | @@ -0,0 +1,77 @@ 545 | +/* 546 | + * Just combine mmsh and mmst 547 | + * Copyright (c) Cedric Fung 548 | + * 549 | + * This file is part of FFmpeg. 550 | + * 551 | + * FFmpeg is free software; you can redistribute it and/or 552 | + * modify it under the terms of the GNU Lesser General Public 553 | + * License as published by the Free Software Foundation; either 554 | + * version 2.1 of the License, or (at your option) any later version. 555 | + * 556 | + * FFmpeg is distributed in the hope that it will be useful, 557 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 558 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 559 | + * Lesser General Public License for more details. 560 | + * 561 | + * You should have received a copy of the GNU Lesser General Public 562 | + * License along with FFmpeg; if not, write to the Free Software 563 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 564 | + */ 565 | + 566 | +#include 567 | +#if HAVE_SETMODE 568 | +#include 569 | +#endif 570 | +#include 571 | +#include 572 | +#include 573 | +#include "mms.h" 574 | +#include "asf.h" 575 | +#include "libavutil/intreadwrite.h" 576 | + 577 | +int mmst = 0; 578 | +int mmsh = 0; 579 | + 580 | +static int mmsu_open(URLContext *h, const char *uri, int flags) { 581 | + extern URLProtocol ff_mmst_protocol; 582 | + extern URLProtocol ff_mmsh_protocol; 583 | + int ret; 584 | + 585 | + if ((ret = ff_mmst_protocol.url_open(h, uri, flags)) == 0) 586 | + mmst = 1; 587 | + else if ((ret = ff_mmsh_protocol.url_open(h, uri, flags)) == 0) 588 | + mmsh = 1; 589 | + 590 | + return ret; 591 | +} 592 | + 593 | +static int mmsu_read(URLContext *h, uint8_t *buf, int size) { 594 | + extern URLProtocol ff_mmst_protocol; 595 | + extern URLProtocol ff_mmsh_protocol; 596 | + if (mmst) 597 | + return ff_mmst_protocol.url_read(h, buf, size); 598 | + else if (mmsh) 599 | + return ff_mmsh_protocol.url_read(h, buf, size); 600 | + 601 | + return 0; 602 | +} 603 | + 604 | +static int mmsu_close(URLContext *h) { 605 | + extern URLProtocol ff_mmst_protocol; 606 | + extern URLProtocol ff_mmsh_protocol; 607 | + if (mmst) 608 | + return ff_mmst_protocol.url_close(h); 609 | + else if (mmsh) 610 | + return ff_mmsh_protocol.url_close(h); 611 | + 612 | + return 0; 613 | +} 614 | + 615 | + 616 | +URLProtocol ff_mmsu_protocol = { 617 | + .name = "mms", 618 | + .url_open = mmsu_open, 619 | + .url_read = mmsu_read, 620 | + .url_close = mmsu_close, 621 | +}; 622 | diff --git a/libavformat/mov.c b/libavformat/mov.c 623 | index b4295f8..f53bddb 100644 624 | --- a/libavformat/mov.c 625 | +++ b/libavformat/mov.c 626 | @@ -2,6 +2,7 @@ 627 | * MOV demuxer 628 | * Copyright (c) 2001 Fabrice Bellard 629 | * Copyright (c) 2009 Baptiste Coudurier 630 | + * Copyright (c) 2011 Cedirc Fung (wolfplanet@gmail.com) 631 | * 632 | * This file is part of FFmpeg. 633 | * 634 | @@ -525,6 +526,13 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) 635 | st = fc->streams[fc->nb_streams-1]; 636 | 637 | avio_rb32(pb); /* version + flags */ 638 | + MOVContext *c = fc->priv_data; 639 | + int64_t left = (int64_t)atom.size; 640 | + if (left > c->esds_size + 3 && left <= (off_t)sizeof(c->esds_data)) { 641 | + avio_read(pb, c->esds_data, left - 4); 642 | + c->esds_size = left - 4; 643 | + avio_skip(pb, 4 - left); 644 | + } 645 | ff_mp4_read_descr(fc, pb, &tag); 646 | if (tag == MP4ESDescrTag) { 647 | ff_mp4_parse_es_descr(pb, NULL); 648 | --------------------------------------------------------------------------------