commit: 2e0e7b01a0c127d0b15a50ae27c6af9b9fb63c8f
Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 16 17:45:32 2023 +0000
Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat Feb 10 21:23:14 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2e0e7b01
media-video/ffmpeg: Conditionally apply patch set for playback on SoCs
As much as we hate deviating from upstream, this patch set is really
important for smooth playback on SoCs commonly used for ARM and RISC-V,
including the Raspberry Pi. We will enable the "soc" USE flag by default
on these architectures.
These are different patch sets floating around, but this one from John
Cox of Kynesim is the most comprehensive. It is the only one that
enables smooth playback for the Pi under Kodi, while benefiting other
systems at the same time. John keeps the set reasonably in sync with
upstream. The road is long, but the hope is that the changes will
eventually be upstreamed.
Note that LibreELEC only applies this patch set specifically for its Pi
builds, while using lighter sets for some other builds, but they have
told me that if we're only going to use one set then this is the one to
have.
Following this, also drop legacy Raspberry Pi support as
media-libs/raspberrypi-userland is being last-rited.
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
media-video/ffmpeg/Manifest | 1 +
.../{ffmpeg-9999.ebuild => ffmpeg-6.1.1-r3.ebuild} | 28 ++++++++++++++++------
media-video/ffmpeg/ffmpeg-9999.ebuild | 3 +--
media-video/ffmpeg/metadata.xml | 6 +++++
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest
index 1aa25cb51598..4175fef70c6f 100644
--- a/media-video/ffmpeg/Manifest
+++ b/media-video/ffmpeg/Manifest
@@ -7,3 +7,4 @@ DIST ffmpeg-6.0.tar.xz 10234012 BLAKE2B
c70884911f3a3e40fe87473f241a2a56b303f5ab
DIST ffmpeg-6.0.tar.xz.asc 520 BLAKE2B
be294d375108b57bca3c687620ce2517c54c99012d82dc7aa1a83d5fe6d5453bd3c8620fdfb743df780cf588983a06a66a458c4e3e454dbe535cbba9da30c48c
SHA512
a64cd0f8578fcea4537f5a38634c930d66c8ba4abd3e8e9dcffaeb95c3ad2e754d7bc4fbb5272409d4d32abf8180ef83f7204c6a570b52a37e635efd96cb94ed
DIST ffmpeg-6.1.1.tar.xz 10458600 BLAKE2B
77827ff92b47c773ed82e7b7793dbb135c370fe23501169cb1eab08ff5ede77cfd5b397e8fb1d38756812cc82277898fd5c74b7d8495842556570c0c5570daeb
SHA512
fca3f8635f29182e3ae0fe843a8a53614e4b47e22c11508df3ff7cdbafbb4b5ee0d82d9b3332871f7c1032033b1cad2f67557d7c5f7f7d85e2adadca122965d5
DIST ffmpeg-6.1.1.tar.xz.asc 520 BLAKE2B
801cd976d10363d1f9fc302351b330cb57e609a266407627ef378172f28974f4a18435b8a77b9cc7a8ff7b75701185211739f685629bbda961c3588c15af1221
SHA512
0e10c1f560bab0812d759d286656593dea5940f02bb52d88d9ba7f10b12b9cc3d7aa2a41c5f7a45b319069e04dce22dc1286b3c1ba685b35cd6d04cd81c5a0f5
+DIST ffmpeg-rpi-6.1.patch 1356823 BLAKE2B
094404eac6d1e43ac094634fa662ce312807013b8af3f80ced03b3d85f2547f803c71181b567c4db2756b2ea54b9bbaf7516a1f72a389d0889c2531edd177275
SHA512
7bdb857146d01ac54ce23c0b2bf32f0255419af52217aed873036cdc82678c3c7ac0e9557ed316fd316faf41c011778bcec277cc4de4d3b7fd9f5eab4078da69
diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild
b/media-video/ffmpeg/ffmpeg-6.1.1-r3.ebuild
similarity index 95%
copy from media-video/ffmpeg/ffmpeg-9999.ebuild
copy to media-video/ffmpeg/ffmpeg-6.1.1-r3.ebuild
index 461eb1559ef2..f512e9d9ac81 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.1.1-r3.ebuild
@@ -14,6 +14,10 @@ EAPI=8
# doing so since such a case is unlikely.
FFMPEG_SUBSLOT=58.60.60
+SOC_PATCHES=(
+ ffmpeg-rpi-6.1.patch
+)
+
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
SCM="git-r3"
@@ -25,14 +29,15 @@ inherit flag-o-matic multilib multilib-minimal
toolchain-funcs ${SCM}
DESCRIPTION="Complete solution to record/convert/stream audio and video.
Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( "${SOC_PATCHES[@]/#/https://dev.gentoo.org/~chewi/distfiles/}"
)"
if [ "${PV#9999}" != "${PV}" ] ; then
- SRC_URI=""
+ :
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.xz"
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
else # Release
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/ffmpeg.asc
inherit verify-sig
- SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.xz"
+ SRC_URI+=" https://ffmpeg.org/releases/${P/_/-}.tar.xz"
SRC_URI+=" verify-sig? (
https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc )"
BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-ffmpeg )"
@@ -84,7 +89,7 @@ FFMPEG_FLAG_MAP=(
# decoders
amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2
+dav1d:libdav1d fdk:libfdk-aac
jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme
gsm:libgsm
- libaribb24 mmal modplug:libmodplug opus:libopus qsv:libvpl
libilbc librtmp ssh:libssh
+ libaribb24 modplug:libmodplug opus:libopus qsv:libvpl libilbc
librtmp ssh:libssh
speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
vorbis:libvorbis vpx:libvpx zvbi:libzvbi
# libavfilter options
@@ -108,7 +113,7 @@ FFMPEG_ENCODER_FLAG_MAP=(
)
IUSE="
- alsa chromium doc +encode oss +pic sndio static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l soc
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -251,7 +256,6 @@ RDEPEND="
libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] )
lv2? ( media-libs/lv2[${MULTILIB_USEDEP}]
media-libs/lilv[${MULTILIB_USEDEP}] )
lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
- mmal? ( media-libs/raspberrypi-userland )
modplug? ( >=media-libs/libmodplug-0.8.8.4-r1[${MULTILIB_USEDEP}] )
openal? ( >=media-libs/openal-1.15.1[${MULTILIB_USEDEP}] )
opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
@@ -264,6 +268,7 @@ RDEPEND="
sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
shaderc? ( media-libs/shaderc[${MULTILIB_USEDEP}] )
sndio? ( media-sound/sndio:=[${MULTILIB_USEDEP}] )
+ soc? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
speex? ( >=media-libs/speex-1.2_rc1-r1[${MULTILIB_USEDEP}] )
srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
ssh? ( >=net-libs/libssh-0.6.0:=[sftp,${MULTILIB_USEDEP}] )
@@ -342,6 +347,7 @@ REQUIRED_USE="
glslang? ( vulkan !shaderc )
libv4l? ( v4l )
shaderc? ( vulkan !glslang )
+ soc? ( libdrm )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
@@ -354,6 +360,8 @@ S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r2.patch
+ "${FILESDIR}"/${PN}-6.1-wint-conversion.patch
+ "${FILESDIR}"/${PN}-6.0-fix-lto-type-mismatch.patch
"${FILESDIR}"/${PN}-6.1-opencl-parallel-gmake-fix.patch
)
@@ -380,6 +388,9 @@ src_prepare() {
export revision=git-N-${FFMPEG_REVISION}
fi
+ use soc &&
+ eapply "${SOC_PATCHES[@]/#/${DISTDIR}/}"
+
default
# -fdiagnostics-color=auto gets appended after user flags which
@@ -393,6 +404,9 @@ src_prepare() {
multilib_src_configure() {
local myconf=( )
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev
--enable-sand )
+
# bug 842201
use ia64 && tc-is-gcc && append-flags \
-fno-tree-ccp \
@@ -578,5 +592,5 @@ multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
- use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override
99amf-env-vulkan-override
+ use amf && elog "To use AMF, prefix the ffmpeg call with the 'vk_pro'
wrapper script, e.g. `vk_pro ffmpeg -vcodec h264_amf [...]`"
}
diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild
b/media-video/ffmpeg/ffmpeg-9999.ebuild
index 461eb1559ef2..e79ef6ab48eb 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-9999.ebuild
@@ -84,7 +84,7 @@ FFMPEG_FLAG_MAP=(
# decoders
amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2
+dav1d:libdav1d fdk:libfdk-aac
jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme
gsm:libgsm
- libaribb24 mmal modplug:libmodplug opus:libopus qsv:libvpl
libilbc librtmp ssh:libssh
+ libaribb24 modplug:libmodplug opus:libopus qsv:libvpl libilbc
librtmp ssh:libssh
speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
vorbis:libvorbis vpx:libvpx zvbi:libzvbi
# libavfilter options
@@ -251,7 +251,6 @@ RDEPEND="
libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] )
lv2? ( media-libs/lv2[${MULTILIB_USEDEP}]
media-libs/lilv[${MULTILIB_USEDEP}] )
lzma? ( >=app-arch/xz-utils-5.0.5-r1[${MULTILIB_USEDEP}] )
- mmal? ( media-libs/raspberrypi-userland )
modplug? ( >=media-libs/libmodplug-0.8.8.4-r1[${MULTILIB_USEDEP}] )
openal? ( >=media-libs/openal-1.15.1[${MULTILIB_USEDEP}] )
opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml
index b4a5b53e7ee1..f309fd82b53b 100644
--- a/media-video/ffmpeg/metadata.xml
+++ b/media-video/ffmpeg/metadata.xml
@@ -4,6 +4,11 @@
<maintainer type="project">
<email>[email protected]</email>
</maintainer>
+ <maintainer type="person">
+ <email>[email protected]</email>
+ <name>James Le Cuirot</name>
+ <description>chromium and soc USE flags</description>
+ </maintainer>
<use>
<flag name="amf">Enables support for AMD's Advanced Media
Framework (AMF)</flag>
<flag name="amr">Enables Adaptive Multi-Rate Audio
support</flag>
@@ -65,6 +70,7 @@
<flag name="shaderc">Use <pkg>media-libs/shaderc</pkg> to
compile GLSL</flag>
<flag name="snappy">Enable <pkg>app-arch/snappy</pkg> support.
Required for e.g. Vidvox Hap encoder.</flag>
<flag name="sndio">Enable support for the
<pkg>media-sound/sndio</pkg> backend</flag>
+ <flag name="soc">Apply additional patches for efficient
playback on some SoCs (e.g. ARM, RISC-V).</flag>
<flag name="srt">Enable support for Secure Reliable Transport
(SRT) via <pkg>net-libs/srt</pkg></flag>
<flag name="ssh">Enable SSH/sftp support via
<pkg>net-libs/libssh</pkg>.</flag>
<flag name="svt-av1">Enables AV1 encoding support via
<pkg>media-libs/svt-av1</pkg>.</flag>