summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-video/ffmpeg')
-rw-r--r--media-video/ffmpeg/Manifest15
-rw-r--r--media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.2.1.ebuild)233
-rw-r--r--media-video/ffmpeg/ffmpeg-6.0-r12.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.1.3.ebuild)245
-rw-r--r--media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.1.4.ebuild)247
-rw-r--r--media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild (renamed from media-video/ffmpeg/ffmpeg-3.4.6-r1.ebuild)343
-rw-r--r--media-video/ffmpeg/ffmpeg-9999.ebuild330
-rw-r--r--media-video/ffmpeg/files/amf-env-vulkan-override1
-rw-r--r--media-video/ffmpeg/files/chromium-r2.patch (renamed from media-video/ffmpeg/files/chromium.patch)23
-rw-r--r--media-video/ffmpeg/files/chromium.c8
-rw-r--r--media-video/ffmpeg/files/ffmpeg-3.4.6-fix-building-against-fdk-aac-2.patch74
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.3-clang-14-ff_seek_frame_binary-crash.patch46
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch24
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.4-fix-build-svt-av1-1.5.0.patch44
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.4-glslang.patch25
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.4-opencl-parallel-gmake-fix.patch12
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.4.4-wint-conversion-vulkan.patch30
-rw-r--r--media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch59
-rw-r--r--media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch25
-rw-r--r--media-video/ffmpeg/files/ffmpeg-5.1.3-binutils-2.41.patch76
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0-DECLARE_ALIGNED.patch29
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0-binutils-2.41.patch76
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0-fix-lto-type-mismatch.patch41
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0-libplacebo-remove-deprecated-field.patch103
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0-wint-conversion-vulkan.patch43
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0.1-alignment.patch114
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch112
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch13
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch12
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1-wint-conversion.patch88
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1.1-vulkan-rename.patch127
-rw-r--r--media-video/ffmpeg/files/vmaf-models-default-path.patch13
-rw-r--r--media-video/ffmpeg/metadata.xml158
32 files changed, 2150 insertions, 639 deletions
diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest
index 0de5b6270034..d370d825a43e 100644
--- a/media-video/ffmpeg/Manifest
+++ b/media-video/ffmpeg/Manifest
@@ -1,4 +1,11 @@
-DIST ffmpeg-3.4.6.tar.bz2 10190001 BLAKE2B 4c7842900171cf871f8524f08f435797b1a168faa11877100fe74c3ecd4a2c2e004a5110dc23bda818f69b0a484f63d8f34c7904c4827c88894d877cdd70c6fe SHA512 0228751b288096e368f9049854936930b7c1fd89aac31a5382f5de78d3282b4e86a6f562c79833d1635222f0ad56b2e5401a150574714e1b7e0ab4f5d8939812
-DIST ffmpeg-4.1.3.tar.bz2 10689073 BLAKE2B 8486e21c8df116af802bb7f9208e702ec1feaa4f292f14021e0b6bfb3957b13ddacfa87db361e677ae0583cc2bd1d402a66b0c8507cbed79a001c9b8462100bf SHA512 d0f8b3ee7b55e67b1c7ad9610a7b19a15acfc35dc843683502e536ebcc2e8678b55325532c0039b764cc978e95f83afb48bd24304abaee26f26d3247a8310bfe
-DIST ffmpeg-4.1.4.tar.bz2 10691784 BLAKE2B 5f1f0b3c78cdd913e44bef448ff4d26fc5ea01e1a002baf98461fe0d8870bc2b0f29a1770377df8ff4f0c45febd532d6436c6627f5d1fb97125e92d9929f9284 SHA512 0c2d5bf4873b2bf12aff8c8b576d58dc3c5984ca727f48e1247293cbebda382e9070e8b7fac99870ec2ae0cef3be0a187d5ec5d58ee3e861cd673cae961b5947
-DIST ffmpeg-4.2.1.tar.bz2 10953293 BLAKE2B efc60a7e4a185d48a9ae7a5737fa930dea35ca19f1e2505fc4355815a8216f365134a018fb7a5eb7be8709989d27c2c0a56f7783e3f27eb12795e005fd6dc28d SHA512 5bd556546716ccb5292289c3092c11f216e573d0b09a015fdb568dee7544878d057d922a63758867f0343a09262d7b51023e862b70cefc529875f2319e716de4
+DIST ffmpeg-4.4.4-texinfo.patch.xz 19136 BLAKE2B 591b46180fccdb58c5b6b102c5e12075ff4388dc6bc0ab1752531d4f9f2802c1fd09ed1353ed70a539fdc5c2298f9cfc84ec24e3a04d371ef0d9f3f30d8e8f38 SHA512 f86a324efe261801a5192d4f204f48de581466550cca49b54432fdf5430f1b3bc9a9d31b9b52e2f23481def67ad55b5ad315752c482709aa67b1f3a3e6c17a4f
+DIST ffmpeg-4.4.4.tar.xz 9565584 BLAKE2B 8cd76a91ae6e485e56c6e5ae7b31d678e2fc2d634b1c56240619a4b6924dae4ec7adb445932bf4455f409dbc03fdc6d52b4fc270da55393e329ccd3d129f5770 SHA512 253799eccd129dad331db85def5352178ae22303e42af47fc013a6adfd4b60d1e59ff5f9ac6118fe3b403affa56ea1f3ba658042f526a914fba27050c3065daf
+DIST ffmpeg-4.4.4.tar.xz.asc 520 BLAKE2B c8bf944883e375555b6dd69029fe863c23f68a3584d84aa3e9c4278ae45aee0bfa3697cc1d8a768b95a1ebd7a9cb91553671072f88f46f6a9c947faa74344a44 SHA512 47afa042d8b529d0bfce391455a25cda261f39f8510601d7de2aba6398483ecb623992626e8489aa2a636e3cb93008f26b32080e526143254226d4e2651accea
+DIST ffmpeg-6.0.1.tar.xz 10240172 BLAKE2B 1e21862f1f4eac04b8e9ef5597853d9e105bac4e858960c07e244ec3dbcea8f9e9fbdec4ff20b64227afad5ea5d0b05eff79a905f8002314ab4e9c37116c1908 SHA512 8a86b2db4a9abb68bb86d770ba1babb76c8b8313cfb0258ae70c88e736a93b99c342a6ecda94b739e8e7c103bed75d4afd756dd94e08c6255f424ef62c264741
+DIST ffmpeg-6.0.1.tar.xz.asc 520 BLAKE2B dc7222c7c55e9af28c54dcfae4fce33fb44aa2a7e9d2ca4af85a961568b67f63116a6597234cd7ce009669b8ecf6576defd9380c389356435ffc3026b1126f03 SHA512 314f9ef996b85bc93c9fb823d582697c7415ac35f56bfc9cd906893491c8076df90bd852cf6e5e757b1fa94bd415ed108488c1220add49eb1f4854fc253c178c
+DIST ffmpeg-6.0.tar.xz 10234012 BLAKE2B c70884911f3a3e40fe87473f241a2a56b303f5abe7f1d7fa797d05e29e00971f98cbf37832c1c3dc5fa949a5beddef05a6ec55ae6668091976ea870ad93c0e8d SHA512 4d0e8f635d5a1633710f30cb3e0a854b6ca3bf85e33a289d1ec7aca2ad55dc4910010bc9cf3f13eee9f6decb9d50a0df6d7aa5a342f308c3868d2730f3a6b980
+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-r3.patch 800738 BLAKE2B b7e449ee5eec8b50a3b3bba233c5269f3b6845dbd18a619b844c841a97345ce24c7a5d7f4da05b08e3cb49668426b9044f3d3553d9c2ef3a50aec7199bfa3c09 SHA512 aeaf12afabf5f2192fb0b6ef47397d8477b109e49cee8c02a890d1656a27b1985c62c719ef72966d8c97b0709918233b65ea2e0ef988771507e4be137fcd9158
+DIST ffmpeg-rpi-6.1-r3.patch.asc 833 BLAKE2B 31fd5823c06d5884f7b0980de9072c35bbf4e1d6c0ed20b089439325d50956127238ca29469b003dba623b888a5aae3c4d8ad177862534e77b8e51f29cbed96c SHA512 3d8943b7151e20f73e9c14b121c501847bd7e01f2cf57ff135fc8c223653ec9d433bfe4012fa564f70c0471980b66d7ec3d9b5b1b14865187187719ba110cb5f
diff --git a/media-video/ffmpeg/ffmpeg-4.2.1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild
index 30af5b7ec27a..7eb94f61dbb6 100644
--- a/media-video/ffmpeg/ffmpeg-4.2.1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
# Subslot: libavutil major.libavcodec major.libavformat major
# Since FFmpeg ships several libraries, subslot is kind of limited here.
@@ -21,16 +21,22 @@ if [ "${PV#9999}" != "${PV}" ] ; then
EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
fi
-inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
-DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
if [ "${PV#9999}" != "${PV}" ] ; then
SRC_URI=""
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
else # Release
- SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
+ 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://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-texinfo.patch.xz"
+ SRC_URI+=" verify-sig? ( https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc )"
+
+ BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-ffmpeg )"
fi
FFMPEG_REVISION="${PV#*_p}"
@@ -59,7 +65,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~x64-macos"
fi
# Options to use as use_enable in the foo[:bar] form.
@@ -67,26 +73,26 @@ fi
# or $(use_enable foo foo) if no :bar is set.
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
- +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
- +gpl hardcoded-tables +iconv libressl:libtls libxml2 lzma +network opencl
- openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
- X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
+ +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp
+ +gpl hardcoded-tables +iconv libxml2 lzma +network opencl
+ openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan
+ X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib
# libavdevice options
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
opengl
# indevs
libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
# decoders
- amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 dav1d:libdav1d fdk:libfdk-aac
+ amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 +dav1d:libdav1d fdk:libfdk-aac
jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
- libaribb24 mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
- speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
+ libaribb24 mmal modplug:libmodplug opus:libopus qsv:libmfx libilbc librtmp ssh:libssh
+ speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
vorbis:libvorbis vpx:libvpx zvbi:libzvbi
# libavfilter options
appkit
- bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass libtesseract lv2 truetype:libfreetype vidstab:libvidstab
- rubberband:librubberband zeromq:libzmq zimg:libzimg
+ bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r fribidi:libfribidi
+ fontconfig glslang:libglslang ladspa libass libtesseract lv2 truetype:libfreetype
+ vidstab:libvidstab vmaf:libvmaf rubberband:librubberband zeromq:libzmq zimg:libzimg
# libswresample options
libsoxr
# Threads; we only support pthread for now but ffmpeg supports more
@@ -95,14 +101,14 @@ FFMPEG_FLAG_MAP=(
# Same as above but for encoders, i.e. they do something only with USE=encode.
FFMPEG_ENCODER_FLAG_MAP=(
- amrenc:libvo-amrwbenc mp3:libmp3lame
- kvazaar:libkvazaar libaom
- openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
- wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+ amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+ openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1
+ theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+ x265:libx265 xvid:libxvid
)
IUSE="
- alsa chromium doc +encode oss pic static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -120,15 +126,25 @@ ARM_CPU_FEATURES=(
)
ARM_CPU_REQUIRED_USE="
arm64? ( cpu_flags_arm_v8 )
- cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
- cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
+ cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
+ cpu_flags_arm_neon? (
+ cpu_flags_arm_vfp
+ arm? ( cpu_flags_arm_thumb2 )
+ )
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
- cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
+ cpu_flags_arm_v6? (
+ arm? ( cpu_flags_arm_thumb )
+ )
"
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
-PPC_CPU_FEATURES=( altivec )
-X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
+PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
+PPC_CPU_REQUIRED_USE="
+ cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec )
+ cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx )
+"
+X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx
+ mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
X86_CPU_REQUIRED_USE="
cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
@@ -159,14 +175,17 @@ IUSE="${IUSE}
CPU_REQUIRED_USE="
${ARM_CPU_REQUIRED_USE}
+ ${PPC_CPU_REQUIRED_USE}
${X86_CPU_REQUIRED_USE}
"
-FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
+FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt
+ graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
RDEPEND="
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+ amf? ( media-video/amdgpu-pro-amf:= )
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
@@ -179,14 +198,14 @@ RDEPEND="
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] )
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
- openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
+ openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] )
+ rav1e? ( >=media-video/rav1e-0.4:=[capi] )
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
theora? (
- >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+ >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
)
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
- wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
@@ -195,9 +214,10 @@ RDEPEND="
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
- frei0r? ( media-plugins/frei0r-plugins )
+ frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] )
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
+ glslang? ( dev-util/glslang:=[${MULTILIB_USEDEP}] )
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] )
gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] )
@@ -208,12 +228,12 @@ RDEPEND="
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
)
ieee1394? (
- >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
+ >=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}]
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
)
jack? ( virtual/jack[${MULTILIB_USEDEP}] )
jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
- libaom? ( >=media-libs/libaom-1.0.0-r1[${MULTILIB_USEDEP}] )
+ libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] )
libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] )
libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
@@ -233,61 +253,62 @@ RDEPEND="
opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/intel-mediasdk[${MULTILIB_USEDEP}] )
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
+ sndio? ( media-sound/sndio:=[${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.5.5[${MULTILIB_USEDEP}] )
- svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
+ srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
+ ssh? ( >=net-libs/libssh-0.5.5:=[sftp,${MULTILIB_USEDEP}] )
+ svg? (
+ gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ )
+ nvenc? ( <media-libs/nv-codec-headers-12 )
+ svt-av1? ( >=media-libs/svt-av1-0.8.4[${MULTILIB_USEDEP}] )
truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
- vaapi? ( >=x11-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
- video_cards_nvidia? ( >=media-libs/nv-codec-headers-9.0.18.0[${MULTILIB_USEDEP}] )
+ vaapi? ( >=media-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+ vmaf? ( media-libs/libvmaf:=[${MULTILIB_USEDEP}] )
vorbis? (
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
)
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.1.97:=[${MULTILIB_USEDEP}] )
X? (
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
)
- xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
zeromq? ( >=net-libs/zeromq-4.1.6 )
zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
- !media-video/qt-faststart
- postproc? ( !media-libs/libpostproc )
"
-# Crypto & co provider magic
-# - libressl is a useflag meaning it should always favor libressl over openssl
-# - libressl and openssl provide more features to ffmpeg than gnutls
-#
-# The ordering is thus: libressl > openssl > gnutls
RDEPEND="${RDEPEND}
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
- !libressl? (
- openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
- !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
- )
+ openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
"
DEPEND="${RDEPEND}
+ amf? ( media-libs/amf-headers )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
v4l? ( sys-kernel/linux-headers )
"
-BDEPEND="
- >=sys-devel/make-3.81
- >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+
+# += for verify-sig above
+BDEPEND+="
+ >=dev-build/make-3.81
+ virtual/pkgconfig
cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
doc? ( sys-apps/texinfo )
- test? ( net-misc/wget sys-devel/bc )
+ test? ( net-misc/wget app-alternatives/bc )
"
# Code requiring FFmpeg to be built under gpl license
@@ -296,29 +317,40 @@ GPL_REQUIRED_USE="
frei0r? ( gpl )
cdio? ( gpl )
rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
x265? ( gpl )
xvid? ( gpl )
- X? ( !xcb? ( gpl ) )
)
"
REQUIRED_USE="
- cuda? ( video_cards_nvidia )
- libv4l? ( v4l )
+ cuda? ( nvenc )
fftools_cws2fws? ( zlib )
+ glslang? ( vulkan )
+ libv4l? ( v4l )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
- gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
"
S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/${PN}-5.0-backport-ranlib-build-fix.patch
+ "${FILESDIR}"/${PN}-4.4.3-clang-14-ff_seek_frame_binary-crash.patch
+ "${FILESDIR}"/${PN}-4.4.3-get_cabac_inline_x86-32-bit.patch
+ "${FILESDIR}"/${PN}-4.4.4-wint-conversion-vulkan.patch
+ "${FILESDIR}"/${P}-fix-build-svt-av1-1.5.0.patch
+ "${FILESDIR}"/${PN}-5.1.3-binutils-2.41.patch
+ "${FILESDIR}"/${PN}-4.4.4-opencl-parallel-gmake-fix.patch
+ "${FILESDIR}"/${PN}-4.4.4-glslang.patch
+ "${WORKDIR}"/${PN}-4.4.4-texinfo.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -329,19 +361,59 @@ build_separate_libffmpeg() {
use opencl
}
+pkg_setup() {
+ # ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg.
+ # May cause breakage while updating, #862996, #625210, #833821.
+ if has_version media-libs/chromaprint[tools] && use chromaprint; then
+ ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which "
+ ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, "
+ ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg."
+ ewarn ""
+ ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint "
+ ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable "
+ ewarn "'tools' USE flag for chromaprint. See #862996."
+ fi
+}
+
+src_unpack() {
+ if use verify-sig ; then
+ # Needed for downloaded patch (which is unsigned, which is fine)
+ verify-sig_verify_detached "${DISTDIR}"/${P/_/-}.tar.xz{,.asc}
+ fi
+
+ default
+}
+
src_prepare() {
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
export revision=git-N-${FFMPEG_REVISION}
fi
+
+ eapply "${FILESDIR}/vmaf-models-default-path.patch"
+
default
+
+ # -fdiagnostics-color=auto gets appended after user flags which
+ # will ignore user's preference.
+ sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
}
multilib_src_configure() {
- local myconf=( ${EXTRA_FFMPEG_CONF} )
+ local myconf=( )
+
+ # bug 842201
+ use ia64 && tc-is-gcc && append-flags \
+ -fno-tree-ccp \
+ -fno-tree-dominator-opts \
+ -fno-tree-fre \
+ -fno-code-hoisting \
+ -fno-tree-pre \
+ -fno-tree-vrp
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
- use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
+ use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
# Encoders
@@ -358,12 +430,12 @@ multilib_src_configure() {
# Indevs
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
- for i in alsa oss jack ; do
+ for i in alsa oss jack sndio ; do
use ${i} || myconf+=( --disable-indev=${i} )
done
# Outdevs
- for i in alsa oss ; do
+ for i in alsa oss sndio ; do
use ${i} || myconf+=( --disable-outdev=${i} )
done
@@ -377,16 +449,13 @@ multilib_src_configure() {
myconf+=( $(use_enable ${i%:*} ${i#*:}) )
done
- # Incompatible features: openssl or libressl and gnutls
- if use libressl ; then
- myconf+=( --disable-gnutls --disable-openssl )
- elif use openssl ; then
+ if use openssl ; then
myconf+=( --disable-gnutls )
fi
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -415,8 +484,9 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
+ # LTO support, bug #566282, bug #754654, bug #772854
+ [[ ${ABI} != x86 ]] && tc-is-lto && myconf+=( "--enable-lto" )
+ filter-lto
# Mandatory configuration
myconf=(
@@ -435,9 +505,6 @@ multilib_src_configure() {
if tc-is-cross-compiler ; then
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
case ${CHOST} in
- *freebsd*)
- myconf+=( --target-os=freebsd )
- ;;
*mingw32*)
myconf+=( --target-os=mingw32 )
;;
@@ -454,6 +521,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -464,9 +532,14 @@ multilib_src_configure() {
--cc="$(tc-getCC)" \
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
+ --nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
+ --ranlib="$(tc-getRANLIB)" \
+ --pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
$(use_enable static-libs static) \
- "${myconf[@]}"
+ "${myconf[@]}" \
+ ${EXTRA_FFMPEG_CONF}
echo "${@}"
"${@}" || die
@@ -508,6 +581,11 @@ multilib_src_compile() {
fi
}
+multilib_src_test() {
+ LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
+ emake V=1 fate -k
+}
+
multilib_src_install() {
emake V=1 DESTDIR="${D}" install install-doc
@@ -538,9 +616,6 @@ multilib_src_install() {
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
-}
-multilib_src_test() {
- LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
- emake V=1 fate
+ use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override 99amf-env-vulkan-override
}
diff --git a/media-video/ffmpeg/ffmpeg-4.1.3.ebuild b/media-video/ffmpeg/ffmpeg-6.0-r12.ebuild
index dde475dd768a..27356c86a31d 100644
--- a/media-video/ffmpeg/ffmpeg-4.1.3.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.0-r12.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=6
+EAPI=8
# Subslot: libavutil major.libavcodec major.libavformat major
# Since FFmpeg ships several libraries, subslot is kind of limited here.
@@ -12,7 +12,7 @@ EAPI=6
# changes its ABI then this package will be rebuilt needlessly. Hence, such a
# package is free _not_ to := depend on FFmpeg but I would strongly encourage
# doing so since such a case is unlikely.
-FFMPEG_SUBSLOT=56.58.58
+FFMPEG_SUBSLOT=58.60.60
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
@@ -21,16 +21,21 @@ if [ "${PV#9999}" != "${PV}" ] ; then
EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
fi
-inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
-DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
if [ "${PV#9999}" != "${PV}" ] ; then
SRC_URI=""
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
else # Release
- SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
+ 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+=" verify-sig? ( https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc )"
+
+ BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-ffmpeg )"
fi
FFMPEG_REVISION="${PV#*_p}"
@@ -46,6 +51,10 @@ LICENSE="
gpl? ( GPL-3 )
!gpl? ( LGPL-3 )
)
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
encode? (
amrenc? (
gpl? ( GPL-3 )
@@ -55,7 +64,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="alpha amd64 arm arm64 ~hppa ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
fi
# Options to use as use_enable in the foo[:bar] form.
@@ -63,25 +72,26 @@ fi
# or $(use_enable foo foo) if no :bar is set.
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
- +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
- +gpl +hardcoded-tables +iconv libressl:libtls libxml2 lzma +network opencl
- openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
- X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
+ +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp
+ +gpl hardcoded-tables +iconv libxml2 lzma +network opencl
+ openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan
+ X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib
# libavdevice options
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
opengl
# indevs
libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
# decoders
- amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 fdk:libfdk-aac
- jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
- mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
- speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
+ 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
+ speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
vorbis:libvorbis vpx:libvpx zvbi:libzvbi
# libavfilter options
appkit
- bs2b:libbs2b chromaprint flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass lv2 truetype:libfreetype
+ bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r vmaf:libvmaf
+ fribidi:libfribidi fontconfig ladspa lcms:lcms2 libass libplacebo libtesseract lv2
+ truetype:libfreetype vidstab:libvidstab
rubberband:librubberband zeromq:libzmq zimg:libzimg
# libswresample options
libsoxr
@@ -91,14 +101,14 @@ FFMPEG_FLAG_MAP=(
# Same as above but for encoders, i.e. they do something only with USE=encode.
FFMPEG_ENCODER_FLAG_MAP=(
- amrenc:libvo-amrwbenc mp3:libmp3lame
- kvazaar:libkvazaar libaom
- openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
- wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+ amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+ openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1
+ theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+ x265:libx265 xvid:libxvid
)
IUSE="
- alsa chromium doc +encode oss pic static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -116,15 +126,25 @@ ARM_CPU_FEATURES=(
)
ARM_CPU_REQUIRED_USE="
arm64? ( cpu_flags_arm_v8 )
- cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
- cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
+ cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
+ cpu_flags_arm_neon? (
+ cpu_flags_arm_vfp
+ arm? ( cpu_flags_arm_thumb2 )
+ )
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
- cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
+ cpu_flags_arm_v6? (
+ arm? ( cpu_flags_arm_thumb )
+ )
"
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
-PPC_CPU_FEATURES=( altivec )
-X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
+PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
+PPC_CPU_REQUIRED_USE="
+ cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec )
+ cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx )
+"
+X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx
+ mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
X86_CPU_REQUIRED_USE="
cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
@@ -155,14 +175,17 @@ IUSE="${IUSE}
CPU_REQUIRED_USE="
${ARM_CPU_REQUIRED_USE}
+ ${PPC_CPU_REQUIRED_USE}
${X86_CPU_REQUIRED_USE}
"
-FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
+FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt
+ graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
RDEPEND="
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+ amf? ( media-video/amdgpu-pro-amf:= )
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
@@ -170,18 +193,19 @@ RDEPEND="
cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
+ dav1d? ( >=media-libs/dav1d-0.4.0:0=[${MULTILIB_USEDEP}] )
encode? (
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] )
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
- openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
+ openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] )
+ rav1e? ( >=media-video/rav1e-0.4:=[capi] )
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
theora? (
- >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+ >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
)
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
- wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
@@ -190,7 +214,7 @@ RDEPEND="
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
- frei0r? ( media-plugins/frei0r-plugins )
+ frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] )
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
@@ -203,17 +227,23 @@ RDEPEND="
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
)
ieee1394? (
- >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
+ >=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}]
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
)
jack? ( virtual/jack[${MULTILIB_USEDEP}] )
jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
- libaom? ( >=media-libs/libaom-1.0.0-r1[${MULTILIB_USEDEP}] )
- libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
+ jpegxl? ( >=media-libs/libjxl-0.7.0[$MULTILIB_USEDEP] )
+ lcms? ( >=media-libs/lcms-2.13:2[$MULTILIB_USEDEP] )
+ libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] )
+ libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] )
+ libass? ( >=media-libs/libass-0.11.0:=[${MULTILIB_USEDEP}] )
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
+ libplacebo? ( >=media-libs/libplacebo-4.192.0:=[$MULTILIB_USEDEP] )
+ librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
+ libtesseract? ( >=app-text/tesseract-4.1.0-r1[${MULTILIB_USEDEP}] )
libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] )
lv2? ( media-libs/lv2[${MULTILIB_USEDEP}] media-libs/lilv[${MULTILIB_USEDEP}] )
@@ -222,91 +252,103 @@ RDEPEND="
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}] )
- opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
+ opengl? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
- librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
+ sndio? ( media-sound/sndio:=[${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.5.5[${MULTILIB_USEDEP}] )
- svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
+ srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
+ ssh? ( >=net-libs/libssh-0.5.5:=[sftp,${MULTILIB_USEDEP}] )
+ svg? (
+ gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ )
+ nvenc? ( <media-libs/nv-codec-headers-12 )
+ svt-av1? ( >=media-libs/svt-av1-0.9.0[${MULTILIB_USEDEP}] )
truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
- vaapi? ( >=x11-libs/libva-1.2.1-r1[${MULTILIB_USEDEP}] )
- video_cards_nvidia? ( >=media-libs/nv-codec-headers-8.1.24.2[${MULTILIB_USEDEP}] )
+ vaapi? ( >=media-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
+ vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+ vmaf? ( >=media-libs/libvmaf-2.0.0:=[${MULTILIB_USEDEP}] )
vorbis? (
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
)
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.2.189:=[${MULTILIB_USEDEP}] )
X? (
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
)
- xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
zeromq? ( >=net-libs/zeromq-4.1.6 )
zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
- !media-video/qt-faststart
- postproc? ( !media-libs/libpostproc )
"
-# Crypto & co provider magic
-# - libressl is a useflag meaning it should always favor libressl over openssl
-# - libressl and openssl provide more features to ffmpeg than gnutls
-#
-# The ordering is thus: libressl > openssl > gnutls
RDEPEND="${RDEPEND}
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
- !libressl? (
- openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
- !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
- )
+ openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
"
DEPEND="${RDEPEND}
- >=sys-devel/make-3.81
- doc? ( sys-apps/texinfo )
- >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ amf? ( >=media-libs/amf-headers-1.4.28 )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
- cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
- test? ( net-misc/wget sys-devel/bc )
v4l? ( sys-kernel/linux-headers )
"
+# += for verify-sig above
+BDEPEND+="
+ >=dev-build/make-3.81
+ virtual/pkgconfig
+ cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
+ cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
+ doc? ( sys-apps/texinfo )
+ test? ( net-misc/wget app-alternatives/bc )
+"
+
# Code requiring FFmpeg to be built under gpl license
GPL_REQUIRED_USE="
postproc? ( gpl )
frei0r? ( gpl )
cdio? ( gpl )
rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
x265? ( gpl )
xvid? ( gpl )
- X? ( !xcb? ( gpl ) )
)
"
REQUIRED_USE="
+ cuda? ( nvenc )
libv4l? ( v4l )
fftools_cws2fws? ( zlib )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
- gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
"
S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/${P}-DECLARE_ALIGNED.patch
+ "${FILESDIR}"/${PN}-5.1.2-get_cabac_inline_x86-32-bit.patch
+ "${FILESDIR}"/${P}-wint-conversion-vulkan.patch
+ "${FILESDIR}"/${P}-libplacebo-remove-deprecated-field.patch
+ "${FILESDIR}"/${P}-binutils-2.41.patch
+ "${FILESDIR}"/${PN}-4.4.4-opencl-parallel-gmake-fix.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -317,19 +359,48 @@ build_separate_libffmpeg() {
use opencl
}
+pkg_setup() {
+ # ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg.
+ # May cause breakage while updating, #862996, #625210, #833821.
+ if has_version media-libs/chromaprint[tools] && use chromaprint; then
+ ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which "
+ ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, "
+ ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg."
+ ewarn ""
+ ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint "
+ ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable "
+ ewarn "'tools' USE flag for chromaprint. See #862996."
+ fi
+}
+
src_prepare() {
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
export revision=git-N-${FFMPEG_REVISION}
fi
+
default
+
+ # -fdiagnostics-color=auto gets appended after user flags which
+ # will ignore user's preference.
+ sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
}
multilib_src_configure() {
- local myconf=( ${EXTRA_FFMPEG_CONF} )
+ local myconf=( )
+
+ # bug 842201
+ use ia64 && tc-is-gcc && append-flags \
+ -fno-tree-ccp \
+ -fno-tree-dominator-opts \
+ -fno-tree-fre \
+ -fno-code-hoisting \
+ -fno-tree-pre \
+ -fno-tree-vrp
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
- use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
+ use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
# Encoders
@@ -346,34 +417,33 @@ multilib_src_configure() {
# Indevs
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
- for i in alsa oss jack ; do
+ for i in alsa oss jack sndio ; do
use ${i} || myconf+=( --disable-indev=${i} )
done
# Outdevs
- for i in alsa oss ; do
+ for i in alsa oss sndio ; do
use ${i} || myconf+=( --disable-outdev=${i} )
done
# Decoders
use amr && myconf+=( --enable-version3 )
use gmp && myconf+=( --enable-version3 )
+ use libaribb24 && myconf+=( --enable-version3 )
use fdk && use gpl && myconf+=( --enable-nonfree )
for i in "${ffuse[@]#+}" ; do
myconf+=( $(use_enable ${i%:*} ${i#*:}) )
done
- # Incompatible features: openssl or libressl and gnutls
- if use libressl ; then
- myconf+=( --disable-gnutls --disable-openssl )
- elif use openssl ; then
+ if use openssl ; then
myconf+=( --disable-gnutls )
+ has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 )
fi
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -402,13 +472,13 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
+ # LTO support, bug #566282, bug #754654, bug #772854
+ [[ ${ABI} != x86 ]] && tc-is-lto && myconf+=( "--enable-lto" )
+ filter-lto
# Mandatory configuration
myconf=(
--enable-avfilter
- --enable-avresample
--disable-stripping
# This is only for hardcoded cflags; those are used in configure checks that may
# interfere with proper detections, bug #671746 and bug #645778
@@ -422,9 +492,6 @@ multilib_src_configure() {
if tc-is-cross-compiler ; then
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
case ${CHOST} in
- *freebsd*)
- myconf+=( --target-os=freebsd )
- ;;
*mingw32*)
myconf+=( --target-os=mingw32 )
;;
@@ -441,6 +508,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -451,9 +519,14 @@ multilib_src_configure() {
--cc="$(tc-getCC)" \
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
+ --nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
+ --ranlib="$(tc-getRANLIB)" \
+ --pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
$(use_enable static-libs static) \
- "${myconf[@]}"
+ "${myconf[@]}" \
+ ${EXTRA_FFMPEG_CONF}
echo "${@}"
"${@}" || die
@@ -495,6 +568,11 @@ multilib_src_compile() {
fi
}
+multilib_src_test() {
+ LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil" \
+ emake V=1 fate -k
+}
+
multilib_src_install() {
emake V=1 DESTDIR="${D}" install install-doc
@@ -513,6 +591,10 @@ multilib_src_install() {
popd >/dev/null || die
else
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
fi
@@ -521,9 +603,6 @@ multilib_src_install() {
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
-}
-multilib_src_test() {
- LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
- emake V=1 fate
+ 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-4.1.4.ebuild b/media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild
index 6aae30ff2717..5609d999e0d2 100644
--- a/media-video/ffmpeg/ffmpeg-4.1.4.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=6
+EAPI=8
# Subslot: libavutil major.libavcodec major.libavformat major
# Since FFmpeg ships several libraries, subslot is kind of limited here.
@@ -12,7 +12,7 @@ EAPI=6
# changes its ABI then this package will be rebuilt needlessly. Hence, such a
# package is free _not_ to := depend on FFmpeg but I would strongly encourage
# doing so since such a case is unlikely.
-FFMPEG_SUBSLOT=56.58.58
+FFMPEG_SUBSLOT=58.60.60
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
@@ -21,16 +21,21 @@ if [ "${PV#9999}" != "${PV}" ] ; then
EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
fi
-inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
-DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
if [ "${PV#9999}" != "${PV}" ] ; then
SRC_URI=""
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ SRC_URI="mirror://gentoo/${P}.tar.xz"
else # Release
- SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
+ 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+=" verify-sig? ( https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc )"
+
+ BDEPEND=" verify-sig? ( sec-keys/openpgp-keys-ffmpeg )"
fi
FFMPEG_REVISION="${PV#*_p}"
@@ -46,6 +51,10 @@ LICENSE="
gpl? ( GPL-3 )
!gpl? ( LGPL-3 )
)
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
encode? (
amrenc? (
gpl? ( GPL-3 )
@@ -55,7 +64,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
fi
# Options to use as use_enable in the foo[:bar] form.
@@ -63,25 +72,26 @@ fi
# or $(use_enable foo foo) if no :bar is set.
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
- +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
- +gpl hardcoded-tables +iconv libressl:libtls libxml2 lzma +network opencl
- openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
- X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
+ +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp
+ +gpl hardcoded-tables +iconv libxml2 lzma +network opencl
+ openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan
+ X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib
# libavdevice options
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
opengl
# indevs
libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
# decoders
- amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 fdk:libfdk-aac
- jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
- mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
- speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
+ 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
+ speex:libspeex srt:libsrt svg:librsvg nvenc:ffnvcodec
vorbis:libvorbis vpx:libvpx zvbi:libzvbi
# libavfilter options
appkit
- bs2b:libbs2b chromaprint flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass lv2 truetype:libfreetype
+ bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r vmaf:libvmaf
+ fribidi:libfribidi fontconfig ladspa lcms:lcms2 libass libplacebo libtesseract lv2
+ truetype:libfreetype vidstab:libvidstab
rubberband:librubberband zeromq:libzmq zimg:libzimg
# libswresample options
libsoxr
@@ -91,14 +101,14 @@ FFMPEG_FLAG_MAP=(
# Same as above but for encoders, i.e. they do something only with USE=encode.
FFMPEG_ENCODER_FLAG_MAP=(
- amrenc:libvo-amrwbenc mp3:libmp3lame
- kvazaar:libkvazaar libaom
- openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
- wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+ amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+ openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1
+ theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+ x265:libx265 xvid:libxvid
)
IUSE="
- alsa chromium doc +encode oss pic static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -116,15 +126,25 @@ ARM_CPU_FEATURES=(
)
ARM_CPU_REQUIRED_USE="
arm64? ( cpu_flags_arm_v8 )
- cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
- cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
+ cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
+ cpu_flags_arm_neon? (
+ cpu_flags_arm_vfp
+ arm? ( cpu_flags_arm_thumb2 )
+ )
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
- cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
+ cpu_flags_arm_v6? (
+ arm? ( cpu_flags_arm_thumb )
+ )
"
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
-PPC_CPU_FEATURES=( altivec )
-X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
+PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
+PPC_CPU_REQUIRED_USE="
+ cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec )
+ cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx )
+"
+X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx
+ mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
X86_CPU_REQUIRED_USE="
cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
@@ -155,14 +175,17 @@ IUSE="${IUSE}
CPU_REQUIRED_USE="
${ARM_CPU_REQUIRED_USE}
+ ${PPC_CPU_REQUIRED_USE}
${X86_CPU_REQUIRED_USE}
"
-FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
+FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt
+ graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
RDEPEND="
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+ amf? ( media-video/amdgpu-pro-amf:= )
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
@@ -170,18 +193,19 @@ RDEPEND="
cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
+ dav1d? ( >=media-libs/dav1d-0.4.0:0=[${MULTILIB_USEDEP}] )
encode? (
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] )
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
- openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
+ openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] )
+ rav1e? ( >=media-video/rav1e-0.4:=[capi] )
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
theora? (
- >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+ >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
)
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
- wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
@@ -190,7 +214,7 @@ RDEPEND="
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
- frei0r? ( media-plugins/frei0r-plugins )
+ frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] )
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
@@ -203,17 +227,23 @@ RDEPEND="
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
)
ieee1394? (
- >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
+ >=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}]
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
)
jack? ( virtual/jack[${MULTILIB_USEDEP}] )
jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
- libaom? ( >=media-libs/libaom-1.0.0-r1[${MULTILIB_USEDEP}] )
- libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
+ jpegxl? ( >=media-libs/libjxl-0.7.0[$MULTILIB_USEDEP] )
+ lcms? ( >=media-libs/lcms-2.13:2[$MULTILIB_USEDEP] )
+ libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] )
+ libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] )
+ libass? ( >=media-libs/libass-0.11.0:=[${MULTILIB_USEDEP}] )
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
+ libplacebo? ( >=media-libs/libplacebo-4.192.0:=[$MULTILIB_USEDEP] )
+ librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
+ libtesseract? ( >=app-text/tesseract-4.1.0-r1[${MULTILIB_USEDEP}] )
libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
libxml2? ( dev-libs/libxml2:=[${MULTILIB_USEDEP}] )
lv2? ( media-libs/lv2[${MULTILIB_USEDEP}] media-libs/lilv[${MULTILIB_USEDEP}] )
@@ -222,91 +252,103 @@ RDEPEND="
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}] )
- opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
+ opengl? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
- pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
- librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
sdl? ( media-libs/libsdl2[sound,video,${MULTILIB_USEDEP}] )
+ sndio? ( media-sound/sndio:=[${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.5.5[${MULTILIB_USEDEP}] )
- svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
+ srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
+ ssh? ( >=net-libs/libssh-0.5.5:=[sftp,${MULTILIB_USEDEP}] )
+ svg? (
+ gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ )
+ nvenc? ( media-libs/nv-codec-headers )
+ svt-av1? ( >=media-libs/svt-av1-0.9.0[${MULTILIB_USEDEP}] )
truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
- vaapi? ( >=x11-libs/libva-1.2.1-r1[${MULTILIB_USEDEP}] )
- video_cards_nvidia? ( >=media-libs/nv-codec-headers-8.1.24.2[${MULTILIB_USEDEP}] )
+ vaapi? ( >=media-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
+ vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+ vmaf? ( >=media-libs/libvmaf-2.0.0:=[${MULTILIB_USEDEP}] )
vorbis? (
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
)
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.2.189:=[${MULTILIB_USEDEP}] )
X? (
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
)
- xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
zeromq? ( >=net-libs/zeromq-4.1.6 )
zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
- !media-video/qt-faststart
- postproc? ( !media-libs/libpostproc )
"
-# Crypto & co provider magic
-# - libressl is a useflag meaning it should always favor libressl over openssl
-# - libressl and openssl provide more features to ffmpeg than gnutls
-#
-# The ordering is thus: libressl > openssl > gnutls
RDEPEND="${RDEPEND}
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
- !libressl? (
- openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
- !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
- )
+ openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
"
DEPEND="${RDEPEND}
- >=sys-devel/make-3.81
- doc? ( sys-apps/texinfo )
- >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ amf? ( >=media-libs/amf-headers-1.4.28 )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
- cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
- test? ( net-misc/wget sys-devel/bc )
v4l? ( sys-kernel/linux-headers )
"
+# += for verify-sig above
+BDEPEND+="
+ >=dev-build/make-3.81
+ virtual/pkgconfig
+ cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
+ cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
+ doc? ( sys-apps/texinfo )
+ test? ( net-misc/wget app-alternatives/bc )
+"
+
# Code requiring FFmpeg to be built under gpl license
GPL_REQUIRED_USE="
postproc? ( gpl )
frei0r? ( gpl )
cdio? ( gpl )
rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
x265? ( gpl )
xvid? ( gpl )
- X? ( !xcb? ( gpl ) )
)
"
REQUIRED_USE="
+ cuda? ( nvenc )
libv4l? ( v4l )
fftools_cws2fws? ( zlib )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
- gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
"
S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/${PN}-5.1.2-get_cabac_inline_x86-32-bit.patch
+ "${FILESDIR}"/${PN}-6.0-libplacebo-remove-deprecated-field.patch
+ "${FILESDIR}"/${PN}-6.0-fix-lto-type-mismatch.patch
+ "${FILESDIR}"/${PN}-4.4.4-opencl-parallel-gmake-fix.patch
+ "${FILESDIR}"/${PN}-6.0.1-alignment.patch
+ "${FILESDIR}"/${PN}-6.0.1-libjxl-0.9.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -317,19 +359,48 @@ build_separate_libffmpeg() {
use opencl
}
+pkg_setup() {
+ # ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg.
+ # May cause breakage while updating, #862996, #625210, #833821.
+ if has_version media-libs/chromaprint[tools] && use chromaprint; then
+ ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which "
+ ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, "
+ ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg."
+ ewarn ""
+ ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint "
+ ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable "
+ ewarn "'tools' USE flag for chromaprint. See #862996."
+ fi
+}
+
src_prepare() {
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
export revision=git-N-${FFMPEG_REVISION}
fi
+
default
+
+ # -fdiagnostics-color=auto gets appended after user flags which
+ # will ignore user's preference.
+ sed -i -e '/check_cflags -fdiagnostics-color=auto/d' configure || die
+
echo 'include $(SRC_PATH)/ffbuild/libffmpeg.mak' >> Makefile || die
}
multilib_src_configure() {
- local myconf=( ${EXTRA_FFMPEG_CONF} )
+ local myconf=( )
+
+ # bug 842201
+ use ia64 && tc-is-gcc && append-flags \
+ -fno-tree-ccp \
+ -fno-tree-dominator-opts \
+ -fno-tree-fre \
+ -fno-code-hoisting \
+ -fno-tree-pre \
+ -fno-tree-vrp
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
- use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
+ use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
# Encoders
@@ -346,34 +417,33 @@ multilib_src_configure() {
# Indevs
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
- for i in alsa oss jack ; do
+ for i in alsa oss jack sndio ; do
use ${i} || myconf+=( --disable-indev=${i} )
done
# Outdevs
- for i in alsa oss ; do
+ for i in alsa oss sndio ; do
use ${i} || myconf+=( --disable-outdev=${i} )
done
# Decoders
use amr && myconf+=( --enable-version3 )
use gmp && myconf+=( --enable-version3 )
+ use libaribb24 && myconf+=( --enable-version3 )
use fdk && use gpl && myconf+=( --enable-nonfree )
for i in "${ffuse[@]#+}" ; do
myconf+=( $(use_enable ${i%:*} ${i#*:}) )
done
- # Incompatible features: openssl or libressl and gnutls
- if use libressl ; then
- myconf+=( --disable-gnutls --disable-openssl )
- elif use openssl ; then
+ if use openssl ; then
myconf+=( --disable-gnutls )
+ has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 )
fi
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -402,13 +472,13 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
+ # LTO support, bug #566282, bug #754654, bug #772854
+ [[ ${ABI} != x86 ]] && tc-is-lto && myconf+=( "--enable-lto" )
+ filter-lto
# Mandatory configuration
myconf=(
--enable-avfilter
- --enable-avresample
--disable-stripping
# This is only for hardcoded cflags; those are used in configure checks that may
# interfere with proper detections, bug #671746 and bug #645778
@@ -422,9 +492,6 @@ multilib_src_configure() {
if tc-is-cross-compiler ; then
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
case ${CHOST} in
- *freebsd*)
- myconf+=( --target-os=freebsd )
- ;;
*mingw32*)
myconf+=( --target-os=mingw32 )
;;
@@ -441,6 +508,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -451,9 +519,14 @@ multilib_src_configure() {
--cc="$(tc-getCC)" \
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
+ --nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
+ --ranlib="$(tc-getRANLIB)" \
+ --pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
$(use_enable static-libs static) \
- "${myconf[@]}"
+ "${myconf[@]}" \
+ ${EXTRA_FFMPEG_CONF}
echo "${@}"
"${@}" || die
@@ -495,6 +568,11 @@ multilib_src_compile() {
fi
}
+multilib_src_test() {
+ LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil" \
+ emake V=1 fate -k
+}
+
multilib_src_install() {
emake V=1 DESTDIR="${D}" install install-doc
@@ -513,6 +591,10 @@ multilib_src_install() {
popd >/dev/null || die
else
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
fi
@@ -521,9 +603,6 @@ multilib_src_install() {
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
-}
-multilib_src_test() {
- LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
- emake V=1 fate
+ 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-3.4.6-r1.ebuild b/media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild
index 57488e979b6c..94fe73865b5b 100644
--- a/media-video/ffmpeg/ffmpeg-3.4.6-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=6
+EAPI=8
# Subslot: libavutil major.libavcodec major.libavformat major
# Since FFmpeg ships several libraries, subslot is kind of limited here.
@@ -12,24 +12,51 @@ EAPI=6
# changes its ABI then this package will be rebuilt needlessly. Hence, such a
# package is free _not_ to := depend on FFmpeg but I would strongly encourage
# doing so since such a case is unlikely.
-FFMPEG_SUBSLOT=55.57.57
+FFMPEG_SUBSLOT=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-6.1-r3.patch"
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
SCM="git-r3"
- EGIT_REPO_URI="git://source.ffmpeg.org/ffmpeg.git"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
fi
-inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
-DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
-HOMEPAGE="http://ffmpeg.org/"
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
if [ "${PV#9999}" != "${PV}" ] ; then
- SRC_URI=""
+ :
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
else # Release
- SRC_URI="http://ffmpeg.org/releases/${P/_/-}.tar.bz2"
+ inherit verify-sig
+
+ SRC_URI+="
+ https://ffmpeg.org/releases/${P/_/-}.tar.xz
+ verify-sig? (
+ https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc
+ soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH}.asc )
+ )
+ "
+
+ BDEPEND="
+ verify-sig? (
+ sec-keys/openpgp-keys-ffmpeg
+ soc? ( sec-keys/openpgp-keys-gentoo-developers )
+ )
+ "
+
+ src_unpack() {
+ if use verify-sig; then
+ verify-sig_verify_detached "${DISTDIR}"/${P/_/-}.tar.xz{,.asc} /usr/share/openpgp-keys/ffmpeg.asc
+ use soc && verify-sig_verify_detached "${DISTDIR}"/${SOC_PATCH}{,.asc} /usr/share/openpgp-keys/gentoo-developers.asc
+ fi
+ default
+ }
fi
FFMPEG_REVISION="${PV#*_p}"
@@ -45,6 +72,10 @@ LICENSE="
gpl? ( GPL-3 )
!gpl? ( LGPL-3 )
)
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
encode? (
amrenc? (
gpl? ( GPL-3 )
@@ -54,7 +85,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
fi
# Options to use as use_enable in the foo[:bar] form.
@@ -62,26 +93,27 @@ fi
# or $(use_enable foo foo) if no :bar is set.
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
- +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
- +gpl +hardcoded-tables +iconv lzma +network opencl openssl +postproc
- samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau X:xlib xcb:libxcb
- xcb:libxcb-shm xcb:libxcb-xfixes +zlib
+ +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp
+ +gpl hardcoded-tables +iconv libxml2 lzma +network opencl
+ openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan
+ X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib
# libavdevice options
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
opengl
# indevs
- libv4l:libv4l2 pulseaudio:libpulse libdrm
+ libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
# decoders
- amr:libopencore-amrwb amr:libopencore-amrnb fdk:libfdk-aac
- jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
- mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
- speex:libspeex svg:librsvg vorbis:libvorbis
- vpx:libvpx zvbi:libzvbi
+ amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 +dav1d:libdav1d fdk:libfdk-aac
+ jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme gsm:libgsm
+ 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
appkit
- bs2b:libbs2b chromaprint flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass truetype:libfreetype
- rubberband:librubberband zeromq:libzmq zimg:libzimg
+ bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite fontconfig frei0r
+ fribidi:libfribidi glslang:libglslang ladspa lcms:lcms2 libass libplacebo
+ libtesseract lv2 rubberband:librubberband shaderc:libshaderc truetype:libfreetype
+ truetype:libharfbuzz vidstab:libvidstab vmaf:libvmaf zeromq:libzmq zimg:libzimg
# libswresample options
libsoxr
# Threads; we only support pthread for now but ffmpeg supports more
@@ -90,14 +122,14 @@ FFMPEG_FLAG_MAP=(
# Same as above but for encoders, i.e. they do something only with USE=encode.
FFMPEG_ENCODER_FLAG_MAP=(
- amrenc:libvo-amrwbenc mp3:libmp3lame
- kvazaar:libkvazaar nvenc:nvenc
- openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
- wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+ amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+ openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1
+ theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+ x265:libx265 xvid:libxvid
)
IUSE="
- alsa chromium doc +encode jack oss pic static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l soc
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -112,18 +144,30 @@ ARM_CPU_FEATURES=(
cpu_flags_arm_vfp:vfp
cpu_flags_arm_vfpv3:vfpv3
cpu_flags_arm_v8:armv8
+ cpu_flags_arm_asimddp:dotprod
+ cpu_flags_arm_i8mm:i8mm
)
ARM_CPU_REQUIRED_USE="
arm64? ( cpu_flags_arm_v8 )
- cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
- cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
+ cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
+ cpu_flags_arm_neon? (
+ cpu_flags_arm_vfp
+ arm? ( cpu_flags_arm_thumb2 )
+ )
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
- cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
+ cpu_flags_arm_v6? (
+ arm? ( cpu_flags_arm_thumb )
+ )
"
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
-PPC_CPU_FEATURES=( altivec )
-X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
+PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
+PPC_CPU_REQUIRED_USE="
+ cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec )
+ cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx )
+"
+X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx
+ mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
X86_CPU_REQUIRED_USE="
cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
@@ -154,33 +198,37 @@ IUSE="${IUSE}
CPU_REQUIRED_USE="
${ARM_CPU_REQUIRED_USE}
+ ${PPC_CPU_REQUIRED_USE}
${X86_CPU_REQUIRED_USE}
"
-FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
+FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt
+ graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
RDEPEND="
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+ amf? ( media-video/amdgpu-pro-amf:= )
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] )
cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
+ codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
+ dav1d? ( >=media-libs/dav1d-0.5.0:0=[${MULTILIB_USEDEP}] )
encode? (
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
- kvazaar? ( media-libs/kvazaar[${MULTILIB_USEDEP}] )
+ kvazaar? ( >=media-libs/kvazaar-2.0.0[${MULTILIB_USEDEP}] )
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
- nvenc? ( media-video/nvidia_video_sdk )
- openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
+ openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
theora? (
- >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+ >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
)
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
- wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
@@ -189,12 +237,12 @@ RDEPEND="
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
- frei0r? ( media-plugins/frei0r-plugins )
+ frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] )
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
+ glslang? ( dev-util/glslang:=[${MULTILIB_USEDEP}] )
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] )
- gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] )
gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] )
iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
iec61883? (
@@ -203,63 +251,95 @@ RDEPEND="
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
)
ieee1394? (
- >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
+ >=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}]
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
)
jack? ( virtual/jack[${MULTILIB_USEDEP}] )
- jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
- libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
+ jpeg2k? ( >=media-libs/openjpeg-2.1:2=[${MULTILIB_USEDEP}] )
+ jpegxl? ( >=media-libs/libjxl-0.7.0:=[$MULTILIB_USEDEP] )
+ lcms? ( >=media-libs/lcms-2.13:2[$MULTILIB_USEDEP] )
+ libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] )
+ libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] )
+ libass? ( >=media-libs/libass-0.11.0:=[${MULTILIB_USEDEP}] )
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
+ libplacebo? ( >=media-libs/libplacebo-4.192.0:=[$MULTILIB_USEDEP] )
+ librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
+ libtesseract? ( >=app-text/tesseract-4.1.0-r1[${MULTILIB_USEDEP}] )
libv4l? ( >=media-libs/libv4l-0.9.5[${MULTILIB_USEDEP}] )
+ 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}] )
- opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
- openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ opengl? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
- pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
- librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
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}] )
- ssh? ( >=net-libs/libssh-0.5.5[${MULTILIB_USEDEP}] )
- svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
- truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
- vaapi? ( >=x11-libs/libva-1.2.1-r1[${MULTILIB_USEDEP}] )
+ srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
+ ssh? ( >=net-libs/libssh-0.6.0:=[sftp,${MULTILIB_USEDEP}] )
+ svg? (
+ gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ )
+ nvenc? ( >=media-libs/nv-codec-headers-11.1.5.3 )
+ svt-av1? ( >=media-libs/svt-av1-0.9.0[${MULTILIB_USEDEP}] )
+ truetype? (
+ >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}]
+ media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
+ )
+ vaapi? ( >=media-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
+ vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+ vmaf? ( >=media-libs/libvmaf-2.0.0:=[${MULTILIB_USEDEP}] )
vorbis? (
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
)
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.3.255:=[${MULTILIB_USEDEP}] )
X? (
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
)
- xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
- zeromq? ( >=net-libs/zeromq-4.1.6 )
- zimg? ( >=media-libs/zimg-2.4:=[${MULTILIB_USEDEP}] )
+ zeromq? ( >=net-libs/zeromq-4.2.1:= )
+ zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
- !media-video/qt-faststart
- postproc? ( !media-libs/libpostproc )
+"
+
+RDEPEND="${RDEPEND}
+ openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
"
DEPEND="${RDEPEND}
- >=sys-devel/make-3.81
- doc? ( sys-apps/texinfo )
- >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+ amf? ( media-libs/amf-headers )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
- cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
- test? ( net-misc/wget sys-devel/bc )
v4l? ( sys-kernel/linux-headers )
+ vulkan? ( >=dev-util/vulkan-headers-1.3.255 )
+"
+
+# += for verify-sig above
+BDEPEND+="
+ >=dev-build/make-3.81
+ virtual/pkgconfig
+ cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
+ cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
+ doc? ( sys-apps/texinfo )
+ test? ( net-misc/wget app-alternatives/bc )
"
# Code requiring FFmpeg to be built under gpl license
@@ -267,48 +347,97 @@ GPL_REQUIRED_USE="
postproc? ( gpl )
frei0r? ( gpl )
cdio? ( gpl )
+ rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
x265? ( gpl )
xvid? ( gpl )
- X? ( !xcb? ( gpl ) )
)
"
REQUIRED_USE="
- libv4l? ( v4l )
+ chromium? ( opus )
+ cuda? ( nvenc )
fftools_cws2fws? ( zlib )
+ glslang? ( vulkan !shaderc )
+ libv4l? ( v4l )
+ shaderc? ( vulkan !glslang )
+ soc? ( libdrm )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
+ !test? ( test )
gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
"
S=${WORKDIR}/${P/_/-}
PATCHES=(
- "${FILESDIR}"/chromium.patch
- "${FILESDIR}"/${PN}-3.4.6-fix-building-against-fdk-aac-2.patch #682890
+ "${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
+ "${FILESDIR}"/${PN}-6.1-gcc-14.patch
+ "${FILESDIR}"/${PN}-6.0.1-alignment.patch
+ "${FILESDIR}"/ffmpeg-6.1.1-vulkan-rename.patch
+
)
MULTILIB_WRAPPED_HEADERS=(
/usr/include/libavutil/avconfig.h
)
+pkg_setup() {
+ # ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg.
+ # May cause breakage while updating, #862996, #625210, #833821.
+ if has_version media-libs/chromaprint[tools] && use chromaprint; then
+ ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which "
+ ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, "
+ ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg."
+ ewarn ""
+ ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint "
+ ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable "
+ ewarn "'tools' USE flag for chromaprint. See #862996."
+ fi
+}
+
src_prepare() {
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
export revision=git-N-${FFMPEG_REVISION}
fi
+
+ use soc &&
+ eapply "${DISTDIR}"/${SOC_PATCH}
+
default
+
+ # -fdiagnostics-color=auto gets appended after user flags which
+ # 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
}
multilib_src_configure() {
- local myconf=( ${EXTRA_FFMPEG_CONF} )
+ 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 \
+ -fno-tree-dominator-opts \
+ -fno-tree-fre \
+ -fno-code-hoisting \
+ -fno-tree-pre \
+ -fno-tree-vrp
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
- use openssl && use gpl && myconf+=( --enable-nonfree )
+ use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
# Encoders
@@ -325,27 +454,33 @@ multilib_src_configure() {
# Indevs
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
- for i in alsa oss jack ; do
+ for i in alsa oss jack sndio ; do
use ${i} || myconf+=( --disable-indev=${i} )
done
# Outdevs
- for i in alsa oss sdl ; do
+ for i in alsa oss sndio ; do
use ${i} || myconf+=( --disable-outdev=${i} )
done
# Decoders
use amr && myconf+=( --enable-version3 )
use gmp && myconf+=( --enable-version3 )
+ use libaribb24 && myconf+=( --enable-version3 )
use fdk && use gpl && myconf+=( --enable-nonfree )
for i in "${ffuse[@]#+}" ; do
myconf+=( $(use_enable ${i%:*} ${i#*:}) )
done
+ if use openssl ; then
+ myconf+=( --disable-gnutls )
+ has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 )
+ fi
+
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -374,14 +509,23 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 ]] && tc-is-lto; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ -n ${v} ]] && myconf+=( "--enable-lto=${v}" ) || myconf+=( "--enable-lto" )
+ fi
+ filter-lto
# Mandatory configuration
myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
--enable-avfilter
- --enable-avresample
--disable-stripping
+ # This is only for hardcoded cflags; those are used in configure checks that may
+ # interfere with proper detections, bug #671746 and bug #645778
+ # We use optflags, so that overrides them anyway.
+ --disable-optimizations
--disable-libcelt # bug #664158
"${myconf[@]}"
)
@@ -390,9 +534,6 @@ multilib_src_configure() {
if tc-is-cross-compiler ; then
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
case ${CHOST} in
- *freebsd*)
- myconf+=( --target-os=freebsd )
- ;;
*mingw32*)
myconf+=( --target-os=mingw32 )
;;
@@ -409,6 +550,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -419,25 +561,16 @@ multilib_src_configure() {
--cc="$(tc-getCC)" \
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
+ --nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
+ --ranlib="$(tc-getRANLIB)" \
+ --pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
$(use_enable static-libs static) \
- "${myconf[@]}"
+ "${myconf[@]}" \
+ ${EXTRA_FFMPEG_CONF}
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() {
@@ -450,15 +583,16 @@ multilib_src_compile() {
fi
done
- if use chromium; then
- einfo "Compiling for Chromium"
- pushd ../chromium >/dev/null || die
+ use chromium &&
emake V=1 libffmpeg
- popd >/dev/null || die
- fi
fi
}
+multilib_src_test() {
+ LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil" \
+ emake V=1 fate -k
+}
+
multilib_src_install() {
emake V=1 DESTDIR="${D}" install install-doc
@@ -469,21 +603,14 @@ multilib_src_install() {
fi
done
- if use chromium; then
- einfo "Installing for Chromium"
- pushd ../chromium >/dev/null || die
+ use chromium &&
emake V=1 DESTDIR="${D}" install-libffmpeg
- popd >/dev/null || die
- fi
fi
}
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
-}
-multilib_src_test() {
- LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
- emake V=1 fate
+ 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 6c78527aa36a..06c2372b2a61 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-9999.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI=7
+EAPI=8
# Subslot: libavutil major.libavcodec major.libavformat major
# Since FFmpeg ships several libraries, subslot is kind of limited here.
@@ -12,7 +12,9 @@ EAPI=7
# changes its ABI then this package will be rebuilt needlessly. Hence, such a
# package is free _not_ to := depend on FFmpeg but I would strongly encourage
# doing so since such a case is unlikely.
-FFMPEG_SUBSLOT=56.58.58
+FFMPEG_SUBSLOT=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-6.1-r3.patch"
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
@@ -21,16 +23,40 @@ if [ "${PV#9999}" != "${PV}" ] ; then
EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
fi
-inherit eutils flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
-DESCRIPTION="Complete solution to record, convert and stream audio and video. Includes libavcodec"
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
if [ "${PV#9999}" != "${PV}" ] ; then
- SRC_URI=""
+ :
elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
- SRC_URI="mirror://gentoo/${P}.tar.bz2"
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
else # Release
- SRC_URI="https://ffmpeg.org/releases/${P/_/-}.tar.bz2"
+ inherit verify-sig
+
+ SRC_URI+="
+ https://ffmpeg.org/releases/${P/_/-}.tar.xz
+ verify-sig? (
+ https://ffmpeg.org/releases/${P/_/-}.tar.xz.asc
+ soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH}.asc )
+ )
+ "
+
+ BDEPEND="
+ verify-sig? (
+ sec-keys/openpgp-keys-ffmpeg
+ soc? ( sec-keys/openpgp-keys-gentoo-developers )
+ )
+ "
+
+ src_unpack() {
+ if use verify-sig; then
+ verify-sig_verify_detached "${DISTDIR}"/${P/_/-}.tar.xz{,.asc} /usr/share/openpgp-keys/ffmpeg.asc
+ use soc && verify-sig_verify_detached "${DISTDIR}"/${SOC_PATCH}{,.asc} /usr/share/openpgp-keys/gentoo-developers.asc
+ fi
+ default
+ }
fi
FFMPEG_REVISION="${PV#*_p}"
@@ -59,7 +85,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~x64-solaris ~x86-solaris"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
fi
# Options to use as use_enable in the foo[:bar] form.
@@ -67,26 +93,27 @@ fi
# or $(use_enable foo foo) if no :bar is set.
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
- +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt gnutls gmp
- +gpl hardcoded-tables +iconv libressl:libtls libxml2 lzma +network opencl
- openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau
- X:xlib xcb:libxcb xcb:libxcb-shm xcb:libxcb-xfixes +zlib
+ +bzip2:bzlib cpudetection:runtime-cpudetect debug gcrypt +gnutls gmp
+ +gpl hardcoded-tables +iconv libxml2 lzma +network opencl
+ openssl +postproc samba:libsmbclient sdl:ffplay sdl:sdl2 vaapi vdpau vulkan
+ X:xlib X:libxcb X:libxcb-shm X:libxcb-xfixes +zlib
# libavdevice options
cdio:libcdio iec61883:libiec61883 ieee1394:libdc1394 libcaca openal
opengl
# indevs
libv4l:libv4l2 pulseaudio:libpulse libdrm jack:libjack
# decoders
- amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 dav1d:libdav1d fdk:libfdk-aac
- jpeg2k:libopenjpeg bluray:libbluray gme:libgme gsm:libgsm
- libaribb24 mmal modplug:libmodplug opus:libopus libilbc librtmp ssh:libssh
- speex:libspeex srt:libsrt svg:librsvg video_cards_nvidia:ffnvcodec
+ amr:libopencore-amrwb amr:libopencore-amrnb codec2:libcodec2 +dav1d:libdav1d fdk:libfdk-aac
+ jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme gsm:libgsm
+ 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
appkit
- bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass libtesseract lv2 truetype:libfreetype vidstab:libvidstab
- rubberband:librubberband zeromq:libzmq zimg:libzimg
+ bs2b:libbs2b chromaprint cuda:cuda-llvm flite:libflite fontconfig frei0r
+ fribidi:libfribidi glslang:libglslang ladspa lcms:lcms2 libass libplacebo
+ libtesseract lv2 rubberband:librubberband shaderc:libshaderc truetype:libfreetype
+ truetype:libharfbuzz vidstab:libvidstab vmaf:libvmaf zeromq:libzmq zimg:libzimg
# libswresample options
libsoxr
# Threads; we only support pthread for now but ffmpeg supports more
@@ -95,14 +122,14 @@ FFMPEG_FLAG_MAP=(
# Same as above but for encoders, i.e. they do something only with USE=encode.
FFMPEG_ENCODER_FLAG_MAP=(
- amrenc:libvo-amrwbenc mp3:libmp3lame
- kvazaar:libkvazaar libaom
- openh264:libopenh264 snappy:libsnappy theora:libtheora twolame:libtwolame
- wavpack:libwavpack webp:libwebp x264:libx264 x265:libx265 xvid:libxvid
+ amf amrenc:libvo-amrwbenc kvazaar:libkvazaar libaom mp3:libmp3lame
+ openh264:libopenh264 rav1e:librav1e snappy:libsnappy svt-av1:libsvtav1
+ theora:libtheora twolame:libtwolame webp:libwebp x264:libx264
+ x265:libx265 xvid:libxvid
)
IUSE="
- alsa chromium doc +encode oss pic static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l soc
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -117,18 +144,30 @@ ARM_CPU_FEATURES=(
cpu_flags_arm_vfp:vfp
cpu_flags_arm_vfpv3:vfpv3
cpu_flags_arm_v8:armv8
+ cpu_flags_arm_asimddp:dotprod
+ cpu_flags_arm_i8mm:i8mm
)
ARM_CPU_REQUIRED_USE="
arm64? ( cpu_flags_arm_v8 )
- cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
- cpu_flags_arm_neon? ( cpu_flags_arm_thumb2 cpu_flags_arm_vfp )
+ cpu_flags_arm_v8? ( cpu_flags_arm_vfpv3 cpu_flags_arm_neon )
+ cpu_flags_arm_neon? (
+ cpu_flags_arm_vfp
+ arm? ( cpu_flags_arm_thumb2 )
+ )
cpu_flags_arm_vfpv3? ( cpu_flags_arm_vfp )
cpu_flags_arm_thumb2? ( cpu_flags_arm_v6 )
- cpu_flags_arm_v6? ( cpu_flags_arm_thumb )
+ cpu_flags_arm_v6? (
+ arm? ( cpu_flags_arm_thumb )
+ )
"
MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
-PPC_CPU_FEATURES=( altivec )
-X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
+PPC_CPU_FEATURES=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
+PPC_CPU_REQUIRED_USE="
+ cpu_flags_ppc_vsx? ( cpu_flags_ppc_altivec )
+ cpu_flags_ppc_vsx2? ( cpu_flags_ppc_vsx )
+"
+X86_CPU_FEATURES_RAW=( 3dnow:amd3dnow 3dnowext:amd3dnowext aes:aesni avx:avx avx2:avx2 fma3:fma3 fma4:fma4 mmx:mmx
+ mmxext:mmxext sse:sse sse2:sse2 sse3:sse3 ssse3:ssse3 sse4_1:sse4 sse4_2:sse42 xop:xop )
X86_CPU_FEATURES=( ${X86_CPU_FEATURES_RAW[@]/#/cpu_flags_x86_} )
X86_CPU_REQUIRED_USE="
cpu_flags_x86_avx2? ( cpu_flags_x86_avx )
@@ -159,14 +198,17 @@ IUSE="${IUSE}
CPU_REQUIRED_USE="
${ARM_CPU_REQUIRED_USE}
+ ${PPC_CPU_REQUIRED_USE}
${X86_CPU_REQUIRED_USE}
"
-FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
+FFTOOLS=( aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt
+ graph2dot ismindex pktdumper qt-faststart sidxindex trasher )
IUSE="${IUSE} ${FFTOOLS[@]/#/+fftools_}"
RDEPEND="
alsa? ( >=media-libs/alsa-lib-1.0.27.2[${MULTILIB_USEDEP}] )
+ amf? ( media-video/amdgpu-pro-amf:= )
amr? ( >=media-libs/opencore-amr-0.1.3-r1[${MULTILIB_USEDEP}] )
bluray? ( >=media-libs/libbluray-0.3.0-r1:=[${MULTILIB_USEDEP}] )
bs2b? ( >=media-libs/libbs2b-3.1.0-r1[${MULTILIB_USEDEP}] )
@@ -174,19 +216,19 @@ RDEPEND="
cdio? ( >=dev-libs/libcdio-paranoia-0.90_p1-r1[${MULTILIB_USEDEP}] )
chromaprint? ( >=media-libs/chromaprint-1.2-r1[${MULTILIB_USEDEP}] )
codec2? ( media-libs/codec2[${MULTILIB_USEDEP}] )
- dav1d? ( >=media-libs/dav1d-0.4.0:0=[${MULTILIB_USEDEP}] )
+ dav1d? ( >=media-libs/dav1d-0.5.0:0=[${MULTILIB_USEDEP}] )
encode? (
amrenc? ( >=media-libs/vo-amrwbenc-0.1.2-r1[${MULTILIB_USEDEP}] )
- kvazaar? ( >=media-libs/kvazaar-1.2.0[${MULTILIB_USEDEP}] )
+ kvazaar? ( >=media-libs/kvazaar-2.0.0[${MULTILIB_USEDEP}] )
mp3? ( >=media-sound/lame-3.99.5-r1[${MULTILIB_USEDEP}] )
- openh264? ( >=media-libs/openh264-1.4.0-r1[${MULTILIB_USEDEP}] )
+ openh264? ( >=media-libs/openh264-1.4.0-r1:=[${MULTILIB_USEDEP}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
theora? (
- >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
+ >=media-libs/libtheora-1.1.1[encode,${MULTILIB_USEDEP}]
)
twolame? ( >=media-sound/twolame-0.3.13-r1[${MULTILIB_USEDEP}] )
- wavpack? ( >=media-sound/wavpack-4.60.1-r1[${MULTILIB_USEDEP}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
x264? ( >=media-libs/x264-0.0.20130506:=[${MULTILIB_USEDEP}] )
x265? ( >=media-libs/x265-1.6:=[${MULTILIB_USEDEP}] )
@@ -195,9 +237,10 @@ RDEPEND="
fdk? ( >=media-libs/fdk-aac-0.1.3:=[${MULTILIB_USEDEP}] )
flite? ( >=app-accessibility/flite-1.4-r4[${MULTILIB_USEDEP}] )
fontconfig? ( >=media-libs/fontconfig-2.10.92[${MULTILIB_USEDEP}] )
- frei0r? ( media-plugins/frei0r-plugins )
+ frei0r? ( media-plugins/frei0r-plugins[${MULTILIB_USEDEP}] )
fribidi? ( >=dev-libs/fribidi-0.19.6[${MULTILIB_USEDEP}] )
gcrypt? ( >=dev-libs/libgcrypt-1.6:0=[${MULTILIB_USEDEP}] )
+ glslang? ( dev-util/glslang:=[${MULTILIB_USEDEP}] )
gme? ( >=media-libs/game-music-emu-0.6.0[${MULTILIB_USEDEP}] )
gmp? ( >=dev-libs/gmp-6:0=[${MULTILIB_USEDEP}] )
gsm? ( >=media-sound/gsm-1.0.13-r1[${MULTILIB_USEDEP}] )
@@ -208,17 +251,20 @@ RDEPEND="
>=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
)
ieee1394? (
- >=media-libs/libdc1394-2.2.1[${MULTILIB_USEDEP}]
+ >=media-libs/libdc1394-2.2.1:2=[${MULTILIB_USEDEP}]
>=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
)
jack? ( virtual/jack[${MULTILIB_USEDEP}] )
- jpeg2k? ( >=media-libs/openjpeg-2:2[${MULTILIB_USEDEP}] )
- libaom? ( >=media-libs/libaom-1.0.0-r1[${MULTILIB_USEDEP}] )
+ jpeg2k? ( >=media-libs/openjpeg-2.1:2=[${MULTILIB_USEDEP}] )
+ jpegxl? ( >=media-libs/libjxl-0.7.0:=[$MULTILIB_USEDEP] )
+ lcms? ( >=media-libs/lcms-2.13:2[$MULTILIB_USEDEP] )
+ libaom? ( >=media-libs/libaom-1.0.0-r1:=[${MULTILIB_USEDEP}] )
libaribb24? ( >=media-libs/aribb24-1.0.3-r2[${MULTILIB_USEDEP}] )
- libass? ( >=media-libs/libass-0.10.2:=[${MULTILIB_USEDEP}] )
+ libass? ( >=media-libs/libass-0.11.0:=[${MULTILIB_USEDEP}] )
libcaca? ( >=media-libs/libcaca-0.99_beta18-r1[${MULTILIB_USEDEP}] )
libdrm? ( x11-libs/libdrm[${MULTILIB_USEDEP}] )
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
+ libplacebo? ( >=media-libs/libplacebo-4.192.0:=[$MULTILIB_USEDEP] )
librtmp? ( >=media-video/rtmpdump-2.4_p20131018[${MULTILIB_USEDEP}] )
libsoxr? ( >=media-libs/soxr-0.1.0[${MULTILIB_USEDEP}] )
libtesseract? ( >=app-text/tesseract-4.1.0-r1[${MULTILIB_USEDEP}] )
@@ -226,68 +272,74 @@ 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}] )
- opengl? ( >=virtual/opengl-7.0-r1[${MULTILIB_USEDEP}] )
+ opengl? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
- pulseaudio? ( >=media-sound/pulseaudio-2.1-r1[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
rubberband? ( >=media-libs/rubberband-1.8.1-r1[${MULTILIB_USEDEP}] )
samba? ( >=net-fs/samba-3.6.23-r1[client,${MULTILIB_USEDEP}] )
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.5.5[${MULTILIB_USEDEP}] )
- svg? ( gnome-base/librsvg:2=[${MULTILIB_USEDEP}] )
- truetype? ( >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}] )
- vaapi? ( >=x11-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
- video_cards_nvidia? ( >=media-libs/nv-codec-headers-9.0.18.0[${MULTILIB_USEDEP}] )
+ srt? ( >=net-libs/srt-1.3.0:=[${MULTILIB_USEDEP}] )
+ ssh? ( >=net-libs/libssh-0.6.0:=[sftp,${MULTILIB_USEDEP}] )
+ svg? (
+ gnome-base/librsvg:2=[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ )
+ nvenc? ( >=media-libs/nv-codec-headers-11.1.5.3 )
+ svt-av1? ( >=media-libs/svt-av1-0.9.0[${MULTILIB_USEDEP}] )
+ truetype? (
+ >=media-libs/freetype-2.5.0.1:2[${MULTILIB_USEDEP}]
+ media-libs/harfbuzz:=[${MULTILIB_USEDEP}]
+ )
+ vaapi? ( >=media-libs/libva-1.2.1-r1:0=[${MULTILIB_USEDEP}] )
vdpau? ( >=x11-libs/libvdpau-0.7[${MULTILIB_USEDEP}] )
vidstab? ( >=media-libs/vidstab-1.1.0[${MULTILIB_USEDEP}] )
+ vmaf? ( >=media-libs/libvmaf-2.0.0:=[${MULTILIB_USEDEP}] )
vorbis? (
>=media-libs/libvorbis-1.3.3-r1[${MULTILIB_USEDEP}]
>=media-libs/libogg-1.3.0[${MULTILIB_USEDEP}]
)
vpx? ( >=media-libs/libvpx-1.4.0:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.3.255:=[${MULTILIB_USEDEP}] )
X? (
>=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}]
>=x11-libs/libXext-1.3.2[${MULTILIB_USEDEP}]
>=x11-libs/libXv-1.0.10[${MULTILIB_USEDEP}]
+ >=x11-libs/libxcb-1.4:=[${MULTILIB_USEDEP}]
)
- xcb? ( >=x11-libs/libxcb-1.4[${MULTILIB_USEDEP}] )
- zeromq? ( >=net-libs/zeromq-4.1.6 )
+ zeromq? ( >=net-libs/zeromq-4.2.1:= )
zimg? ( >=media-libs/zimg-2.7.4:=[${MULTILIB_USEDEP}] )
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )
zvbi? ( >=media-libs/zvbi-0.2.35[${MULTILIB_USEDEP}] )
- !media-video/qt-faststart
- postproc? ( !media-libs/libpostproc )
"
-# Crypto & co provider magic
-# - libressl is a useflag meaning it should always favor libressl over openssl
-# - libressl and openssl provide more features to ffmpeg than gnutls
-#
-# The ordering is thus: libressl > openssl > gnutls
RDEPEND="${RDEPEND}
- libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
- !libressl? (
- openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
- !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
- )
+ openssl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
+ !openssl? ( gnutls? ( >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}] ) )
"
DEPEND="${RDEPEND}
+ amf? ( media-libs/amf-headers )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
v4l? ( sys-kernel/linux-headers )
+ vulkan? ( >=dev-util/vulkan-headers-1.3.255 )
"
-BDEPEND="
- >=sys-devel/make-3.81
- >=virtual/pkgconfig-0-r1[${MULTILIB_USEDEP}]
+
+# += for verify-sig above
+BDEPEND+="
+ >=dev-build/make-3.81
+ virtual/pkgconfig
cpu_flags_x86_mmx? ( || ( >=dev-lang/nasm-2.13 >=dev-lang/yasm-1.3 ) )
cuda? ( >=sys-devel/clang-7[llvm_targets_NVPTX] )
doc? ( sys-apps/texinfo )
- test? ( net-misc/wget sys-devel/bc )
+ test? ( net-misc/wget app-alternatives/bc )
"
# Code requiring FFmpeg to be built under gpl license
@@ -296,52 +348,90 @@ GPL_REQUIRED_USE="
frei0r? ( gpl )
cdio? ( gpl )
rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
x265? ( gpl )
xvid? ( gpl )
- X? ( !xcb? ( gpl ) )
)
"
REQUIRED_USE="
- cuda? ( video_cards_nvidia )
- libv4l? ( v4l )
+ chromium? ( opus )
+ cuda? ( nvenc )
fftools_cws2fws? ( zlib )
+ glslang? ( vulkan !shaderc )
+ libv4l? ( v4l )
+ shaderc? ( vulkan !glslang )
+ soc? ( libdrm )
test? ( encode )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
- gpl? ( openssl? ( bindist ) fdk? ( bindist ) libressl? ( bindist ) )
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
"
S=${WORKDIR}/${P/_/-}
PATCHES=(
- "${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/chromium-r2.patch
+ "${FILESDIR}"/${PN}-6.1-opencl-parallel-gmake-fix.patch
)
MULTILIB_WRAPPED_HEADERS=(
/usr/include/libavutil/avconfig.h
)
-build_separate_libffmpeg() {
- use opencl
+pkg_setup() {
+ # ffmpeg[chromaprint] depends on chromaprint, and chromaprint[tools] depends on ffmpeg.
+ # May cause breakage while updating, #862996, #625210, #833821.
+ if has_version media-libs/chromaprint[tools] && use chromaprint; then
+ ewarn "You have media-libs/chromaprint installed with 'tools' USE flag, which "
+ ewarn "links to ffmpeg, and you have enabled 'chromaprint' USE flag for ffmpeg, "
+ ewarn "which links to chromaprint. This may cause issues while rebuilding ffmpeg."
+ ewarn ""
+ ewarn "If your build fails to 'ERROR: chromaprint not found', rebuild chromaprint "
+ ewarn "without the 'tools' use flag first, then rebuild ffmpeg, and then finally enable "
+ ewarn "'tools' USE flag for chromaprint. See #862996."
+ fi
}
src_prepare() {
if [[ "${PV%_p*}" != "${PV}" ]] ; then # Snapshot
export revision=git-N-${FFMPEG_REVISION}
fi
+
+ use soc &&
+ eapply "${DISTDIR}"/${SOC_PATCH}
+
default
+
+ # -fdiagnostics-color=auto gets appended after user flags which
+ # 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
}
multilib_src_configure() {
- local myconf=( ${EXTRA_FFMPEG_CONF} )
+ 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 \
+ -fno-tree-dominator-opts \
+ -fno-tree-fre \
+ -fno-code-hoisting \
+ -fno-tree-pre \
+ -fno-tree-vrp
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
- use openssl || use libressl && use gpl && myconf+=( --enable-nonfree )
+ use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
# Encoders
@@ -358,12 +448,12 @@ multilib_src_configure() {
# Indevs
use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
- for i in alsa oss jack ; do
+ for i in alsa oss jack sndio ; do
use ${i} || myconf+=( --disable-indev=${i} )
done
# Outdevs
- for i in alsa oss ; do
+ for i in alsa oss sndio ; do
use ${i} || myconf+=( --disable-outdev=${i} )
done
@@ -377,16 +467,14 @@ multilib_src_configure() {
myconf+=( $(use_enable ${i%:*} ${i#*:}) )
done
- # Incompatible features: openssl or libressl and gnutls
- if use libressl ; then
- myconf+=( --disable-gnutls --disable-openssl )
- elif use openssl ; then
+ if use openssl ; then
myconf+=( --disable-gnutls )
+ has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 )
fi
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -415,13 +503,18 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 ]] && tc-is-lto; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ -n ${v} ]] && myconf+=( "--enable-lto=${v}" ) || myconf+=( "--enable-lto" )
+ fi
+ filter-lto
# Mandatory configuration
myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
--enable-avfilter
- --enable-avresample
--disable-stripping
# This is only for hardcoded cflags; those are used in configure checks that may
# interfere with proper detections, bug #671746 and bug #645778
@@ -435,9 +528,6 @@ multilib_src_configure() {
if tc-is-cross-compiler ; then
myconf+=( --enable-cross-compile --arch=$(tc-arch-kernel) --cross-prefix=${CHOST}- --host-cc="$(tc-getBUILD_CC)" )
case ${CHOST} in
- *freebsd*)
- myconf+=( --target-os=freebsd )
- ;;
*mingw32*)
myconf+=( --target-os=mingw32 )
;;
@@ -454,6 +544,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -464,25 +555,16 @@ multilib_src_configure() {
--cc="$(tc-getCC)" \
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
+ --nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
+ --ranlib="$(tc-getRANLIB)" \
+ --pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
$(use_enable static-libs static) \
- "${myconf[@]}"
+ "${myconf[@]}" \
+ ${EXTRA_FFMPEG_CONF}
echo "${@}"
"${@}" || die
-
- if multilib_is_native_abi && use chromium && build_separate_libffmpeg; then
- einfo "Configuring for Chromium"
- mkdir -p ../chromium || die
- pushd ../chromium >/dev/null || die
- set -- "${@}" \
- --disable-shared \
- --enable-static \
- --enable-pic \
- --disable-opencl
- echo "${@}"
- "${@}" || die
- popd >/dev/null || die
- fi
}
multilib_src_compile() {
@@ -495,19 +577,16 @@ multilib_src_compile() {
fi
done
- if use chromium; then
- if build_separate_libffmpeg; then
- einfo "Compiling for Chromium"
- pushd ../chromium >/dev/null || die
- emake V=1 libffmpeg
- popd >/dev/null || die
- else
- emake V=1 libffmpeg
- fi
- fi
+ use chromium &&
+ emake V=1 libffmpeg
fi
}
+multilib_src_test() {
+ LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil" \
+ emake V=1 fate -k
+}
+
multilib_src_install() {
emake V=1 DESTDIR="${D}" install install-doc
@@ -518,29 +597,14 @@ multilib_src_install() {
fi
done
- if use chromium; then
- if build_separate_libffmpeg; then
- einfo "Installing for Chromium"
- pushd ../chromium >/dev/null || die
- emake V=1 DESTDIR="${D}" install-libffmpeg
- popd >/dev/null || die
- else
- 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
+ use chromium &&
+ emake V=1 DESTDIR="${D}" install-libffmpeg
fi
}
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
-}
-multilib_src_test() {
- LD_LIBRARY_PATH="${BUILD_DIR}/libpostproc:${BUILD_DIR}/libswscale:${BUILD_DIR}/libswresample:${BUILD_DIR}/libavcodec:${BUILD_DIR}/libavdevice:${BUILD_DIR}/libavfilter:${BUILD_DIR}/libavformat:${BUILD_DIR}/libavutil:${BUILD_DIR}/libavresample" \
- emake V=1 fate
+ use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override 99amf-env-vulkan-override
}
diff --git a/media-video/ffmpeg/files/amf-env-vulkan-override b/media-video/ffmpeg/files/amf-env-vulkan-override
new file mode 100644
index 000000000000..41ee27911178
--- /dev/null
+++ b/media-video/ffmpeg/files/amf-env-vulkan-override
@@ -0,0 +1 @@
+VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json
diff --git a/media-video/ffmpeg/files/chromium.patch b/media-video/ffmpeg/files/chromium-r2.patch
index 60a3e5d6cb99..1de86fe09a1e 100644
--- a/media-video/ffmpeg/files/chromium.patch
+++ b/media-video/ffmpeg/files/chromium-r2.patch
@@ -9,17 +9,23 @@ new file mode 100644
index 0000000..992cf3c
--- /dev/null
+++ b/ffbuild/libffmpeg.mak
-@@ -0,0 +1,21 @@
+@@ -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)
+
-+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)
++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-yes: libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF)
-+ $(LIBFFMPEG_LINK) -Wl,--no-as-needed -lavcodec -lavformat -lavutil
++$(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-$(CONFIG_SHARED)
+libffmpeg: $(LIBFFMPEG)
+
+install-libffmpeg: $(LIBFFMPEG)
@@ -30,7 +36,6 @@ index 0000000..992cf3c
+uninstall-libffmpeg:
+ $(RM) "$(SHLIBDIR)/chromium/$(LIBFFMPEG)"
+
-+.PHONY: libffmpeg libffmpeg-* install-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;
+}
diff --git a/media-video/ffmpeg/files/ffmpeg-3.4.6-fix-building-against-fdk-aac-2.patch b/media-video/ffmpeg/files/ffmpeg-3.4.6-fix-building-against-fdk-aac-2.patch
deleted file mode 100644
index 0ee99da96b3b..000000000000
--- a/media-video/ffmpeg/files/ffmpeg-3.4.6-fix-building-against-fdk-aac-2.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-https://bugs.gentoo.org/682890
-https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/141c960e21d2860e354f9b90df136184dd00a9a8
-
---- a/libavcodec/libfdk-aacenc.c
-+++ b/libavcodec/libfdk-aacenc.c
-@@ -26,6 +26,11 @@
- #include "audio_frame_queue.h"
- #include "internal.h"
-
-+#define FDKENC_VER_AT_LEAST(vl0, vl1) \
-+ (defined(AACENCODER_LIB_VL0) && \
-+ ((AACENCODER_LIB_VL0 > vl0) || \
-+ (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
-+
- typedef struct AACContext {
- const AVClass *class;
- HANDLE_AACENCODER handle;
-@@ -290,7 +295,11 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
- }
-
- avctx->frame_size = info.frameLength;
-+#if FDKENC_VER_AT_LEAST(4, 0)
-+ avctx->initial_padding = info.nDelay;
-+#else
- avctx->initial_padding = info.encoderDelay;
-+#endif
- ff_af_queue_init(avctx, &s->afq);
-
- if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
-@@ -323,28 +332,35 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
- int out_buffer_size, out_buffer_element_size;
- void *in_ptr, *out_ptr;
- int ret;
-+ uint8_t dummy_buf[1];
- AACENC_ERROR err;
-
- /* handle end-of-stream small frame and flushing */
- if (!frame) {
-+ /* Must be a non-null pointer, even if it's a dummy. We could use
-+ * the address of anything else on the stack as well. */
-+ in_ptr = dummy_buf;
-+ in_buffer_size = 0;
-+
- in_args.numInSamples = -1;
- } else {
-- in_ptr = frame->data[0];
-- in_buffer_size = 2 * avctx->channels * frame->nb_samples;
-- in_buffer_element_size = 2;
-+ in_ptr = frame->data[0];
-+ in_buffer_size = 2 * avctx->channels * frame->nb_samples;
-
-- in_args.numInSamples = avctx->channels * frame->nb_samples;
-- in_buf.numBufs = 1;
-- in_buf.bufs = &in_ptr;
-- in_buf.bufferIdentifiers = &in_buffer_identifier;
-- in_buf.bufSizes = &in_buffer_size;
-- in_buf.bufElSizes = &in_buffer_element_size;
-+ in_args.numInSamples = avctx->channels * frame->nb_samples;
-
- /* add current frame to the queue */
- if ((ret = ff_af_queue_add(&s->afq, frame)) < 0)
- return ret;
- }
-
-+ in_buffer_element_size = 2;
-+ in_buf.numBufs = 1;
-+ in_buf.bufs = &in_ptr;
-+ in_buf.bufferIdentifiers = &in_buffer_identifier;
-+ in_buf.bufSizes = &in_buffer_size;
-+ in_buf.bufElSizes = &in_buffer_element_size;
-+
- /* The maximum packet size is 6144 bits aka 768 bytes per channel. */
- if ((ret = ff_alloc_packet(avpkt, FFMAX(8192, 768 * avctx->channels)))) {
- av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.3-clang-14-ff_seek_frame_binary-crash.patch b/media-video/ffmpeg/files/ffmpeg-4.4.3-clang-14-ff_seek_frame_binary-crash.patch
new file mode 100644
index 000000000000..c8733ea2382f
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.3-clang-14-ff_seek_frame_binary-crash.patch
@@ -0,0 +1,46 @@
+https://github.com/FFmpeg/FFmpeg/commit/ab792634197e364ca1bb194f9abe36836e42f12d
+
+(Rebased for 4.4.x in Gentoo.)
+
+From ab792634197e364ca1bb194f9abe36836e42f12d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Mon, 18 Oct 2021 12:31:38 +0300
+Subject: [PATCH] seek: Fix crashes in ff_seek_frame_binary if built with
+ latest Clang 14
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Passing an uninitialized variable as argument to a function is
+undefined behaviour (UB). The compiler can assume that UB does not
+happen.
+
+Hence, the compiler can assume that the variables are never
+uninitialized when passed as argument, which means that the codepaths
+that initializes them must be taken.
+
+In ff_seek_frame_binary, this means that the compiler can assume
+that the codepaths that initialize pos_min and pos_max are taken,
+which means that the conditions "if (sti->index_entries)" and
+"if (index >= 0)" can be optimized out.
+
+Current Clang git versions (upcoming Clang 14) enabled an optimization
+that does this, which broke the current version of this function
+(which intentionally left the variables uninitialized, but silencing
+warnings about being uninitialized). See [1] for discussion on
+the matter.
+
+[1] https://reviews.llvm.org/D105169#3069555
+
+Signed-off-by: Martin Storsjö <martin@martin.st>
+--- a/libavformat/utils.c
++++ b/libavformat/utils.c
+@@ -2146,7 +2146,7 @@ int ff_seek_frame_binary(AVFormatContext *s, int stream_index,
+ int64_t target_ts, int flags)
+ {
+ const AVInputFormat *avif = s->iformat;
+- int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit;
++ int64_t pos_min = 0, pos_max = 0, pos, pos_limit;
+ int64_t ts_min, ts_max, ts;
+ int index;
+ int64_t ret;
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch b/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch
new file mode 100644
index 000000000000..ed273975452d
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.3-get_cabac_inline_x86-32-bit.patch
@@ -0,0 +1,24 @@
+https://bugs.gentoo.org/901099 and partly https://bugs.gentoo.org/900937.
+
+Newer compilers may optimise such that < 7 registers are free on 32-bit x86
+and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
+and https://trac.ffmpeg.org/ticket/8903.
+
+Making matters worse, GCC sometimes hangs on invalid asm, so this also
+mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
+and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
+
+In future, we may want to adjust the definition of HAVE_7REGS to just exclude
+32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
+a reply on the upstream ffmpeg bug.
+--- a/libavcodec/x86/cabac.h
++++ b/libavcodec/x86/cabac.h
+@@ -175,7 +175,7 @@
+
+ #endif /* BROKEN_RELOCATIONS */
+
+-#if HAVE_7REGS && !BROKEN_COMPILER
++#if HAVE_7REGS && !BROKEN_COMPILER && !ARCH_X86_32
+ #define get_cabac_inline get_cabac_inline_x86
+ static av_always_inline int get_cabac_inline_x86(CABACContext *c,
+ uint8_t *const state)
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.4-fix-build-svt-av1-1.5.0.patch b/media-video/ffmpeg/files/ffmpeg-4.4.4-fix-build-svt-av1-1.5.0.patch
new file mode 100644
index 000000000000..c9c180f06641
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.4-fix-build-svt-av1-1.5.0.patch
@@ -0,0 +1,44 @@
+https://bugs.gentoo.org/907478
+https://bugs.gentoo.org/907493
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=c3c8f97a9804b4234e97f13b0057ffc2c9af27c0
+
+From c3c8f97a9804b4234e97f13b0057ffc2c9af27c0 Mon Sep 17 00:00:00 2001
+From: Christopher Degawa <christopher.degawa@intel.com>
+Date: Thu, 20 Oct 2022 22:55:27 -0500
+Subject: [PATCH] avcodec/libsvtav1: remove compressed_ten_bit_format and
+ simplify alloc_buffer
+
+compressed_ten_bit_format has been deprecated upstream and has no effect
+and can be removed. Plus, technically it was never used in the first place
+since it would require the app (ffmpeg) to set it and do additional
+processing of the input frames.
+
+Also simplify alloc_buffer by removing calculations relating to the
+non-existant processing.
+
+Signed-off-by: Christopher Degawa <christopher.degawa@intel.com>
+(cherry picked from commit 031f1561cd286596cdb374da32f8aa816ce3b135)
+--- a/libavcodec/libsvtav1.c
++++ b/libavcodec/libsvtav1.c
+@@ -120,16 +120,12 @@ static int svt_print_error(void *log_ctx, EbErrorType err,
+
+ static int alloc_buffer(EbSvtAv1EncConfiguration *config, SvtContext *svt_enc)
+ {
+- const int pack_mode_10bit =
+- (config->encoder_bit_depth > 8) && (config->compressed_ten_bit_format == 0) ? 1 : 0;
+- const size_t luma_size_8bit =
+- config->source_width * config->source_height * (1 << pack_mode_10bit);
+- const size_t luma_size_10bit =
+- (config->encoder_bit_depth > 8 && pack_mode_10bit == 0) ? luma_size_8bit : 0;
++ const size_t luma_size = config->source_width * config->source_height *
++ (config->encoder_bit_depth > 8 ? 2 : 1);
+
+ EbSvtIOFormat *in_data;
+
+- svt_enc->raw_size = (luma_size_8bit + luma_size_10bit) * 3 / 2;
++ svt_enc->raw_size = luma_size * 3 / 2;
+
+ // allocate buffer for in and out
+ svt_enc->in_buf = av_mallocz(sizeof(*svt_enc->in_buf));
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.4-glslang.patch b/media-video/ffmpeg/files/ffmpeg-4.4.4-glslang.patch
new file mode 100644
index 000000000000..f19bf8e47a42
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.4-glslang.patch
@@ -0,0 +1,25 @@
+Bug: https://bugs.gentoo.org/926551
+
+diff -Naur a/configure b/configure
+--- a/configure 2024-03-09 22:07:52.005888104 +0000
++++ b/configure 2024-03-09 22:08:18.634656978 +0000
+@@ -6374,7 +6374,7 @@
+ enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
+ enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
+ enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
+-enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lMachineIndependent -lOSDependent -lHLSL -lOGLCompiler -lGenericCodeGen -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
++enabled libglslang && require_cpp libglslang glslang/SPIRV/GlslangToSpv.h "glslang::TIntermediate*" -lglslang -lSPVRemapper -lSPIRV -lSPIRV-Tools-opt -lSPIRV-Tools -lpthread -lstdc++
+ enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
+ require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
+ enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
+diff -Naur a/libavfilter/glslang.cpp b/libavfilter/glslang.cpp
+--- a/libavfilter/glslang.cpp 2023-04-12 19:01:50.000000000 +0100
++++ b/libavfilter/glslang.cpp 2024-03-09 22:08:36.210161783 +0000
+@@ -17,6 +17,7 @@
+ */
+
+ #include <pthread.h>
++#include <cassert>
+
+ extern "C" {
+ #include "libavutil/mem.h"
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.4-opencl-parallel-gmake-fix.patch b/media-video/ffmpeg/files/ffmpeg-4.4.4-opencl-parallel-gmake-fix.patch
new file mode 100644
index 000000000000..9ac8ec79cf2e
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.4-opencl-parallel-gmake-fix.patch
@@ -0,0 +1,12 @@
+Bug: https://bugs.gentoo.org/782553
+
+--- ffmpeg-4.4.4/tools/cl2c.orig 2024-03-14 04:53:45.468507151 +0300
++++ ffmpeg-4.4.4/tools/cl2c 2024-03-14 04:54:53.503086088 +0300
+@@ -24,6 +24,7 @@
+
+ name=$(basename "$input" | sed 's/.cl$//')
+
++mkdir -p "$(dirname "$output")"
+ cat >$output <<EOF
+ // Generated from $input
+ const char *ff_opencl_source_$name =
diff --git a/media-video/ffmpeg/files/ffmpeg-4.4.4-wint-conversion-vulkan.patch b/media-video/ffmpeg/files/ffmpeg-4.4.4-wint-conversion-vulkan.patch
new file mode 100644
index 000000000000..f3766bb69f50
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.4-wint-conversion-vulkan.patch
@@ -0,0 +1,30 @@
+https://bugs.gentoo.org/903752
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=cc76e8340d28438c1ac56ee7dfd774d25e944264
+
+(Dropped second bit for vulkan.h as has changed significantly in >4.4.)
+
+From cc76e8340d28438c1ac56ee7dfd774d25e944264 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
+Date: Thu, 2 Mar 2023 17:27:30 +0100
+Subject: [PATCH] lavu/vulkan: fix handle type for 32-bit targets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+Fixes compilation with clang which errors out on Wint-conversion.
+
+Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+--- a/libavutil/hwcontext_vulkan.c
++++ b/libavutil/hwcontext_vulkan.c
+@@ -1149,7 +1149,7 @@ static void free_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
+
+ av_freep(&cmd->queues);
+ av_freep(&cmd->bufs);
+- cmd->pool = NULL;
++ cmd->pool = VK_NULL_HANDLE;
+ }
+
+ static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
+
+
diff --git a/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch b/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch
new file mode 100644
index 000000000000..1c264f752099
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-5.0-backport-ranlib-build-fix.patch
@@ -0,0 +1,59 @@
+From bc5ccea3b9d2c71929af6271bd8afe9b6cfab436 Mon Sep 17 00:00:00 2001
+From: Adrian Ratiu <adrian.ratiu@collabora.com>
+Date: Mon, 14 Feb 2022 15:00:07 +0200
+Subject: [PATCH] configure: move ranlib -D test after setting defaults
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream-Status: Backport [from master bc5ccea3b9d2c7]
+
+In Gentoo and ChromeOS we want to allow pure LLVM builds without
+using GNU tools, so we block any unwanted mixed GNU/LLVM usages
+(GNU tools are still kept around in our chroots for projects
+like glibc which cannot yet be built otherwise).
+
+The default ${cross_prefix}${ranlib_default} points to GNU and
+fails, so move the test a bit later - after the defaults are
+set and the proper values get overriden - such that ffmpeg
+configure calls the llvm-ranlib we desire. [1]
+
+[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/media-video/ffmpeg/ffmpeg-4.4.1-r1.ebuild?id=7a34377e3277a6a0e2eedd40e90452a44c55f1e6#n477
+
+Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+---
+ configure | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/configure b/configure
+index 7d22c2a345..82642deabe 100755
+--- a/configure
++++ b/configure
+@@ -4403,11 +4403,7 @@ cc_default="${cross_prefix}${cc_default}"
+ cxx_default="${cross_prefix}${cxx_default}"
+ nm_default="${cross_prefix}${nm_default}"
+ pkg_config_default="${cross_prefix}${pkg_config_default}"
+-if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
+- ranlib_default="${cross_prefix}${ranlib_default} -D"
+-else
+- ranlib_default="${cross_prefix}${ranlib_default}"
+-fi
++ranlib_default="${cross_prefix}${ranlib_default}"
+ strip_default="${cross_prefix}${strip_default}"
+ windres_default="${cross_prefix}${windres_default}"
+
+@@ -4440,6 +4436,10 @@ set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
+ enabled cross_compile || host_cc_default=$cc
+ set_default host_cc
+
++if ${ranlib} 2>&1 | grep -q "\-D "; then
++ ranlib="${ranlib} -D"
++fi
++
+ pkg_config_fail_message=""
+ if ! $pkg_config --version >/dev/null 2>&1; then
+ warn "$pkg_config not found, library detection may fail."
+--
+2.35.1
+
diff --git a/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch b/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch
new file mode 100644
index 000000000000..40db3304b564
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-5.1.2-get_cabac_inline_x86-32-bit.patch
@@ -0,0 +1,25 @@
+https://bugs.gentoo.org/901099 and partly https://bugs.gentoo.org/900937.
+
+Newer compilers may optimise such that < 7 registers are free on 32-bit x86
+and then we get an "invalid asm" error. This is https://bugs.gentoo.org/901099
+and https://trac.ffmpeg.org/ticket/8903.
+
+Making matters worse, GCC sometimes hangs on invalid asm, so this also
+mitigates a hang with e.g. -O3 -march=znver1. See https://bugs.gentoo.org/900937
+and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109137.
+
+In future, we may want to adjust the definition of HAVE_7REGS to just exclude
+32-bit x86, but that's a big sledgehammer, so let's avoid it for now until we have
+a reply on the upstream ffmpeg bug.
+--- a/libavcodec/x86/cabac.h
++++ b/libavcodec/x86/cabac.h
+@@ -175,7 +175,7 @@
+
+ #endif /* BROKEN_RELOCATIONS */
+
+-#if HAVE_7REGS && !BROKEN_COMPILER
++#if HAVE_7REGS && !BROKEN_COMPILER && !ARCH_X86_32
+ #define get_cabac_inline get_cabac_inline_x86
+ static
+ #if defined(_WIN32) && !defined(_WIN64) && defined(__clang__)
+
diff --git a/media-video/ffmpeg/files/ffmpeg-5.1.3-binutils-2.41.patch b/media-video/ffmpeg/files/ffmpeg-5.1.3-binutils-2.41.patch
new file mode 100644
index 000000000000..7031d1f02ccf
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-5.1.3-binutils-2.41.patch
@@ -0,0 +1,76 @@
+https://bugs.gentoo.org/911582
+https://trac.ffmpeg.org/ticket/10405
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=25cd95a9dc3510c3cc0d7aad6f9d83f6a1078c7e
+https://sourceware.org/PR30578
+https://gcc.gnu.org/PR108941
+
+From 25cd95a9dc3510c3cc0d7aad6f9d83f6a1078c7e Mon Sep 17 00:00:00 2001
+From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
+Date: Sun, 16 Jul 2023 18:18:02 +0300
+Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift
+ instructions within inline assembly
+
+Fixes assembling with binutil as >= 2.41
+
+Signed-off-by: James Almer <jamrial@gmail.com>
+(cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb)
+--- a/libavcodec/x86/mathops.h
++++ b/libavcodec/x86/mathops.h
+@@ -35,12 +35,20 @@
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
+ {
+ int rt, dummy;
++ if (__builtin_constant_p(shift))
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
++ :"a"(a), "rm"(b), "i"(shift & 0x1F)
+ );
++ else
++ __asm__ (
++ "imull %3 \n\t"
++ "shrdl %4, %%edx, %%eax \n\t"
++ :"=a"(rt), "=d"(dummy)
++ :"a"(a), "rm"(b), "c"((uint8_t)shift)
++ );
+ return rt;
+ }
+
+@@ -113,19 +121,31 @@ __asm__ volatile(\
+ // avoid +32 for shift optimization (gcc should do that ...)
+ #define NEG_SSR32 NEG_SSR32
+ static inline int32_t NEG_SSR32( int32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("sarl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+ #define NEG_USR32 NEG_USR32
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("shrl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0-DECLARE_ALIGNED.patch b/media-video/ffmpeg/files/ffmpeg-6.0-DECLARE_ALIGNED.patch
new file mode 100644
index 000000000000..88af1e58458c
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0-DECLARE_ALIGNED.patch
@@ -0,0 +1,29 @@
+From: Zhao Zhili <zhilizhao@tencent.com>
+Date: Tue, 28 Feb 2023 18:23:00 +0000 (+0800)
+Subject: avcodec/aacps_tablegen: fix build error after avutil bump
+X-Git-Url: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff_plain;h=46970dd1555b3e50eee48ec95c893ee9a52f7fab
+
+avcodec/aacps_tablegen: fix build error after avutil bump
+
+Fix tickets #10225
+
+DECLARE_ALIGNED has been moved to mem_internal.h.
+
+Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
+Reviewed-by: Anton Khirnov <anton@khirnov.net>
+(cherry picked from commit 814178f92647be2411516bbb82f48532373d2554)
+---
+
+diff --git a/libavcodec/aacps_tablegen.h b/libavcodec/aacps_tablegen.h
+index 0ac4f68d68..5fdd7f0a9d 100644
+--- a/libavcodec/aacps_tablegen.h
++++ b/libavcodec/aacps_tablegen.h
+@@ -34,7 +34,7 @@
+ #include "libavutil/common.h"
+ #include "libavutil/libm.h"
+ #include "libavutil/mathematics.h"
+-#include "libavutil/mem.h"
++#include "libavutil/mem_internal.h"
+ #define NR_ALLPASS_BANDS20 30
+ #define NR_ALLPASS_BANDS34 50
+ #define PS_AP_LINKS 3
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0-binutils-2.41.patch b/media-video/ffmpeg/files/ffmpeg-6.0-binutils-2.41.patch
new file mode 100644
index 000000000000..a06b9119666f
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0-binutils-2.41.patch
@@ -0,0 +1,76 @@
+https://bugs.gentoo.org/911582
+https://trac.ffmpeg.org/ticket/10405
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=cc703cf60759d9798f440a9417e4efa2fcbe2747
+https://sourceware.org/PR30578
+https://gcc.gnu.org/PR108941
+
+From cc703cf60759d9798f440a9417e4efa2fcbe2747 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
+Date: Sun, 16 Jul 2023 18:18:02 +0300
+Subject: [PATCH] avcodec/x86/mathops: clip constants used with shift
+ instructions within inline assembly
+
+Fixes assembling with binutil as >= 2.41
+
+Signed-off-by: James Almer <jamrial@gmail.com>
+(cherry picked from commit effadce6c756247ea8bae32dc13bb3e6f464f0eb)
+--- a/libavcodec/x86/mathops.h
++++ b/libavcodec/x86/mathops.h
+@@ -35,12 +35,20 @@
+ static av_always_inline av_const int MULL(int a, int b, unsigned shift)
+ {
+ int rt, dummy;
++ if (__builtin_constant_p(shift))
+ __asm__ (
+ "imull %3 \n\t"
+ "shrdl %4, %%edx, %%eax \n\t"
+ :"=a"(rt), "=d"(dummy)
+- :"a"(a), "rm"(b), "ci"((uint8_t)shift)
++ :"a"(a), "rm"(b), "i"(shift & 0x1F)
+ );
++ else
++ __asm__ (
++ "imull %3 \n\t"
++ "shrdl %4, %%edx, %%eax \n\t"
++ :"=a"(rt), "=d"(dummy)
++ :"a"(a), "rm"(b), "c"((uint8_t)shift)
++ );
+ return rt;
+ }
+
+@@ -113,19 +121,31 @@ __asm__ volatile(\
+ // avoid +32 for shift optimization (gcc should do that ...)
+ #define NEG_SSR32 NEG_SSR32
+ static inline int32_t NEG_SSR32( int32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("sarl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("sarl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+ #define NEG_USR32 NEG_USR32
+ static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
++ if (__builtin_constant_p(s))
+ __asm__ ("shrl %1, %0\n\t"
+ : "+r" (a)
+- : "ic" ((uint8_t)(-s))
++ : "i" (-s & 0x1F)
+ );
++ else
++ __asm__ ("shrl %1, %0\n\t"
++ : "+r" (a)
++ : "c" ((uint8_t)(-s))
++ );
+ return a;
+ }
+
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0-fix-lto-type-mismatch.patch b/media-video/ffmpeg/files/ffmpeg-6.0-fix-lto-type-mismatch.patch
new file mode 100644
index 000000000000..9cc2dd732016
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0-fix-lto-type-mismatch.patch
@@ -0,0 +1,41 @@
+https://ffmpeg.org//pipermail/ffmpeg-devel/2023-November/317055.html
+https://bugs.gentoo.org/907484
+
+From 408882a387f75ae57524073385b47d68339ec486 Mon Sep 17 00:00:00 2001
+From: Alfred Wingate <parona@protonmail.com>
+Date: Tue, 14 Nov 2023 13:26:47 +0000
+Subject: [PATCH 1/1] swscale/x86/rgb_2_rgb: Add opaque pointer to missed
+ definitions of ff_nv12ToUV
+
+Opaque parameters were previously added to the original definition of
+ff_nv12ToUV, leading to gcc noticing a type mismatch with -Wlto-type-mismatch.
+
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/f2de911818fbd7e73343803626b697fd0c968121
+https://bugs.gentoo.org/907484
+
+Signed-off-by: Alfred Wingate <parona@protonmail.com>
+Signed-off-by: Anton Khirnov <anton@khirnov.net>
+--- a/libswscale/x86/rgb2rgb_template.c
++++ b/libswscale/x86/rgb2rgb_template.c
+@@ -1823,7 +1823,8 @@ void RENAME(ff_nv12ToUV)(uint8_t *dstU, uint8_t *dstV,
+ const uint8_t *src1,
+ const uint8_t *src2,
+ int w,
+- uint32_t *unused2);
++ uint32_t *unused2,
++ void *opq);
+ static void RENAME(deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t *dst2,
+ int width, int height, int srcStride,
+ int dst1Stride, int dst2Stride)
+@@ -1831,7 +1832,7 @@ static void RENAME(deinterleaveBytes)(const uint8_t *src, uint8_t *dst1, uint8_t
+ int h;
+
+ for (h = 0; h < height; h++) {
+- RENAME(ff_nv12ToUV)(dst1, dst2, NULL, src, NULL, width, NULL);
++ RENAME(ff_nv12ToUV)(dst1, dst2, NULL, src, NULL, width, NULL, NULL);
+ src += srcStride;
+ dst1 += dst1Stride;
+ dst2 += dst2Stride;
+--
+2.43.0
+
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0-libplacebo-remove-deprecated-field.patch b/media-video/ffmpeg/files/ffmpeg-6.0-libplacebo-remove-deprecated-field.patch
new file mode 100644
index 000000000000..ca05c1c56ea4
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0-libplacebo-remove-deprecated-field.patch
@@ -0,0 +1,103 @@
+Bug: https://bugs.gentoo.org/910406
+
+Backports the following two commits:
+ https://github.com/FFmpeg/FFmpeg/commit/11eca6018c40f5ebe6af93cbc4b4dce447d8b3bc
+ https://github.com/FFmpeg/FFmpeg/commit/1231003c3c6d4839a9e838d06f8e16ee7690958f
+
+--- a/doc/filters.texi
++++ b/doc/filters.texi
+@@ -16242,9 +16242,6 @@
+ @item disable_builtin
+ Disable built-in GPU sampling (forces LUT).
+
+-@item force_icc_lut
+-Force the use of a full ICC 3DLUT for gamut mapping.
+-
+ @item disable_fbos
+ Forcibly disable FBOs, resulting in loss of almost all functionality, but
+ offering the maximum possible speed.
+--- a/libavfilter/version_major.h
++++ b/libavfilter/version_major.h
+@@ -35,4 +35,6 @@
+ * the public API and may change, break or disappear at any time.
+ */
+
++#define FF_API_LIBPLACEBO_OPTS (LIBAVFILTER_VERSION_MAJOR < 10)
++
+ #endif /* AVFILTER_VERSION_MAJOR_H */
+--- a/libavfilter/vf_libplacebo.c
++++ b/libavfilter/vf_libplacebo.c
+@@ -97,7 +97,6 @@
+ float polar_cutoff;
+ int disable_linear;
+ int disable_builtin;
+- int force_icc_lut;
+ int force_dither;
+ int disable_fbos;
+
+@@ -132,11 +131,15 @@
+ int inverse_tonemapping;
+ float crosstalk;
+ int tonemapping_lut_size;
++
++#if FF_API_LIBPLACEBO_OPTS
+ /* for backwards compatibility */
+ float desat_str;
+ float desat_exp;
+ int gamut_warning;
+ int gamut_clipping;
++ int force_icc_lut;
++#endif
+
+ /* pl_dither_params */
+ int dithering;
+@@ -380,6 +383,7 @@
+ pl_rect2df_aspect_set(&target.crop, aspect, s->pad_crop_ratio);
+ }
+
++#if FF_API_LIBPLACEBO_OPTS
+ /* backwards compatibility with older API */
+ if (!tonemapping_mode && (s->desat_str >= 0.0f || s->desat_exp >= 0.0f)) {
+ float str = s->desat_str < 0.0f ? 0.9f : s->desat_str;
+@@ -397,6 +401,7 @@
+ gamut_mode = PL_GAMUT_WARN;
+ if (s->gamut_clipping)
+ gamut_mode = PL_GAMUT_DESATURATE;
++#endif
+
+ /* Update render params */
+ params = (struct pl_render_params) {
+@@ -458,7 +463,6 @@
+ .polar_cutoff = s->polar_cutoff,
+ .disable_linear_scaling = s->disable_linear,
+ .disable_builtin_scalers = s->disable_builtin,
+- .force_icc_lut = s->force_icc_lut,
+ .force_dither = s->force_dither,
+ .disable_fbos = s->disable_fbos,
+ };
+@@ -818,11 +822,14 @@
+ { "inverse_tonemapping", "Inverse tone mapping (range expansion)", OFFSET(inverse_tonemapping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+ { "tonemapping_crosstalk", "Crosstalk factor for tone-mapping", OFFSET(crosstalk), AV_OPT_TYPE_FLOAT, {.dbl = 0.04}, 0.0, 0.30, DYNAMIC },
+ { "tonemapping_lut_size", "Tone-mapping LUT size", OFFSET(tonemapping_lut_size), AV_OPT_TYPE_INT, {.i64 = 256}, 2, 1024, DYNAMIC },
++
++#if FF_API_LIBPLACEBO_OPTS
+ /* deprecated options for backwards compatibility, defaulting to -1 to not override the new defaults */
+ { "desaturation_strength", "Desaturation strength", OFFSET(desat_str), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 1.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
+ { "desaturation_exponent", "Desaturation exponent", OFFSET(desat_exp), AV_OPT_TYPE_FLOAT, {.dbl = -1.0}, -1.0, 10.0, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
+ { "gamut_warning", "Highlight out-of-gamut colors", OFFSET(gamut_warning), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
+ { "gamut_clipping", "Enable colorimetric gamut clipping", OFFSET(gamut_clipping), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
++#endif
+
+ { "dithering", "Dither method to use", OFFSET(dithering), AV_OPT_TYPE_INT, {.i64 = PL_DITHER_BLUE_NOISE}, -1, PL_DITHER_METHOD_COUNT - 1, DYNAMIC, "dither" },
+ { "none", "Disable dithering", 0, AV_OPT_TYPE_CONST, {.i64 = -1}, 0, 0, STATIC, "dither" },
+@@ -847,7 +854,9 @@
+ { "polar_cutoff", "Polar LUT cutoff", OFFSET(polar_cutoff), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0.0, 1.0, DYNAMIC },
+ { "disable_linear", "Disable linear scaling", OFFSET(disable_linear), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+ { "disable_builtin", "Disable built-in scalers", OFFSET(disable_builtin), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+- { "force_icc_lut", "Force the use of a full ICC 3DLUT for color mapping", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
++#if FF_API_LIBPLACEBO_OPTS
++ { "force_icc_lut", "Deprecated, does nothing", OFFSET(force_icc_lut), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC | AV_OPT_FLAG_DEPRECATED },
++#endif
+ { "force_dither", "Force dithering", OFFSET(force_dither), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+ { "disable_fbos", "Force-disable FBOs", OFFSET(disable_fbos), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, DYNAMIC },
+ { NULL },
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0-wint-conversion-vulkan.patch b/media-video/ffmpeg/files/ffmpeg-6.0-wint-conversion-vulkan.patch
new file mode 100644
index 000000000000..2c71a189329a
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0-wint-conversion-vulkan.patch
@@ -0,0 +1,43 @@
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=58f18df430d48e47a82c5e740d6e63a50c97d75f
+
+From 58f18df430d48e47a82c5e740d6e63a50c97d75f Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Kacper=20Michaj=C5=82ow?= <kasper93@gmail.com>
+Date: Thu, 2 Mar 2023 17:27:30 +0100
+Subject: [PATCH] lavu/vulkan: fix handle type for 32-bit targets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+Fixes compilation with clang which errors out on Wint-conversion.
+
+Signed-off-by: Kacper MichajÅow <kasper93@gmail.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+(cherry picked from commit cc76e8340d28438c1ac56ee7dfd774d25e944264)
+Signed-off-by: Martin Storsjö <martin@martin.st>
+--- a/libavutil/hwcontext_vulkan.c
++++ b/libavutil/hwcontext_vulkan.c
+@@ -1149,7 +1149,7 @@ static void free_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
+
+ av_freep(&cmd->queues);
+ av_freep(&cmd->bufs);
+- cmd->pool = NULL;
++ cmd->pool = VK_NULL_HANDLE;
+ }
+
+ static VkCommandBuffer get_buf_exec_ctx(AVHWFramesContext *hwfc, VulkanExecCtx *cmd)
+--- a/libavutil/vulkan.h
++++ b/libavutil/vulkan.h
+@@ -122,7 +122,11 @@ typedef struct FFVulkanPipeline {
+ VkDescriptorSetLayout *desc_layout;
+ VkDescriptorPool desc_pool;
+ VkDescriptorSet *desc_set;
++#if VK_USE_64_BIT_PTR_DEFINES == 1
+ void **desc_staging;
++#else
++ uint64_t *desc_staging;
++#endif
+ VkDescriptorSetLayoutBinding **desc_binding;
+ VkDescriptorUpdateTemplate *desc_template;
+ int *desc_set_initialized;
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0.1-alignment.patch b/media-video/ffmpeg/files/ffmpeg-6.0.1-alignment.patch
new file mode 100644
index 000000000000..256feab8aea2
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0.1-alignment.patch
@@ -0,0 +1,114 @@
+https://trac.ffmpeg.org/ticket/10549
+https://bugs.gentoo.org/915384
+https://git.videolan.org/?p=ffmpeg.git;a=patch;h=7945d30e91b96d2f4f5b612048169087d214d41e
+
+From 7945d30e91b96d2f4f5b612048169087d214d41e Mon Sep 17 00:00:00 2001
+From: Timo Rothenpieler <timo@rothenpieler.org>
+Date: Sun, 3 Dec 2023 21:01:50 +0100
+Subject: [PATCH] avutil/mem: limit alignment to maximum simd align
+
+FFmpeg has instances of DECLARE_ALIGNED(32, ...) in a lot of structs,
+which then end up heap-allocated.
+By declaring any variable in a struct, or tree of structs, to be 32 byte
+aligned, it allows the compiler to safely assume the entire struct
+itself is also 32 byte aligned.
+
+This might make the compiler emit code which straight up crashes or
+misbehaves in other ways, and at least in one instances is now
+documented to actually do (see ticket 10549 on trac).
+The issue there is that an unrelated variable in SingleChannelElement is
+declared to have an alignment of 32 bytes. So if the compiler does a copy
+in decode_cpe() with avx instructions, but ffmpeg is built with
+--disable-avx, this results in a crash, since the memory is only 16 byte
+aligned.
+
+Mind you, even if the compiler does not emit avx instructions, the code
+is still invalid and could misbehave. It just happens not to. Declaring
+any variable in a struct with a 32 byte alignment promises 32 byte
+alignment of the whole struct to the compiler.
+
+This patch limits the maximum alignment to the maximum possible simd
+alignment according to configure.
+While not perfect, it at the very least gets rid of a lot of UB, by
+matching up the maximum DECLARE_ALIGNED value with the alignment of heap
+allocations done by lavu.
+---
+ libavutil/mem.c | 2 +-
+ libavutil/mem_internal.h | 33 ++++++++++++++++++++++++++++-----
+ 2 files changed, 29 insertions(+), 6 deletions(-)
+
+diff --git a/libavutil/mem.c b/libavutil/mem.c
+index 36b8940a0c..62163b4cb3 100644
+--- a/libavutil/mem.c
++++ b/libavutil/mem.c
+@@ -62,7 +62,7 @@ void free(void *ptr);
+
+ #endif /* MALLOC_PREFIX */
+
+-#define ALIGN (HAVE_AVX512 ? 64 : (HAVE_AVX ? 32 : 16))
++#define ALIGN (HAVE_SIMD_ALIGN_64 ? 64 : (HAVE_SIMD_ALIGN_32 ? 32 : 16))
+
+ /* NOTE: if you want to override these functions with your own
+ * implementations (not recommended) you have to link libav* as
+diff --git a/libavutil/mem_internal.h b/libavutil/mem_internal.h
+index 2448c606f1..b1d89a0605 100644
+--- a/libavutil/mem_internal.h
++++ b/libavutil/mem_internal.h
+@@ -76,27 +76,50 @@
+ */
+
+ #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
+- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
++ #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
+ #elif defined(__DJGPP__)
+- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
++ #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #elif defined(__GNUC__) || defined(__clang__)
+- #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
++ #define DECLARE_ALIGNED_T(n,t,v) t __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t av_used __attribute__ ((aligned (n))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
+ #elif defined(_MSC_VER)
+- #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
++ #define DECLARE_ALIGNED_T(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v
+ #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
+ #else
+- #define DECLARE_ALIGNED(n,t,v) t v
++ #define DECLARE_ALIGNED_T(n,t,v) t v
+ #define DECLARE_ASM_ALIGNED(n,t,v) t v
+ #define DECLARE_ASM_CONST(n,t,v) static const t v
+ #endif
+
++#if HAVE_SIMD_ALIGN_64
++ #define ALIGN_64 64
++ #define ALIGN_32 32
++#elif HAVE_SIMD_ALIGN_32
++ #define ALIGN_64 32
++ #define ALIGN_32 32
++#else
++ #define ALIGN_64 16
++ #define ALIGN_32 16
++#endif
++
++#define DECLARE_ALIGNED(n,t,v) DECLARE_ALIGNED_V(n,t,v)
++
++// Macro needs to be double-wrapped in order to expand
++// possible other macros being passed for n.
++#define DECLARE_ALIGNED_V(n,t,v) DECLARE_ALIGNED_##n(t,v)
++
++#define DECLARE_ALIGNED_4(t,v) DECLARE_ALIGNED_T( 4, t, v)
++#define DECLARE_ALIGNED_8(t,v) DECLARE_ALIGNED_T( 8, t, v)
++#define DECLARE_ALIGNED_16(t,v) DECLARE_ALIGNED_T( 16, t, v)
++#define DECLARE_ALIGNED_32(t,v) DECLARE_ALIGNED_T(ALIGN_32, t, v)
++#define DECLARE_ALIGNED_64(t,v) DECLARE_ALIGNED_T(ALIGN_64, t, v)
++
+ // Some broken preprocessors need a second expansion
+ // to be forced to tokenize __VA_ARGS__
+ #define E1(x) x
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch b/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch
new file mode 100644
index 000000000000..10c216ec4c88
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.0.1-libjxl-0.9.patch
@@ -0,0 +1,112 @@
+https://bugs.gentoo.org/924431
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=75b1a555a70c178a9166629e43ec2f6250219eb2
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=ac06190a5a11f2b170e7719d769d7c0d65bff3e0
+
+From 75b1a555a70c178a9166629e43ec2f6250219eb2 Mon Sep 17 00:00:00 2001
+From: Leo Izen <leo.izen@gmail.com>
+Date: Sat, 8 Jul 2023 14:43:31 -0400
+Subject: [PATCH] avcodec/libjxldec: build against libjxl 0.9
+
+Git master libjxl changed several function signatures, so this commit
+adds some #ifdefs to handle the new signatures without breaking old
+releases. Do note that old git master development versions of libjxl
+will be broken, but no releases will be.
+
+Signed-off-by: Leo Izen <leo.izen@gmail.com>
+--- a/libavcodec/libjxldec.c
++++ b/libavcodec/libjxldec.c
+@@ -210,14 +210,22 @@ static int libjxl_get_icc(AVCodecContext *avctx)
+ JxlDecoderStatus jret;
+ /* an ICC profile is present, and we can meaningfully get it,
+ * because the pixel data is not XYB-encoded */
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+ jret = JxlDecoderGetICCProfileSize(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
++#else
++ jret = JxlDecoderGetICCProfileSize(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &icc_len);
++#endif
+ if (jret == JXL_DEC_SUCCESS && icc_len > 0) {
+ av_buffer_unref(&ctx->iccp);
+ ctx->iccp = av_buffer_alloc(icc_len);
+ if (!ctx->iccp)
+ return AVERROR(ENOMEM);
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+ jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA,
+- ctx->iccp->data, icc_len);
++ ctx->iccp->data, icc_len);
++#else
++ jret = JxlDecoderGetColorAsICCProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, ctx->iccp->data, icc_len);
++#endif
+ if (jret != JXL_DEC_SUCCESS) {
+ av_log(avctx, AV_LOG_WARNING, "Unable to obtain ICC Profile\n");
+ av_buffer_unref(&ctx->iccp);
+@@ -253,12 +261,21 @@ static int libjxl_color_encoding_event(AVCodecContext *avctx, AVFrame *frame)
+ /* set this flag if we need to fall back on wide gamut */
+ int fallback = 0;
+
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
+ jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, NULL, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
++#else
++ jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &jxl_color);
++#endif
+ if (jret == JXL_DEC_SUCCESS) {
+ /* enum values describe the colors of this image */
+ jret = JxlDecoderSetPreferredColorProfile(ctx->decoder, &jxl_color);
+ if (jret == JXL_DEC_SUCCESS)
+- jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#if JPEGXL_NUMERIC_VERSION < JPEGXL_COMPUTE_NUMERIC_VERSION(0, 9, 0)
++ jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, &ctx->jxl_pixfmt,
++ JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#else
++ jret = JxlDecoderGetColorAsEncodedProfile(ctx->decoder, JXL_COLOR_PROFILE_TARGET_DATA, &jxl_color);
++#endif
+ /* if we couldn't successfully request the pixel data space, we fall back on wide gamut */
+ /* this code path is very unlikely to happen in practice */
+ if (jret != JXL_DEC_SUCCESS)
+--
+2.30.2
+
+From ac06190a5a11f2b170e7719d769d7c0d65bff3e0 Mon Sep 17 00:00:00 2001
+From: Leo Izen <leo.izen@gmail.com>
+Date: Tue, 23 Jan 2024 17:29:14 -0500
+Subject: [PATCH] avcodec/libjxl.h: include version.h
+
+This file has been exported since our minimum required version (0.7.0),
+but it wasn't documented. Instead it was transitively included by
+<jxl/decode.h> (but not jxl/encode.h), which ffmpeg relied on.
+
+libjxl broke its API in libjxl/libjxl@66b959239355aef5255 by removing
+the transitive include of version.h, and they do not plan on adding
+it back. Instead they are choosing to leave the API backwards-
+incompatible with downstream callers written for some fairly recent
+versions of their API.
+
+As a result, we include <jxl/version.h> to continue to build against
+more recent versions of libjxl. The version macros removed are also
+present in that file, so we no longer need to redefine them.
+
+Signed-off-by: Leo Izen <leo.izen@gmail.com>
+--- a/libavcodec/libjxl.h
++++ b/libavcodec/libjxl.h
+@@ -27,19 +27,8 @@
+ #ifndef AVCODEC_LIBJXL_H
+ #define AVCODEC_LIBJXL_H
+
+-#include <jxl/decode.h>
+ #include <jxl/memory_manager.h>
+-
+-/*
+- * libjxl version 0.7.0 and earlier doesn't contain these macros at all
+- * so to detect version 0.7.0 versus 0.8.0 we need to define them ourselves
+- */
+-#ifndef JPEGXL_COMPUTE_NUMERIC_VERSION
+- #define JPEGXL_COMPUTE_NUMERIC_VERSION(major,minor,patch) ((major<<24) | (minor<<16) | (patch<<8) | 0)
+-#endif
+-#ifndef JPEGXL_NUMERIC_VERSION
+- #define JPEGXL_NUMERIC_VERSION JPEGXL_COMPUTE_NUMERIC_VERSION(0, 7, 0)
+-#endif
++#include <jxl/version.h>
+
+ /**
+ * Transform threadcount in ffmpeg to one used by libjxl.
+--
+2.30.2
diff --git a/media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch b/media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch
new file mode 100644
index 000000000000..0db7301f18d9
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch
@@ -0,0 +1,13 @@
+diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
+index 29fc8bd648..1f85fac7f4 100644
+--- a/libavutil/hwcontext_vaapi.c
++++ b/libavutil/hwcontext_vaapi.c
+@@ -1203,7 +1203,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
+
+ if (!use_prime2 || vas != VA_STATUS_SUCCESS) {
+ int k;
+- unsigned long buffer_handle;
++ uintptr_t buffer_handle;
+ VASurfaceAttribExternalBuffers buffer_desc;
+ VASurfaceAttrib buffer_attrs[2] = {
+ {
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 000000000000..271a18999fb3
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1-opencl-parallel-gmake-fix.patch
@@ -0,0 +1,12 @@
+Bug: https://bugs.gentoo.org/782553
+
+--- ffmpeg-6.1.1/tools/source2c.orig 2024-03-14 04:53:45.468507151 +0300
++++ ffmpeg-6.1.1/tools/source2c 2024-03-14 04:54:53.503086088 +0300
+@@ -24,6 +24,7 @@
+
+ name=$(basename "$input" | sed 's/.cl$//')
+
++mkdir -p "$(dirname "$output")"
+ cat >$output <<EOF
+ // Generated from $input
+ const char *ff_opencl_source_$name =
diff --git a/media-video/ffmpeg/files/ffmpeg-6.1-wint-conversion.patch b/media-video/ffmpeg/files/ffmpeg-6.1-wint-conversion.patch
new file mode 100644
index 000000000000..c95566117903
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1-wint-conversion.patch
@@ -0,0 +1,88 @@
+Sent upstream to the mailing list but stuck in moderation queue / not yet on archive.
+
+From 50f34826bcff90f393dfbc6c4e0c908556831d4d Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Wed, 13 Dec 2023 04:25:54 +0000
+Subject: [PATCH] libavcodec: fix -Wint-conversion in vulkan
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+FIx warnings (soon to be errors in GCC 14, already so in Clang 15):
+```
+src/libavcodec/vulkan_av1.c: In function ‘vk_av1_create_params’:
+src/libavcodec/vulkan_av1.c:183:43: error: initialization of ‘long long unsigned int’ from ‘void *’ makes integer from pointer without a cast [-Wint-conversion]
+ 183 | .videoSessionParametersTemplate = NULL,
+ | ^~~~
+src/libavcodec/vulkan_av1.c:183:43: note: (near initialization for ‘(anonymous).videoSessionParametersTemplate’)
+```
+
+Use Vulkan's VK_NULL_HANDLE instead of bare NULL.
+
+Fix Trac ticket #10724.
+
+Was reported downstream in Gentoo at https://bugs.gentoo.org/919067.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/libavcodec/vulkan_av1.c
++++ b/libavcodec/vulkan_av1.c
+@@ -180,7 +180,7 @@ static int vk_av1_create_params(AVCodecContext *avctx, AVBufferRef **buf)
+ .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
+ .pNext = &av1_params,
+ .videoSession = ctx->common.session,
+- .videoSessionParametersTemplate = NULL,
++ .videoSessionParametersTemplate = VK_NULL_HANDLE,
+ };
+
+ err = ff_vk_decode_create_params(buf, avctx, ctx, &session_params_create);
+--- a/libavcodec/vulkan_decode.c
++++ b/libavcodec/vulkan_decode.c
+@@ -188,9 +188,9 @@ int ff_vk_decode_prepare_frame(FFVulkanDecodeContext *dec, AVFrame *pic,
+ return 0;
+
+ vkpic->dpb_frame = NULL;
+- vkpic->img_view_ref = NULL;
+- vkpic->img_view_out = NULL;
+- vkpic->img_view_dest = NULL;
++ vkpic->img_view_ref = VK_NULL_HANDLE;
++ vkpic->img_view_out = VK_NULL_HANDLE;
++ vkpic->img_view_dest = VK_NULL_HANDLE;
+
+ vkpic->destroy_image_view = vk->DestroyImageView;
+ vkpic->wait_semaphores = vk->WaitSemaphores;
+--- a/libavcodec/vulkan_h264.c
++++ b/libavcodec/vulkan_h264.c
+@@ -315,7 +315,7 @@ static int vk_h264_create_params(AVCodecContext *avctx, AVBufferRef **buf)
+ .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
+ .pNext = &h264_params,
+ .videoSession = ctx->common.session,
+- .videoSessionParametersTemplate = NULL,
++ .videoSessionParametersTemplate = VK_NULL_HANDLE,
+ };
+
+ /* SPS list */
+--- a/libavcodec/vulkan_hevc.c
++++ b/libavcodec/vulkan_hevc.c
+@@ -653,7 +653,7 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf)
+ .sType = VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR,
+ .pNext = &h265_params,
+ .videoSession = ctx->common.session,
+- .videoSessionParametersTemplate = NULL,
++ .videoSessionParametersTemplate = VK_NULL_HANDLE,
+ };
+
+ HEVCHeaderSet *hdr;
+--- a/libavcodec/vulkan_video.c
++++ b/libavcodec/vulkan_video.c
+@@ -287,7 +287,7 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s,
+ if (common->session) {
+ vk->DestroyVideoSessionKHR(s->hwctx->act_dev, common->session,
+ s->hwctx->alloc);
+- common->session = NULL;
++ common->session = VK_NULL_HANDLE;
+ }
+
+ if (common->nb_mem && common->mem)
+--
+2.43.0
+
diff --git a/media-video/ffmpeg/files/ffmpeg-6.1.1-vulkan-rename.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-vulkan-rename.patch
new file mode 100644
index 000000000000..b564e3874485
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-vulkan-rename.patch
@@ -0,0 +1,127 @@
+https://bugs.gentoo.org/928593
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/fef22c87ada4517441701e6e61e062c9f4399c8e
+
+From fef22c87ada4517441701e6e61e062c9f4399c8e Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Jan=20Ekstr=C3=B6m?= <jeebjp@gmail.com>
+Date: Wed, 14 Feb 2024 22:40:54 +0200
+Subject: [PATCH] {avcodec,tests}: rename the bundled Mesa AV1 vulkan video
+ headers
+
+This together with adjusting the inclusion define allows for the
+build to not fail with latest Vulkan-Headers that contain the
+stabilized Vulkan AV1 decoding definitions.
+
+Compilation fails currently as the AV1 header is getting included
+via hwcontext_vulkan.h -> <vulkan/vulkan.h> -> vulkan_core.h, which
+finally includes vk_video/vulkan_video_codec_av1std.h and the decode
+header, leading to the bundled header to never defining anything
+due to the inclusion define being the same.
+
+This fix is imperfect, as it leads to additional re-definition
+warnings for things such as
+VK_STD_VULKAN_VIDEO_CODEC_AV1_DECODE_SPEC_VERSION. , but it is
+not clear how to otherwise have the bundled version trump the
+actually standardized one for a short-term compilation fix.
+
+(cherry picked from commit e06ce6d2b45edac4a2df04f304e18d4727417d24)
+---
+ libavcodec/Makefile | 4 ++--
+ libavcodec/vulkan_video.h | 4 ++--
+ ...v1std_decode.h => vulkan_video_codec_av1std_decode_mesa.h} | 4 ++--
+ ..._video_codec_av1std.h => vulkan_video_codec_av1std_mesa.h} | 4 ++--
+ tests/ref/fate/source | 4 ++--
+ 5 files changed, 10 insertions(+), 10 deletions(-)
+ rename libavcodec/{vulkan_video_codec_av1std_decode.h => vulkan_video_codec_av1std_decode_mesa.h} (89%)
+ rename libavcodec/{vulkan_video_codec_av1std.h => vulkan_video_codec_av1std_mesa.h} (99%)
+
+diff --git a/libavcodec/Makefile b/libavcodec/Makefile
+index ec57e53e30..eb25707ef5 100644
+--- a/libavcodec/Makefile
++++ b/libavcodec/Makefile
+@@ -1284,7 +1284,7 @@ SKIPHEADERS += %_tablegen.h \
+ aacenc_quantization.h \
+ aacenc_quantization_misc.h \
+ bitstream_template.h \
+- vulkan_video_codec_av1std.h \
++ vulkan_video_codec_av1std_mesa.h \
+ $(ARCH)/vpx_arith.h \
+
+ SKIPHEADERS-$(CONFIG_AMF) += amfenc.h
+@@ -1306,7 +1306,7 @@ SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
+ SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_decode.h vaapi_hevc.h vaapi_encode.h
+ SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h vdpau_internal.h
+ SKIPHEADERS-$(CONFIG_VIDEOTOOLBOX) += videotoolbox.h vt_internal.h
+-SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode.h
++SKIPHEADERS-$(CONFIG_VULKAN) += vulkan.h vulkan_video.h vulkan_decode.h vulkan_video_codec_av1std_decode_mesa.h
+ SKIPHEADERS-$(CONFIG_V4L2_M2M) += v4l2_buffers.h v4l2_context.h v4l2_m2m.h
+ SKIPHEADERS-$(CONFIG_ZLIB) += zlib_wrapper.h
+
+diff --git a/libavcodec/vulkan_video.h b/libavcodec/vulkan_video.h
+index b28e3fe0bd..51f44dd543 100644
+--- a/libavcodec/vulkan_video.h
++++ b/libavcodec/vulkan_video.h
+@@ -23,8 +23,8 @@
+ #include "vulkan.h"
+
+ #include <vk_video/vulkan_video_codecs_common.h>
+-#include "vulkan_video_codec_av1std.h"
+-#include "vulkan_video_codec_av1std_decode.h"
++#include "vulkan_video_codec_av1std_mesa.h"
++#include "vulkan_video_codec_av1std_decode_mesa.h"
+
+ #define CODEC_VER_MAJ(ver) (ver >> 22)
+ #define CODEC_VER_MIN(ver) ((ver >> 12) & ((1 << 10) - 1))
+diff --git a/libavcodec/vulkan_video_codec_av1std_decode.h b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+similarity index 89%
+rename from libavcodec/vulkan_video_codec_av1std_decode.h
+rename to libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+index a697c00593..e2f37b4e6e 100644
+--- a/libavcodec/vulkan_video_codec_av1std_decode.h
++++ b/libavcodec/vulkan_video_codec_av1std_decode_mesa.h
+@@ -14,8 +14,8 @@
+ * limitations under the License.
+ */
+
+-#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_
+-#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_H_ 1
++#ifndef VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_
++#define VULKAN_VIDEO_CODEC_AV1STD_DECODE_MESA_H_ 1
+
+ /*
+ ** This header is NOT YET generated from the Khronos Vulkan XML API Registry.
+diff --git a/libavcodec/vulkan_video_codec_av1std.h b/libavcodec/vulkan_video_codec_av1std_mesa.h
+similarity index 99%
+rename from libavcodec/vulkan_video_codec_av1std.h
+rename to libavcodec/vulkan_video_codec_av1std_mesa.h
+index c46236c457..c91589eee2 100644
+--- a/libavcodec/vulkan_video_codec_av1std.h
++++ b/libavcodec/vulkan_video_codec_av1std_mesa.h
+@@ -14,8 +14,8 @@
+ * limitations under the License.
+ */
+
+-#ifndef VULKAN_VIDEO_CODEC_AV1STD_H_
+-#define VULKAN_VIDEO_CODEC_AV1STD_H_ 1
++#ifndef VULKAN_VIDEO_CODEC_AV1STD_MESA_H_
++#define VULKAN_VIDEO_CODEC_AV1STD_MESA_H_ 1
+
+ /*
+ ** This header is NOT YET generated from the Khronos Vulkan XML API Registry.
+diff --git a/tests/ref/fate/source b/tests/ref/fate/source
+index c575789dd5..8bb58b61f1 100644
+--- a/tests/ref/fate/source
++++ b/tests/ref/fate/source
+@@ -23,8 +23,8 @@ compat/djgpp/math.h
+ compat/float/float.h
+ compat/float/limits.h
+ libavcodec/bitstream_template.h
+-libavcodec/vulkan_video_codec_av1std.h
+-libavcodec/vulkan_video_codec_av1std_decode.h
++libavcodec/vulkan_video_codec_av1std_decode_mesa.h
++libavcodec/vulkan_video_codec_av1std_mesa.h
+ tools/decode_simple.h
+ Use of av_clip() where av_clip_uintp2() could be used:
+ Use of av_clip() where av_clip_intp2() could be used:
+--
+2.25.1
+
diff --git a/media-video/ffmpeg/files/vmaf-models-default-path.patch b/media-video/ffmpeg/files/vmaf-models-default-path.patch
new file mode 100644
index 000000000000..a9777e94b7aa
--- /dev/null
+++ b/media-video/ffmpeg/files/vmaf-models-default-path.patch
@@ -0,0 +1,13 @@
+Put default path of models to /usr/share/vmaf/model
+
+--- a/libavfilter/vf_libvmaf.c
++++ b/libavfilter/vf_libvmaf.c
+@@ -72,7 +72,7 @@ typedef struct LIBVMAFContext {
+ #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+ static const AVOption libvmaf_options[] = {
+- {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/local/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS},
++ {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/share/vmaf/model/vmaf_v0.6.1.json"}, 0, 1, FLAGS},
+ {"log_path", "Set the file path to be used to store logs.", OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
+ {"log_fmt", "Set the format of the log (xml or json).", OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS},
+ {"enable_transform", "Enables transform for computing vmaf.", OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS},
diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml
index 338a8f562975..31380f3cda3d 100644
--- a/media-video/ffmpeg/metadata.xml
+++ b/media-video/ffmpeg/metadata.xml
@@ -1,68 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
-<maintainer type="project">
- <email>media-video@gentoo.org</email>
-</maintainer>
-<use>
- <flag name="amr">Enables Adaptive Multi-Rate Audio support</flag>
- <flag name="amrenc">Enables Adaptive Multi-Rate Audio encoding support with <pkg>media-libs/vo-amrwbenc</pkg>.</flag>
- <flag name="appkit">Enables Apple AppKit framework</flag>
- <flag name="bluray">Enable playback of Blu-ray filesystems</flag>
- <flag name="bs2b">Enables <pkg>media-libs/libbs2b</pkg> based Bauer stereo-to-binaural filter.</flag>
- <flag name="cdio">Enables audio CD grabbing with <pkg>dev-libs/libcdio</pkg>.</flag>
- <flag name="chromaprint">Enables audio fingerprinting support with <pkg>media-libs/chromaprint</pkg>.</flag>
- <flag name="chromium">Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi.</flag>
- <flag name="codec2">Enables codec2 low bit rate speech codec support via <pkg>media-libs/codec2</pkg>.</flag>
- <flag name="cpudetection">Enables runtime CPU detection (useful for bindist, compatibility on other CPUs)</flag>
- <flag name="cuda">Enables CUDA-based acceleration. Mostly used for specific filters.</flag>
- <flag name="dav1d">Enables AV1 decoding via <pkg>media-libs/dav1d</pkg>.</flag>
- <flag name="fdk">Use external fdk-aac library for AAC encoding</flag>
- <flag name="flite">Adds a text-to-speech filter based on <pkg>app-accessibility/flite</pkg>.</flag>
- <flag name="frei0r">Enable frei0r wrapping in libavfilter</flag>
- <flag name="fribidi">Enables fribidi support in the drawtext filter.</flag>
- <flag name="gcrypt">Enables gcrypt support: Needed for rtmp(t)e support if openssl, librtmp or gmp is not used.</flag>
- <flag name="gme">Enables support for <pkg>media-libs/game-music-emu</pkg> for playing various video game music formats.</flag>
- <flag name="gpl">Build GPL code. Should be enabled unless you require LGPL binaries.</flag>
- <flag name="hardcoded-tables">Use pre-calculated tables rather than calculating them on the fly.</flag>
- <flag name="iec61883"> Support for FireWire DV/HDV input device using <pkg>media-libs/libiec61883</pkg>.</flag>
- <flag name="kvazaar">Enables <pkg>media-libs/kvazaar</pkg> based HEVC encoder.</flag>
- <flag name="libaom">Enables <pkg>media-libs/libaom</pkg> based AV1 codec support.</flag>
- <flag name="libaribb24">Enables ARIB text and caption decoding via <pkg>media-libs/aribb24</pkg>.</flag>
- <flag name="libdrm">Enables <pkg>x11-libs/libdrm</pkg> support for better screen grabbing and hardware accelerated codecs.</flag>
- <flag name="libilbc">Enables iLBC de/encoding via <pkg>media-libs/libilbc</pkg>.</flag>
- <flag name="librtmp">Enables Real Time Messaging Protocol using librtmp (<pkg>media-video/rtmpdump</pkg>) in addition to FFmpeg's native implementation.</flag>
- <flag name="libsoxr">Enables audio resampling through <pkg>media-libs/soxr</pkg>.</flag>
- <flag name="libtesseract">Enables the OCR filter via <pkg>app-text/tesseract</pkg>.</flag>
- <flag name="libv4l">Uses <pkg>media-libs/libv4l</pkg> for video4linux instead of direct calls. Adds support for more devices via the userspace library.</flag>
- <flag name="libxml2">Uses <pkg>dev-libs/libxml2</pkg> to enable dash demuxing support.</flag>
- <flag name="lv2">Enables lv2 audio filter wrapper.</flag>
- <flag name="mipsdspr1">Enables MIPS DSP ASE R1 optimizations.</flag>
- <flag name="mipsdspr2">Enables MIPS DSP ASE R2 optimizations.</flag>
- <flag name="mipsfpu">Enables floating point MIPS optimizations.</flag>
- <flag name="mmal">Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi.</flag>
- <flag name="network">Enables network streaming support</flag>
- <flag name="nvenc">Adds support for NVIDIA Encoder (NVENC) API for hardware accelerated encoding on NVIDIA cards.</flag>
- <flag name="opencl">Enable OpenCL support</flag>
- <flag name="openh264">Enables H.264 encoding suppoprt via <pkg>media-libs/openh264</pkg>.</flag>
- <flag name="openssl">Enables <pkg>dev-libs/openssl</pkg> support. Adds support for encrypted network protocols (TLS/HTTPS).</flag>
- <flag name="pic">Force shared libraries to be built as PIC (this is slower)</flag>
- <flag name="postproc">Build and install libpostproc.</flag>
- <flag name="rubberband">Adds time-stretching and pitch-shifting audio filter based on <pkg>media-libs/rubberband</pkg>.</flag>
- <flag name="snappy">Enable <pkg>app-arch/snappy</pkg> support. Required for e.g. Vidvox Hap encoder.</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="twolame">Enables MP2 encoding via <pkg>media-sound/twolame</pkg> as an alternative to the internal encoder.</flag>
- <flag name="vidstab">Enables video stabilization filter using vid.stab library (<pkg>media-libs/vidstab</pkg>).</flag>
- <flag name="vpx">Enables vp8 codec support using libvpx: Decoding vp8 does not require this to be enabled but libvpx can also be used for decoding; encoding vp8 requires this useflag to be enabled though.</flag>
- <flag name="x265">Enables HEVC encoding with <pkg>media-libs/x265</pkg>.</flag>
- <flag name="zeromq">Enables <pkg>net-libs/zeromq</pkg> support with the zmq/azmq filters.</flag>
- <flag name="zimg">Enables <pkg>media-libs/zimg</pkg> based scale filter.</flag>
- <flag name="zvbi">Enables <pkg>media-libs/zvbi</pkg> based teletext decoder.</flag>
-</use>
-<slots>
- <slot name="0">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.</slot>
-</slots>
+ <maintainer type="project">
+ <email>media-video@gentoo.org</email>
+ </maintainer>
+ <maintainer type="person">
+ <email>chewi@gentoo.org</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>
+ <flag name="amrenc">Enables Adaptive Multi-Rate Audio encoding support with <pkg>media-libs/vo-amrwbenc</pkg>.</flag>
+ <flag name="appkit">Enables Apple AppKit framework</flag>
+ <flag name="bluray">Enable playback of Blu-ray filesystems</flag>
+ <flag name="bs2b">Enables <pkg>media-libs/libbs2b</pkg> based Bauer stereo-to-binaural filter.</flag>
+ <flag name="cdio">Enables audio CD grabbing with <pkg>dev-libs/libcdio</pkg>.</flag>
+ <flag name="chromaprint">Enables audio fingerprinting support with <pkg>media-libs/chromaprint</pkg>.</flag>
+ <flag name="chromium">Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi.</flag>
+ <flag name="codec2">Enables codec2 low bit rate speech codec support via <pkg>media-libs/codec2</pkg>.</flag>
+ <flag name="cpudetection">Enables runtime CPU detection (useful for bindist, compatibility on other CPUs)</flag>
+ <flag name="cuda">Enables CUDA-based acceleration. Mostly used for specific filters.</flag>
+ <flag name="dav1d">Enables AV1 decoding via <pkg>media-libs/dav1d</pkg>.</flag>
+ <flag name="fdk">Use external fdk-aac library for AAC encoding</flag>
+ <flag name="flite">Adds a text-to-speech filter based on <pkg>app-accessibility/flite</pkg>.</flag>
+ <flag name="frei0r">Enable frei0r wrapping in libavfilter</flag>
+ <flag name="fribidi">Enables fribidi support in the drawtext filter.</flag>
+ <flag name="gcrypt">Enables gcrypt support: Needed for rtmp(t)e support if openssl, librtmp or gmp is not used.</flag>
+ <flag name="gme">Enables support for <pkg>media-libs/game-music-emu</pkg> for playing various video game music formats.</flag>
+ <flag name="glslang">Use <pkg>dev-util/glslang</pkg> to compile GLSL</flag>
+ <flag name="gpl">Build GPL code. Should be enabled unless you require LGPL binaries.</flag>
+ <flag name="hardcoded-tables">
+ 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.
+ </flag>
+ <flag name="iec61883"> Support for FireWire DV/HDV input device using <pkg>media-libs/libiec61883</pkg>.</flag>
+ <flag name="kvazaar">Enables <pkg>media-libs/kvazaar</pkg> based HEVC encoder.</flag>
+ <flag name="lcms">Enable ICC profile support via <pkg>media-libs/lcms</pkg>.</flag>
+ <flag name="libaom">Enables <pkg>media-libs/libaom</pkg> based AV1 codec support.</flag>
+ <flag name="libaribb24">Enables ARIB text and caption decoding via <pkg>media-libs/aribb24</pkg>.</flag>
+ <flag name="libdrm">Enables <pkg>x11-libs/libdrm</pkg> support for better screen grabbing and hardware accelerated codecs.</flag>
+ <flag name="libilbc">Enables iLBC de/encoding via <pkg>media-libs/libilbc</pkg>.</flag>
+ <flag name="libplacebo">Adds flexible GPU-accelerated processing filter based on <pkg>media-libs/libplacebo</pkg>.</flag>
+ <flag name="librtmp">Enables Real Time Messaging Protocol using librtmp (<pkg>media-video/rtmpdump</pkg>) in addition to FFmpeg's native implementation.</flag>
+ <flag name="libsoxr">Enables audio resampling through <pkg>media-libs/soxr</pkg>.</flag>
+ <flag name="libtesseract">Enables the OCR filter via <pkg>app-text/tesseract</pkg>.</flag>
+ <flag name="libv4l">Uses <pkg>media-libs/libv4l</pkg> for video4linux instead of direct calls. Adds support for more devices via the userspace library.</flag>
+ <flag name="libxml2">Uses <pkg>dev-libs/libxml2</pkg> to enable dash demuxing support.</flag>
+ <flag name="lv2">Enables lv2 audio filter wrapper.</flag>
+ <flag name="mipsdspr1">Enables MIPS DSP ASE R1 optimizations.</flag>
+ <flag name="mipsdspr2">Enables MIPS DSP ASE R2 optimizations.</flag>
+ <flag name="mipsfpu">Enables floating point MIPS optimizations.</flag>
+ <flag name="qsv">Enable Intel Quick Sync Video via <pkg>media-libs/intel-mediasdk</pkg> (ffmpeg versions older than, and including, 5.1) or <pkg>media-libs/libvpl</pkg> (ffmpeg version newer than 5.1).</flag>
+ <flag name="mmal">Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi.</flag>
+ <flag name="network">Enables network streaming support</flag>
+ <flag name="openh264">Enables H.264 encoding suppoprt via <pkg>media-libs/openh264</pkg>.</flag>
+ <flag name="openssl">Enables <pkg>dev-libs/openssl</pkg> support. Adds support for encrypted network protocols (TLS/HTTPS).</flag>
+ <flag name="pic">Force shared libraries to be built as PIC (this is slower)</flag>
+ <flag name="postproc">Build and install libpostproc.</flag>
+ <flag name="rav1e">Enables AV1 encoding support via <pkg>media-video/rav1e</pkg>.</flag>
+ <flag name="rubberband">Adds time-stretching and pitch-shifting audio filter based on <pkg>media-libs/rubberband</pkg>.</flag>
+ <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>
+ <flag name="truetype">Enables drawtext filter via <pkg>media-libs/freetype</pkg> and <pkg>media-libs/harfbuzz</pkg>.</flag>
+ <flag name="twolame">Enables MP2 encoding via <pkg>media-sound/twolame</pkg> as an alternative to the internal encoder.</flag>
+ <flag name="vidstab">Enables video stabilization filter using vid.stab library (<pkg>media-libs/vidstab</pkg>).</flag>
+ <flag name="vmaf">Enables Netflix's perceptual video quality assessment filter using the library (<pkg>media-libs/libvmaf</pkg>).</flag>
+ <flag name="vpx">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.</flag>
+ <flag name="x265">Enables HEVC encoding with <pkg>media-libs/x265</pkg>.</flag>
+ <flag name="zeromq">Enables <pkg>net-libs/zeromq</pkg> support with the zmq/azmq filters.</flag>
+ <flag name="zimg">Enables <pkg>media-libs/zimg</pkg> based scale filter.</flag>
+ <flag name="zvbi">Enables <pkg>media-libs/zvbi</pkg> based teletext decoder.</flag>
+ </use>
+ <slots>
+ <slot name="0">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.</slot>
+ </slots>
+ <upstream>
+ <remote-id type="github">FFmpeg/FFmpeg</remote-id>
+ <remote-id type="cpe">cpe:/a:ffmpeg:ffmpeg</remote-id>
+ </upstream>
</pkgmetadata>