[vlc-commits] contrib: FFmpeg (basic)
Rémi Denis-Courmont
git at videolan.org
Tue Jun 28 22:46:03 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jun 28 23:45:44 2011 +0300| [70af0a8cc63ab4a637a787e727be739b4e62b31c] | committer: Rémi Denis-Courmont
contrib: FFmpeg (basic)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=70af0a8cc63ab4a637a787e727be739b4e62b31c
---
contrib/src/ffmpeg/ffmpeg-win64.patch | 20 ++++
contrib/src/ffmpeg/libavformat-ape.c.patch | 17 +++
contrib/src/ffmpeg/rules.mak | 147 ++++++++++++++++++++++++++++
3 files changed, 184 insertions(+), 0 deletions(-)
diff --git a/contrib/src/ffmpeg/ffmpeg-win64.patch b/contrib/src/ffmpeg/ffmpeg-win64.patch
new file mode 100644
index 0000000..ea65999
--- /dev/null
+++ b/contrib/src/ffmpeg/ffmpeg-win64.patch
@@ -0,0 +1,20 @@
+Index: swscale_template.c
+===================================================================
+--- swscale_template.c (revision 31036)
++++ swscale_template.c (working copy)
+@@ -2466,6 +2466,7 @@
+ }
+ } else {
+ #endif /* COMPILE_TEMPLATE_MMX2 */
++#if 0
+ x86_reg xInc_shr16 = (x86_reg) (xInc >> 16);
+ uint16_t xInc_mask = xInc & 0xffff;
+ __asm__ volatile(
+@@ -2501,6 +2502,7 @@
+ "r" (src2)
+ : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
+ );
++#endif
+ #if COMPILE_TEMPLATE_MMX2
+ } //if MMX2 can't be used
+ #endif
diff --git a/contrib/src/ffmpeg/libavformat-ape.c.patch b/contrib/src/ffmpeg/libavformat-ape.c.patch
new file mode 100644
index 0000000..ab05cfc
--- /dev/null
+++ b/contrib/src/ffmpeg/libavformat-ape.c.patch
@@ -0,0 +1,17 @@
+X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=blobdiff_plain;f=libavformat%2Fape.c;h=187c9865a4fce398c7a4b4b19aad0a59b281a469;hp=2de47ef483245372a9a3c56656cd48a30a383856;hb=1c31b26bdf66879a46a7a3e340da815c1b2125a8;hpb=6947b0c42e0649f0c8355442d1732d642e467902
+
+diff --git a/libavformat/ape.c b/libavformat/ape.c
+index 2de47ef..187c986 100644
+--- a/libavformat/ape.c
++++ b/libavformat/ape.c
+@@ -242,6 +242,10 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
+ avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
+ }
+
++ if(!ape->totalframes){
++ av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
++ return AVERROR(EINVAL);
++ }
+ if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
+ av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
+ return -1;
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
new file mode 100644
index 0000000..d7c15ac
--- /dev/null
+++ b/contrib/src/ffmpeg/rules.mak
@@ -0,0 +1,147 @@
+# FFmpeg
+
+FFMPEG_VERSION=0.4.8
+FFMPEG_URL=$(SF)/ffmpeg/ffmpeg-$(FFMPEG_VERSION).tar.gz
+FFMPEG_SVN=svn://svn.ffmpeg.org/ffmpeg/trunk
+FFMPEG_SVN_REV=26400
+
+
+FFMPEGCONF = --cc="$(CC)" \
+ --disable-doc \
+ --disable-decoder=libvpx \
+ --disable-debug \
+ --enable-gpl \
+ --enable-postproc \
+ --disable-ffprobe \
+ --disable-ffserver \
+ --disable-ffmpeg \
+ --disable-ffplay \
+ --disable-devices \
+ --disable-protocols \
+ --disable-avfilter \
+ --disable-network
+
+# Optional dependencies
+ifdef BUILD_ENCODERS
+# TODO:
+#FFMPEGCONF+= --enable-libmp3lame
+#.ffmpeg: .lame
+else
+FFMPEGCONF += --disable-encoders --disable-muxers
+# XXX: REVISIT --enable-small ?
+endif
+
+ifdef HAVE_CROSS_COMPILE
+FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
+endif
+# XXX: REVISIT: gsm and vpx not used by VLC so should in PKGS?
+ifneq ($(filter gsm,$(PKGS)),)
+#FFMPEGCONF+= --enable-libgsm
+#.ffmpeg: .gsm
+endif
+ifneq ($(filter vpx,$(PKGS)),)
+#FFMPEGCONF += --enable-libvpx
+#.ffmpeg: .vpx
+endif
+
+# XXX: REVISIT
+#ifndef HAVE_FPU
+#FFMPEGCONF+= --disable-mpegaudio-hp
+#endif
+
+# ARM stuff
+ifeq ($(ARCH),arm)
+FFMPEGCONF += --disable-runtime-cpudetect
+# TODO: define HAVE_ARM_NEON or something
+ifdef HAVE_ARM_NEON
+# XXX: REVISIT choice of CPU?
+FFMPEGCONF += --cpu=cortex-a8 --enable-neon
+endif
+# TODO: --enable-iwmmxt if anyone still cares
+endif
+
+# Darwin
+ifdef HAVE_DARWIN_OS
+FFMPEGCONF += --arch=$(ARCH) --target-os=darwin
+FFMPEG_CFLAGS += -DHAVE_LRINTF
+endif
+ifdef HAVE_MACOSX
+ifneq ($(findstring $(ARCH),i386 x86_64),)
+FFMPEGCONF += --enable-memalign-hack
+endif
+ifeq ($(ARCH),x86_64)
+FFMPEGCONF += --cpu=core2
+endif
+.ffmpeg: .yasm
+endif
+
+# Linux
+ifdef HAVE_LINUX
+FFMPEGCONF += --target-os=linux --enable-pic
+endif
+
+# Windows
+ifdef HAVE_WIN32
+FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
+FFMPEGCONF += --enable-w32threads \
+ --disable-bzlib --disable-bsfs \
+ --disable-decoder=dca --disable-encoder=vorbis
+ifdef HAVE_WIN64
+FFMPEGCONF += --disable-dxva2
+FFMPEGCONF += --cpu=athlon64 --arch=x86_64
+else # !WIN64
+FFMPEGCONF += --enable-dxva2
+.ffmpeg: .directx
+FFMPEGCONF+= --cpu=i686 --arch=x86
+endif
+else
+FFMPEGCONF += --enable-pthreads
+endif
+
+ifdef HAVE_WINCE
+FFMPEGCONF += --target-os=mingw32ce --arch=armv4l --cpu=armv4t \
+ --disable-decoder=snow --disable-decoder=vc9 \
+ --disable-decoder=wmv3 --disable-decoder=vorbis \
+ --disable-decoder=dvdsub --disable-decoder=dvbsub
+endif
+
+FFMPEG_CFLAGS += --std=gnu99
+
+# Build
+
+PKGS += libav
+
+ffmpeg-$(FFMPEG_VERSION).tar.gz:
+ $(error FFmpeg snapshot is too old, VCS must be used!)
+ $(call download,$(FFMPEG_URL))
+
+$(TARBALLS)/ffmpeg-svn.tar.gz:
+ $(SVN) export $(FFMPEG_SVN) ffmpeg-svn
+ tar cv ffmpeg-svn | gzip > $@
+
+FFMPEG_VERSION := svn
+
+.sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
+ $(warning Not implemented.)
+ touch $@
+
+ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
+ $(UNPACK)
+ifdef HAVE_WIN64
+ (cd $@-$(FFMPEG_VERSION)/libswscale && patch -p0) < $(SRC)/ffmpeg/ffmpeg-win64.patch
+endif
+ifdef HAVE_WIN32
+ sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
+endif
+ (cd $@-$(FFMPEG_VERSION) && patch -p1) < $(SRC)/ffmpeg/libavformat-ape.c.patch
+ mv $@-$(FFMPEG_VERSION) $@
+ touch $@
+
+.ffmpeg: ffmpeg
+ # TODO: .zlib
+ cd $< && $(HOSTVARS) ./configure \
+ --extra-cflags="$(FFMPEG_CFLAGS) -DHAVE_STDINT_H" \
+ --extra-ldflags="$(LDFLAGS)" $(FFMPEGCONF) \
+ --prefix="$(PREFIX)" --enable-static --disable-shared
+ cd $< && $(MAKE) install-libs install-headers
+ touch $@
More information about the vlc-commits
mailing list