From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id DE6951396D0 for ; Sun, 27 Aug 2017 06:33:45 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 24035E0E21; Sun, 27 Aug 2017 06:33:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E62ADE0E21 for ; Sun, 27 Aug 2017 06:33:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7E7B8341909 for ; Sun, 27 Aug 2017 06:33:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D4E3C841F for ; Sun, 27 Aug 2017 06:33:41 +0000 (UTC) From: "Alexis Ballier" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alexis Ballier" Message-ID: <1503815617.e63a1ba6346da70d5a896393f0c28cef6a6fd868.aballier@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-video/ffmpeg/, media-video/ffmpeg/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-video/ffmpeg/ffmpeg-9999.ebuild media-video/ffmpeg/files/chromium.patch media-video/ffmpeg/metadata.xml X-VCS-Directories: media-video/ffmpeg/files/ media-video/ffmpeg/ X-VCS-Committer: aballier X-VCS-Committer-Name: Alexis Ballier X-VCS-Revision: e63a1ba6346da70d5a896393f0c28cef6a6fd868 X-VCS-Branch: master Date: Sun, 27 Aug 2017 06:33:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: be373b4b-1cf9-4591-bce7-208f5863a5c6 X-Archives-Hash: 4fee1ed2cddc8556ac2ba83fb3242b54 commit: e63a1ba6346da70d5a896393f0c28cef6a6fd868 Author: James Le Cuirot gentoo org> AuthorDate: Mon Jul 24 21:53:18 2017 +0000 Commit: Alexis Ballier gentoo org> CommitDate: Sun Aug 27 06:33:37 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e63a1ba6 media-video/ffmpeg: Allow building libffmpeg for Chromium via USE flag Chromium is built from source and therefore can be built against the system ffmpeg. Google Chrome already ships with support for proprietary codecs and has libffmpeg.so built in. Opera and Vivaldi, on the other hand, do not support proprietary codecs and actively encourage you to replace the libffmpeg.so they provide. Official instructions involve downloading the huge Chromium tarball and building tons of baggage that you don't actually need, despite the fact that libffmpeg.so is really just the main ffmpeg libraries combined. In order to build this, I felt it was worthwhile leveraging our existing feature-rich ffmpeg package rather than duplicating it or creating some poor imitation. This commit shows what little extra code is required. It would be possible to link to the regular libraries directly instead of buildling additional copies if it weren't for the fact that these browsers are usually built with -DFF_API_CONVERGENCE_DURATION=0, making the ABI incompatible, at least until libavcodec hits 59. That aside, all Chromium versions between 59 and 61 (maybe earlier?) use the 55.57.57 ffmpeg ABI found in the 3.x series. Having these browsers optionally RDEPEND on ffmpeg:0/55.57.57[chromium] should therefore not be a problem for the time being. They simply need to provide a symlink. I have tested this with current versions of vivaldi, vivaldi-snapshot, opera, opera-beta, and opera-developer. None were able to play videos on news.bbc.co.uk without Flash until swapping in this library. It has been noted that Vivaldi could potentially be built from source. I may explore this possibility but I believe this change is still useful, especially as some lack sufficient hardware to build these browsers from source. Package-Manager: Portage-2.3.6, Repoman-2.3.2 media-video/ffmpeg/ffmpeg-9999.ebuild | 34 ++++++++++++++++++++++++- media-video/ffmpeg/files/chromium.patch | 45 +++++++++++++++++++++++++++++++++ media-video/ffmpeg/metadata.xml | 1 + 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild b/media-video/ffmpeg/ffmpeg-9999.ebuild index e2ab9a865dc..55572458a50 100644 --- a/media-video/ffmpeg/ffmpeg-9999.ebuild +++ b/media-video/ffmpeg/ffmpeg-9999.ebuild @@ -96,7 +96,7 @@ FFMPEG_ENCODER_FLAG_MAP=( ) IUSE=" - alsa doc +encode jack oss pic static-libs test v4l + alsa chromium doc +encode jack oss pic static-libs test v4l ${FFMPEG_FLAG_MAP[@]%:*} ${FFMPEG_ENCODER_FLAG_MAP[@]%:*} " @@ -289,6 +289,10 @@ RESTRICT=" S=${WORKDIR}/${P/_/-} +PATCHES=( + "${FILESDIR}"/chromium.patch +) + MULTILIB_WRAPPED_HEADERS=( /usr/include/libavutil/avconfig.h ) @@ -419,6 +423,20 @@ multilib_src_configure() { "${myconf[@]}" echo "${@}" "${@}" || die + + if multilib_is_native_abi && use chromium; then + einfo "Configuring for Chromium" + mkdir -p ../chromium || die + pushd ../chromium >/dev/null || die + set -- "${@}" \ + --disable-shared \ + --enable-static \ + --enable-pic \ + --extra-cflags="-DFF_API_CONVERGENCE_DURATION=0" + echo "${@}" + "${@}" || die + popd >/dev/null || die + fi } multilib_src_compile() { @@ -430,6 +448,13 @@ multilib_src_compile() { emake V=1 tools/${i} fi done + + if use chromium; then + einfo "Compiling for Chromium" + pushd ../chromium >/dev/null || die + emake V=1 libffmpeg + popd >/dev/null || die + fi fi } @@ -442,6 +467,13 @@ multilib_src_install() { dobin tools/${i} fi done + + if use chromium; then + einfo "Installing for Chromium" + pushd ../chromium >/dev/null || die + emake V=1 DESTDIR="${D}" install-libffmpeg + popd >/dev/null || die + fi fi } diff --git a/media-video/ffmpeg/files/chromium.patch b/media-video/ffmpeg/files/chromium.patch new file mode 100644 index 00000000000..bc8b8d38698 --- /dev/null +++ b/media-video/ffmpeg/files/chromium.patch @@ -0,0 +1,45 @@ +Allow libffmpeg to be built for Chromium-based browsers +https://patchwork.ffmpeg.org/patch/4500/ + +diff --git a/Makefile b/Makefile +index 29870d7..1e267e7 100644 +--- a/Makefile ++++ b/Makefile +@@ -65,6 +65,7 @@ all: all-yes + + include $(SRC_PATH)/tools/Makefile + include $(SRC_PATH)/ffbuild/common.mak ++include $(SRC_PATH)/ffbuild/libffmpeg.mak + + FF_EXTRALIBS := $(FFEXTRALIBS) + FF_DEP_LIBS := $(DEP_LIBS) +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,21 @@ ++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) ++ ++libffmpeg-: libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) libswresample/$(LIBPREF)swresample$(LIBSUF) ++ $(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(FFEXTRALIBS) ++ ++libffmpeg-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF) ++ $(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil ++ ++$(LIBFFMPEG): libffmpeg-$(CONFIG_SHARED) ++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 libffmpeg-* install-libffmpeg +-- +2.13.1 + diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml index b8773a83a67..ef95f758afd 100644 --- a/media-video/ffmpeg/metadata.xml +++ b/media-video/ffmpeg/metadata.xml @@ -17,6 +17,7 @@ Enables audio CD grabbing with dev-libs/libcdio. Adds Xiph CELT audio decoding support via media-libs/celt Enables audio fingerprinting support with media-libs/chromaprint. + Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi. Enables runtime CPU detection (useful for bindist, compatibility on other CPUs) Enables EBU R128 loudness normalization filter via media-libs/libebur128 Use external faac library for AAC encoding