From edc982430cc93144b0e6edb9fc49f04275eb69ed Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Tue, 7 Feb 2017 20:17:33 -0800 Subject: [PATCH] ffmpeg: update to 3.2.4, add libshine support, add fdk-aac support to custom, cleanup Also makes the following changes: Updates project URL and moves libpthread to a common dependency; Makes libopus support in libffmpeg-full contingent on selecting the libopus package, like other external libraries; Adds note regarding disabling altivec in ppc hard-float; Reorganizes SIMD sections to be together; Drops the need to specify decoder=libopus from -full, done by default; Adds encoder=libopus to custom. Expand options for libffmpeg-custom: Build licensing: GPL, GPLv3, LGPLv3 Building for performance or size Drops version 3 of GPL for -audio-dec, -mini, and -full. Version 3 is at the discretion of the packager, per: http://ffmpeg.org/doxygen/trunk/md_LICENSE.html Add enable-nonfree toggle support to libffmpeg-custom build licensing to allow inclusion of libfdk-aac. Use ffmpeg's names for its external libraries in libffmpeg-custom config Alphabetize same Correct @BUILD_PATENTED flags for libffmpeg variants Split libffmpeg-full into hard/soft float: Hard float configures itself for lame / libx264 using GPL license Soft float for libshine and LGPL license Signed-off-by: Ian Leonard Signed-off-by: Ted Hess --- multimedia/ffmpeg/Config.in | 48 +++++++++++-- multimedia/ffmpeg/Makefile | 137 ++++++++++++++++++++++++++---------- 2 files changed, 143 insertions(+), 42 deletions(-) diff --git a/multimedia/ffmpeg/Config.in b/multimedia/ffmpeg/Config.in index d2ab7d1f0..cd0d5f885 100644 --- a/multimedia/ffmpeg/Config.in +++ b/multimedia/ffmpeg/Config.in @@ -1,9 +1,37 @@ if PACKAGE_libffmpeg-custom +comment "Build Licensing" + +config FFMPEG_CUSTOM_GPL + bool "Allow use of GPL code" + help + By default, FFMpeg is licensed under the LGPL. This builds a GPL licensed version. + Some software requires this, such as libx264. + default y + +config FFMPEG_CUSTOM_GPLV3 + bool "Use (L)GPL v3" + help + Uses the LPGL v3 if GPL isn't selected, or GPL v3 if it is. + +config FFMPEG_CUSTOM_NONFREE + bool "Use code with complex licensing requirements; see help" + help + This sets --enable-nonfree, which in almost all cases, will prohibit redistribution of the resulting package. + Use this with care. + default n + config FFMPEG_CUSTOM_PATENTED bool "Include patented codecs and technologies" default BUILD_PATENTED +comment "Build Properties" + +config FFMPEG_CUSTOM_LARGE + bool "Build libffmpeg for performance instead of minimizing size on disk" + default y if ( x86_64 ) + default n + comment "Profiles" config FFMPEG_CUSTOM_FFSERVER_SUPPORT @@ -105,8 +133,14 @@ config FFMPEG_CUSTOM_AUDIO_DEC_SUPPORT comment "External Libraries" -config FFMPEG_CUSTOM_SELECT_mp3lame - bool "MP3 LAME" +config FFMPEG_CUSTOM_SELECT_libfdk-aac + bool "Fraunhofer FDK AAC encoding library (libfdk-aac)" + depends on FFMPEG_CUSTOM_NONFREE + depends on FFMPEG_CUSTOM_PATENTED + depends on PACKAGE_fdk-aac + +config FFMPEG_CUSTOM_SELECT_libmp3lame + bool "Libmp3lame" depends on FFMPEG_CUSTOM_PATENTED depends on PACKAGE_lame-lib select FFMPEG_CUSTOM_DECODER_mp3 @@ -114,11 +148,15 @@ config FFMPEG_CUSTOM_SELECT_mp3lame select FFMPEG_CUSTOM_DEMUXER_mp3 config FFMPEG_CUSTOM_SELECT_libopus - bool "Opus" + bool "Libopus" + +config FFMPEG_CUSTOM_SELECT_libshine + bool "Libshine" -config FFMPEG_CUSTOM_SELECT_x264 - bool "x264" +config FFMPEG_CUSTOM_SELECT_libx264 + bool "Libx264" depends on FFMPEG_CUSTOM_PATENTED + depends on FFMPEG_CUSTOM_GPL depends on PACKAGE_libx264 select FFMPEG_CUSTOM_DECODER_h264 select FFMPEG_CUSTOM_MUXER_h264 diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index f87401444..75933bb3a 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -1,5 +1,6 @@ # # Copyright (C) 2006-2017 OpenWrt.org +# Copyright (C) 2017 Ian Leonard # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,14 +9,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ffmpeg -PKG_VERSION:=3.2.2 +PKG_VERSION:=3.2.4 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://ffmpeg.org/releases/ -PKG_MD5SUM:=e34d1b92c5d844f2a3611c741a6dba18 -PKG_HASH:=3f01bd1fe1a17a277f8c84869e5d9192b4b978cb660872aa2b54c3cc8a2fedfc -PKG_MAINTAINER:=Ted Hess +PKG_MD5SUM:=39fd71024ac76ba35f04397021af5606 +PKG_HASH:=6e38ff14f080c98b58cf5967573501b8cb586e3a173b591f3807d8f0660daf7a +PKG_MAINTAINER:=Ted Hess , \ + Ian Leonard PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3 PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3 @@ -224,7 +226,8 @@ include $(INCLUDE_DIR)/package.mk define Package/ffmpeg/Default TITLE:=FFmpeg - URL:=http://ffmpeg.mplayerhq.hu/ + URL:=https://ffmpeg.org/ + DEPENDS+= +libpthread endef define Package/ffmpeg/Default/description @@ -238,7 +241,7 @@ $(call Package/ffmpeg/Default) SECTION:=multimedia CATEGORY:=Multimedia TITLE+= program - DEPENDS+= +libpthread +libffmpeg-full + DEPENDS+= +libffmpeg-full VARIANT:=full endef @@ -270,7 +273,7 @@ $(call Package/ffserver/Default) SECTION:=multimedia CATEGORY:=Multimedia TITLE+= streaming server - DEPENDS+= +libpthread +libffmpeg-full + DEPENDS+= +libffmpeg-full VARIANT:=full endef @@ -285,7 +288,7 @@ $(call Package/ffmpeg/Default) SECTION:=libs CATEGORY:=Libraries TITLE+= libraries - DEPENDS+= @BUILD_PATENTED +libpthread +zlib +libbz2 + DEPENDS+= +libpthread +zlib +libbz2 PROVIDES:= libffmpeg endef @@ -294,8 +297,9 @@ define Package/libffmpeg-custom $(call Package/libffmpeg/Default) TITLE+= (custom) DEPENDS+= +FFMPEG_CUSTOM_SELECT_libopus:libopus \ - +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib - + +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \ + +FFMPEG_CUSTOM_SELECT_libshine:shine \ + +PACKAGE_fdk-aac:fdk-aac VARIANT:=custom MENU:=1 endef @@ -314,6 +318,7 @@ endef define Package/libffmpeg-audio-dec $(call Package/libffmpeg/Default) TITLE+= (audio) + DEPENDS+= @BUILD_PATENTED VARIANT:=audio-dec endef @@ -327,10 +332,16 @@ endef define Package/libffmpeg-full $(call Package/libffmpeg/Default) TITLE+= (full) - DEPENDS+= +alsa-lib +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib +libopus + DEPENDS+= @BUILD_PATENTED +alsa-lib +PACKAGE_libopus:libopus + ifeq ($(CONFIG_SOFT_FLOAT),y) + DEPENDS+= +PACKAGE_shine:shine + else + DEPENDS+= +PACKAGE_lame-lib:lame-lib +PACKAGE_libx264:libx264 + endif VARIANT:=full endef + define Package/libffmpeg-full/description $(call Package/ffmpeg/Default/description) . @@ -341,6 +352,7 @@ endef define Package/libffmpeg-mini $(call Package/libffmpeg/Default) TITLE+= (mini) + DEPENDS+= @BUILD_PATENTED VARIANT:=mini endef @@ -363,15 +375,11 @@ FFMPEG_CONFIGURE:= \ --pkg-config="pkg-config" \ --enable-shared \ --enable-static \ - --enable-small \ --enable-pthreads \ --enable-zlib \ --disable-doc \ --disable-debug \ \ - --enable-gpl \ - --enable-version3 \ - \ --disable-dxva2 \ --disable-lzma \ --disable-vaapi \ @@ -415,18 +423,13 @@ FFMPEG_CONFIGURE += \ else ifneq ($(findstring arm,$(CONFIG_ARCH)),) FFMPEG_CONFIGURE += \ --disable-runtime-cpudetect +# XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700) else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),) FFMPEG_CONFIGURE += \ --disable-altivec endif -ifneq ($(CONFIG_YASM),y) -FFMPEG_CONFIGURE += \ - --disable-yasm - -endif - -#selectibly disable optimizations according to arch/cpu type +# selectively disable optimizations according to arch/cpu type ifneq ($(findstring arm,$(CONFIG_ARCH)),) ifeq (,$(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION))) FFMPEG_CONFIGURE+= \ @@ -439,11 +442,28 @@ ifneq ($(findstring arm,$(CONFIG_ARCH)),) endif +ifneq ($(CONFIG_YASM),y) +FFMPEG_CONFIGURE += \ + --disable-yasm + +endif + ifeq ($(BUILD_VARIANT),full) FFMPEG_CONFIGURE+= \ - --enable-libopus --enable-decoder=libopus \ - $(if $(CONFIG_PACKAGE_libx264),--enable-libx264) \ - $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame) + $(if $(CONFIG_PACKAGE_libopus),--enable-libopus) + ifeq ($(CONFIG_SOFT_FLOAT),y) + FFMPEG_CONFIGURE+= \ + --enable-small \ + \ + $(if $(CONFIG_PACKAGE_shine),--enable-libshine) + else + FFMPEG_CONFIGURE+= \ + --enable-small \ + --enable-gpl \ + \ + $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame) \ + $(if $(CONFIG_PACKAGE_libx264),--enable-libx264) + endif endif ifeq ($(BUILD_VARIANT),custom) @@ -453,6 +473,26 @@ ifeq ($(BUILD_VARIANT),custom) $(if $($(3)_$(c)),--enable-$(1)="$(c)") \ ) + ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y) + FFMPEG_CONFIGURE+= \ + --enable-hardcoded-tables + else + FFMPEG_CONFIGURE+= \ + --enable-small + endif + + ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y) + FFMPEG_CONFIGURE+= --enable-gpl + endif + + ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y) + FFMPEG_CONFIGURE+= --enable-version3 + endif + + ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y) + FFMPEG_CONFIGURE+= --enable-nonfree + endif + FFMPEG_CONFIGURE+= \ --disable-programs \ --disable-avfilter \ @@ -471,23 +511,32 @@ ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y) FFMPEG_CONFIGURE+= \ --enable-decoder=adpcm_ima_wav \ --enable-decoder=adpcm_ima_qt \ - --enable-decoder=adpcm_ms \ + --enable-decoder=adpcm_ms +endif + +ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y) + FFMPEG_CONFIGURE+= \ + --enable-libfdk-aac --enable-encoder=libfdk_aac +endif +ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y) + FFMPEG_CONFIGURE+= \ + --enable-libmp3lame --enable-encoder=libmp3lame endif ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y) FFMPEG_CONFIGURE+= \ - --enable-libopus --enable-decoder=libopus + --enable-libopus --enable-decoder=libopus --enable-encoder=libopus endif -ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_x264),y) +ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y) FFMPEG_CONFIGURE+= \ - --enable-libx264 + --enable-libshine --enable-encoder=libshine endif -ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_mp3lame),y) +ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),y) FFMPEG_CONFIGURE+= \ - --enable-libmp3lame + --enable-libx264 --enable-encoder=libx264 endif endif @@ -500,6 +549,9 @@ ifeq ($(BUILD_VARIANT),audio-dec) ) FFMPEG_CONFIGURE+= \ + --enable-small \ + --enable-gpl \ + \ --disable-programs \ --disable-avfilter \ --disable-postproc \ @@ -522,6 +574,8 @@ ifeq ($(BUILD_VARIANT),mini) ) FFMPEG_CONFIGURE+= \ + --enable-small \ + \ --disable-programs \ --disable-avdevice \ --disable-avfilter \ @@ -531,8 +585,7 @@ ifeq ($(BUILD_VARIANT),mini) --disable-everything \ $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \ $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \ - $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \ - + $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) endif ifneq ($(CONFIG_TARGET_x86),) @@ -558,13 +611,19 @@ define Build/InstallDev/custom $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/ endef +# Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc) define Build/InstallDev/full $(INSTALL_DIR) $(1)/usr/include - $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale} $(1)/usr/include/ $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.{a,so*} $(1)/usr/lib/ $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/ + $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale} $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/ +ifneq ($(CONFIG_SOFT_FLOAT),y) + $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/ +endif endef define Build/InstallDev/mini @@ -622,9 +681,13 @@ define Package/libffmpeg-custom/install $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/ endef +# Soft float is LGPL (no libpostproc); Hard float is GPL (yes libpostproc) define Package/libffmpeg-full/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,postproc,swresample,swscale}.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avutil,swresample,swscale}.so.* $(1)/usr/lib/ +ifneq ($(CONFIG_SOFT_FLOAT),y) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/ +endif endef define Package/libffmpeg-mini/install