summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-video/ffmpeg')
-rw-r--r--media-video/ffmpeg/Manifest25
-rw-r--r--media-video/ffmpeg/ffmpeg-4.4.4-r10.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.3.1-r1.ebuild)168
-rw-r--r--media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.3.2-r1.ebuild)157
-rw-r--r--media-video/ffmpeg/ffmpeg-4.4.5.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.4-r1.ebuild)152
-rw-r--r--media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild (renamed from media-video/ffmpeg/ffmpeg-4.2.4-r1.ebuild)184
-rw-r--r--media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild607
-rw-r--r--media-video/ffmpeg/ffmpeg-6.1.1-r8.ebuild614
-rw-r--r--media-video/ffmpeg/ffmpeg-6.1.2.ebuild612
-rw-r--r--media-video/ffmpeg/ffmpeg-7.0.1.ebuild614
-rw-r--r--media-video/ffmpeg/ffmpeg-7.0.2.ebuild614
-rw-r--r--media-video/ffmpeg/ffmpeg-9999.ebuild273
-rw-r--r--media-video/ffmpeg/files/amf-env-vulkan-override1
-rw-r--r--media-video/ffmpeg/files/chromium-r2.patch41
-rw-r--r--media-video/ffmpeg/files/chromium.c8
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.3-altivec-novsx-yuv2rgb.patch23
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.3-fix-build-without-SSSE3.patch22
-rw-r--r--media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch52
-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-amd-av1-vaapi.patch257
-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-4.4.5-incmptbl-pntr-types.patch15
-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-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.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-amd-av1-vaapi.patch254
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1.1-memory-leak.patch129
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1.1-vulkan-rename.patch127
-rw-r--r--media-video/ffmpeg/files/ffmpeg-6.1.1-wint-inconversion-libgcrypt.patch68
-rw-r--r--media-video/ffmpeg/files/vmaf-models-default-path.patch13
-rw-r--r--media-video/ffmpeg/metadata.xml163
41 files changed, 5533 insertions, 484 deletions
diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest
index d1777180b58e..2c622807c410 100644
--- a/media-video/ffmpeg/Manifest
+++ b/media-video/ffmpeg/Manifest
@@ -1,6 +1,19 @@
-DIST ffmpeg-4.2.2-ppc64-altivec.patch.gz 7171 BLAKE2B 6676dadb22d2ab4b0f5c19b418448c5b9b54fd8c803c3f0ab517c6fa7990be08098dd6f6a2b1b3e77a1bed31a069c702366aba79ef9141ff9e23cd8c1b6e2885 SHA512 6653975017de3f7bde420860419fbdddb50ae41dbb811b819f4b5b13807bf885a4c01736f05a684515f97b0d63bd8896d5951a3276af90cc74abfe32dc2e2407
-DIST ffmpeg-4.2.2-ppc64-gcc.patch.gz 750 BLAKE2B 3a9cc7f0135e077c77179a7ca3da917bca3995d99d53b58221b23181a075f330132f83ea90a6110e89f90c7c3b5b2a7837559c5df414d9bd52dbb3ec166b1545 SHA512 701b0635e0819484a31de2062ba52d95ee03883ab56547cd75c3646a9b32bf3ecc7f719690b93f29202cfed0fdeecd26b51b9f3c66e72a999a3e8d9e97389275
-DIST ffmpeg-4.2.4.tar.bz2 10959430 BLAKE2B 932bc0046edab5587063bbc04d6ef0149876bd1001ad185384fcabb3d0ae196c9ba591e680823b3c7b6e0ef9a0a9e9575a8b08439fdd89ef0e4dabb9d4a7f4e6 SHA512 5c74e3fe77ddf8ffede0e4692d574858dd0626e542380a819ab79c0f669c6c1329ffbccb872502f60306e561f10aa8bc1e61d09b2bea829870fe4a48b76460c6
-DIST ffmpeg-4.3.1.tar.bz2 11301038 BLAKE2B 3b0eb332459921435b60e72f5c572034abf65d4ab79ef4cfae94fe594048eaa37eec47724d119863102a7211c2178f5a2382a6d4016b792818079b8241bde084 SHA512 831a187d8b8f2715a9f11c93c8d3ec126ff579d470797da452d3395178877de113af7ae90ed27fca0b223791ad257972570481e6dbb8361d2b7f3b010924bee8
-DIST ffmpeg-4.3.2.tar.bz2 11307134 BLAKE2B 97e1e598e4abe397b06298d545c3073ea2303e11c01e98343fe09d99174e02ca94f52c4df0d389fbefe7814686221446d30f107092f00cb0b69275c8747d6f32 SHA512 ec5566f8684f0ceb18184d59786ea1fc166ab28c46260ebcca5b919ad53137ba7317fd0c537e97df28553572a0d5e42c558773c808cf76995d67985aec2d6d4d
-DIST ffmpeg-4.4.tar.bz2 11489948 BLAKE2B a8dc007e260896228789d27339402e846cd21758e02c7a8d66a745ced2d1bbef4aa9c18c9b7cefef004b5ffa3fc859e2a2474c957bdf9ff27e82cec72ed4a5bf SHA512 212c330f477e9452b9d7873d6d3c452a5c946b6b9c17b01d94c60fda66e61e53b78388ef7686b8d9415a27cd3e05d5f0d6639a02a22467dbf1ed483b5594c80f
+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-4.4.5.tar.xz 9575596 BLAKE2B 546df09f7731d22e532a18d9ba9be184283f62b7a2e9470e745e536802bc2263a00f11ed6ab0aee8fc60c5f728826311cbf3542084ba3a64b65a61d76295cd64 SHA512 70df4e63ef507a7ec76da34438142499139769728fd5130d9cf48d56c110ec82c3d6a7e6d1622da03c70167fa861d901d016bbe52c21d2b284b8a0d9f30811dc
+DIST ffmpeg-4.4.5.tar.xz.asc 520 BLAKE2B 505987208ed58b548f910299adb1324e6eba655cc37e6f03cac32c8623e16a4a884e822c745fb72b1934129a8c0a2706bb8bfb785715e6a68e43f737cb8ed365 SHA512 bcfee8986681dfbefd3add741fcbbc5e223bb06c9800797e68fde968c114055ac3fc02ce8731ed269bf30c92d6c990c7f636f82d42379920012e8a0ace8d527e
+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.1.1.tar.xz 10458600 BLAKE2B 77827ff92b47c773ed82e7b7793dbb135c370fe23501169cb1eab08ff5ede77cfd5b397e8fb1d38756812cc82277898fd5c74b7d8495842556570c0c5570daeb SHA512 fca3f8635f29182e3ae0fe843a8a53614e4b47e22c11508df3ff7cdbafbb4b5ee0d82d9b3332871f7c1032033b1cad2f67557d7c5f7f7d85e2adadca122965d5
+DIST ffmpeg-6.1.1.tar.xz.asc 520 BLAKE2B 801cd976d10363d1f9fc302351b330cb57e609a266407627ef378172f28974f4a18435b8a77b9cc7a8ff7b75701185211739f685629bbda961c3588c15af1221 SHA512 0e10c1f560bab0812d759d286656593dea5940f02bb52d88d9ba7f10b12b9cc3d7aa2a41c5f7a45b319069e04dce22dc1286b3c1ba685b35cd6d04cd81c5a0f5
+DIST ffmpeg-6.1.2.tar.xz 10466152 BLAKE2B ff1f2b2bb60ccc4c37b6ffda2a0e6a0be80c451dc99f6d4a99bd95a1bdc44c494d62377c53383ccfb5b818573a1971948d7db34119099dbc56d7258724831d3c SHA512 3a009184d971fc3168e1322d1d724aae787ed0e9c152d8d1813ea0b9099bda3b35c41fcabbd7b140560e7a8fa9fa1ffd7f0938432d5d498c43829fc6cc3d9e08
+DIST ffmpeg-6.1.2.tar.xz.asc 520 BLAKE2B f26a2d6f5423f93090f2a448172e49f3858aeb5a00f326207d374bbb70fa8942c7ee1a7c55338b2db664b647c983cd5ab4fd8d71efe5c37af4c90385ca17d0ab SHA512 a26dba1f4870b964080b45f8468f5ce3591eb6aa69be426bf4afbe5a60c3cbd0fe5056dc86ca7bb817c04ae30d39160cb7773772a9a2123ae7f095b18a6d7050
+DIST ffmpeg-7.0.1.tar.xz 10793572 BLAKE2B 7468bb0768da56794c57b43db5fb8a1c5471f86dc7789ba342e494907b2f05fd0edbaa93159b05927a749d878c431ad8ac56cafc2434b54c5190b91ca6a6116a SHA512 94e06c4ce64ed3888620547db0e33b29c68a9e78b3ea748346f34280f69723a6d4b7485911f45f1849f9aa3036c0699334abbcf7126d2763bdaa7276673b7daa
+DIST ffmpeg-7.0.1.tar.xz.asc 520 BLAKE2B 3fe3bdd8da390591849ac3784bf8e68e021124715de1a8d142a42096d625df9d9a27b224258f2f0c24b20397bfea7a8035ced4202904ca12fe0eef109516dbf1 SHA512 bd787bfa6dbb147800f5f79a3fe5e4c20054d48ea9e6af4d5c84ace68c19459f4ea677f5921b084eab889ed7b9f81dc138fa2ecf9ae306ac7fb19434a68aeced
+DIST ffmpeg-7.0.2.tar.xz 10795332 BLAKE2B f6536f41f784f1b49ed0728d80a522676dfe1facbeb7fec3f7796683ce28c73e41508f9a5dd1e5cd18d3ff787d562bb1e6a5085ee0660076b84a76040587e5a8 SHA512 2fc66e919db53f6b12f845c0f9b92f3d8a7ec1db1ff533d29e679a6524f32567babf2d0791da039dcf2918c4d4cbb3f99c2898d3795345f03112238af8edcbd9
+DIST ffmpeg-7.0.2.tar.xz.asc 520 BLAKE2B edaadb45588938a524b64d82f96d224c2060648c10649adeba4a3546863eea45b674ebca80e7839e92138ae0b375afd22e0b4552d4d5a68dbb021e706f965b6d SHA512 b41eeb8044754bfcf2cf67a3ed4a4e74194ee6e5f4ed5f03aa03bb68772f6bacd7a1839d8e9740573889230a71d3bc7d52b4625542f4c892e8de8c61deda2c51
+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
+DIST ffmpeg-rpi-7.0.patch 807653 BLAKE2B 2d7d4fb55313c0ea227bf714af08fe17c118969aef972cf85bd8bf33643da08b2a224b2ea7c369a58e62fb758c0e8747c6cc6694672b889016fdb16b3d33f530 SHA512 cf65f68f6b0fa351d273c1b4fd74fca63a40cbd802bcd14124018784164fd1c6a09de3d9b0e0631eaf4c8b4fbcb846cc47a7831ad70eb0cfac6d21a51bd09941
+DIST ffmpeg-rpi-7.0.patch.asc 833 BLAKE2B 3086d77e2cc05b7c295fcaef26a9a0d32775999d1bab9075eeeb0a80804b35928698efe870a432558ece55d7873e016422a00013e7d0cca160b71172c31ab449 SHA512 cc885f01b9547f17c6ef1d26d7d1d053186fdf57aa31c0a411a2ab1c0246cec9c2aeef8687e7f8eb0c998d3379712541c60432bc2521a3db1b45d72d316c2d2b
diff --git a/media-video/ffmpeg/ffmpeg-4.3.1-r1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.4-r10.ebuild
index 7d3956a93641..9e0ffd130260 100644
--- a/media-video/ffmpeg/ffmpeg-4.3.1-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.4-r10.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 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.
@@ -28,9 +28,15 @@ 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="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ~ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~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.
@@ -79,14 +85,14 @@ FFMPEG_FLAG_MAP=(
# 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
+ 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 rav1e:librav1e 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,11 +126,16 @@ 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=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
@@ -132,7 +143,8 @@ 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_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 )
@@ -167,11 +179,13 @@ 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}] )
@@ -185,14 +199,13 @@ RDEPEND="
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}] )
- rav1e? ( media-video/rav1e:=[capi] )
+ 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}] )
@@ -201,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}] )
@@ -239,18 +253,25 @@ 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}] )
+ 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.1.23.1[${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}]
@@ -261,31 +282,33 @@ RDEPEND="
>=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}]
+ >=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}] )
- 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}] ) )
+ 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
+
+# += 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
@@ -303,9 +326,10 @@ GPL_REQUIRED_USE="
)
"
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}"
@@ -318,9 +342,16 @@ S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
- "${FILESDIR}"/${PN}-4.3-fix-build-without-SSSE3.patch
- "${FILESDIR}"/${PN}-4.3-altivec-novsx-yuv2rgb.patch
- "${FILESDIR}"/${PN}-4.3.1-srt-1.4.2-build.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
+ "${FILESDIR}"/${PN}-4.4.4-amd-av1-vaapi.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -331,11 +362,42 @@ 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
}
@@ -360,12 +422,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
@@ -385,7 +447,7 @@ multilib_src_configure() {
# (temporarily) disable non-multilib deps
if ! multilib_is_native_abi; then
- for i in frei0r librav1e libzmq ; do
+ for i in librav1e libzmq ; do
myconf+=( --disable-${i} )
done
fi
@@ -414,8 +476,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=(
@@ -434,9 +497,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 )
;;
@@ -453,6 +513,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,6 +525,7 @@ multilib_src_configure() {
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
--nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
--ranlib="$(tc-getRANLIB)" \
--pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
@@ -511,6 +573,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
@@ -541,9 +608,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.3.2-r1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild
index 25d462c19509..155021576490 100644
--- a/media-video/ffmpeg/ffmpeg-4.3.2-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.4-r9.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 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.
@@ -28,9 +28,15 @@ 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="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~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.
@@ -79,14 +85,14 @@ FFMPEG_FLAG_MAP=(
# 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
+ 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 rav1e:librav1e snappy:libsnappy theora:libtheora twolame:libtwolame
- 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 sndio static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -120,11 +126,16 @@ 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=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
@@ -132,7 +143,8 @@ 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_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 )
@@ -167,11 +179,13 @@ 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}] )
@@ -185,11 +199,11 @@ RDEPEND="
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}] )
- rav1e? ( media-video/rav1e:=[capi] )
+ 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}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
@@ -203,6 +217,7 @@ RDEPEND="
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}] )
@@ -238,19 +253,25 @@ 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}] )
+ 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.1.23.1[${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}]
@@ -261,31 +282,33 @@ RDEPEND="
>=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}]
+ >=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}] )
- 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}] ) )
+ 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
+
+# += 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
@@ -303,9 +326,10 @@ GPL_REQUIRED_USE="
)
"
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}"
@@ -318,8 +342,15 @@ S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
- "${FILESDIR}"/${PN}-4.3-fix-build-without-SSSE3.patch
- "${FILESDIR}"/${PN}-4.3-altivec-novsx-yuv2rgb.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=(
@@ -330,11 +361,42 @@ 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
}
@@ -413,9 +475,9 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282, bug #754654
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
- filter-flags "-flto*"
+ # LTO support, bug #566282, bug #754654, bug #772854
+ [[ ${ABI} != x86 ]] && tc-is-lto && myconf+=( "--enable-lto" )
+ filter-lto
# Mandatory configuration
myconf=(
@@ -434,9 +496,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 )
;;
@@ -453,6 +512,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,6 +524,7 @@ multilib_src_configure() {
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
--nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
--ranlib="$(tc-getRANLIB)" \
--pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
@@ -511,6 +572,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
@@ -541,9 +607,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.4-r1.ebuild b/media-video/ffmpeg/ffmpeg-4.4.5.ebuild
index 9dfdeaccd48a..fcdff1e2f2ef 100644
--- a/media-video/ffmpeg/ffmpeg-4.4-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-4.4.5.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 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.
@@ -28,9 +28,14 @@ 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}"
@@ -59,7 +64,7 @@ LICENSE="
samba? ( GPL-3 )
"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x86-linux"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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.
@@ -79,14 +84,14 @@ FFMPEG_FLAG_MAP=(
# 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
+ 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 +100,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 rav1e:librav1e snappy:libsnappy theora:libtheora twolame:libtwolame
- 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 sndio static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -120,11 +125,16 @@ 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=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
@@ -132,7 +142,8 @@ 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_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 )
@@ -167,11 +178,13 @@ 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}] )
@@ -188,8 +201,8 @@ RDEPEND="
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}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
@@ -203,6 +216,7 @@ RDEPEND="
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}] )
@@ -238,19 +252,25 @@ 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}] )
+ 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.1.23.1[${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}]
@@ -261,31 +281,33 @@ RDEPEND="
>=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}]
+ >=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}] )
- 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}] ) )
+ 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
+
+# += 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
@@ -303,9 +325,10 @@ GPL_REQUIRED_USE="
)
"
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}"
@@ -318,6 +341,13 @@ S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
+ "${FILESDIR}"/${PN}-5.0-backport-ranlib-build-fix.patch
+ "${FILESDIR}"/${PN}-4.4.3-get_cabac_inline_x86-32-bit.patch
+ "${FILESDIR}"/${PN}-4.4.4-wint-conversion-vulkan.patch
+ "${FILESDIR}"/${PN}-4.4.4-opencl-parallel-gmake-fix.patch
+ "${FILESDIR}"/${PN}-4.4.4-glslang.patch
+ "${FILESDIR}"/${PN}-4.4.4-amd-av1-vaapi.patch
+ "${FILESDIR}"/${PN}-4.4.5-incmptbl-pntr-types.patch
)
MULTILIB_WRAPPED_HEADERS=(
@@ -328,11 +358,42 @@ 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
}
@@ -411,9 +472,9 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282, bug #754654
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
- filter-flags "-flto*"
+ # LTO support, bug #566282, bug #754654, bug #772854
+ [[ ${ABI} != x86 ]] && tc-is-lto && myconf+=( "--enable-lto" )
+ filter-lto
# Mandatory configuration
myconf=(
@@ -432,9 +493,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 )
;;
@@ -451,13 +509,7 @@ multilib_src_configure() {
$(multilib_native_enable manpages)
)
- local extra_libs
- if use arm || use ppc ; then
- # bug #782811
- # bug #790590
- extra_libs+="-latomic "
- fi
-
+ # Use --extra-libs if needed for LIBS
set -- "${S}/configure" \
--prefix="${EPREFIX}/usr" \
--libdir="${EPREFIX}/usr/$(get_libdir)" \
@@ -469,10 +521,10 @@ multilib_src_configure() {
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
--nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
--ranlib="$(tc-getRANLIB)" \
--pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
- --extra-libs="${extra_libs}" \
$(use_enable static-libs static) \
"${myconf[@]}" \
${EXTRA_FFMPEG_CONF}
@@ -519,7 +571,7 @@ multilib_src_compile() {
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
+ emake V=1 fate -k
}
multilib_src_install() {
@@ -552,4 +604,6 @@ multilib_src_install() {
multilib_src_install_all() {
dodoc Changelog README.md CREDITS doc/*.txt doc/APIchanges
[ -f "RELEASE_NOTES" ] && dodoc "RELEASE_NOTES"
+
+ use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override 99amf-env-vulkan-override
}
diff --git a/media-video/ffmpeg/ffmpeg-4.2.4-r1.ebuild b/media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild
index 2457a735302d..d0a3bb596892 100644
--- a/media-video/ffmpeg/ffmpeg-4.2.4-r1.ebuild
+++ b/media-video/ffmpeg/ffmpeg-6.0.1-r4.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 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,7 @@ 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
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
@@ -28,12 +28,14 @@ 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
- https://dev.gentoo.org/~gyakovlev/distfiles/${PN}-4.2.2-ppc64-altivec.patch.gz
- https://dev.gentoo.org/~gyakovlev/distfiles/${PN}-4.2.2-ppc64-gcc.patch.gz
- "
+ 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}"
@@ -62,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"
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~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.
@@ -70,9 +72,9 @@ 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
+ +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
+ 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
@@ -80,15 +82,16 @@ FFMPEG_FLAG_MAP=(
# 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 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 cuda:cuda-llvm flite:libflite frei0r
- fribidi:libfribidi fontconfig ladspa libass libtesseract lv2 truetype:libfreetype vidstab:libvidstab
+ 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
@@ -98,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[@]%:*}
"
@@ -123,11 +126,16 @@ 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=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
@@ -135,7 +143,8 @@ 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_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 )
@@ -170,11 +179,13 @@ 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}] )
@@ -187,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}] )
@@ -203,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}] )
@@ -216,17 +227,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}] )
+ 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}] )
@@ -238,55 +252,65 @@ 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}] )
+ 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}] )
+ 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: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-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}]
+ >=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}] )
- 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}] ) )
+ 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-1.4.28 )
ladspa? ( >=media-libs/ladspa-sdk-1.13-r2[${MULTILIB_USEDEP}] )
v4l? ( sys-kernel/linux-headers )
"
-BDEPEND="
- >=sys-devel/make-3.81
+
+# += 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
@@ -295,6 +319,7 @@ GPL_REQUIRED_USE="
frei0r? ( gpl )
cdio? ( gpl )
rubberband? ( gpl )
+ vidstab? ( gpl )
samba? ( gpl )
encode? (
x264? ( gpl )
@@ -303,7 +328,7 @@ GPL_REQUIRED_USE="
)
"
REQUIRED_USE="
- cuda? ( video_cards_nvidia )
+ cuda? ( nvenc )
libv4l? ( v4l )
fftools_cws2fws? ( zlib )
test? ( encode )
@@ -318,9 +343,12 @@ S=${WORKDIR}/${P/_/-}
PATCHES=(
"${FILESDIR}"/chromium-r1.patch
- "${WORKDIR}/${PN}"-4.2.2-ppc64-gcc.patch # both ppc patches from
- "${WORKDIR}/${PN}"-4.2.2-ppc64-altivec.patch # https://trac.ffmpeg.org/ticket/7861
-
+ "${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=(
@@ -331,16 +359,36 @@ 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=( )
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
use openssl && myconf+=( --enable-nonfree )
@@ -360,12 +408,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
@@ -381,11 +429,12 @@ multilib_src_configure() {
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
@@ -414,13 +463,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
@@ -434,9 +483,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 )
;;
@@ -453,6 +499,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)" \
@@ -463,9 +510,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
@@ -507,6 +559,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
@@ -537,9 +594,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-6.1.1-r5.ebuild b/media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild
new file mode 100644
index 000000000000..8ca3ffa196ed
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-6.1.1-r5.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Subslot: libavutil major.libavcodec major.libavformat major
+# Since FFmpeg ships several libraries, subslot is kind of limited here.
+# Most consumers will use those three libraries, if a "less used" library
+# changes its soname, consumers will have to be rebuilt the old way
+# (preserve-libs).
+# If, for example, a package does not link to libavformat and only libavformat
+# 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=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-6.1-r3.patch"
+
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+ SCM="git-r3"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
+fi
+
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
+if [ "${PV#9999}" != "${PV}" ] ; then
+ :
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
+else # Release
+ 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}"
+
+SLOT="0/${FFMPEG_SUBSLOT}"
+LICENSE="
+ !gpl? ( LGPL-2.1 )
+ gpl? ( GPL-2 )
+ amr? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ gmp? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ encode? (
+ amrenc? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ )
+ samba? ( GPL-3 )
+"
+if [ "${PV#9999}" = "${PV}" ] ; then
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~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.
+# This will feed configure with $(use_enable foo bar)
+# 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 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 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 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
+ +threads:pthreads
+)
+
+# Same as above but for encoders, i.e. they do something only with USE=encode.
+FFMPEG_ENCODER_FLAG_MAP=(
+ 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 sndio static-libs test v4l soc
+ ${FFMPEG_FLAG_MAP[@]%:*}
+ ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
+"
+
+# Strings for CPU features in the useflag[:configure_option] form
+# if :configure_option isn't set, it will use 'useflag' as configure option
+ARM_CPU_FEATURES=(
+ cpu_flags_arm_thumb:armv5te
+ cpu_flags_arm_v6:armv6
+ cpu_flags_arm_thumb2:armv6t2
+ cpu_flags_arm_neon:neon
+ 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_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? (
+ arm? ( cpu_flags_arm_thumb )
+ )
+"
+MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
+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 )
+ cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
+ cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
+ cpu_flags_x86_xop? ( cpu_flags_x86_avx )
+ cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
+ cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
+ cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
+ cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
+ cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
+ cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
+ cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
+ cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
+ cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
+"
+
+CPU_FEATURES_MAP=(
+ ${ARM_CPU_FEATURES[@]}
+ ${MIPS_CPU_FEATURES[@]}
+ ${PPC_CPU_FEATURES[@]}
+ ${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE}
+ ${CPU_FEATURES_MAP[@]%:*}"
+
+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 )
+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-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}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
+ snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
+ theora? (
+ >=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}] )
+ 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}] )
+ xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
+ )
+ 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[${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}] )
+ iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
+ iec61883? (
+ >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
+ )
+ ieee1394? (
+ >=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.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}] )
+ 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? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
+ opus? ( >=media-libs/opus-1.0.2-r2[${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.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}]
+ )
+ 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}] )
+"
+
+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}
+ 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 )
+"
+
+# += 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 )
+ )
+"
+REQUIRED_USE="
+ 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-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=( )
+
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
+ local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
+ use openssl && myconf+=( --enable-nonfree )
+ use samba && myconf+=( --enable-version3 )
+
+ # Encoders
+ if use encode ; then
+ ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
+
+ # Licensing.
+ if use amrenc ; then
+ myconf+=( --enable-version3 )
+ fi
+ else
+ myconf+=( --disable-encoders )
+ fi
+
+ # Indevs
+ use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
+ for i in alsa oss jack sndio ; do
+ use ${i} || myconf+=( --disable-indev=${i} )
+ done
+
+ # Outdevs
+ 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 librav1e libzmq ; do
+ myconf+=( --disable-${i} )
+ done
+ fi
+
+ # CPU features
+ for i in "${CPU_FEATURES_MAP[@]}" ; do
+ use ${i%:*} || myconf+=( --disable-${i#*:} )
+ done
+
+ if use pic ; then
+ myconf+=( --enable-pic )
+ # disable asm code if PIC is required
+ # as the provided asm decidedly is not PIC for x86.
+ [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
+ fi
+ [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
+
+ # Try to get cpu type based on CFLAGS.
+ # Bug #172723
+ # We need to do this so that features of that CPU will be better used
+ # If they contain an unknown CPU it will not hurt since ffmpeg's configure
+ # will just ignore it.
+ for i in $(get-flag mcpu) $(get-flag march) ; do
+ [[ ${i} = native ]] && i="host" # bug #273421
+ myconf+=( --cpu=${i} )
+ break
+ done
+
+ # 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
+ --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[@]}"
+ )
+
+ # cross compile support
+ 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
+ *mingw32*)
+ myconf+=( --target-os=mingw32 )
+ ;;
+ *linux*)
+ myconf+=( --target-os=linux )
+ ;;
+ esac
+ fi
+
+ # doc
+ myconf+=(
+ $(multilib_native_use_enable doc)
+ $(multilib_native_use_enable doc htmlpages)
+ $(multilib_native_enable manpages)
+ )
+
+ # Use --extra-libs if needed for LIBS
+ set -- "${S}/configure" \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ --mandir="${EPREFIX}/usr/share/man" \
+ --enable-shared \
+ --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[@]}" \
+ ${EXTRA_FFMPEG_CONF}
+ echo "${@}"
+ "${@}" || die
+}
+
+multilib_src_compile() {
+ emake V=1
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ emake V=1 tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ dobin tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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"
+
+ 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-6.1.1-r8.ebuild b/media-video/ffmpeg/ffmpeg-6.1.1-r8.ebuild
new file mode 100644
index 000000000000..f83fcb1a0176
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-6.1.1-r8.ebuild
@@ -0,0 +1,614 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Subslot: libavutil major.libavcodec major.libavformat major
+# Since FFmpeg ships several libraries, subslot is kind of limited here.
+# Most consumers will use those three libraries, if a "less used" library
+# changes its soname, consumers will have to be rebuilt the old way
+# (preserve-libs).
+# If, for example, a package does not link to libavformat and only libavformat
+# 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=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-6.1-r3.patch"
+
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+ SCM="git-r3"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
+fi
+
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
+if [ "${PV#9999}" != "${PV}" ] ; then
+ :
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
+else # Release
+ 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}"
+
+SLOT="0/${FFMPEG_SUBSLOT}"
+LICENSE="
+ !gpl? ( LGPL-2.1 )
+ gpl? ( GPL-2 )
+ amr? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ gmp? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ encode? (
+ amrenc? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ )
+ samba? ( GPL-3 )
+"
+if [ "${PV#9999}" = "${PV}" ] ; then
+ KEYWORDS="~alpha amd64 arm arm64 ~hppa ~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.
+# This will feed configure with $(use_enable foo bar)
+# 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 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 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 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
+ +threads:pthreads
+)
+
+# Same as above but for encoders, i.e. they do something only with USE=encode.
+FFMPEG_ENCODER_FLAG_MAP=(
+ 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 sndio static-libs test v4l soc
+ ${FFMPEG_FLAG_MAP[@]%:*}
+ ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
+"
+
+# Strings for CPU features in the useflag[:configure_option] form
+# if :configure_option isn't set, it will use 'useflag' as configure option
+ARM_CPU_FEATURES=(
+ cpu_flags_arm_thumb:armv5te
+ cpu_flags_arm_v6:armv6
+ cpu_flags_arm_thumb2:armv6t2
+ cpu_flags_arm_neon:neon
+ 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_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? (
+ arm? ( cpu_flags_arm_thumb )
+ )
+"
+MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
+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 )
+ cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
+ cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
+ cpu_flags_x86_xop? ( cpu_flags_x86_avx )
+ cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
+ cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
+ cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
+ cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
+ cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
+ cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
+ cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
+ cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
+ cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
+"
+
+CPU_FEATURES_MAP=(
+ ${ARM_CPU_FEATURES[@]}
+ ${MIPS_CPU_FEATURES[@]}
+ ${PPC_CPU_FEATURES[@]}
+ ${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE}
+ ${CPU_FEATURES_MAP[@]%:*}"
+
+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 )
+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-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}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
+ snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
+ theora? (
+ >=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}] )
+ 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}] )
+ xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
+ )
+ 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[${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}] )
+ iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
+ iec61883? (
+ >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
+ )
+ ieee1394? (
+ >=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.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}] )
+ 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? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
+ opus? ( >=media-libs/opus-1.0.2-r2[${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.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}]
+ )
+ 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}] )
+"
+
+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}
+ 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 )
+"
+
+# += 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 )
+ )
+"
+REQUIRED_USE="
+ 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-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}"/${PN}-6.1.1-vulkan-rename.patch
+ "${FILESDIR}"/${PN}-6.1.1-memory-leak.patch
+ "${FILESDIR}"/${PN}-6.1.1-wint-inconversion-libgcrypt.patch
+ "${FILESDIR}"/${PN}-6.1.1-amd-av1-vaapi.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
+
+ # We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+ if tc-is-lto ; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ ${v} != -flto ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+ fi
+ filter-lto
+}
+
+multilib_src_configure() {
+ local myconf=( )
+
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
+ local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
+ use openssl && myconf+=( --enable-nonfree )
+ use samba && myconf+=( --enable-version3 )
+
+ # Encoders
+ if use encode ; then
+ ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
+
+ # Licensing.
+ if use amrenc ; then
+ myconf+=( --enable-version3 )
+ fi
+ else
+ myconf+=( --disable-encoders )
+ fi
+
+ # Indevs
+ use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
+ for i in alsa oss jack sndio ; do
+ use ${i} || myconf+=( --disable-indev=${i} )
+ done
+
+ # Outdevs
+ 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 librav1e libzmq ; do
+ myconf+=( --disable-${i} )
+ done
+ fi
+
+ # CPU features
+ for i in "${CPU_FEATURES_MAP[@]}" ; do
+ use ${i%:*} || myconf+=( --disable-${i#*:} )
+ done
+
+ if use pic ; then
+ myconf+=( --enable-pic )
+ # disable asm code if PIC is required
+ # as the provided asm decidedly is not PIC for x86.
+ [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
+ fi
+ [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
+
+ # Try to get cpu type based on CFLAGS.
+ # Bug #172723
+ # We need to do this so that features of that CPU will be better used
+ # If they contain an unknown CPU it will not hurt since ffmpeg's configure
+ # will just ignore it.
+ for i in $(get-flag mcpu) $(get-flag march) ; do
+ [[ ${i} = native ]] && i="host" # bug #273421
+ myconf+=( --cpu=${i} )
+ break
+ done
+
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+ myconf+=( ${LTO_FLAG} )
+ fi
+
+ # Mandatory configuration
+ myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
+ --enable-avfilter
+ --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[@]}"
+ )
+
+ # cross compile support
+ 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
+ *mingw32*)
+ myconf+=( --target-os=mingw32 )
+ ;;
+ *linux*)
+ myconf+=( --target-os=linux )
+ ;;
+ esac
+ fi
+
+ # doc
+ myconf+=(
+ $(multilib_native_use_enable doc)
+ $(multilib_native_use_enable doc htmlpages)
+ $(multilib_native_enable manpages)
+ )
+
+ # Use --extra-libs if needed for LIBS
+ set -- "${S}/configure" \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ --mandir="${EPREFIX}/usr/share/man" \
+ --enable-shared \
+ --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[@]}" \
+ ${EXTRA_FFMPEG_CONF}
+ echo "${@}"
+ "${@}" || die
+}
+
+multilib_src_compile() {
+ emake V=1
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ emake V=1 tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ dobin tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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"
+
+ 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-6.1.2.ebuild b/media-video/ffmpeg/ffmpeg-6.1.2.ebuild
new file mode 100644
index 000000000000..cf2f2c615aaf
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-6.1.2.ebuild
@@ -0,0 +1,612 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Subslot: libavutil major.libavcodec major.libavformat major
+# Since FFmpeg ships several libraries, subslot is kind of limited here.
+# Most consumers will use those three libraries, if a "less used" library
+# changes its soname, consumers will have to be rebuilt the old way
+# (preserve-libs).
+# If, for example, a package does not link to libavformat and only libavformat
+# 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=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-6.1-r3.patch"
+
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+ SCM="git-r3"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
+fi
+
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
+if [ "${PV#9999}" != "${PV}" ] ; then
+ :
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
+else # Release
+ 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}"
+
+SLOT="0/${FFMPEG_SUBSLOT}"
+LICENSE="
+ !gpl? ( LGPL-2.1 )
+ gpl? ( GPL-2 )
+ amr? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ gmp? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ encode? (
+ amrenc? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ )
+ samba? ( GPL-3 )
+"
+if [ "${PV#9999}" = "${PV}" ] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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.
+# This will feed configure with $(use_enable foo bar)
+# 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 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 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 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
+ +threads:pthreads
+)
+
+# Same as above but for encoders, i.e. they do something only with USE=encode.
+FFMPEG_ENCODER_FLAG_MAP=(
+ 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 sndio static-libs test v4l soc
+ ${FFMPEG_FLAG_MAP[@]%:*}
+ ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
+"
+
+# Strings for CPU features in the useflag[:configure_option] form
+# if :configure_option isn't set, it will use 'useflag' as configure option
+ARM_CPU_FEATURES=(
+ cpu_flags_arm_thumb:armv5te
+ cpu_flags_arm_v6:armv6
+ cpu_flags_arm_thumb2:armv6t2
+ cpu_flags_arm_neon:neon
+ 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_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? (
+ arm? ( cpu_flags_arm_thumb )
+ )
+"
+MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
+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 )
+ cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
+ cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
+ cpu_flags_x86_xop? ( cpu_flags_x86_avx )
+ cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
+ cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
+ cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
+ cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
+ cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
+ cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
+ cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
+ cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
+ cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
+"
+
+CPU_FEATURES_MAP=(
+ ${ARM_CPU_FEATURES[@]}
+ ${MIPS_CPU_FEATURES[@]}
+ ${PPC_CPU_FEATURES[@]}
+ ${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE}
+ ${CPU_FEATURES_MAP[@]%:*}"
+
+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 )
+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-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}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
+ snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
+ theora? (
+ >=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}] )
+ 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}] )
+ xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
+ )
+ 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[${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}] )
+ iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
+ iec61883? (
+ >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
+ )
+ ieee1394? (
+ >=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.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}] )
+ 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? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
+ opus? ( >=media-libs/opus-1.0.2-r2[${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.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}]
+ )
+ 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}] )
+"
+
+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}
+ 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 )
+"
+
+# += 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 )
+ )
+"
+REQUIRED_USE="
+ 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-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}"/${PN}-6.1.1-wint-inconversion-libgcrypt.patch
+ "${FILESDIR}"/${PN}-6.1.1-amd-av1-vaapi.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
+
+ # We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+ if tc-is-lto ; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ ${v} != -flto ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+ fi
+ filter-lto
+}
+
+multilib_src_configure() {
+ local myconf=( )
+
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
+ local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
+ use openssl && myconf+=( --enable-nonfree )
+ use samba && myconf+=( --enable-version3 )
+
+ # Encoders
+ if use encode ; then
+ ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
+
+ # Licensing.
+ if use amrenc ; then
+ myconf+=( --enable-version3 )
+ fi
+ else
+ myconf+=( --disable-encoders )
+ fi
+
+ # Indevs
+ use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
+ for i in alsa oss jack sndio ; do
+ use ${i} || myconf+=( --disable-indev=${i} )
+ done
+
+ # Outdevs
+ 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 librav1e libzmq ; do
+ myconf+=( --disable-${i} )
+ done
+ fi
+
+ # CPU features
+ for i in "${CPU_FEATURES_MAP[@]}" ; do
+ use ${i%:*} || myconf+=( --disable-${i#*:} )
+ done
+
+ if use pic ; then
+ myconf+=( --enable-pic )
+ # disable asm code if PIC is required
+ # as the provided asm decidedly is not PIC for x86.
+ [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
+ fi
+ [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
+
+ # Try to get cpu type based on CFLAGS.
+ # Bug #172723
+ # We need to do this so that features of that CPU will be better used
+ # If they contain an unknown CPU it will not hurt since ffmpeg's configure
+ # will just ignore it.
+ for i in $(get-flag mcpu) $(get-flag march) ; do
+ [[ ${i} = native ]] && i="host" # bug #273421
+ myconf+=( --cpu=${i} )
+ break
+ done
+
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+ myconf+=( ${LTO_FLAG} )
+ fi
+
+ # Mandatory configuration
+ myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
+ --enable-avfilter
+ --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[@]}"
+ )
+
+ # cross compile support
+ 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
+ *mingw32*)
+ myconf+=( --target-os=mingw32 )
+ ;;
+ *linux*)
+ myconf+=( --target-os=linux )
+ ;;
+ esac
+ fi
+
+ # doc
+ myconf+=(
+ $(multilib_native_use_enable doc)
+ $(multilib_native_use_enable doc htmlpages)
+ $(multilib_native_enable manpages)
+ )
+
+ # Use --extra-libs if needed for LIBS
+ set -- "${S}/configure" \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ --mandir="${EPREFIX}/usr/share/man" \
+ --enable-shared \
+ --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[@]}" \
+ ${EXTRA_FFMPEG_CONF}
+ echo "${@}"
+ "${@}" || die
+}
+
+multilib_src_compile() {
+ emake V=1
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ emake V=1 tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ dobin tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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"
+
+ 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-7.0.1.ebuild b/media-video/ffmpeg/ffmpeg-7.0.1.ebuild
new file mode 100644
index 000000000000..467c8c4a6bb7
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-7.0.1.ebuild
@@ -0,0 +1,614 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Subslot: libavutil major.libavcodec major.libavformat major
+# Since FFmpeg ships several libraries, subslot is kind of limited here.
+# Most consumers will use those three libraries, if a "less used" library
+# changes its soname, consumers will have to be rebuilt the old way
+# (preserve-libs).
+# If, for example, a package does not link to libavformat and only libavformat
+# 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=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-7.0.patch"
+
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+ SCM="git-r3"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
+fi
+
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
+if [ "${PV#9999}" != "${PV}" ] ; then
+ :
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
+else # Release
+ 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-20240708 )
+ )
+ "
+
+ 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}"
+
+S=${WORKDIR}/${P/_/-}
+LICENSE="
+ !gpl? ( LGPL-2.1 )
+ gpl? ( GPL-2 )
+ amr? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ gmp? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ encode? (
+ amrenc? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ )
+ samba? ( GPL-3 )
+"
+SLOT="0/${FFMPEG_SUBSLOT}"
+if [ "${PV#9999}" = "${PV}" ] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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.
+# This will feed configure with $(use_enable foo bar)
+# 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 libxml2 libdvdnav libdvdread lzma +network
+ opencl openssl +postproc qrcode:libqrencode quirc:libquirc
+ 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 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 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
+ +threads:pthreads
+)
+
+# Same as above but for encoders, i.e. they do something only with USE=encode.
+FFMPEG_ENCODER_FLAG_MAP=(
+ 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 sndio static-libs test v4l soc
+ ${FFMPEG_FLAG_MAP[@]%:*}
+ ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
+"
+
+# Strings for CPU features in the useflag[:configure_option] form
+# if :configure_option isn't set, it will use 'useflag' as configure option
+ARM_CPU_FEATURES=(
+ cpu_flags_arm_thumb:armv5te
+ cpu_flags_arm_v6:armv6
+ cpu_flags_arm_thumb2:armv6t2
+ cpu_flags_arm_neon:neon
+ 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_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? (
+ arm? ( cpu_flags_arm_thumb )
+ )
+"
+MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
+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 )
+ cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
+ cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
+ cpu_flags_x86_xop? ( cpu_flags_x86_avx )
+ cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
+ cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
+ cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
+ cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
+ cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
+ cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
+ cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
+ cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
+ cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
+"
+
+CPU_FEATURES_MAP=(
+ ${ARM_CPU_FEATURES[@]}
+ ${MIPS_CPU_FEATURES[@]}
+ ${PPC_CPU_FEATURES[@]}
+ ${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE}
+ ${CPU_FEATURES_MAP[@]%:*}"
+
+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 )
+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-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}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
+ snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
+ theora? (
+ >=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}] )
+ 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}] )
+ xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
+ )
+ 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[${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}] )
+ iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
+ iec61883? (
+ >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
+ )
+ ieee1394? (
+ >=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.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}] )
+ libdvdnav? ( media-libs/libdvdnav[${MULTILIB_USEDEP}] )
+ libdvdread? ( media-libs/libdvdread:=[${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}] )
+ 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? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
+ opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
+ qrcode? ( media-gfx/qrencode:=[${MULTILIB_USEDEP}] )
+ quirc? ( media-libs/quirc:=[${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.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.277:=[${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}]
+ )
+ 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}] )
+"
+
+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}
+ 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.277 )
+"
+
+# += 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 )
+ )
+"
+REQUIRED_USE="
+ chromium? ( opus )
+ cuda? ( nvenc )
+ fftools_cws2fws? ( zlib )
+ glslang? ( vulkan !shaderc )
+ libv4l? ( v4l )
+ shaderc? ( vulkan !glslang )
+ soc? ( libdrm )
+ test? ( encode )
+ vulkan? ( threads )
+ ${GPL_REQUIRED_USE}
+ ${CPU_REQUIRED_USE}"
+RESTRICT="
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
+"
+
+PATCHES=(
+ "${FILESDIR}"/chromium-r2.patch
+ "${FILESDIR}"/${PN}-6.1-opencl-parallel-gmake-fix.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
+
+ # We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+ if tc-is-lto ; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ ${v} != -flto ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+ fi
+ filter-lto
+}
+
+multilib_src_configure() {
+ local myconf=( )
+
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
+ local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
+ use openssl && myconf+=( --enable-nonfree )
+ use samba && myconf+=( --enable-version3 )
+
+ # Encoders
+ if use encode ; then
+ ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
+
+ # Licensing.
+ if use amrenc ; then
+ myconf+=( --enable-version3 )
+ fi
+ else
+ myconf+=( --disable-encoders )
+ fi
+
+ # Indevs
+ use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
+ for i in alsa oss jack sndio ; do
+ use ${i} || myconf+=( --disable-indev=${i} )
+ done
+
+ # Outdevs
+ 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 librav1e libzmq ; do
+ myconf+=( --disable-${i} )
+ done
+ fi
+
+ # CPU features
+ for i in "${CPU_FEATURES_MAP[@]}" ; do
+ use ${i%:*} || myconf+=( --disable-${i#*:} )
+ done
+
+ if use pic ; then
+ myconf+=( --enable-pic )
+ # disable asm code if PIC is required
+ # as the provided asm decidedly is not PIC for x86.
+ [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
+ fi
+ [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
+
+ # Try to get cpu type based on CFLAGS.
+ # Bug #172723
+ # We need to do this so that features of that CPU will be better used
+ # If they contain an unknown CPU it will not hurt since ffmpeg's configure
+ # will just ignore it.
+ for i in $(get-flag mcpu) $(get-flag march) ; do
+ [[ ${i} = native ]] && i="host" # bug #273421
+ myconf+=( --cpu=${i} )
+ break
+ done
+
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+ myconf+=( ${LTO_FLAG} )
+ fi
+
+ # Mandatory configuration
+ myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
+ --disable-libxeve
+ --disable-libxevd
+ --disable-d3d12va
+ --enable-avfilter
+ --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[@]}"
+ )
+
+ # cross compile support
+ 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
+ *mingw32*)
+ myconf+=( --target-os=mingw32 )
+ ;;
+ *linux*)
+ myconf+=( --target-os=linux )
+ ;;
+ esac
+ fi
+
+ # doc
+ myconf+=(
+ $(multilib_native_use_enable doc)
+ $(multilib_native_use_enable doc htmlpages)
+ $(multilib_native_enable manpages)
+ )
+
+ # Use --extra-libs if needed for LIBS
+ set -- "${S}/configure" \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ --mandir="${EPREFIX}/usr/share/man" \
+ --enable-shared \
+ --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[@]}" \
+ ${EXTRA_FFMPEG_CONF}
+ echo "${@}"
+ "${@}" || die
+}
+
+multilib_src_compile() {
+ emake V=1
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ emake V=1 tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ dobin tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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"
+
+ use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override 99amf-env-vulkan-override
+}
diff --git a/media-video/ffmpeg/ffmpeg-7.0.2.ebuild b/media-video/ffmpeg/ffmpeg-7.0.2.ebuild
new file mode 100644
index 000000000000..467c8c4a6bb7
--- /dev/null
+++ b/media-video/ffmpeg/ffmpeg-7.0.2.ebuild
@@ -0,0 +1,614 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Subslot: libavutil major.libavcodec major.libavformat major
+# Since FFmpeg ships several libraries, subslot is kind of limited here.
+# Most consumers will use those three libraries, if a "less used" library
+# changes its soname, consumers will have to be rebuilt the old way
+# (preserve-libs).
+# If, for example, a package does not link to libavformat and only libavformat
+# 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=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-7.0.patch"
+
+SCM=""
+if [ "${PV#9999}" != "${PV}" ] ; then
+ SCM="git-r3"
+ EGIT_MIN_CLONE_TYPE="single"
+ EGIT_REPO_URI="https://git.ffmpeg.org/ffmpeg.git"
+fi
+
+inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
+
+DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
+HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( https://dev.gentoo.org/~chewi/distfiles/${SOC_PATCH} )"
+if [ "${PV#9999}" != "${PV}" ] ; then
+ :
+elif [ "${PV%_p*}" != "${PV}" ] ; then # Snapshot
+ SRC_URI+=" mirror://gentoo/${P}.tar.xz"
+else # Release
+ 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-20240708 )
+ )
+ "
+
+ 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}"
+
+S=${WORKDIR}/${P/_/-}
+LICENSE="
+ !gpl? ( LGPL-2.1 )
+ gpl? ( GPL-2 )
+ amr? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ gmp? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ libaribb24? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ encode? (
+ amrenc? (
+ gpl? ( GPL-3 )
+ !gpl? ( LGPL-3 )
+ )
+ )
+ samba? ( GPL-3 )
+"
+SLOT="0/${FFMPEG_SUBSLOT}"
+if [ "${PV#9999}" = "${PV}" ] ; then
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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.
+# This will feed configure with $(use_enable foo bar)
+# 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 libxml2 libdvdnav libdvdread lzma +network
+ opencl openssl +postproc qrcode:libqrencode quirc:libquirc
+ 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 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 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
+ +threads:pthreads
+)
+
+# Same as above but for encoders, i.e. they do something only with USE=encode.
+FFMPEG_ENCODER_FLAG_MAP=(
+ 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 sndio static-libs test v4l soc
+ ${FFMPEG_FLAG_MAP[@]%:*}
+ ${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
+"
+
+# Strings for CPU features in the useflag[:configure_option] form
+# if :configure_option isn't set, it will use 'useflag' as configure option
+ARM_CPU_FEATURES=(
+ cpu_flags_arm_thumb:armv5te
+ cpu_flags_arm_v6:armv6
+ cpu_flags_arm_thumb2:armv6t2
+ cpu_flags_arm_neon:neon
+ 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_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? (
+ arm? ( cpu_flags_arm_thumb )
+ )
+"
+MIPS_CPU_FEATURES=( mipsdspr1:mipsdsp mipsdspr2 mipsfpu )
+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 )
+ cpu_flags_x86_fma4? ( cpu_flags_x86_avx )
+ cpu_flags_x86_fma3? ( cpu_flags_x86_avx )
+ cpu_flags_x86_xop? ( cpu_flags_x86_avx )
+ cpu_flags_x86_avx? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_aes? ( cpu_flags_x86_sse4_2 )
+ cpu_flags_x86_sse4_2? ( cpu_flags_x86_sse4_1 )
+ cpu_flags_x86_sse4_1? ( cpu_flags_x86_ssse3 )
+ cpu_flags_x86_ssse3? ( cpu_flags_x86_sse3 )
+ cpu_flags_x86_sse3? ( cpu_flags_x86_sse2 )
+ cpu_flags_x86_sse2? ( cpu_flags_x86_sse )
+ cpu_flags_x86_sse? ( cpu_flags_x86_mmxext )
+ cpu_flags_x86_mmxext? ( cpu_flags_x86_mmx )
+ cpu_flags_x86_3dnowext? ( cpu_flags_x86_3dnow )
+ cpu_flags_x86_3dnow? ( cpu_flags_x86_mmx )
+"
+
+CPU_FEATURES_MAP=(
+ ${ARM_CPU_FEATURES[@]}
+ ${MIPS_CPU_FEATURES[@]}
+ ${PPC_CPU_FEATURES[@]}
+ ${X86_CPU_FEATURES[@]}
+)
+IUSE="${IUSE}
+ ${CPU_FEATURES_MAP[@]%:*}"
+
+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 )
+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-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}] )
+ rav1e? ( >=media-video/rav1e-0.5:=[capi] )
+ snappy? ( >=app-arch/snappy-1.1.2-r1:=[${MULTILIB_USEDEP}] )
+ theora? (
+ >=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}] )
+ 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}] )
+ xvid? ( >=media-libs/xvid-1.3.2-r1[${MULTILIB_USEDEP}] )
+ )
+ 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[${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}] )
+ iconv? ( >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}] )
+ iec61883? (
+ >=media-libs/libiec61883-1.2.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libraw1394-2.1.0-r1[${MULTILIB_USEDEP}]
+ >=sys-libs/libavc1394-0.5.4-r1[${MULTILIB_USEDEP}]
+ )
+ ieee1394? (
+ >=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.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}] )
+ libdvdnav? ( media-libs/libdvdnav[${MULTILIB_USEDEP}] )
+ libdvdread? ( media-libs/libdvdread:=[${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}] )
+ 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? ( media-libs/libglvnd[X,${MULTILIB_USEDEP}] )
+ opus? ( >=media-libs/opus-1.0.2-r2[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-libs/libpulse[${MULTILIB_USEDEP}] )
+ qsv? ( media-libs/libvpl[${MULTILIB_USEDEP}] )
+ qrcode? ( media-gfx/qrencode:=[${MULTILIB_USEDEP}] )
+ quirc? ( media-libs/quirc:=[${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.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.277:=[${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}]
+ )
+ 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}] )
+"
+
+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}
+ 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.277 )
+"
+
+# += 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 )
+ )
+"
+REQUIRED_USE="
+ chromium? ( opus )
+ cuda? ( nvenc )
+ fftools_cws2fws? ( zlib )
+ glslang? ( vulkan !shaderc )
+ libv4l? ( v4l )
+ shaderc? ( vulkan !glslang )
+ soc? ( libdrm )
+ test? ( encode )
+ vulkan? ( threads )
+ ${GPL_REQUIRED_USE}
+ ${CPU_REQUIRED_USE}"
+RESTRICT="
+ !test? ( test )
+ gpl? ( openssl? ( bindist ) fdk? ( bindist ) )
+"
+
+PATCHES=(
+ "${FILESDIR}"/chromium-r2.patch
+ "${FILESDIR}"/${PN}-6.1-opencl-parallel-gmake-fix.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
+
+ # We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+ if tc-is-lto ; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ ${v} != -flto ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+ fi
+ filter-lto
+}
+
+multilib_src_configure() {
+ local myconf=( )
+
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
+ local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
+ use openssl && myconf+=( --enable-nonfree )
+ use samba && myconf+=( --enable-version3 )
+
+ # Encoders
+ if use encode ; then
+ ffuse+=( "${FFMPEG_ENCODER_FLAG_MAP[@]}" )
+
+ # Licensing.
+ if use amrenc ; then
+ myconf+=( --enable-version3 )
+ fi
+ else
+ myconf+=( --disable-encoders )
+ fi
+
+ # Indevs
+ use v4l || myconf+=( --disable-indev=v4l2 --disable-outdev=v4l2 )
+ for i in alsa oss jack sndio ; do
+ use ${i} || myconf+=( --disable-indev=${i} )
+ done
+
+ # Outdevs
+ 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 librav1e libzmq ; do
+ myconf+=( --disable-${i} )
+ done
+ fi
+
+ # CPU features
+ for i in "${CPU_FEATURES_MAP[@]}" ; do
+ use ${i%:*} || myconf+=( --disable-${i#*:} )
+ done
+
+ if use pic ; then
+ myconf+=( --enable-pic )
+ # disable asm code if PIC is required
+ # as the provided asm decidedly is not PIC for x86.
+ [[ ${ABI} == x86 ]] && myconf+=( --disable-asm )
+ fi
+ [[ ${ABI} == x32 ]] && myconf+=( --disable-asm ) #427004
+
+ # Try to get cpu type based on CFLAGS.
+ # Bug #172723
+ # We need to do this so that features of that CPU will be better used
+ # If they contain an unknown CPU it will not hurt since ffmpeg's configure
+ # will just ignore it.
+ for i in $(get-flag mcpu) $(get-flag march) ; do
+ [[ ${i} = native ]] && i="host" # bug #273421
+ myconf+=( --cpu=${i} )
+ break
+ done
+
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+ myconf+=( ${LTO_FLAG} )
+ fi
+
+ # Mandatory configuration
+ myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
+ --disable-libxeve
+ --disable-libxevd
+ --disable-d3d12va
+ --enable-avfilter
+ --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[@]}"
+ )
+
+ # cross compile support
+ 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
+ *mingw32*)
+ myconf+=( --target-os=mingw32 )
+ ;;
+ *linux*)
+ myconf+=( --target-os=linux )
+ ;;
+ esac
+ fi
+
+ # doc
+ myconf+=(
+ $(multilib_native_use_enable doc)
+ $(multilib_native_use_enable doc htmlpages)
+ $(multilib_native_enable manpages)
+ )
+
+ # Use --extra-libs if needed for LIBS
+ set -- "${S}/configure" \
+ --prefix="${EPREFIX}/usr" \
+ --libdir="${EPREFIX}/usr/$(get_libdir)" \
+ --shlibdir="${EPREFIX}/usr/$(get_libdir)" \
+ --docdir="${EPREFIX}/usr/share/doc/${PF}/html" \
+ --mandir="${EPREFIX}/usr/share/man" \
+ --enable-shared \
+ --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[@]}" \
+ ${EXTRA_FFMPEG_CONF}
+ echo "${@}"
+ "${@}" || die
+}
+
+multilib_src_compile() {
+ emake V=1
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ emake V=1 tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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
+
+ if multilib_is_native_abi; then
+ for i in "${FFTOOLS[@]}" ; do
+ if use fftools_${i} ; then
+ dobin tools/${i}$(get_exeext)
+ fi
+ done
+
+ 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"
+
+ use amf && newenvd "${FILESDIR}"/amf-env-vulkan-override 99amf-env-vulkan-override
+}
diff --git a/media-video/ffmpeg/ffmpeg-9999.ebuild b/media-video/ffmpeg/ffmpeg-9999.ebuild
index 21212b25c0a4..2c36d52fbafe 100644
--- a/media-video/ffmpeg/ffmpeg-9999.ebuild
+++ b/media-video/ffmpeg/ffmpeg-9999.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 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=57.59.59
+FFMPEG_SUBSLOT=58.60.60
+
+SOC_PATCH="ffmpeg-rpi-7.0.patch"
SCM=""
if [ "${PV#9999}" != "${PV}" ] ; then
@@ -25,16 +27,40 @@ inherit flag-o-matic multilib multilib-minimal toolchain-funcs ${SCM}
DESCRIPTION="Complete solution to record/convert/stream audio and video. Includes libavcodec"
HOMEPAGE="https://ffmpeg.org/"
+SRC_URI="soc? ( 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-20240708 )
+ )
+ "
+
+ 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}"
-SLOT="0/${FFMPEG_SUBSLOT}"
+S=${WORKDIR}/${P/_/-}
LICENSE="
!gpl? ( LGPL-2.1 )
gpl? ( GPL-2 )
@@ -58,8 +84,9 @@ LICENSE="
)
samba? ( GPL-3 )
"
+SLOT="0/${FFMPEG_SUBSLOT}"
if [ "${PV#9999}" = "${PV}" ] ; then
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~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.
@@ -68,8 +95,9 @@ fi
# foo is added to IUSE.
FFMPEG_FLAG_MAP=(
+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
+ +gpl hardcoded-tables +iconv libxml2 libdvdnav libdvdread lzma +network
+ opencl openssl +postproc qrcode:libqrencode quirc:libquirc
+ 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
@@ -78,15 +106,16 @@ FFMPEG_FLAG_MAP=(
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
+ jpeg2k:libopenjpeg jpegxl:libjxl bluray:libbluray gme:libgme gsm:libgsm liblc3
+ 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 +124,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 rav1e:librav1e snappy:libsnappy theora:libtheora twolame:libtwolame
- 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 sndio static-libs test v4l
+ alsa chromium doc +encode oss +pic sndio static-libs test v4l soc
${FFMPEG_FLAG_MAP[@]%:*}
${FFMPEG_ENCODER_FLAG_MAP[@]%:*}
"
@@ -117,14 +146,21 @@ 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=( cpu_flags_ppc_altivec:altivec cpu_flags_ppc_vsx:vsx cpu_flags_ppc_vsx2:power8 )
@@ -132,7 +168,8 @@ 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_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 )
@@ -167,11 +204,13 @@ 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,17 +218,17 @@ 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}] )
- rav1e? ( >=media-video/rav1e-0.4:=[capi] )
+ 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}] )
webp? ( >=media-libs/libwebp-0.3.0:=[${MULTILIB_USEDEP}] )
@@ -203,6 +242,7 @@ RDEPEND="
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}] )
@@ -217,13 +257,19 @@ RDEPEND="
>=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-2.0.0:=[${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}] )
+ libdvdnav? ( media-libs/libdvdnav[${MULTILIB_USEDEP}] )
+ libdvdread? ( media-libs/libdvdread:=[${MULTILIB_USEDEP}] )
libilbc? ( >=media-libs/libilbc-2[${MULTILIB_USEDEP}] )
+ liblc3? ( >=media-sound/liblc3-1.1[${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}] )
@@ -231,61 +277,76 @@ 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}] )
+ qrcode? ( media-gfx/qrencode:=[${MULTILIB_USEDEP}] )
+ quirc? ( media-libs/quirc:=[${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.1.23.1[${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.1.97:=[${MULTILIB_USEDEP}] )
+ vulkan? ( >=media-libs/vulkan-loader-1.3.277:=[${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}]
+ >=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}] )
- 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}] ) )
+ 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.277 )
"
-BDEPEND="
- >=sys-devel/make-3.81
+
+# += 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
@@ -303,10 +364,15 @@ GPL_REQUIRED_USE="
)
"
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 )
+ vulkan? ( threads )
${GPL_REQUIRED_USE}
${CPU_REQUIRED_USE}"
RESTRICT="
@@ -314,31 +380,61 @@ RESTRICT="
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
+
+ # We need to detect LTO usage before multilib stuff and filter-lto is called (bug #923491)
+ if tc-is-lto ; then
+ # Respect -flto value, e.g -flto=thin
+ local v="$(get-flag flto)"
+ [[ ${v} != -flto ]] && LTO_FLAG="--enable-lto=${v}" || LTO_FLAG="--enable-lto"
+ fi
+ filter-lto
}
multilib_src_configure() {
local myconf=( )
+ # Conditional patch options
+ use soc && myconf+=( --enable-v4l2-request --enable-libudev --enable-sand )
+
local ffuse=( "${FFMPEG_FLAG_MAP[@]}" )
use openssl && myconf+=( --enable-nonfree )
use samba && myconf+=( --enable-version3 )
@@ -378,6 +474,7 @@ multilib_src_configure() {
if use openssl ; then
myconf+=( --disable-gnutls )
+ has_version dev-libs/openssl:0/3 && myconf+=( --enable-version3 )
fi
# (temporarily) disable non-multilib deps
@@ -411,12 +508,17 @@ multilib_src_configure() {
break
done
- # LTO support, bug #566282, bug #754654
- is-flagq "-flto*" && myconf+=( "--enable-lto" )
- filter-flags "-flto*"
+ # LTO support, bug #566282, bug #754654, bug #772854
+ if [[ ${ABI} != x86 && ! -z ${LTO_FLAG} ]]; then
+ myconf+=( ${LTO_FLAG} )
+ fi
# Mandatory configuration
myconf=(
+ --disable-libaribcaption # libaribcaption is not packaged (yet?)
+ --disable-libxeve
+ --disable-libxevd
+ --disable-d3d12va
--enable-avfilter
--disable-stripping
# This is only for hardcoded cflags; those are used in configure checks that may
@@ -431,9 +533,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 )
;;
@@ -450,6 +549,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)" \
@@ -461,6 +561,7 @@ multilib_src_configure() {
--cxx="$(tc-getCXX)" \
--ar="$(tc-getAR)" \
--nm="$(tc-getNM)" \
+ --strip="$(tc-getSTRIP)" \
--ranlib="$(tc-getRANLIB)" \
--pkg-config="$(tc-getPKG_CONFIG)" \
--optflags="${CFLAGS}" \
@@ -469,20 +570,6 @@ multilib_src_configure() {
${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,22 +582,14 @@ 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
+ emake V=1 fate -k
}
multilib_src_install() {
@@ -523,24 +602,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"
+
+ 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-r2.patch b/media-video/ffmpeg/files/chromium-r2.patch
new file mode 100644
index 000000000000..1de86fe09a1e
--- /dev/null
+++ b/media-video/ffmpeg/files/chromium-r2.patch
@@ -0,0 +1,41 @@
+Allow libffmpeg to be built for Chromium-based browsers
+https://patchwork.ffmpeg.org/patch/4500/
+
+NOTE: This patch lacks the Makefile include line. We append it
+manually instead to make patching across different versions easier.
+
+diff --git a/ffbuild/libffmpeg.mak b/ffbuild/libffmpeg.mak
+new file mode 100644
+index 0000000..992cf3c
+--- /dev/null
++++ b/ffbuild/libffmpeg.mak
+@@ -0,0 +1,27 @@
++LIBFFMPEG = $(SLIBPREF)ffmpeg$(SLIBSUF)
++LIBFFMPEG_LINK = $(LD) -shared -Wl,-soname,$(LIBFFMPEG) -Wl,-Bsymbolic -Wl,-z,now -Wl,-z,relro -Wl,-z,defs -Wl,--gc-sections $(LDFLAGS) $(LDLIBFLAGS) -o $(LIBFFMPEG)
++
++ifeq ($(CONFIG_SHARED),yes)
++LIBFFMPEG_DEPS = libavcodec/$(SLIBPREF)avcodec$(SLIBSUF) libavformat/$(SLIBPREF)avformat$(SLIBSUF) libavutil/$(SLIBPREF)avutil$(SLIBSUF)
++else
++LIBFFMPEG_DEPS = libavcodec/$(LIBPREF)avcodec$(LIBSUF) libavformat/$(LIBPREF)avformat$(LIBSUF) libavutil/$(LIBPREF)avutil$(LIBSUF) libswresample/$(LIBPREF)swresample$(LIBSUF)
++endif
++
++$(LIBFFMPEG): $(LIBFFMPEG_DEPS) chromium.o
++ifeq ($(CONFIG_SHARED),yes)
++ $(LIBFFMPEG_LINK) -Wl,--no-as-needed chromium.o -lavcodec -lavformat -lavutil
++else
++ $(LIBFFMPEG_LINK) -Wl,--whole-archive $^ -Wl,--no-whole-archive $(EXTRALIBS-avcodec) $(EXTRALIBS-avformat) $(EXTRALIBS-avutil) $(EXTRALIBS-swresample)
++endif
++
++libffmpeg: $(LIBFFMPEG)
++
++install-libffmpeg: $(LIBFFMPEG)
++ $(Q)mkdir -p "$(SHLIBDIR)/chromium"
++ $(INSTALL) -m 755 $< "$(SHLIBDIR)/chromium/$<"
++ $(STRIP) "$(SHLIBDIR)/chromium/$<"
++
++uninstall-libffmpeg:
++ $(RM) "$(SHLIBDIR)/chromium/$(LIBFFMPEG)"
++
++.PHONY: libffmpeg install-libffmpeg uninstall-libffmpeg
+--
+2.13.1
diff --git a/media-video/ffmpeg/files/chromium.c b/media-video/ffmpeg/files/chromium.c
new file mode 100644
index 000000000000..66c2e9f6614f
--- /dev/null
+++ b/media-video/ffmpeg/files/chromium.c
@@ -0,0 +1,8 @@
+#include "libavformat/avformat.h"
+#include "libavformat/internal.h"
+
+int64_t av_stream_get_first_dts(const AVStream *st);
+int64_t av_stream_get_first_dts(const AVStream *st)
+{
+ return cffstream(st)->first_dts;
+}
diff --git a/media-video/ffmpeg/files/ffmpeg-4.3-altivec-novsx-yuv2rgb.patch b/media-video/ffmpeg/files/ffmpeg-4.3-altivec-novsx-yuv2rgb.patch
deleted file mode 100644
index 40e7f9161726..000000000000
--- a/media-video/ffmpeg/files/ffmpeg-4.3-altivec-novsx-yuv2rgb.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-Fixes build on ppc.
-https://trac.ffmpeg.org/attachment/ticket/8750/ffmpeg_altivec_yuv2rgb_novsx.patch
-diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
-index 536545293d..930ef6b98f 100644
---- a/libswscale/ppc/yuv2rgb_altivec.c
-+++ b/libswscale/ppc/yuv2rgb_altivec.c
-@@ -283,6 +283,16 @@ static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y,
- * ------------------------------------------------------------------------------
- */
-
-+#if !HAVE_VSX
-+static inline vector unsigned char vec_xl(signed long long offset, const ubyte *addr)
-+{
-+ const vector unsigned char *v_addr = (const vector unsigned char *) (addr + offset);
-+ vector unsigned char align_perm = vec_lvsl(offset, addr);
-+
-+ return (vector unsigned char) vec_perm(v_addr[0], v_addr[1], align_perm);
-+}
-+#endif /* !HAVE_VSX */
-+
- #define DEFCSP420_CVT(name, out_pixels) \
- static int altivec_ ## name(SwsContext *c, const unsigned char **in, \
- int *instrides, int srcSliceY, int srcSliceH, \
diff --git a/media-video/ffmpeg/files/ffmpeg-4.3-fix-build-without-SSSE3.patch b/media-video/ffmpeg/files/ffmpeg-4.3-fix-build-without-SSSE3.patch
deleted file mode 100644
index c3e6733160f6..000000000000
--- a/media-video/ffmpeg/files/ffmpeg-4.3-fix-build-without-SSSE3.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-https://bugs.gentoo.org/728566
-http://ffmpeg.org/pipermail/ffmpeg-devel/2020-February/257474.html
-
---- a/libswscale/x86/yuv2rgb.c
-+++ b/libswscale/x86/yuv2rgb.c
-@@ -83,6 +83,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
- #if HAVE_X86ASM
- int cpu_flags = av_get_cpu_flags();
-
-+#if HAVE_SSSE3
- if (EXTERNAL_SSSE3(cpu_flags)) {
- switch (c->dstFormat) {
- case AV_PIX_FMT_RGB32:
-@@ -111,6 +112,7 @@ av_cold SwsFunc ff_yuv2rgb_init_x86(SwsContext *c)
- return yuv420_rgb15_ssse3;
- }
- }
-+#endif
-
- if (EXTERNAL_MMXEXT(cpu_flags)) {
- switch (c->dstFormat) {
-
diff --git a/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch b/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch
deleted file mode 100644
index 691314cbacb8..000000000000
--- a/media-video/ffmpeg/files/ffmpeg-4.3.1-srt-1.4.2-build.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-http://git.videolan.org/?p=ffmpeg.git;a=patch;h=7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315
-https://bugs.gentoo.org/756859
-From 7c59e1b0f285cd7c7b35fcd71f49c5fd52cf9315 Mon Sep 17 00:00:00 2001
-From: Jun Zhao <barryjzhao@tencent.com>
-Date: Sun, 12 Jul 2020 13:48:48 +0800
-Subject: [PATCH] lavf/srt: fix build fail when used the libsrt 1.4.1
-
-libsrt changed the:
-SRTO_SMOOTHER -> SRTO_CONGESTION
-SRTO_STRICTENC -> SRTO_ENFORCEDENCRYPTION
-and removed the front of deprecated options (SRTO_SMOOTHER/SRTO_STRICTENC)
-in the header, it's lead to build fail
-
-fix #8760
-
-Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
----
- libavformat/libsrt.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/libavformat/libsrt.c b/libavformat/libsrt.c
-index 4de575b37c..4719ce0d4b 100644
---- a/libavformat/libsrt.c
-+++ b/libavformat/libsrt.c
-@@ -313,8 +313,12 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
- (s->pbkeylen >= 0 && libsrt_setsockopt(h, fd, SRTO_PBKEYLEN, "SRTO_PBKEYLEN", &s->pbkeylen, sizeof(s->pbkeylen)) < 0) ||
- (s->passphrase && libsrt_setsockopt(h, fd, SRTO_PASSPHRASE, "SRTO_PASSPHRASE", s->passphrase, strlen(s->passphrase)) < 0) ||
- #if SRT_VERSION_VALUE >= 0x010302
-+#if SRT_VERSION_VALUE >= 0x010401
-+ (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_ENFORCEDENCRYPTION, "SRTO_ENFORCEDENCRYPTION", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
-+#else
- /* SRTO_STRICTENC == SRTO_ENFORCEDENCRYPTION (53), but for compatibility, we used SRTO_STRICTENC */
- (s->enforced_encryption >= 0 && libsrt_setsockopt(h, fd, SRTO_STRICTENC, "SRTO_STRICTENC", &s->enforced_encryption, sizeof(s->enforced_encryption)) < 0) ||
-+#endif
- (s->kmrefreshrate >= 0 && libsrt_setsockopt(h, fd, SRTO_KMREFRESHRATE, "SRTO_KMREFRESHRATE", &s->kmrefreshrate, sizeof(s->kmrefreshrate)) < 0) ||
- (s->kmpreannounce >= 0 && libsrt_setsockopt(h, fd, SRTO_KMPREANNOUNCE, "SRTO_KMPREANNOUNCE", &s->kmpreannounce, sizeof(s->kmpreannounce)) < 0) ||
- #endif
-@@ -333,7 +337,11 @@ static int libsrt_set_options_pre(URLContext *h, int fd)
- (s->lossmaxttl >= 0 && libsrt_setsockopt(h, fd, SRTO_LOSSMAXTTL, "SRTO_LOSSMAXTTL", &s->lossmaxttl, sizeof(s->lossmaxttl)) < 0) ||
- (s->minversion >= 0 && libsrt_setsockopt(h, fd, SRTO_MINVERSION, "SRTO_MINVERSION", &s->minversion, sizeof(s->minversion)) < 0) ||
- (s->streamid && libsrt_setsockopt(h, fd, SRTO_STREAMID, "SRTO_STREAMID", s->streamid, strlen(s->streamid)) < 0) ||
-+#if SRT_VERSION_VALUE >= 0x010401
-+ (s->smoother && libsrt_setsockopt(h, fd, SRTO_CONGESTION, "SRTO_CONGESTION", s->smoother, strlen(s->smoother)) < 0) ||
-+#else
- (s->smoother && libsrt_setsockopt(h, fd, SRTO_SMOOTHER, "SRTO_SMOOTHER", s->smoother, strlen(s->smoother)) < 0) ||
-+#endif
- (s->messageapi >= 0 && libsrt_setsockopt(h, fd, SRTO_MESSAGEAPI, "SRTO_MESSAGEAPI", &s->messageapi, sizeof(s->messageapi)) < 0) ||
- (s->payload_size >= 0 && libsrt_setsockopt(h, fd, SRTO_PAYLOADSIZE, "SRTO_PAYLOADSIZE", &s->payload_size, sizeof(s->payload_size)) < 0) ||
- ((h->flags & AVIO_FLAG_WRITE) && libsrt_setsockopt(h, fd, SRTO_SENDER, "SRTO_SENDER", &yes, sizeof(yes)) < 0)) {
---
-2.20.1
-
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-amd-av1-vaapi.patch b/media-video/ffmpeg/files/ffmpeg-4.4.4-amd-av1-vaapi.patch
new file mode 100644
index 000000000000..5f13edf68fca
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.4-amd-av1-vaapi.patch
@@ -0,0 +1,257 @@
+https://bugs.gentoo.org/936310
+https://github.com/getsolus/packages/commit/50b029f7801c2c73da655e7dd5ae826244f9ae2c
+https://gitlab.freedesktop.org/mesa/mesa/-/issues/11533#note_2495206
+
+The backport here is from Solus who resolved a conflict for 4.4.x as it
+doesn't apply cleanly there.
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: David Rosca <nowrep@gmail.com>
+Date: Wed, 8 May 2024 09:11:11 +0200
+Subject: [PATCH 1/2] lavc/vaapi_decode: Make it possible to send multiple
+ slice params buffers
+
+Reviewed-by: Neal Gompa <ngompa13@gmail.com>
+Signed-off-by: David Rosca <nowrep@gmail.com>
+Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
+--- a/libavcodec/vaapi_av1.c
++++ b/libavcodec/vaapi_av1.c
+@@ -419,7 +419,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ .tg_end = s->tg_end,
+ };
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param,
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
+ sizeof(VASliceParameterBufferAV1),
+ buffer,
+ size);
+--- a/libavcodec/vaapi_decode.c
++++ b/libavcodec/vaapi_decode.c
+@@ -59,6 +59,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
+ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+ VAAPIDecodePicture *pic,
+ const void *params_data,
++ int nb_params,
+ size_t params_size,
+ const void *slice_data,
+ size_t slice_size)
+@@ -87,7 +88,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+
+ vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
+ VASliceParameterBufferType,
+- params_size, 1, (void*)params_data,
++ params_size, nb_params, (void*)params_data,
+ &pic->slice_buffers[index]);
+ if (vas != VA_STATUS_SUCCESS) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to create slice "
+--- a/libavcodec/vaapi_decode.h
++++ b/libavcodec/vaapi_decode.h
+@@ -86,6 +86,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
+ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+ VAAPIDecodePicture *pic,
+ const void *params_data,
++ int nb_params,
+ size_t params_size,
+ const void *slice_data,
+ size_t slice_size);
+--- a/libavcodec/vaapi_h264.c
++++ b/libavcodec/vaapi_h264.c
+@@ -375,7 +375,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
+ slice_param.chroma_offset_l1);
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_hevc.c
++++ b/libavcodec/vaapi_hevc.c
+@@ -305,7 +305,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
+ if (pic->last_size) {
+ last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1;
+ ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
+- &pic->last_slice_param, slice_param_size,
++ &pic->last_slice_param, 1, slice_param_size,
+ pic->last_buffer, pic->last_size);
+ if (ret < 0)
+ goto fail;
+@@ -410,7 +410,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
+
+ if (!sh->first_slice_in_pic_flag) {
+ err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
+- &pic->last_slice_param, slice_param_size,
++ &pic->last_slice_param, 1, slice_param_size,
+ pic->last_buffer, pic->last_size);
+ pic->last_buffer = NULL;
+ pic->last_size = 0;
+--- a/libavcodec/vaapi_mjpeg.c
++++ b/libavcodec/vaapi_mjpeg.c
+@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
+ sp.components[i].ac_table_selector = s->ac_index[i];
+ }
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size);
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size);
+ if (err)
+ goto fail;
+
+--- a/libavcodec/vaapi_mpeg2.c
++++ b/libavcodec/vaapi_mpeg2.c
+@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_mpeg4.c
++++ b/libavcodec/vaapi_mpeg4.c
+@@ -167,7 +167,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_vc1.c
++++ b/libavcodec/vaapi_vc1.c
+@@ -490,7 +490,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_vp8.c
++++ b/libavcodec/vaapi_vp8.c
+@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx,
+ for (i = 0; i < 8; i++)
+ sp.partition_size[i+1] = s->coeff_partition_size[i];
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size);
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size);
+ if (err)
+ goto fail;
+
+--- a/libavcodec/vaapi_vp9.c
++++ b/libavcodec/vaapi_vp9.c
+@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
+ }
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err) {
+ ff_vaapi_decode_cancel(avctx, pic);
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: David Rosca <nowrep@gmail.com>
+Date: Wed, 8 May 2024 09:11:13 +0200
+Subject: [PATCH 2/2] lavc/vaapi_av1: Avoid sending the same slice buffer
+ multiple times
+
+When there are multiple tiles in one slice buffer, use multiple slice
+params to avoid sending the same slice buffer multiple times and thus
+increasing the bitstream size the driver will need to upload to hw.
+
+Reviewed-by: Neal Gompa <ngompa13@gmail.com>
+Signed-off-by: David Rosca <nowrep@gmail.com>
+Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
+--- a/libavcodec/vaapi_av1.c
++++ b/libavcodec/vaapi_av1.c
+@@ -19,6 +19,8 @@
+ */
+
+ #include "libavutil/pixdesc.h"
++#include "libavutil/frame.h"
++#include "libavutil/mem.h"
+ #include "hwconfig.h"
+ #include "vaapi_decode.h"
+ #include "internal.h"
+@@ -41,6 +43,9 @@ typedef struct VAAPIAV1DecContext {
+ */
+ VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES];
+ ThreadFrame tmp_frame;
++
++ int nb_slice_params;
++ VASliceParameterBufferAV1 *slice_params;
+ } VAAPIAV1DecContext;
+
+ static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
+@@ -107,6 +112,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx)
+ av_frame_free(&ctx->ref_tab[i].frame.f);
+ }
+
++ av_freep(&ctx->slice_params);
++
+ return ff_vaapi_decode_uninit(avctx);
+ }
+
+@@ -403,13 +410,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ {
+ const AV1DecContext *s = avctx->priv_data;
+ VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
+- VASliceParameterBufferAV1 slice_param;
+- int err = 0;
++ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
++ int err, nb_params;
++
++ nb_params = s->tg_end - s->tg_start + 1;
++ if (ctx->nb_slice_params < nb_params) {
++ ctx->slice_params = av_realloc_array(ctx->slice_params,
++ nb_params,
++ sizeof(*ctx->slice_params));
++ if (!ctx->slice_params) {
++ ctx->nb_slice_params = 0;
++ err = AVERROR(ENOMEM);
++ goto fail;
++ }
++ ctx->nb_slice_params = nb_params;
++ }
+
+ for (int i = s->tg_start; i <= s->tg_end; i++) {
+- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1));
+-
+- slice_param = (VASliceParameterBufferAV1) {
++ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) {
+ .slice_data_size = s->tile_group_info[i].tile_size,
+ .slice_data_offset = s->tile_group_info[i].tile_offset,
+ .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
+@@ -418,18 +436,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ .tg_start = s->tg_start,
+ .tg_end = s->tg_end,
+ };
+-
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
+- sizeof(VASliceParameterBufferAV1),
+- buffer,
+- size);
+- if (err) {
+- ff_vaapi_decode_cancel(avctx, pic);
+- return err;
+- }
+ }
+
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params,
++ sizeof(VASliceParameterBufferAV1),
++ buffer,
++ size);
++ if (err)
++ goto fail;
++
+ return 0;
++
++fail:
++ ff_vaapi_decode_cancel(avctx, pic);
++ return err;
+ }
+
+ const AVHWAccel ff_av1_vaapi_hwaccel = {
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-4.4.5-incmptbl-pntr-types.patch b/media-video/ffmpeg/files/ffmpeg-4.4.5-incmptbl-pntr-types.patch
new file mode 100644
index 000000000000..a47a62917a29
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-4.4.5-incmptbl-pntr-types.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/936433
+
+diff --git a/libavutil/hwcontext_vaapi.c b/libavutil/hwcontext_vaapi.c
+index 4b81bd1..4e7f49f 100644
+--- a/libavutil/hwcontext_vaapi.c
++++ b/libavutil/hwcontext_vaapi.c
+@@ -1032,7 +1032,7 @@ static int vaapi_map_from_drm(AVHWFramesContext *src_fc, AVFrame *dst,
+ uint32_t va_fourcc;
+ int err, i, j, k;
+
+- unsigned long buffer_handle;
++ uintptr_t buffer_handle;
+ VASurfaceAttribExternalBuffers buffer_desc;
+ VASurfaceAttrib attrs[2] = {
+ {
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-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.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-amd-av1-vaapi.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-amd-av1-vaapi.patch
new file mode 100644
index 000000000000..41dc17353510
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-amd-av1-vaapi.patch
@@ -0,0 +1,254 @@
+https://bugs.gentoo.org/936310
+https://gitlab.freedesktop.org/mesa/mesa/-/issues/11533
+https://github.com/FFmpeg/FFmpeg/commit/fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c
+https://github.com/FFmpeg/FFmpeg/commit/d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba
+
+From fe9d889dcd79ea18d4dfaa39df4ddbd4c8c3b15c Mon Sep 17 00:00:00 2001
+From: David Rosca <nowrep@gmail.com>
+Date: Wed, 8 May 2024 09:11:11 +0200
+Subject: [PATCH] lavc/vaapi_decode: Make it possible to send multiple slice
+ params buffers
+
+Reviewed-by: Neal Gompa <ngompa13@gmail.com>
+Signed-off-by: David Rosca <nowrep@gmail.com>
+Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
+--- a/libavcodec/vaapi_av1.c
++++ b/libavcodec/vaapi_av1.c
+@@ -409,7 +409,7 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ .tg_end = s->tg_end,
+ };
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param,
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
+ sizeof(VASliceParameterBufferAV1),
+ buffer,
+ size);
+--- a/libavcodec/vaapi_decode.c
++++ b/libavcodec/vaapi_decode.c
+@@ -63,6 +63,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
+ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+ VAAPIDecodePicture *pic,
+ const void *params_data,
++ int nb_params,
+ size_t params_size,
+ const void *slice_data,
+ size_t slice_size)
+@@ -88,7 +89,7 @@ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+
+ vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context,
+ VASliceParameterBufferType,
+- params_size, 1, (void*)params_data,
++ params_size, nb_params, (void*)params_data,
+ &pic->slice_buffers[index]);
+ if (vas != VA_STATUS_SUCCESS) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to create slice "
+--- a/libavcodec/vaapi_decode.h
++++ b/libavcodec/vaapi_decode.h
+@@ -73,6 +73,7 @@ int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx,
+ int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx,
+ VAAPIDecodePicture *pic,
+ const void *params_data,
++ int nb_params,
+ size_t params_size,
+ const void *slice_data,
+ size_t slice_size);
+--- a/libavcodec/vaapi_h264.c
++++ b/libavcodec/vaapi_h264.c
+@@ -375,7 +375,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
+ slice_param.chroma_offset_l1);
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_hevc.c
++++ b/libavcodec/vaapi_hevc.c
+@@ -353,7 +353,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx)
+ if (pic->last_size) {
+ last_slice_param->LongSliceFlags.fields.LastSliceOfPic = 1;
+ ret = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
+- &pic->last_slice_param, slice_param_size,
++ &pic->last_slice_param, 1, slice_param_size,
+ pic->last_buffer, pic->last_size);
+ if (ret < 0)
+ goto fail;
+@@ -471,7 +471,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
+
+ if (!sh->first_slice_in_pic_flag) {
+ err = ff_vaapi_decode_make_slice_buffer(avctx, &pic->pic,
+- &pic->last_slice_param, slice_param_size,
++ &pic->last_slice_param, 1, slice_param_size,
+ pic->last_buffer, pic->last_size);
+ pic->last_buffer = NULL;
+ pic->last_size = 0;
+--- a/libavcodec/vaapi_mjpeg.c
++++ b/libavcodec/vaapi_mjpeg.c
+@@ -131,7 +131,7 @@ static int vaapi_mjpeg_decode_slice(AVCodecContext *avctx,
+ sp.components[i].ac_table_selector = s->ac_index[i];
+ }
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), buffer, size);
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), buffer, size);
+ if (err)
+ goto fail;
+
+--- a/libavcodec/vaapi_mpeg2.c
++++ b/libavcodec/vaapi_mpeg2.c
+@@ -162,7 +162,7 @@ static int vaapi_mpeg2_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_mpeg4.c
++++ b/libavcodec/vaapi_mpeg4.c
+@@ -169,7 +169,7 @@ static int vaapi_mpeg4_decode_slice(AVCodecContext *avctx, const uint8_t *buffer
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_vc1.c
++++ b/libavcodec/vaapi_vc1.c
+@@ -490,7 +490,7 @@ static int vaapi_vc1_decode_slice(AVCodecContext *avctx, const uint8_t *buffer,
+ };
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err < 0) {
+ ff_vaapi_decode_cancel(avctx, pic);
+--- a/libavcodec/vaapi_vp8.c
++++ b/libavcodec/vaapi_vp8.c
+@@ -209,7 +209,7 @@ static int vaapi_vp8_decode_slice(AVCodecContext *avctx,
+ for (i = 0; i < 8; i++)
+ sp.partition_size[i+1] = s->coeff_partition_size[i];
+
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, sizeof(sp), data, data_size);
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &sp, 1, sizeof(sp), data, data_size);
+ if (err)
+ goto fail;
+
+--- a/libavcodec/vaapi_vp9.c
++++ b/libavcodec/vaapi_vp9.c
+@@ -158,7 +158,7 @@ static int vaapi_vp9_decode_slice(AVCodecContext *avctx,
+ }
+
+ err = ff_vaapi_decode_make_slice_buffer(avctx, pic,
+- &slice_param, sizeof(slice_param),
++ &slice_param, 1, sizeof(slice_param),
+ buffer, size);
+ if (err) {
+ ff_vaapi_decode_cancel(avctx, pic);
+
+From d2d911eb9a2fc6eb8d86b3ae025a56c1a2692fba Mon Sep 17 00:00:00 2001
+From: David Rosca <nowrep@gmail.com>
+Date: Wed, 8 May 2024 09:11:13 +0200
+Subject: [PATCH] lavc/vaapi_av1: Avoid sending the same slice buffer multiple
+ times
+
+When there are multiple tiles in one slice buffer, use multiple slice
+params to avoid sending the same slice buffer multiple times and thus
+increasing the bitstream size the driver will need to upload to hw.
+
+Reviewed-by: Neal Gompa <ngompa13@gmail.com>
+Signed-off-by: David Rosca <nowrep@gmail.com>
+Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
+--- a/libavcodec/vaapi_av1.c
++++ b/libavcodec/vaapi_av1.c
+@@ -19,6 +19,7 @@
+ */
+
+ #include "libavutil/frame.h"
++#include "libavutil/mem.h"
+ #include "hwaccel_internal.h"
+ #include "vaapi_decode.h"
+ #include "internal.h"
+@@ -42,6 +43,9 @@ typedef struct VAAPIAV1DecContext {
+ */
+ VAAPIAV1FrameRef ref_tab[AV1_NUM_REF_FRAMES];
+ AVFrame *tmp_frame;
++
++ int nb_slice_params;
++ VASliceParameterBufferAV1 *slice_params;
+ } VAAPIAV1DecContext;
+
+ static VASurfaceID vaapi_av1_surface_id(AV1Frame *vf)
+@@ -97,6 +101,8 @@ static int vaapi_av1_decode_uninit(AVCodecContext *avctx)
+ for (int i = 0; i < FF_ARRAY_ELEMS(ctx->ref_tab); i++)
+ av_frame_free(&ctx->ref_tab[i].frame);
+
++ av_freep(&ctx->slice_params);
++
+ return ff_vaapi_decode_uninit(avctx);
+ }
+
+@@ -393,13 +399,24 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ {
+ const AV1DecContext *s = avctx->priv_data;
+ VAAPIDecodePicture *pic = s->cur_frame.hwaccel_picture_private;
+- VASliceParameterBufferAV1 slice_param;
+- int err = 0;
++ VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data;
++ int err, nb_params;
++
++ nb_params = s->tg_end - s->tg_start + 1;
++ if (ctx->nb_slice_params < nb_params) {
++ ctx->slice_params = av_realloc_array(ctx->slice_params,
++ nb_params,
++ sizeof(*ctx->slice_params));
++ if (!ctx->slice_params) {
++ ctx->nb_slice_params = 0;
++ err = AVERROR(ENOMEM);
++ goto fail;
++ }
++ ctx->nb_slice_params = nb_params;
++ }
+
+ for (int i = s->tg_start; i <= s->tg_end; i++) {
+- memset(&slice_param, 0, sizeof(VASliceParameterBufferAV1));
+-
+- slice_param = (VASliceParameterBufferAV1) {
++ ctx->slice_params[i - s->tg_start] = (VASliceParameterBufferAV1) {
+ .slice_data_size = s->tile_group_info[i].tile_size,
+ .slice_data_offset = s->tile_group_info[i].tile_offset,
+ .slice_data_flag = VA_SLICE_DATA_FLAG_ALL,
+@@ -408,18 +425,20 @@ static int vaapi_av1_decode_slice(AVCodecContext *avctx,
+ .tg_start = s->tg_start,
+ .tg_end = s->tg_end,
+ };
+-
+- err = ff_vaapi_decode_make_slice_buffer(avctx, pic, &slice_param, 1,
+- sizeof(VASliceParameterBufferAV1),
+- buffer,
+- size);
+- if (err) {
+- ff_vaapi_decode_cancel(avctx, pic);
+- return err;
+- }
+ }
+
++ err = ff_vaapi_decode_make_slice_buffer(avctx, pic, ctx->slice_params, nb_params,
++ sizeof(VASliceParameterBufferAV1),
++ buffer,
++ size);
++ if (err)
++ goto fail;
++
+ return 0;
++
++fail:
++ ff_vaapi_decode_cancel(avctx, pic);
++ return err;
+ }
+
+ const FFHWAccel ff_av1_vaapi_hwaccel = {
diff --git a/media-video/ffmpeg/files/ffmpeg-6.1.1-memory-leak.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-memory-leak.patch
new file mode 100644
index 000000000000..d02522b3a3a4
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-memory-leak.patch
@@ -0,0 +1,129 @@
+https://bugs.gentoo.org/931059
+https://ffmpeg.org//pipermail/ffmpeg-devel/2024-May/326569.html
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=670c823406612697b394d4933e03d3e1a176474f
+https://git.videolan.org/?p=ffmpeg.git;a=commit;h=1606aab99bd84f0040fb0fa6ccccb092941f01ec
+
+From 670c823406612697b394d4933e03d3e1a176474f Mon Sep 17 00:00:00 2001
+From: Paul B Mahol <onemda@gmail.com>
+Date: Fri, 27 Oct 2023 14:26:50 +0200
+Subject: [PATCH] avfilter/buffersrc: switch to activate
+
+Fixes OOM when caller keeps adding frames into filtergraph
+that reached EOF by other means, for example EOF is signalled
+by other filter in filtergraph or by buffersink.
+
+(cherry picked from commit 84e400ae37b1e2849a3ead399ef86c808356cdd6)
+--- a/libavfilter/buffersrc.c
++++ b/libavfilter/buffersrc.c
+@@ -36,6 +36,7 @@
+ #include "audio.h"
+ #include "avfilter.h"
+ #include "buffersrc.h"
++#include "filters.h"
+ #include "formats.h"
+ #include "internal.h"
+ #include "video.h"
+@@ -194,7 +195,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
+ if (!frame)
+ return av_buffersrc_close(ctx, s->last_pts, flags);
+ if (s->eof)
+- return AVERROR(EINVAL);
++ return AVERROR_EOF;
+
+ s->last_pts = frame->pts + frame->duration;
+
+@@ -484,21 +485,28 @@ static int config_props(AVFilterLink *link)
+ return 0;
+ }
+
+-static int request_frame(AVFilterLink *link)
++static int activate(AVFilterContext *ctx)
+ {
+- BufferSourceContext *c = link->src->priv;
++ AVFilterLink *outlink = ctx->outputs[0];
++ BufferSourceContext *c = ctx->priv;
+
+- if (c->eof)
+- return AVERROR_EOF;
++ if (!c->eof && ff_outlink_get_status(outlink)) {
++ c->eof = 1;
++ return 0;
++ }
++
++ if (c->eof) {
++ ff_outlink_set_status(outlink, AVERROR_EOF, c->last_pts);
++ return 0;
++ }
+ c->nb_failed_requests++;
+- return AVERROR(EAGAIN);
++ return FFERROR_NOT_READY;
+ }
+
+ static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+- .request_frame = request_frame,
+ .config_props = config_props,
+ },
+ };
+@@ -507,7 +515,7 @@ const AVFilter ff_vsrc_buffer = {
+ .name = "buffer",
+ .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
+ .priv_size = sizeof(BufferSourceContext),
+-
++ .activate = activate,
+ .init = init_video,
+ .uninit = uninit,
+
+@@ -521,7 +529,6 @@ static const AVFilterPad avfilter_asrc_abuffer_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_AUDIO,
+- .request_frame = request_frame,
+ .config_props = config_props,
+ },
+ };
+@@ -530,7 +537,7 @@ const AVFilter ff_asrc_abuffer = {
+ .name = "abuffer",
+ .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
+ .priv_size = sizeof(BufferSourceContext),
+-
++ .activate = activate,
+ .init = init_audio,
+ .uninit = uninit,
+
+--
+2.30.2
+
+From 1606aab99bd84f0040fb0fa6ccccb092941f01ec Mon Sep 17 00:00:00 2001
+From: Paul B Mahol <onemda@gmail.com>
+Date: Fri, 1 Dec 2023 16:59:07 +0100
+Subject: [PATCH] avfilter/avfilter: fix OOM case for default activate
+
+Fixes OOM when caller keeps adding frames into filtergraph
+that reached EOF by other means, for example EOF is signalled
+by other filter in filtergraph or by buffersink.
+
+(cherry picked from commit d9e41ead82263e96ebd14d4d88d6e7f858dd944c)
+--- a/libavfilter/avfilter.c
++++ b/libavfilter/avfilter.c
+@@ -1167,6 +1167,16 @@ static int ff_filter_activate_default(AVFilterContext *filter)
+ {
+ unsigned i;
+
++ for (i = 0; i < filter->nb_outputs; i++) {
++ int ret = filter->outputs[i]->status_in;
++
++ if (ret) {
++ for (int j = 0; j < filter->nb_inputs; j++)
++ ff_inlink_set_status(filter->inputs[j], ret);
++ return 0;
++ }
++ }
++
+ for (i = 0; i < filter->nb_inputs; i++) {
+ if (samples_ready(filter->inputs[i], filter->inputs[i]->min_samples)) {
+ return ff_filter_frame_to_filter(filter->inputs[i]);
+--
+2.30.2
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/ffmpeg-6.1.1-wint-inconversion-libgcrypt.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-wint-inconversion-libgcrypt.patch
new file mode 100644
index 000000000000..d27240ffc557
--- /dev/null
+++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-wint-inconversion-libgcrypt.patch
@@ -0,0 +1,68 @@
+https://bugs.gentoo.org/935377
+https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/42982b5a5d461530a792e69b3e8abdd9d6d67052
+
+From 42982b5a5d461530a792e69b3e8abdd9d6d67052 Mon Sep 17 00:00:00 2001
+From: Frank Plowman <post@frankplowman.com>
+Date: Fri, 22 Dec 2023 12:00:01 +0000
+Subject: [PATCH 1/1] avformat/ffrtmpcrypt: Fix int-conversion warning
+MIME-Version: 1.0
+Content-Type: text/plain; charset=utf8
+Content-Transfer-Encoding: 8bit
+
+The gcrypt definition of `bn_new` used to use the return statement
+on errors, with an AVERROR return value, regardless of the signature
+of the function where the macro is used - it is called in
+`dh_generate_key` and `ff_dh_init` which return pointers. As a result,
+compiling with gcrypt and the ffrtmpcrypt protocol resulted in an
+int-conversion warning. GCC 14 may upgrade these to errors [1].
+
+This patch fixes the problem by changing the macro to remove `AVERROR`
+and instead set `bn` to null if the allocation fails. This is the
+behaviour of all the other `bn_new` implementations and so the result is
+already checked at all the callsites. AFAICT, this should be the only
+change needed to get ffmpeg off Fedora's naughty list of projects with
+warnings which may be upgraded to errors in GCC 14 [2].
+
+[1]: https://gcc.gnu.org/pipermail/gcc/2023-May/241264.html
+[2]: https://www.mail-archive.com/devel@lists.fedoraproject.org/msg196024.html
+
+Signed-off-by: Frank Plowman <post@frankplowman.com>
+Signed-off-by: Martin Storsjö <martin@martin.st>
+---
+ libavformat/rtmpdh.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
+index 5ddae537a1..6a6c2ccd87 100644
+--- a/libavformat/rtmpdh.c
++++ b/libavformat/rtmpdh.c
+@@ -113,15 +113,18 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p)
+ return 0;
+ }
+ #elif CONFIG_GCRYPT
+-#define bn_new(bn) \
+- do { \
+- if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \
+- if (!gcry_check_version("1.5.4")) \
+- return AVERROR(EINVAL); \
+- gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \
+- gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \
+- } \
+- bn = gcry_mpi_new(1); \
++#define bn_new(bn) \
++ do { \
++ if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \
++ if (gcry_check_version("1.5.4")) { \
++ gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \
++ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \
++ } \
++ } \
++ if (gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) \
++ bn = gcry_mpi_new(1); \
++ else \
++ bn = NULL; \
+ } while (0)
+ #define bn_free(bn) gcry_mpi_release(bn)
+ #define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w)
+--
+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 be0716e194db..09dba7627ec5 100644
--- a/media-video/ffmpeg/metadata.xml
+++ b/media-video/ffmpeg/metadata.xml
@@ -1,70 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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="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="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="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="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 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="vulkan">Enables support for the vulkan API for GPU offload.</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="libdvdnav">Uses <pkg>media-libs/libdvdnav</pkg> to enable DVD demuxing</flag>
+ <flag name="libdvdread">Uses <pkg>media-libs/libdvdread</pkg> to enable DVD demuxing</flag>
+ <flag name="libilbc">Enables iLBC de/encoding via <pkg>media-libs/libilbc</pkg>.</flag>
+ <flag name="liblc3">Enables LC3 de/encoding via <pkg>media-sound/liblc3</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="qrcode">Enables QR encode generation via <pkg>media-gfx/qrencode</pkg></flag>
+ <flag name="quirc">Enables QR decoding via <pkg>media-libs/quirc</pkg></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>