# 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
+#Uncomment the one you want
+#USE_LIBAV ?= 1
+#USE_FFMPEG ?= 1
+
+ifdef USE_FFMPEG
+HASH=HEAD
+FFMPEG_SNAPURL := http://git.videolan.org/?p=ffmpeg.git;a=snapshot;h=$(HASH);sf=tgz
+else
+HASH=HEAD
+FFMPEG_SNAPURL := http://git.libav.org/?p=libav.git;a=snapshot;h=$(HASH);sf=tgz
+endif
FFMPEGCONF = \
--cc="$(CC)" \
+ --pkg-config="$(PKG_CONFIG)" \
--disable-doc \
- --disable-decoder=libvpx \
+ --disable-encoder=vorbis \
--enable-libgsm \
- --enable-libvpx \
--enable-libopenjpeg \
--disable-debug \
- --enable-gpl \
- --enable-postproc \
- --disable-ffprobe \
- --disable-ffserver \
- --disable-ffmpeg \
- --disable-ffplay \
+ --disable-avdevice \
--disable-devices \
- --disable-protocols \
--disable-avfilter \
- --disable-network
-DEPS_ffmpeg = zlib gsm vpx $(DEPS_vpx) openjpeg
+ --disable-filters \
+ --disable-bsfs \
+ --disable-bzlib \
+ --disable-avresample
+
+ifdef USE_FFMPEG
+FFMPEGCONF += \
+ --disable-swresample \
+ --disable-iconv
+endif
+
+DEPS_ffmpeg = zlib gsm openjpeg
# Optional dependencies
+ifndef BUILD_NETWORK
+FFMPEGCONF += --disable-network
+endif
ifdef BUILD_ENCODERS
-FFMPEGCONF += --enable-libmp3lame
-DEPS_ffmpeg += lame $(DEPS_lame)
+FFMPEGCONF += --enable-libmp3lame --enable-libvpx --disable-decoder=libvpx --disable-decoder=libvpx_vp8 --disable-decoder=libvpx_vp9
+DEPS_ffmpeg += lame $(DEPS_lame) vpx $(DEPS_vpx)
else
FFMPEGCONF += --disable-encoders --disable-muxers
-# XXX: REVISIT --enable-small ?
endif
-# XXX: REVISIT
-#ifndef HAVE_FPU
-#FFMPEGCONF += --disable-mpegaudio-hp
-#endif
+# Small size
+ifdef ENABLE_SMALL
+FFMPEGCONF += --enable-small
+endif
+ifeq ($(ARCH),arm)
+ifdef HAVE_ARMV7A
+FFMPEGCONF += --enable-thumb
+endif
+endif
ifdef HAVE_CROSS_COMPILE
-FFMPEGCONF += --enable-cross-compile --cross-prefix=$(HOST)-
+FFMPEGCONF += --enable-cross-compile --disable-programs
+ifndef HAVE_DARWIN_OS
+FFMPEGCONF += --cross-prefix=$(HOST)-
+endif
endif
# ARM stuff
ifeq ($(ARCH),arm)
-FFMPEGCONF += --disable-runtime-cpudetect
+FFMPEGCONF += --arch=arm
+ifdef HAVE_NEON
+FFMPEGCONF += --enable-neon
+endif
+ifdef HAVE_ARMV7A
+FFMPEGCONF += --cpu=cortex-a8
+endif
+ifdef HAVE_ARMV6
+FFMPEGCONF += --cpu=armv6 --disable-neon
+endif
+endif
+
+# ARM64 stuff
+ifeq ($(ARCH),aarch64)
+FFMPEGCONF += --arch=aarch64
+endif
+
+# MIPS stuff
+ifeq ($(ARCH),mipsel)
+FFMPEGCONF += --arch=mips
+endif
+
+# x86 stuff
+ifeq ($(ARCH),i386)
+ifndef HAVE_DARWIN_OS
+FFMPEGCONF += --arch=x86
+endif
+endif
+
+# x86_64 stuff
+ifeq ($(ARCH),x86_64)
+ifndef HAVE_DARWIN_OS
+FFMPEGCONF += --arch=x86_64
+endif
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
+ifdef USE_FFMPEG
+FFMPEGCONF += --disable-lzma
endif
ifeq ($(ARCH),x86_64)
FFMPEGCONF += --cpu=core2
endif
-DEPS_ffmpeg += yasm $(DEPS_yasm)
+ifdef HAVE_IOS
+FFMPEGCONF += --enable-pic --extra-ldflags="$(EXTRA_CFLAGS)"
+ifdef HAVE_NEON
+FFMPEGCONF += --as="$(AS)"
+endif
+endif
+ifdef HAVE_MACOSX
+FFMPEGCONF += --enable-vda
+endif
endif
# Linux
ifdef HAVE_LINUX
FFMPEGCONF += --target-os=linux --enable-pic
+
endif
# Windows
ifdef HAVE_WIN32
+ifndef HAVE_MINGW_W64
+DEPS_ffmpeg += directx
+endif
FFMPEGCONF += --target-os=mingw32 --enable-memalign-hack
-FFMPEGCONF += --enable-w32threads \
- --disable-bzlib --disable-bsfs \
- --disable-decoder=dca --disable-encoder=vorbis
+FFMPEGCONF += --enable-w32threads --enable-dxva2 \
+ --disable-decoder=dca
ifdef HAVE_WIN64
-FFMPEGCONF += --disable-dxva2
-
FFMPEGCONF += --cpu=athlon64 --arch=x86_64
else # !WIN64
-FFMPEGCONF += --enable-dxva2
-DEPS_ffmpeg += directx
-
FFMPEGCONF+= --cpu=i686 --arch=x86
endif
-else
+
+else # !Windows
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
+# Solaris
+ifdef HAVE_SOLARIS
+ifeq ($(ARCH),x86_64)
+FFMPEGCONF += --cpu=core2
+endif
+FFMPEGCONF += --target-os=sunos --enable-pic
endif
-
-FFMPEG_CFLAGS += --std=gnu99
# Build
-
PKGS += ffmpeg
-ifeq ($(call need_pkg,"libavcodec libavformat libswscale"),)
+ifeq ($(call need_pkg,"libavcodec >= 54.25.0 libavformat >= 53.21.0 libswscale"),)
PKGS_FOUND += ffmpeg
endif
-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 cvz ffmpeg-svn > $@
+FFMPEGCONF += --nm="$(NM)" --ar="$(AR)"
-FFMPEG_VERSION := svn
+$(TARBALLS)/ffmpeg-$(HASH).tar.gz:
+ $(call download,$(FFMPEG_SNAPURL))
-.sum-ffmpeg: $(TARBALLS)/ffmpeg-$(FFMPEG_VERSION).tar.gz
+.sum-ffmpeg: $(TARBALLS)/ffmpeg-$(HASH).tar.gz
$(warning Not implemented.)
touch $@
-ffmpeg: ffmpeg-$(FFMPEG_VERSION).tar.gz .sum-ffmpeg
- $(UNPACK)
-ifdef HAVE_WIN64
- $(APPLY) $(SRC)/ffmpeg/ffmpeg-win64.patch
-endif
-ifdef HAVE_WIN32
- sed -i "s/std=c99/std=gnu99/" $@-$(FFMPEG_VERSION)/configure
-endif
- $(APPLY) $(SRC)/ffmpeg/libavformat-ape.c.patch
+ffmpeg: ffmpeg-$(HASH).tar.gz .sum-ffmpeg
+ rm -Rf $@ $@-$(HASH)
+ mkdir -p $@-$(HASH)
+ $(XZCAT) "$<" | (cd $@-$(HASH) && tar xv --strip-components=1)
$(MOVE)
.ffmpeg: ffmpeg
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