summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Le Cuirot <chewi@gentoo.org>2023-12-03 23:00:26 +0000
committerJames Le Cuirot <chewi@gentoo.org>2023-12-03 23:20:35 +0000
commit7f29ab93f0b3a680d39e48dece2bb98149dd8aff (patch)
treef1e443398b05f0aff6e882a50e4d5042351a1772 /media-video
parentmedia-video/ffmpeg: Stop building a separate Chromium library for 6.1+ (diff)
downloadgentoo-7f29ab93f0b3a680d39e48dece2bb98149dd8aff.tar.gz
gentoo-7f29ab93f0b3a680d39e48dece2bb98149dd8aff.tar.bz2
gentoo-7f29ab93f0b3a680d39e48dece2bb98149dd8aff.zip
media-video/ffmpeg: Make Chromium library useful again for 6.1+
The libffmpeg.so Chromium library hasn't actually been usable with Chromium for a long time due to a missing symbol. It seems like this symbol will never be upstreamed, so patch it in here. Also ensure Opus support is enabled as browsers expect this. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Diffstat (limited to 'media-video')
-rw-r--r--media-video/ffmpeg/ffmpeg-6.1.ebuild11
-rw-r--r--media-video/ffmpeg/ffmpeg-9999.ebuild11
-rw-r--r--media-video/ffmpeg/files/chromium-r2.patch41
-rw-r--r--media-video/ffmpeg/files/chromium.c8
4 files changed, 57 insertions, 14 deletions
diff --git a/media-video/ffmpeg/ffmpeg-6.1.ebuild b/media-video/ffmpeg/ffmpeg-6.1.ebuild
index 665e6e7610cb..188eb6e7b762 100644
--- a/media-video/ffmpeg/ffmpeg-6.1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.1.ebuild
@@ -334,6 +334,7 @@ GPL_REQUIRED_USE="
)
"
REQUIRED_USE="
+ chromium? ( opus )
cuda? ( nvenc )
fftools_cws2fws? ( zlib )
glslang? ( vulkan !shaderc )
@@ -350,7 +351,7 @@ RESTRICT="
S=${WORKDIR}/${P/_/-}
PATCHES=(
- "${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/chromium-r2.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -382,6 +383,7 @@ src_prepare() {
# will ignore user's preference.
sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+ ln -snf "${FILESDIR}"/chromium.c chromium.c || die
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
}
@@ -566,13 +568,8 @@ multilib_src_install() {
fi
done
- if use chromium; then
+ use chromium &&
emake V=1 DESTDIR="${D}" install-libffmpeg
-
- # When not built separately, libffmpeg has no code of
- # its own so this QA check raises a false positive.
- QA_FLAGS_IGNORED+=" usr/$(get_libdir)/chromium/.*"
- fi
fi
}
diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild b/media-video/ffmpeg/ffmpeg-9999.ebuild
index 665e6e7610cb..188eb6e7b762 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-9999.ebuild
@@ -334,6 +334,7 @@ GPL_REQUIRED_USE="
)
"
REQUIRED_USE="
+ chromium? ( opus )
cuda? ( nvenc )
fftools_cws2fws? ( zlib )
glslang? ( vulkan !shaderc )
@@ -350,7 +351,7 @@ RESTRICT="
S=${WORKDIR}/${P/_/-}
PATCHES=(
- "${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/chromium-r2.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -382,6 +383,7 @@ src_prepare() {
# will ignore user's preference.
sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+ ln -snf "${FILESDIR}"/chromium.c chromium.c || die
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
}
@@ -566,13 +568,8 @@ multilib_src_install() {
fi
done
- if use chromium; then
+ use chromium &&
emake V=1 DESTDIR="${D}" install-libffmpeg
-
- # When not built separately, libffmpeg has no code of
- # its own so this QA check raises a false positive.
- QA_FLAGS_IGNORED+=" usr/$(get_libdir)/chromium/.*"
- fi
fi
}
diff --git a/media-video/ffmpeg/files/chromium-r2.patch b/media-video/ffmpeg/files/chromium-r2.patch
new file mode 100644
index 000000000000..1de86fe09a1e
--- /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/chromium.c b/media-video/ffmpeg/files/chromium.c
new file mode 100644
index 000000000000..66c2e9f6614f
--- /dev/null
+++ b/media-video/ffmpeg/files/chromium.c
@@ -0,0 +1,8 @@
+#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
+
+int64_t av_stream_get_first_dts(const AVStream *st);
+int64_t av_stream_get_first_dts(const AVStream *st)
+{
+ return cffstream(st)->first_dts;
+}