From 501291269e95bf1d8a2abc48d78e0a22d351eadf Mon Sep 17 00:00:00 2001 From: odrling Date: Thu, 21 Mar 2024 00:41:18 +0100 Subject: [PATCH] media-video/ffmpeg: add patches and metadata --- media-video/ffmpeg/files/chromium-r2.patch | 41 ++++++++ ...ffmpeg-6.1-opencl-parallel-gmake-fix.patch | 13 +++ media-video/ffmpeg/metadata.xml | 96 +++++++++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 media-video/ffmpeg/files/chromium-r2.patch create mode 100644 media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch create mode 100644 media-video/ffmpeg/metadata.xml diff --git a/media-video/ffmpeg/files/chromium-r2.patch b/media-video/ffmpeg/files/chromium-r2.patch new file mode 100644 index 0000000..1de86fe --- /dev/null +++ b/media-video/ffmpeg/files/chromium-r2.patch @@ -0,0 +1,41 @@ +Allow libffmpeg to be built for Chromium-based browsers +https://patchwork.ffmpeg.org/patch/4500/ + +NOTE: This patch lacks the Makefile include line. We append it +manually instead to make patching across different versions easier. + +diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak +new file mode 100644 +index 0000000..992cf3c +--- /dev/null ++++ b/ffbuild/libffmpeg.mak +@@ -0,0 +1,27 @@ ++LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF) ++LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) $(LDLIBFLAGS) -o $(LIBFFMPEG) ++ ++ifeq ($(CONFIG_SHARED),yes) ++LIBFFMPEG_DEPS = libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF) ++else ++LIBFFMPEG_DEPS = libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) libswresample/$(LIBPREF)swresample$(LIBSUF) ++endif ++ ++$(LIBFFMPEG): $(LIBFFMPEG_DEPS) chromium.o ++ifeq ($(CONFIG_SHARED),yes) ++ $(LIBFFMPEG_LINK) -Wl,--no-as-needed chromium.o -lavcodec -lavformat -lavutil ++else ++ $(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(EXTRALIBS-avcodec) $(EXTRALIBS-avformat) $(EXTRALIBS-avutil) $(EXTRALIBS-swresample) ++endif ++ ++libffmpeg: $(LIBFFMPEG) ++ ++install-libffmpeg: $(LIBFFMPEG) ++ $(Q)mkdir -p "$(SHLIBDIR)/chromium" ++ $(INSTALL) -m 755 $< "$(SHLIBDIR)/chromium/$<" ++ $(STRIP) "$(SHLIBDIR)/chromium/$<" ++ ++uninstall-libffmpeg: ++ $(RM) "$(SHLIBDIR)/chromium/$(LIBFFMPEG)" ++ ++.PHONY: libffmpeg install-libffmpeg uninstall-libffmpeg +-- +2.13.1 diff --git a/media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch b/media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch new file mode 100644 index 0000000..c7eef79 --- /dev/null +++ b/media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch @@ -0,0 +1,13 @@ +Bug: https://bugs.gentoo.org/782553 + +--- a/libavfilter/Makefile ++++ b/libavfilter/Makefile +@@ -663,7 +663,7 @@ clean:: + $(RM) $(CLEANSUFFIXES:%=libavfilter/dnn/%) $(CLEANSUFFIXES:%=libavfilter/opencl/%) \ + $(CLEANSUFFIXES:%=libavfilter/vulkan/%) + +-OPENCL = $(subst $(SRC_PATH)/,,$(wildcard $(SRC_PATH)/libavfilter/opencl/*.cl)) ++OPENCL = $(wildcard libavfilter/opencl/*.cl) + .SECONDARY: $(OPENCL:.cl=.c) + libavfilter/opencl/%.c: TAG = OPENCL + libavfilter/opencl/%.c: $(SRC_PATH)/libavfilter/opencl/%.cl diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml new file mode 100644 index 0000000..31380f3 --- /dev/null +++ b/media-video/ffmpeg/metadata.xml @@ -0,0 +1,96 @@ + + + + + media-video@gentoo.org + + + chewi@gentoo.org + James Le Cuirot + chromium and soc USE flags + + + Enables support for AMD's Advanced Media Framework (AMF) + Enables Adaptive Multi-Rate Audio support + Enables Adaptive Multi-Rate Audio encoding support with media-libs/vo-amrwbenc. + Enables Apple AppKit framework + Enable playback of Blu-ray filesystems + Enables media-libs/libbs2b based Bauer stereo-to-binaural filter. + Enables audio CD grabbing with dev-libs/libcdio. + Enables audio fingerprinting support with media-libs/chromaprint. + Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi. + Enables codec2 low bit rate speech codec support via media-libs/codec2. + Enables runtime CPU detection (useful for bindist, compatibility on other CPUs) + Enables CUDA-based acceleration. Mostly used for specific filters. + Enables AV1 decoding via media-libs/dav1d. + Use external fdk-aac library for AAC encoding + Adds a text-to-speech filter based on app-accessibility/flite. + Enable frei0r wrapping in libavfilter + Enables fribidi support in the drawtext filter. + Enables gcrypt support: Needed for rtmp(t)e support if openssl, librtmp or gmp is not used. + Enables support for media-libs/game-music-emu for playing various video game music formats. + Use dev-util/glslang to compile GLSL + Build GPL code. Should be enabled unless you require LGPL binaries. + + Use pre-calculated tables rather than calculating them on the fly. + + It results in an increase of approximately 15% in the size of libavcodec, the main library impacted by this change. + It enables savings in table generation time, done once at codec initialization, since by hardcoding the tables, + they do not need to be computed at runtime. However, the savings are often negligible (~100k cycles is a typical number) especially when amortized + over the entire encoding/decoding operation. + + Improvements are being made to the runtime initialization, and so over time, this option will have an impact on fewer and fewer codecs. + + Support for FireWire DV/HDV input device using media-libs/libiec61883. + Enables media-libs/kvazaar based HEVC encoder. + Enable ICC profile support via media-libs/lcms. + Enables media-libs/libaom based AV1 codec support. + Enables ARIB text and caption decoding via media-libs/aribb24. + Enables x11-libs/libdrm support for better screen grabbing and hardware accelerated codecs. + Enables iLBC de/encoding via media-libs/libilbc. + Adds flexible GPU-accelerated processing filter based on media-libs/libplacebo. + Enables Real Time Messaging Protocol using librtmp (media-video/rtmpdump) in addition to FFmpeg's native implementation. + Enables audio resampling through media-libs/soxr. + Enables the OCR filter via app-text/tesseract. + Uses media-libs/libv4l for video4linux instead of direct calls. Adds support for more devices via the userspace library. + Uses dev-libs/libxml2 to enable dash demuxing support. + Enables lv2 audio filter wrapper. + Enables MIPS DSP ASE R1 optimizations. + Enables MIPS DSP ASE R2 optimizations. + Enables floating point MIPS optimizations. + Enable Intel Quick Sync Video via media-libs/intel-mediasdk (ffmpeg versions older than, and including, 5.1) or media-libs/libvpl (ffmpeg version newer than 5.1). + Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi. + Enables network streaming support + Enables H.264 encoding suppoprt via media-libs/openh264. + Enables dev-libs/openssl support. Adds support for encrypted network protocols (TLS/HTTPS). + Force shared libraries to be built as PIC (this is slower) + Build and install libpostproc. + Enables AV1 encoding support via media-video/rav1e. + Adds time-stretching and pitch-shifting audio filter based on media-libs/rubberband. + Use media-libs/shaderc to compile GLSL + Enable app-arch/snappy support. Required for e.g. Vidvox Hap encoder. + Enable support for the media-sound/sndio backend + Apply additional patches for efficient playback on some SoCs (e.g. ARM, RISC-V). + Enable support for Secure Reliable Transport (SRT) via net-libs/srt + Enable SSH/sftp support via net-libs/libssh. + Enables AV1 encoding support via media-libs/svt-av1. + Enables drawtext filter via media-libs/freetype and media-libs/harfbuzz. + Enables MP2 encoding via media-sound/twolame as an alternative to the internal encoder. + Enables video stabilization filter using vid.stab library (media-libs/vidstab). + Enables Netflix's perceptual video quality assessment filter using the library (media-libs/libvmaf). + Enables VP8 and VP9 codec support using libvpx: Decoding does not require this to be enabled but libvpx can also be used for decoding; encoding requires this useflag to be enabled though. + Enables HEVC encoding with media-libs/x265. + Enables net-libs/zeromq support with the zmq/azmq filters. + Enables media-libs/zimg based scale filter. + Enables media-libs/zvbi based teletext decoder. + + + For building against. This is the only slot that provides + headers and command line tools. Binary compatibility slots come and go + as required, so always pin dependencies to this slot when appropriate. + + + FFmpeg/FFmpeg + cpe:/a:ffmpeg:ffmpeg + +