From 5328a2f39350ac16734807e28255fedfb9cf30be Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Sat, 14 Dec 2019 21:27:35 -0800 Subject: [PATCH 1/5] ffmpeg: update to 4.2.2 Drop upstreamed libfdk-aac patches. ffserver was removed in 4.0. ffmpeg does not have a replacement. Signed-off-by: Ian Leonard --- multimedia/ffmpeg/Config.in | 14 --- multimedia/ffmpeg/Makefile | 45 +-------- ...20-ffmpeg-fix-build-with-fdk-aac-2.0.patch | 92 ------------------- .../ffmpeg/patches/030-fdkaac-version.patch | 90 ------------------ .../ffmpeg/patches/040-fdkaac-eld.patch | 67 -------------- .../ffmpeg/patches/050-fdkaac-define.patch | 63 ------------- 6 files changed, 5 insertions(+), 366 deletions(-) delete mode 100644 multimedia/ffmpeg/patches/020-ffmpeg-fix-build-with-fdk-aac-2.0.patch delete mode 100644 multimedia/ffmpeg/patches/030-fdkaac-version.patch delete mode 100644 multimedia/ffmpeg/patches/040-fdkaac-eld.patch delete mode 100644 multimedia/ffmpeg/patches/050-fdkaac-define.patch diff --git a/multimedia/ffmpeg/Config.in b/multimedia/ffmpeg/Config.in index e365dc6ae..93cdd67cd 100644 --- a/multimedia/ffmpeg/Config.in +++ b/multimedia/ffmpeg/Config.in @@ -42,13 +42,6 @@ config FFMPEG_CUSTOM_LARGE comment "Profiles" -config FFMPEG_CUSTOM_FFSERVER_SUPPORT - bool "Include support for ffserver (FFmpeg streaming server)" - select FFMPEG_CUSTOM_MUXER_ffm - select FFMPEG_CUSTOM_DEMUXER_ffm - select FFMPEG_CUSTOM_DEMUXER_rtsp - select FFMPEG_CUSTOM_PROTOCOL_rtp - config FFMPEG_CUSTOM_MINIDLNA_SUPPORT bool "Include support for minidlna" select FFMPEG_CUSTOM_DECODER_aac @@ -136,7 +129,6 @@ config FFMPEG_CUSTOM_AUDIO_DEC_SUPPORT config FFMPEG_CUSTOM_PROGRAMS bool "Include ffmpeg command-line utilities" select PACKAGE_ffmpeg-custom - select PACKAGE_ffserver-custom select PACKAGE_ffprobe-custom comment "External Libraries" @@ -311,9 +303,6 @@ comment "Muxers" config FFMPEG_CUSTOM_MUXER_ac3 bool "AC3" -config FFMPEG_CUSTOM_MUXER_ffm - bool "FFM (ffserver live feed)" - config FFMPEG_CUSTOM_MUXER_h264 bool "H.264 Raw Video" depends on FFMPEG_CUSTOM_PATENTED @@ -363,9 +352,6 @@ config FFMPEG_CUSTOM_DEMUXER_ape config FFMPEG_CUSTOM_DEMUXER_flac bool "FLAC" -config FFMPEG_CUSTOM_DEMUXER_ffm - bool "FFM (ffserver live feed)" - config FFMPEG_CUSTOM_DEMUXER_h264 bool "H.264 Raw Video" depends on FFMPEG_CUSTOM_PATENTED diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index a5c04e7bc..c11f400a2 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2017-2019 Ian Leonard +# Copyright (C) 2017-2020 Ian Leonard # Copyright (C) 2018 Ted Hess # # This is free software, licensed under the GNU General Public License v2. @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ffmpeg -PKG_VERSION:=3.4.7 -PKG_RELEASE:=4 +PKG_VERSION:=4.2.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://ffmpeg.org/releases/ -PKG_HASH:=efd01782fd29b62505c973f5b61a65632d7b435dc9f4a6c97e92e6afd36cf5c8 +PKG_HASH:=cb754255ab0ee2ea5f66f8850e1bd6ad5cac1cd855d0a2f4990fb8c668b0d29c PKG_MAINTAINER:=Ted Hess , \ Ian Leonard @@ -203,7 +203,7 @@ FFMPEG_PATENTED_DECODERS:= \ hevc \ vc1 \ -FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENDED_DECODERS) +FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENTED_DECODERS) FFMPEG_PATENTED_MUXERS:= \ h264 \ @@ -295,32 +295,6 @@ endef Package/ffprobe-custom/description = $(Package/ffprobe/description) -define Package/ffserver -$(call Package/ffmpeg/Default) - SECTION:=multimedia - CATEGORY:=Multimedia - TITLE+= streaming server - DEPENDS+= +libffmpeg-full - VARIANT:=full -endef - -define Package/ffserver-custom -$(call Package/ffmpeg/Default) - SECTION:=multimedia - CATEGORY:=Multimedia - TITLE+= streaming server (custom) - DEPENDS+= @!ALL libffmpeg-custom - VARIANT:=custom -endef - -define Package/ffserver/description -$(call Package/ffmpeg/Default/description) - . - This package contains the FFmpeg streaming server. -endef - -Package/ffserver-custom/description = $(Package/ffserver/description) - define Package/libffmpeg/Default $(call Package/ffmpeg/Default) SECTION:=libs @@ -751,13 +725,6 @@ endef Package/ffprobe-custom/install = $(Package/ffprobe/install) -define Package/ffserver/install - $(INSTALL_DIR) $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/ -endef - -Package/ffserver-custom/install = $(Package/ffserver/install) - define Package/libffmpeg-custom/install $(INSTALL_DIR) $(1)/usr/lib $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/ @@ -787,10 +754,8 @@ Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install) $(eval $(call BuildPackage,ffmpeg)) $(eval $(call BuildPackage,ffprobe)) -$(eval $(call BuildPackage,ffserver)) $(eval $(call BuildPackage,ffmpeg-custom)) $(eval $(call BuildPackage,ffprobe-custom)) -$(eval $(call BuildPackage,ffserver-custom)) $(eval $(call BuildPackage,libffmpeg-audio-dec)) $(eval $(call BuildPackage,libffmpeg-full)) $(eval $(call BuildPackage,libffmpeg-mini)) diff --git a/multimedia/ffmpeg/patches/020-ffmpeg-fix-build-with-fdk-aac-2.0.patch b/multimedia/ffmpeg/patches/020-ffmpeg-fix-build-with-fdk-aac-2.0.patch deleted file mode 100644 index b8bd26ed4..000000000 --- a/multimedia/ffmpeg/patches/020-ffmpeg-fix-build-with-fdk-aac-2.0.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 141c960e21d2860e354f9b90df136184dd00a9a8 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Fri, 31 Aug 2018 14:25:30 +0300 -Subject: [PATCH] libfdk-aacenc: Fix building with libfdk-aac v2 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -When flushing the encoder, we now need to provide non-null buffer -parameters for everything, even if they are unused. - -The encoderDelay parameter has been replaced by two, nDelay and -nDelayCore. - -Signed-off-by: Martin Storsjö ---- - libavcodec/libfdk-aacenc.c | 34 +++++++++++++++++++++++++--------- - 1 file changed, 25 insertions(+), 9 deletions(-) - -diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c -index c340a1e3e0c..2ad768ed44e 100644 ---- a/libavcodec/libfdk-aacenc.c -+++ b/libavcodec/libfdk-aacenc.c -@@ -26,6 +26,11 @@ - #include "audio_frame_queue.h" - #include "internal.h" - -+#define FDKENC_VER_AT_LEAST(vl0, vl1) \ -+ (defined(AACENCODER_LIB_VL0) && \ -+ ((AACENCODER_LIB_VL0 > vl0) || \ -+ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))) -+ - typedef struct AACContext { - const AVClass *class; - HANDLE_AACENCODER handle; -@@ -286,7 +291,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) - } - - avctx->frame_size = info.frameLength; -+#if FDKENC_VER_AT_LEAST(4, 0) -+ avctx->initial_padding = info.nDelay; -+#else - avctx->initial_padding = info.encoderDelay; -+#endif - ff_af_queue_init(avctx, &s->afq); - - if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) { -@@ -319,28 +328,35 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - int out_buffer_size, out_buffer_element_size; - void *in_ptr, *out_ptr; - int ret; -+ uint8_t dummy_buf[1]; - AACENC_ERROR err; - - /* handle end-of-stream small frame and flushing */ - if (!frame) { -+ /* Must be a non-null pointer, even if it's a dummy. We could use -+ * the address of anything else on the stack as well. */ -+ in_ptr = dummy_buf; -+ in_buffer_size = 0; -+ - in_args.numInSamples = -1; - } else { -- in_ptr = frame->data[0]; -- in_buffer_size = 2 * avctx->channels * frame->nb_samples; -- in_buffer_element_size = 2; -+ in_ptr = frame->data[0]; -+ in_buffer_size = 2 * avctx->channels * frame->nb_samples; - -- in_args.numInSamples = avctx->channels * frame->nb_samples; -- in_buf.numBufs = 1; -- in_buf.bufs = &in_ptr; -- in_buf.bufferIdentifiers = &in_buffer_identifier; -- in_buf.bufSizes = &in_buffer_size; -- in_buf.bufElSizes = &in_buffer_element_size; -+ in_args.numInSamples = avctx->channels * frame->nb_samples; - - /* add current frame to the queue */ - if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) - return ret; - } - -+ in_buffer_element_size = 2; -+ in_buf.numBufs = 1; -+ in_buf.bufs = &in_ptr; -+ in_buf.bufferIdentifiers = &in_buffer_identifier; -+ in_buf.bufSizes = &in_buffer_size; -+ in_buf.bufElSizes = &in_buffer_element_size; -+ - /* The maximum packet size is 6144 bits aka 768 bytes per channel. */ - if ((ret = ff_alloc_packet2(avctx, avpkt, FFMAX(8192, 768 * avctx->channels), 0)) < 0) - return ret; diff --git a/multimedia/ffmpeg/patches/030-fdkaac-version.patch b/multimedia/ffmpeg/patches/030-fdkaac-version.patch deleted file mode 100644 index 5162ae894..000000000 --- a/multimedia/ffmpeg/patches/030-fdkaac-version.patch +++ /dev/null @@ -1,90 +0,0 @@ -From ffb9b7a6bab6c6bfd3dd9a7c32e3724209824999 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Tue, 4 Sep 2018 11:29:37 +0300 -Subject: [PATCH] libfdk-aac: Consistently use a proper version check macro for - detecting features -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The previous version checks checked explicitly for the version -where the version define was added to the installed headers, -making an "#ifdef AACDECODER_LIB_VL0" enough. Now that we have -a need for more diverse version checks than this, convert all checks -to such checks. - -Signed-off-by: Martin Storsjö ---- - libavcodec/libfdk-aacdec.c | 13 ++++++++----- - libavcodec/libfdk-aacenc.c | 6 +++--- - 2 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c -index 3be65155b5f..c3d3b70fc93 100644 ---- a/libavcodec/libfdk-aacdec.c -+++ b/libavcodec/libfdk-aacdec.c -@@ -25,9 +25,12 @@ - #include "avcodec.h" - #include "internal.h" - --/* The version macro is introduced the same time as the setting enum was -- * changed, so this check should suffice. */ --#ifndef AACDECODER_LIB_VL0 -+#define FDKDEC_VER_AT_LEAST(vl0, vl1) \ -+ (defined(AACDECODER_LIB_VL0) && \ -+ ((AACDECODER_LIB_VL0 > vl0) || \ -+ (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))) -+ -+#if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10 - #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS - #endif - -@@ -72,7 +75,7 @@ static const AVOption fdk_aac_dec_options[] = { - OFFSET(drc_level), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 127, AD, NULL }, - { "drc_heavy", "Dynamic Range Control: heavy compression, where [1] is on (RF mode) and [0] is off", - OFFSET(drc_heavy), AV_OPT_TYPE_INT, { .i64 = -1}, -1, 1, AD, NULL }, --#ifdef AACDECODER_LIB_VL0 -+#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 - { "level_limit", "Signal level limiting", OFFSET(level_limit), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, 1, AD }, - #endif - { NULL } -@@ -293,7 +296,7 @@ static av_cold int fdk_aac_decode_init(AVCodecContext *avctx) - } - } - --#ifdef AACDECODER_LIB_VL0 -+#if FDKDEC_VER_AT_LEAST(2, 5) // 2.5.10 - if (aacDecoder_SetParam(s->handle, AAC_PCM_LIMITER_ENABLE, s->level_limit) != AAC_DEC_OK) { - av_log(avctx, AV_LOG_ERROR, "Unable to set in signal level limiting in the decoder\n"); - return AVERROR_UNKNOWN; -diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c -index 2ad768ed44e..92ad1762aea 100644 ---- a/libavcodec/libfdk-aacenc.c -+++ b/libavcodec/libfdk-aacenc.c -@@ -156,7 +156,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) - case 6: mode = MODE_1_2_2_1; sce = 2; cpe = 2; break; - /* The version macro is introduced the same time as the 7.1 support, so this - should suffice. */ --#ifdef AACENCODER_LIB_VL0 -+#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12 - case 8: - sce = 2; - cpe = 3; -@@ -291,7 +291,7 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) - } - - avctx->frame_size = info.frameLength; --#if FDKENC_VER_AT_LEAST(4, 0) -+#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0 - avctx->initial_padding = info.nDelay; - #else - avctx->initial_padding = info.encoderDelay; -@@ -412,7 +412,7 @@ static const uint64_t aac_channel_layout[] = { - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT0_BACK, - AV_CH_LAYOUT_5POINT1_BACK, --#ifdef AACENCODER_LIB_VL0 -+#if FDKENC_VER_AT_LEAST(3, 4) // 3.4.12 - AV_CH_LAYOUT_7POINT1_WIDE_BACK, - AV_CH_LAYOUT_7POINT1, - #endif diff --git a/multimedia/ffmpeg/patches/040-fdkaac-eld.patch b/multimedia/ffmpeg/patches/040-fdkaac-eld.patch deleted file mode 100644 index 2f9880ef8..000000000 --- a/multimedia/ffmpeg/patches/040-fdkaac-eld.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 7e929dac100916fc45cb95e231025f3439c20156 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Tue, 4 Sep 2018 11:45:35 +0300 -Subject: [PATCH] libfdk-aacenc: Allow enabling the ELDv2 profile -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This is a new feature in FDK v2. - -Signed-off-by: Martin Storsjö ---- - libavcodec/libfdk-aacenc.c | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) - -diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c -index 92ad1762aea..f71a276403e 100644 ---- a/libavcodec/libfdk-aacenc.c -+++ b/libavcodec/libfdk-aacenc.c -@@ -36,6 +36,7 @@ typedef struct AACContext { - HANDLE_AACENCODER handle; - int afterburner; - int eld_sbr; -+ int eld_v2; - int signaling; - int latm; - int header_period; -@@ -47,6 +48,9 @@ typedef struct AACContext { - static const AVOption aac_enc_options[] = { - { "afterburner", "Afterburner (improved quality)", offsetof(AACContext, afterburner), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, - { "eld_sbr", "Enable SBR for ELD (for SBR in other configurations, use the -profile parameter)", offsetof(AACContext, eld_sbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, -+#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0 -+ { "eld_v2", "Enable ELDv2 (LD-MPS extension for ELD stereo signals)", offsetof(AACContext, eld_v2), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM }, -+#endif - { "signaling", "SBR/PS signaling style", offsetof(AACContext, signaling), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 2, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, - { "default", "Choose signaling implicitly (explicit hierarchical by default, implicit if global header is disabled)", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, - { "implicit", "Implicit backwards compatible signaling", 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, "signaling" }, -@@ -149,7 +153,28 @@ static av_cold int aac_encode_init(AVCodecContext *avctx) - - switch (avctx->channels) { - case 1: mode = MODE_1; sce = 1; cpe = 0; break; -- case 2: mode = MODE_2; sce = 0; cpe = 1; break; -+ case 2: -+#if FDKENC_VER_AT_LEAST(4, 0) // 4.0.0 -+ // (profile + 1) to map from profile range to AOT range -+ if (aot == FF_PROFILE_AAC_ELD + 1 && s->eld_v2) { -+ if ((err = aacEncoder_SetParam(s->handle, AACENC_CHANNELMODE, -+ 128)) != AACENC_OK) { -+ av_log(avctx, AV_LOG_ERROR, "Unable to enable ELDv2: %s\n", -+ aac_get_error(err)); -+ goto error; -+ } else { -+ mode = MODE_212; -+ sce = 1; -+ cpe = 0; -+ } -+ } else -+#endif -+ { -+ mode = MODE_2; -+ sce = 0; -+ cpe = 1; -+ } -+ break; - case 3: mode = MODE_1_2; sce = 1; cpe = 1; break; - case 4: mode = MODE_1_2_1; sce = 2; cpe = 1; break; - case 5: mode = MODE_1_2_2; sce = 1; cpe = 2; break; diff --git a/multimedia/ffmpeg/patches/050-fdkaac-define.patch b/multimedia/ffmpeg/patches/050-fdkaac-define.patch deleted file mode 100644 index 4a84ad8c2..000000000 --- a/multimedia/ffmpeg/patches/050-fdkaac-define.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 2a9e1c122eed66be1b26b747342b848300b226c7 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Martin=20Storsj=C3=B6?= -Date: Wed, 12 Sep 2018 23:03:12 +0300 -Subject: [PATCH] libfdk-aac: Don't use defined() in a #define -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -MSVC expands the preprocessor directives differently, making the -version check fail in the previous form. - -Clang can warn about this with -Wexpansion-to-defined (not currently -enabled by default): -warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined] - -Signed-off-by: Martin Storsjö ---- - libavcodec/libfdk-aacdec.c | 9 ++++++--- - libavcodec/libfdk-aacenc.c | 9 ++++++--- - 2 files changed, 12 insertions(+), 6 deletions(-) - -diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c -index ca70a49ad46..63856232d9e 100644 ---- a/libavcodec/libfdk-aacdec.c -+++ b/libavcodec/libfdk-aacdec.c -@@ -25,10 +25,13 @@ - #include "avcodec.h" - #include "internal.h" - -+#ifdef AACDECODER_LIB_VL0 - #define FDKDEC_VER_AT_LEAST(vl0, vl1) \ -- (defined(AACDECODER_LIB_VL0) && \ -- ((AACDECODER_LIB_VL0 > vl0) || \ -- (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))) -+ ((AACDECODER_LIB_VL0 > vl0) || \ -+ (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)) -+#else -+#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0 -+#endif - - #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10 - #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS -diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c -index f71a276403e..3b492ef8f48 100644 ---- a/libavcodec/libfdk-aacenc.c -+++ b/libavcodec/libfdk-aacenc.c -@@ -26,10 +26,13 @@ - #include "audio_frame_queue.h" - #include "internal.h" - -+#ifdef AACENCODER_LIB_VL0 - #define FDKENC_VER_AT_LEAST(vl0, vl1) \ -- (defined(AACENCODER_LIB_VL0) && \ -- ((AACENCODER_LIB_VL0 > vl0) || \ -- (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))) -+ ((AACENCODER_LIB_VL0 > vl0) || \ -+ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)) -+#else -+#define FDKENC_VER_AT_LEAST(vl0, vl1) 0 -+#endif - - typedef struct AACContext { - const AVClass *class; From 74b076521b2a6af016dc58ac6d7445175903b80f Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Sat, 14 Dec 2019 22:08:56 -0800 Subject: [PATCH 2/5] ffmpeg: enable gnutls support in libffmpeg-full Provides access to services requiring a secure connection. Chosen over openssl for license reason (can't redistribute). To my knowledge, libressl will have the same issue. mbed-tls is the only other ssl/tls provider, and this package is complicated enough. Signed-off-by: Ian Leonard --- multimedia/ffmpeg/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index c11f400a2..393982fc0 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -345,7 +345,7 @@ endef define Package/libffmpeg-full $(call Package/libffmpeg/Default) TITLE+= (full) - DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus \ + DEPENDS+= +alsa-lib +libgnutls +PACKAGE_libopus:libopus \ +SOFT_FLOAT:shine \ +!SOFT_FLOAT:lame-lib \ +PACKAGE_libx264:libx264 \ @@ -471,6 +471,7 @@ ifeq ($(BUILD_VARIANT),full) ) FFMPEG_CONFIGURE+= \ + --enable-gnutls \ --enable-avresample \ $(if $(CONFIG_BUILD_PATENTED),, \ $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \ From 4adfaa279e0761cc236445646be68cc555b7278f Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Tue, 31 Mar 2020 16:34:45 -0700 Subject: [PATCH 3/5] ffmpeg: don't provide libavresample libavresample has bene deprecated for a number of years. Its replacement is libswresample. Signed-off-by: Ian Leonard --- multimedia/ffmpeg/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index 393982fc0..57dbadd15 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -472,7 +472,6 @@ ifeq ($(BUILD_VARIANT),full) FFMPEG_CONFIGURE+= \ --enable-gnutls \ - --enable-avresample \ $(if $(CONFIG_BUILD_PATENTED),, \ $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \ $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \ @@ -667,9 +666,9 @@ define Build/InstallDev/full $(INSTALL_DIR) $(1)/usr/include $(INSTALL_DIR) $(1)/usr/lib $(INSTALL_DIR) $(1)/usr/lib/pkgconfig - $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,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_PACKAGE_libx264),) $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/ $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/ @@ -740,7 +739,7 @@ endef # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc) define Package/libffmpeg-full/install $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,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_PACKAGE_libx264),) $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/ endif From 79afc370f94cfcbb9104470aaf5b8433b829b0b4 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 11 Apr 2020 19:00:14 -0700 Subject: [PATCH 4/5] ffmpeg: add upstream patches fixing MIPS compilation Removed the Makefile references. Signed-off-by: Rosen Penev --- multimedia/ffmpeg/Makefile | 13 -- multimedia/ffmpeg/patches/020-drawtext.patch | 31 ++++ multimedia/ffmpeg/patches/030-h264-mips.patch | 16 ++ multimedia/ffmpeg/patches/040-aac-mips.patch | 141 ++++++++++++++++++ 4 files changed, 188 insertions(+), 13 deletions(-) create mode 100644 multimedia/ffmpeg/patches/020-drawtext.patch create mode 100644 multimedia/ffmpeg/patches/030-h264-mips.patch create mode 100644 multimedia/ffmpeg/patches/040-aac-mips.patch diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index 57dbadd15..333a8ef8a 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -410,12 +410,6 @@ FFMPEG_CONFIGURE+= \ --disable-armv5te \ --disable-armv6 \ --disable-armv6t2 \ - --disable-inline-asm \ - --disable-mipsdsp \ - --disable-mipsdspr2 \ - --disable-mipsfpu \ - --disable-msa \ - --disable-mmi \ --disable-fast-unaligned \ --disable-runtime-cpudetect @@ -428,13 +422,6 @@ FFMPEG_CONFIGURE+= \ --disable-altivec endif -# libavcodec/mips/aacdec_mips.c build problem -# XXX: disable use of assembly on MIPS. Patches welcome. -ifneq ($(findstring mips,$(CONFIG_ARCH)),) -FFMPEG_CONFIGURE+= \ - --disable-asm --disable-inline-asm -endif - # selectively disable optimizations according to arch/cpu type ifneq ($(findstring arm,$(CONFIG_ARCH)),) FFMPEG_CONFIGURE+= --enable-lto diff --git a/multimedia/ffmpeg/patches/020-drawtext.patch b/multimedia/ffmpeg/patches/020-drawtext.patch new file mode 100644 index 000000000..1b1887017 --- /dev/null +++ b/multimedia/ffmpeg/patches/020-drawtext.patch @@ -0,0 +1,31 @@ +From 8beb9e571ca6fb38d5f784bedd581398fb3da06f Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Mon, 6 Apr 2020 17:38:59 -0700 +Subject: [PATCH] avfilter/vf_drawtext: only test available exceptions + +soft float systems do not define these macros under musl. + +Fixes: Ticket7102 + +Signed-off-by: Rosen Penev +--- + libavfilter/vf_drawtext.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c +index 887a686d16d..abe1ca6c35c 100644 +--- a/libavfilter/vf_drawtext.c ++++ b/libavfilter/vf_drawtext.c +@@ -1083,10 +1083,12 @@ static int func_eval_expr_int_format(AVFilterContext *ctx, AVBPrint *bp, + + feclearexcept(FE_ALL_EXCEPT); + intval = res; ++#if defined(FE_INVALID) && defined(FE_OVERFLOW) && defined(FE_UNDERFLOW) + if ((ret = fetestexcept(FE_INVALID|FE_OVERFLOW|FE_UNDERFLOW))) { + av_log(ctx, AV_LOG_ERROR, "Conversion of floating-point result to int failed. Control register: 0x%08x. Conversion result: %d\n", ret, intval); + return AVERROR(EINVAL); + } ++#endif + + if (argc == 3) + av_strlcatf(fmt_str, sizeof(fmt_str), "0%u", positions); diff --git a/multimedia/ffmpeg/patches/030-h264-mips.patch b/multimedia/ffmpeg/patches/030-h264-mips.patch new file mode 100644 index 000000000..1626aa52d --- /dev/null +++ b/multimedia/ffmpeg/patches/030-h264-mips.patch @@ -0,0 +1,16 @@ +--- a/libavcodec/mips/cabac.h ++++ b/libavcodec/mips/cabac.h +@@ -28,6 +28,7 @@ + #include "libavutil/mips/mmiutils.h" + #include "config.h" + ++#ifndef __mips16 + #define get_cabac_inline get_cabac_inline_mips + static av_always_inline int get_cabac_inline(CABACContext *c, + uint8_t * const state){ +@@ -116,4 +117,5 @@ static av_always_inline int get_cabac_inline(CABACContext *c, + return bit; + } + ++#endif + #endif /* AVCODEC_MIPS_CABAC_H */ diff --git a/multimedia/ffmpeg/patches/040-aac-mips.patch b/multimedia/ffmpeg/patches/040-aac-mips.patch new file mode 100644 index 000000000..4605ca728 --- /dev/null +++ b/multimedia/ffmpeg/patches/040-aac-mips.patch @@ -0,0 +1,141 @@ +From 875ba2333340c2e13af370832e49c9371ffb0f91 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 5 Apr 2020 20:37:10 -0700 +Subject: [PATCH] avcodec/aacdec: fix compilation under soft float MIPS + +Place HAVE_MIPSFPU further up so that functions that use floating point +ASM are defined away. Otherwise compilation failures result when soft +float in enabled on the toolchain. + +Signed-off-by: Rosen Penev +--- + libavcodec/mips/aacdec_mips.c | 4 ++-- + libavcodec/mips/aacpsdsp_mips.c | 4 ++-- + libavcodec/mips/aacsbr_mips.c | 4 ++-- + libavcodec/mips/sbrdsp_mips.c | 4 ++-- + 4 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/libavcodec/mips/aacdec_mips.c b/libavcodec/mips/aacdec_mips.c +index 01a2b3087ba..8e306529351 100644 +--- a/libavcodec/mips/aacdec_mips.c ++++ b/libavcodec/mips/aacdec_mips.c +@@ -59,6 +59,7 @@ + #include "libavutil/mips/asmdefs.h" + + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + static av_always_inline void float_copy(float *dst, const float *src, int count) + { + // Copy 'count' floats from src to dst +@@ -282,7 +283,6 @@ static void apply_ltp_mips(AACContext *ac, SingleChannelElement *sce) + } + } + +-#if HAVE_MIPSFPU + static av_always_inline void fmul_and_reverse(float *dst, const float *src0, const float *src1, int count) + { + /* Multiply 'count' floats in src0 by src1 and store the results in dst in reverse */ +@@ -433,9 +433,9 @@ static void update_ltp_mips(AACContext *ac, SingleChannelElement *sce) + void ff_aacdec_init_mips(AACContext *c) + { + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + c->imdct_and_windowing = imdct_and_windowing_mips; + c->apply_ltp = apply_ltp_mips; +-#if HAVE_MIPSFPU + c->update_ltp = update_ltp_mips; + #endif /* HAVE_MIPSFPU */ + #endif /* HAVE_INLINE_ASM */ +diff --git a/libavcodec/mips/aacpsdsp_mips.c b/libavcodec/mips/aacpsdsp_mips.c +index 83fdc2f9dbd..ef47e31a9ea 100644 +--- a/libavcodec/mips/aacpsdsp_mips.c ++++ b/libavcodec/mips/aacpsdsp_mips.c +@@ -57,6 +57,7 @@ + #include "libavutil/mips/asmdefs.h" + + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + static void ps_hybrid_analysis_ileave_mips(float (*out)[32][2], float L[2][38][64], + int i, int len) + { +@@ -187,7 +188,6 @@ static void ps_hybrid_synthesis_deint_mips(float out[2][38][64], + } + } + +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + static void ps_add_squares_mips(float *dst, const float (*src)[2], int n) + { +@@ -450,9 +450,9 @@ static void ps_stereo_interpolate_mips(float (*l)[2], float (*r)[2], + void ff_psdsp_init_mips(PSDSPContext *s) + { + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_mips; + s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_mips; +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + s->add_squares = ps_add_squares_mips; + s->mul_pair_single = ps_mul_pair_single_mips; +diff --git a/libavcodec/mips/aacsbr_mips.c b/libavcodec/mips/aacsbr_mips.c +index 56aa4e86822..2e0cd723d7e 100644 +--- a/libavcodec/mips/aacsbr_mips.c ++++ b/libavcodec/mips/aacsbr_mips.c +@@ -58,6 +58,7 @@ + #define ENVELOPE_ADJUSTMENT_OFFSET 2 + + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + static int sbr_lf_gen_mips(AACContext *ac, SpectralBandReplication *sbr, + float X_low[32][40][2], const float W[2][32][32][2], + int buf_idx) +@@ -310,7 +311,6 @@ static int sbr_x_gen_mips(SpectralBandReplication *sbr, float X[2][38][64], + return 0; + } + +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + static void sbr_hf_assemble_mips(float Y1[38][64][2], + const float X_high[64][40][2], +@@ -611,9 +611,9 @@ static void sbr_hf_inverse_filter_mips(SBRDSPContext *dsp, + void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c) + { + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + c->sbr_lf_gen = sbr_lf_gen_mips; + c->sbr_x_gen = sbr_x_gen_mips; +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + c->sbr_hf_inverse_filter = sbr_hf_inverse_filter_mips; + c->sbr_hf_assemble = sbr_hf_assemble_mips; +diff --git a/libavcodec/mips/sbrdsp_mips.c b/libavcodec/mips/sbrdsp_mips.c +index 1b0a10608de..83039fd802a 100644 +--- a/libavcodec/mips/sbrdsp_mips.c ++++ b/libavcodec/mips/sbrdsp_mips.c +@@ -59,6 +59,7 @@ + #include "libavutil/mips/asmdefs.h" + + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + static void sbr_qmf_pre_shuffle_mips(float *z) + { + int Temp1, Temp2, Temp3, Temp4, Temp5, Temp6; +@@ -165,7 +166,6 @@ static void sbr_qmf_post_shuffle_mips(float W[32][2], const float *z) + ); + } + +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + static void sbr_sum64x5_mips(float *z) + { +@@ -890,9 +890,9 @@ static void sbr_hf_apply_noise_3_mips(float (*Y)[2], const float *s_m, + void ff_sbrdsp_init_mips(SBRDSPContext *s) + { + #if HAVE_INLINE_ASM ++#if HAVE_MIPSFPU + s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_mips; + s->qmf_post_shuffle = sbr_qmf_post_shuffle_mips; +-#if HAVE_MIPSFPU + #if !HAVE_MIPS32R6 && !HAVE_MIPS64R6 + s->sum64x5 = sbr_sum64x5_mips; + s->sum_square = sbr_sum_square_mips; From 366b8c706ff23742b15baf944f87b11c65369415 Mon Sep 17 00:00:00 2001 From: Ian Leonard Date: Tue, 28 Apr 2020 17:32:45 -0700 Subject: [PATCH 5/5] ffmpeg: drop call to disable PATENTED_ENCODERS Presently, this attempts to disable atrac3, h264, hevc and vc1. These encoders don't exist or are done through other programs (eg libx264). Handling of those other programs is done elsewhere. Signed-off-by: Ian Leonard --- multimedia/ffmpeg/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/multimedia/ffmpeg/Makefile b/multimedia/ffmpeg/Makefile index 333a8ef8a..a5025d73a 100644 --- a/multimedia/ffmpeg/Makefile +++ b/multimedia/ffmpeg/Makefile @@ -203,8 +203,6 @@ FFMPEG_PATENTED_DECODERS:= \ hevc \ vc1 \ -FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENTED_DECODERS) - FFMPEG_PATENTED_MUXERS:= \ h264 \ hevc \ @@ -461,7 +459,6 @@ ifeq ($(BUILD_VARIANT),full) --enable-gnutls \ $(if $(CONFIG_BUILD_PATENTED),, \ $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \ - $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \ $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \ $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \ $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \