public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "James Le Cuirot" <chewi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/, media-video/ffmpeg/files/
Date: Sun,  3 Dec 2023 23:20:53 +0000 (UTC)	[thread overview]
Message-ID: <1701645635.7f29ab93f0b3a680d39e48dece2bb98149dd8aff.chewi@gentoo> (raw)

commit:     7f29ab93f0b3a680d39e48dece2bb98149dd8aff
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  3 23:00:26 2023 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun Dec  3 23:20:35 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f29ab93

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 <AT> gentoo.org>

 media-video/ffmpeg/ffmpeg-6.1.ebuild       | 11 +++-----
 media-video/ffmpeg/ffmpeg-9999.ebuild      | 11 +++-----
 media-video/ffmpeg/files/chromium-r2.patch | 41 ++++++++++++++++++++++++++++++
 media-video/ffmpeg/files/chromium.c        |  8 ++++++
 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;
+}


             reply	other threads:[~2023-12-03 23:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-03 23:20 James Le Cuirot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-10-19 13:22 [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/, media-video/ffmpeg/files/ Ionen Wolkens
2025-08-05 15:50 Ionen Wolkens
2025-03-11  9:04 Ionen Wolkens
2024-11-19 21:21 Andreas K. Hüttel
2024-08-29  7:52 Andrew Ammerlaan
2024-07-03  0:37 Sam James
2023-12-16 11:26 Sam James
2023-08-02  8:13 Sam James
2023-07-26  4:08 Sam James
2023-06-07  3:38 Sam James
2023-03-15  2:15 Sam James
2023-03-14 20:23 Craig Andrews
2022-10-09 23:10 Sam James
2022-08-21  2:39 Sam James
2022-07-21  2:53 Matt Turner
2022-07-21  2:31 Matt Turner
2022-04-17 19:24 Sam James
2022-03-16 15:18 Sam James
2020-10-07 17:07 Sam James
2020-07-27 16:40 Sam James
2020-06-17 17:35 Thomas Deutschmann
2017-10-08 10:21 Alexis Ballier
2017-08-27  6:33 Alexis Ballier
2016-10-24 10:35 Alexis Ballier
2016-02-01  8:41 Alexis Ballier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1701645635.7f29ab93f0b3a680d39e48dece2bb98149dd8aff.chewi@gentoo \
    --to=chewi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox