diff --git a/media-video/ffmpeg/Manifest b/media-video/ffmpeg/Manifest new file mode 100644 index 0000000..1af261c --- /dev/null +++ b/media-video/ffmpeg/Manifest @@ -0,0 +1,18 @@ +AUX chromium-r2.patch 1602 BLAKE2B e3f5441dfb3b8b6975da9dc6c1283c814fae24d0c373b86a2b6b8706d7169a63504f258fcef57c28f738aa7dba0b1f3186afebe45e13e1ab14b7538bdeb1b86e SHA512 31ff29d8fdf91cb4151a6a32902aaac55bb0062383619a655db20351582a88c487da528c6cf319717e4f39a140e3721de9d499c3e96ca0ea231aa4651f41ed9d +AUX chromium.c 215 BLAKE2B 2b5149d401433a362149cd4ff020cdc2217388e3ecac4aef86e7a46c7abb0d13a050eb61eab859578ecb9682e075451e2ccf7c2bda5c7ec397f71b9d06c1cf48 SHA512 552ef0a6316e743be717bdb8f49b69ab0b2acda828ff87f581aaf816d403ff59d5153a57f0bfd3b64e37a4fb8d261f0449b520b7e26feb7fd444cb480dc895b5 +AUX ffmpeg-4.4.5-binutils-2.43-arm.patch 1999 BLAKE2B 89d9ed274ea6e637424b4e83e5029b6a90140bcebf577e2b9eab5e2a7c803f5a78a06f0d794ef797733c0bc3c50c9446a38f783b6a7ca84b23e117c71b792e4e SHA512 33eff894a68fe46d2440f3ada9f1d016949119028d3e9b2f8b2ec428fa255a31d4f2b72a5fc9dd91abe06d20728d58221bd9b9e3f921f5b5b43d286ebe4c0f65 +AUX ffmpeg-6.0-fix-lto-type-mismatch.patch 1782 BLAKE2B 4cafd0244136c645e8da072b21c906fba97579f667e57f678b450410759fddc834e5a2428b7d0f078130cfc7ab267cad82a46d369951efddcfc5853dd2118837 SHA512 170114d57af0a0b5fc5da71ae76f4725b8cf1a604b5eca10e60761ef22fb0cdb35a166d1dd5ebc4ef990c383e1d1331f8ef2ceccb8dc7bf4adcc7e9ebb2ba899 +AUX ffmpeg-6.0.1-alignment.patch 5048 BLAKE2B 9a9345b84b68442c97258a71b49ed773e40d985ea8f2525a8749a7562d787634ff0b0e5e1d257e94f7cf68fab81790ca2f0b64cfcb27453e1e6912de30c560e9 SHA512 575b71b2d69b0c7b4e0498b9375dad55945adc7178c72ed5fd12addeae3ffb0081ab59d743a2a6da1a3b67d84642c7dd3d04e2fdb9ae2d992968ba52aa1aee41 +AUX ffmpeg-6.1-gcc-14.patch 523 BLAKE2B b82fc06a7eee0c7ab68ef78f3ac205f45a68a7799dc241f0a574afa48e4dbd477c0d67f7c5a7ff46971adc821ef1507f4957156200167a2c59f8c7f7867ac048 SHA512 092cd9bad652ab82c3b160a37c0c92b561577d56b33776e30b79b7abf487fffeb1ef1273b950c4d4eff62d3cd7fec2a6dc2c294285b0b32eda364e47834a4ff9 +AUX ffmpeg-6.1-opencl-parallel-gmake-fix.patch 370 BLAKE2B 46afba747d26105e5520389016aa8cc73ebc1425095e7818e0c2e23ff66b822a5428fec8253a6b545456bd94d0e746ed24bc014a7fa25d97b6fc4acf753341d4 SHA512 82b16798e63736dc67ad03e62eb31c7d3653d2e53a775a0a4456e01985da2336ebde587d3acd2272065c5ce82be528ebc051cd6c121832829d7cd0ed2aba3fdd +AUX ffmpeg-6.1-wint-conversion.patch 3514 BLAKE2B fcb65b882af964a8f45f71ea3f885fc016e3f89c3d6f0bd6d661d489715c0f746e763a86c6ade1515e212b01559d90ea9c2a97c965e0c0f9087b8396cdd58414 SHA512 7e09fc1a811a21aee9eef0370e57a37817652229a6b0e58cd2e8723e8336124396fe40f6a7c6c5f860046410596027d27d900371ff86609b86ef94dd0633977f +AUX ffmpeg-6.1.1-amd-av1-vaapi.patch 11069 BLAKE2B f30d00fd00215b8753ba720bde8b040f03fadb9ae6d1e3ebf98ae20564104a55aa220ac91ab082e3086943677a9be6d8b709170765605ecb681458ad215e44d9 SHA512 cf8127f3e50c28824367ca489568eb1e8ff11207291b2354d4bf8027a2bc4a884e24e76bad4fd023cf80268c04e0893f3d6d1fbd8ccf4b9c5e69b74ae41775d4 +AUX ffmpeg-6.1.1-incmptbl-pntr-types.patch 2314 BLAKE2B cfd05bdec613ec3c7c7a57f294b2d56959bb062eb2bfac8f799784bf913601b7a455d7e8d706054b32ac94c894773edc37417ac022cbbd64f5faca53c0193118 SHA512 c3b4abca88d831ddfefd9639fb26df636ba0fb0f5a502c30fe26d0672b8a3e0168af098647c0204c56857b46fa22add3c880bef737592a6c35f85f191eabafd4 +AUX ffmpeg-6.1.1-wint-inconversion-libgcrypt.patch 3442 BLAKE2B 21d441dd39595c13b7be7407c774a9e3a9d4ae8b2334aeed79d2fa5b88f4c637665b782b0705fabe6283062549138453fb01d1c1d4bbcd799474a7590e59ed75 SHA512 aa8c0c259e7ab98afd608e4c2167eebe4e373000713c84a2052b9836cd04a029d6123bc1ce27a84589048ee3634ab8b30a8e501ff48394d3fccf9f13c85273af +AUX ffmpeg-6.1.1-wint-inconversion-vulkan.patch 1565 BLAKE2B 275132b55cdd9b6e1671dc2db5cf5aea1b6198d0942f2ecda5078902ad62172742bf29e17ba63847133b7eb3ff93ccb832ad92e7a7c42ab8c8cc917e964be888 SHA512 fef857daa13fe2b146d22764ede340ccf348d21beda5db4635273c37e22acb054e9d000466fd06b057c97187ba406e5fb08b929808b49e64d67ffcfa0e459a9e +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-rpi-6.1-r3.patch 800738 BLAKE2B b7e449ee5eec8b50a3b3bba233c5269f3b6845dbd18a619b844c841a97345ce24c7a5d7f4da05b08e3cb49668426b9044f3d3553d9c2ef3a50aec7199bfa3c09 SHA512 aeaf12afabf5f2192fb0b6ef47397d8477b109e49cee8c02a890d1656a27b1985c62c719ef72966d8c97b0709918233b65ea2e0ef988771507e4be137fcd9158 +DIST ffmpeg-rpi-6.1-r3.patch.asc 833 BLAKE2B 31fd5823c06d5884f7b0980de9072c35bbf4e1d6c0ed20b089439325d50956127238ca29469b003dba623b888a5aae3c4d8ad177862534e77b8e51f29cbed96c SHA512 3d8943b7151e20f73e9c14b121c501847bd7e01f2cf57ff135fc8c223653ec9d433bfe4012fa564f70c0471980b66d7ec3d9b5b1b14865187187719ba110cb5f +EBUILD ffmpeg-6.1.2.ebuild 20422 BLAKE2B e97868eb815439d994a4a80018eaeca23e9e25a18b58cb841710e560ed0467bc54ffeeba7a18257d8f91a6e948f52a382519cd7f7caf34b467d1a8d6c56bde4e SHA512 40dec5943ce7641360d6500df8f5843f863064b75d074b0b2e948449c592f761634c9c2064ec7b6b2854ec07b1e4d003b0c6c11fcee729ec6c3e5ea9a0e4ee81 +MISC metadata.xml 9814 BLAKE2B fa834051d2c63e0175e397e0ab861aca6f069a717791882d95abb37c1e94ed452660b6529d0882f339e0370ff6e9108ad6a3f16d776fc0794b9a9e3529dbbfa6 SHA512 75cc92b385425524791ff1591716b2f0417c741c955d1ca4d6d2c3e05adfe4aa934e0399cc244636a314522e542e0f3f172b016dbe6fb97e9ad96968b7d64852 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 0000000..2b00c26 --- /dev/null +++ b/media-video/ffmpeg/ffmpeg-6.1.2.ebuild @@ -0,0 +1,617 @@ +# Copyright 1999-2025 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? ( >=llvm-core/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 + "${FILESDIR}"/${PN}-6.1.1-wint-inconversion-vulkan.patch + "${FILESDIR}"/${PN}-6.1.1-incmptbl-pntr-types.patch + "${FILESDIR}"/${PN}-4.4.5-binutils-2.43-arm.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) + ) + + if use elibc_musl ; then + append-cflags -D__musl__ + fi + + # 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" +} diff --git a/media-video/ffmpeg/files/chromium-r2.patch b/media-video/ffmpeg/files/chromium-r2.patch new file mode 100644 index 0000000..1de86fe --- /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 0000000..66c2e9f --- /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.4.5-binutils-2.43-arm.patch b/media-video/ffmpeg/files/ffmpeg-4.4.5-binutils-2.43-arm.patch new file mode 100644 index 0000000..7ce8e0a --- /dev/null +++ b/media-video/ffmpeg/files/ffmpeg-4.4.5-binutils-2.43-arm.patch @@ -0,0 +1,60 @@ +https://bugs.gentoo.org/942790 +https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/654bd47716c4f36719fb0f3f7fd8386d5ed0b916 + +From 654bd47716c4f36719fb0f3f7fd8386d5ed0b916 Mon Sep 17 00:00:00 2001 +From: Ross Burton +Date: Fri, 9 Aug 2024 11:32:00 +0100 +Subject: [PATCH] libavcodec/arm/mlpdsp_armv5te: fix label format to work with + binutils 2.43 +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf8 +Content-Transfer-Encoding: 8bit + +binutils 2.43 has stricter validation for labels[1] and results in errors +when building ffmpeg for armv5: + +src/libavcodec/arm/mlpdsp_armv5te.S:232: Error: junk at end of line, first unrecognized character is `0' + +Remove the leading zero in the "01" label to resolve this error. + +[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b + +Signed-off-by: Ross Burton +Signed-off-by: Martin Storsjö +--- + libavcodec/arm/mlpdsp_armv5te.S | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/arm/mlpdsp_armv5te.S b/libavcodec/arm/mlpdsp_armv5te.S +index 4f9aa485fd..d31568611c 100644 +--- a/libavcodec/arm/mlpdsp_armv5te.S ++++ b/libavcodec/arm/mlpdsp_armv5te.S +@@ -229,7 +229,7 @@ A .endif + .endif + + // Begin loop +-01: ++1: + .if TOTAL_TAPS == 0 + // Things simplify a lot in this case + // In fact this could be pipelined further if it's worth it... +@@ -241,7 +241,7 @@ A .endif + str ST0, [PST, #-4]! + str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)] + str ST0, [PSAMP], #4 * MAX_CHANNELS +- bne 01b ++ bne 1b + .else + .if \fir_taps & 1 + .set LOAD_REG, 1 +@@ -333,7 +333,7 @@ T orr AC0, AC0, AC1 + str ST3, [PST, #-4]! + str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)] + str ST3, [PSAMP], #4 * MAX_CHANNELS +- bne 01b ++ bne 1b + .endif + b 99f + +-- +2.25.1 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 0000000..9cc2dd7 --- /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 +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 +Signed-off-by: Anton Khirnov +--- 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.1-alignment.patch b/media-video/ffmpeg/files/ffmpeg-6.0.1-alignment.patch new file mode 100644 index 0000000..256feab --- /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 +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.1-gcc-14.patch b/media-video/ffmpeg/files/ffmpeg-6.1-gcc-14.patch new file mode 100644 index 0000000..0db7301 --- /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 0000000..271a189 --- /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 < +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 +--- 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 0000000..41dc173 --- /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 +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 +Signed-off-by: David Rosca +Signed-off-by: Haihao Xiang +--- 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 +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 +Signed-off-by: David Rosca +Signed-off-by: Haihao Xiang +--- 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-incmptbl-pntr-types.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-incmptbl-pntr-types.patch new file mode 100644 index 0000000..a65828e --- /dev/null +++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-incmptbl-pntr-types.patch @@ -0,0 +1,50 @@ +https://git.ffmpeg.org/gitweb/ffmpeg.git/commit/347a70f101be28f8d78e8fd62ffc3a78324f49e9 +https://bugs.gentoo.org/922621 + +From 347a70f101be28f8d78e8fd62ffc3a78324f49e9 Mon Sep 17 00:00:00 2001 +From: Andreas Rheinhardt +Date: Thu, 28 Mar 2024 05:35:36 +0100 +Subject: [PATCH] avcodec/pcm-bluray/dvd: Use correct pointer types on BE + +Signed-off-by: Andreas Rheinhardt +--- + libavcodec/pcm-bluray.c | 5 +++-- + libavcodec/pcm-dvd.c | 2 +- + 2 files changed, 4 insertions(+), 3 deletions(-) + +diff --git a/libavcodec/pcm-bluray.c b/libavcodec/pcm-bluray.c +index f65609514a1c1..235020d78f0cf 100644 +--- a/libavcodec/pcm-bluray.c ++++ b/libavcodec/pcm-bluray.c +@@ -167,7 +167,7 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, + samples *= num_source_channels; + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, buf_size); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, buf_size); + #else + do { + *dst16++ = bytestream2_get_be16u(&gb); +@@ -187,7 +187,8 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, AVFrame *frame, + if (AV_SAMPLE_FMT_S16 == avctx->sample_fmt) { + do { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, avctx->ch_layout.nb_channels * 2); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, ++ avctx->ch_layout.nb_channels * 2); + dst16 += avctx->ch_layout.nb_channels; + #else + channel = avctx->ch_layout.nb_channels; +diff --git a/libavcodec/pcm-dvd.c b/libavcodec/pcm-dvd.c +index 419b2a138f887..319746c62e2dc 100644 +--- a/libavcodec/pcm-dvd.c ++++ b/libavcodec/pcm-dvd.c +@@ -157,7 +157,7 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src, + switch (avctx->bits_per_coded_sample) { + case 16: { + #if HAVE_BIGENDIAN +- bytestream2_get_buffer(&gb, dst16, blocks * s->block_size); ++ bytestream2_get_buffer(&gb, (uint8_t*)dst16, blocks * s->block_size); + dst16 += blocks * s->block_size / 2; + #else + int samples = blocks * avctx->ch_layout.nb_channels; 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 0000000..d27240f --- /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 +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 +Signed-off-by: Martin Storsjö +--- + 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/ffmpeg-6.1.1-wint-inconversion-vulkan.patch b/media-video/ffmpeg/files/ffmpeg-6.1.1-wint-inconversion-vulkan.patch new file mode 100644 index 0000000..56c2d11 --- /dev/null +++ b/media-video/ffmpeg/files/ffmpeg-6.1.1-wint-inconversion-vulkan.patch @@ -0,0 +1,35 @@ +From 5860a966d2fffbbda1af0014f0a4d37a21c4f2ca Mon Sep 17 00:00:00 2001 +From: Lynne +Date: Wed, 31 Jan 2024 14:15:04 +0100 +Subject: [PATCH] lavfi/vsrc_testsrc_vulkan: fix -Wint-conversion + +While VK_NULL_HANDLE is equivalent to NULL on 64-bit platforms, the same is not +true across all platforms. + +Fixes building with gcc-14. +--- + libavfilter/vsrc_testsrc_vulkan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/libavfilter/vsrc_testsrc_vulkan.c b/libavfilter/vsrc_testsrc_vulkan.c +index 8761c21dfd1ed..1720bfac5e3a2 100644 +--- a/libavfilter/vsrc_testsrc_vulkan.c ++++ b/libavfilter/vsrc_testsrc_vulkan.c +@@ -231,7 +231,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + return AVERROR(ENOMEM); + + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, s->picref, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) + return err; + } +@@ -250,7 +250,7 @@ static int testsrc_vulkan_activate(AVFilterContext *ctx) + frame->sample_aspect_ratio = s->sar; + if (!s->draw_once) { + err = ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->pl, frame, NULL, +- NULL, &s->opts, sizeof(s->opts)); ++ VK_NULL_HANDLE, &s->opts, sizeof(s->opts)); + if (err < 0) { + av_frame_free(&frame); + return err; diff --git a/media-video/ffmpeg/metadata.xml b/media-video/ffmpeg/metadata.xml new file mode 100644 index 0000000..7b259a5 --- /dev/null +++ b/media-video/ffmpeg/metadata.xml @@ -0,0 +1,146 @@ + + + + + ionen@gentoo.org + Ionen Wolkens + + + chewi@gentoo.org + James Le Cuirot + chromium and soc USE flags + + + Enable AMD's Advanced Media Framework support via media-video/amdgpu-pro-amf + Enable Adaptive Multi-Rate Audio support via media-libs/opencore-amr + Enable Adaptive Multi-Rate Audio encoding support via media-libs/vo-amrwbenc + Enable Apple AppKit framework + Enable Blu-ray filesystems reading support via media-libs/libbluray + Enable Bauer Stereo-to-Binaural filter support via media-libs/libbs2b + Enable audio CDs reading via dev-libs/libcdio-paranoia + Enable audio fingerprinting support via media-libs/chromaprint + Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi. + Enable codec2 low bit rate speech codec support via media-libs/codec2 + Enables runtime CPU detection (useful for bindist, compatibility on other CPUs) + Enable support for various GPU-accelerated filters using NVIDIA PTX compiled with llvm-core/clang + Enable AV1 decoding support via media-libs/dav1d + + Enable use of x11-libs/libdrm for various hardware + accelerated functions and Kernel Mode Setting screen capture + + + Enable AAC (Advanced Audio Coding) encoding support via + media-libs/fdk-aac in addition to FFmpeg's own + implementation (warning: if USE=gpl is enabled, this produces + a non-redistributable build) + + Enable text-to-speech filter support via app-accessibility/flite + Enable use of filters through media-plugins/frei0r-plugins + Enable Bidi support for the drawtext filter via dev-libs/fribidi + + Enable using dev-libs/libgcrypt for rtmp(t)e support (not + needed if using any of USE=gmp,librtmp,openssl), and for obtaining + random bytes (not needed if USE=openssl) + Enables various game music formats support via media-libs/game-music-emu + + Enable using net-libs/gnutls for TLS/HTTPS support + and other minor functions (has no effect if USE=openssl is set) + + Use dev-util/glslang to compile GLSL + Enable use of GPL licensed code, should be kept enabled unless LGPL binaries are needed + + 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. + + Enable FireWire DV/HDV input device support via media-libs/libiec61883 + Enable H.265/HEVC encoding support via media-libs/kvazaar + Enable ICC profile support via media-libs/lcms + + Enable AV1 de/encoding via media-libs/libaom (warning: this + is the reference implementation and is slower than the alternatives) + + Enable ARIB text and caption decoding via media-libs/aribb24 + Enables x11-libs/libdrm support for better screen grabbing and hardware accelerated codecs. + Enable internet Low Bitrate Codec de/encoding support via media-libs/libilbc + Enable Low Complexity Communication Codec de/encoding support via media-sound/liblc3 + Enable use of GPU-accelerated filters from media-libs/libplacebo + + Enable Real Time Messaging Protocol support via media-video/rtmpdump + in addition to FFmpeg's own implementation + + Enable use of the audio resampler from media-libs/soxr + Enable Optical Character Recognition (OCR) filter support via app-text/tesseract + Uses media-libs/libv4l for video4linux instead of direct calls. Adds support for more devices via the userspace library. + Uses dev-libs/libxml2 to enable dash demuxing support. + Enable use of filters through media-libs/lv2 + Enables MIPS DSP ASE R1 optimizations. + Enables MIPS DSP ASE R2 optimizations. + Enables floating point MIPS optimizations. + Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi. + Enables network streaming support + + Enable Nvidia Performance Primitives-based filters via + dev-util/nvidia-cuda-toolkit (warning: if USE=gpl + is enabled, this produces non-redistributable build) + + Enable H.264 encoding support via media-libs/openh264 + Enable MPTM tracked music files decoding support via media-libs/libopenmpt + + Enable using dev-libs/openssl for TLS/HTTPS support + and other minor functions (USE=gnutls has no effect if set) + + Force shared libraries to be built as PIC (this is safer) + + Enable libpostproc video post processing library support + (should not disable this unless need to disable USE=gpl) + + Enable QR encode generation support via media-gfx/qrencode + Enable Intel Quick Sync Video support via media-libs/libvpl + Enable QR decoding support via media-libs/quirc + Enable AMQP stream support via net-libs/rabbitmq-c + Enable AV1 encoding support via media-video/rav1e + Enable time-stretching and pitch-shifting audio filter support via media-libs/rubberband + Enable use of the Simple Direct Layer library (required for the ffplay command) + Enable support for various GPU-accelerated filters using Vulkan compiled with media-libs/shaderc + + Enable Snappy compression support via app-arch/snappy + (required for Vidvox Hap encoder support) + + Enable audio output support via media-sound/sndio + Apply additional patches for efficient playback on some SoCs (e.g. ARM, RISC-V) + Enable Secure Reliable Transport (SRT) support via net-libs/srt + Enable SSH/SFTP support via net-libs/libssh + Enable AV1 encoding support via media-libs/svt-av1 + + Enable drawtext filter support via media-libs/freetype + and media-libs/harfbuzz + + + Enable MP2 encoding support via media-sound/twolame + in addition to FFmpeg's own implementation + + Enable video stabilization filter support via media-libs/vidstab + Enable Netflix's perceptual video quality assessment filter support via media-libs/libvmaf + + Enable VP8 and VP9 de/encoding support via media-libs/libvpx + in addition to FFmpeg's own implementation (for decoding only) + + Enable H.265/HEVC encoding support via media-libs/x265 + Enable Dynamic Adaptive Streaming over HTTP (DASH) stream support using dev-libs/libxml2 + Enable ZMQ command receiver filter and streaming support via net-libs/zeromq + Enable zscale filter support using media-libs/zimg + Enable teletext decoding support via media-libs/zvbi + + + https://trac.ffmpeg.org/ + https://ffmpeg.org/documentation.html + cpe:/a:ffmpeg:ffmpeg + FFmpeg/FFmpeg + +