diff options
Diffstat (limited to 'pkgs/development/libraries/ffmpeg/generic.nix')
-rw-r--r-- | pkgs/development/libraries/ffmpeg/generic.nix | 219 |
1 files changed, 121 insertions, 98 deletions
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 7496cb4de0e76..dc471944654a1 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, buildPackages, removeReferencesTo, addOpenGLRunpath, pkg-config, perl, texinfo, yasm +{ lib, stdenv, buildPackages, removeReferencesTo, addDriverRunpath, pkg-config, perl, texinfo, texinfo6, yasm # You can fetch any upstream version using this derivation by specifying version and hash # NOTICE: Always use this argument to override the version. Do not use overrideAttrs. @@ -33,27 +33,28 @@ , fetchpatch2 # Feature flags -, withAlsa ? withHeadlessDeps && stdenv.isLinux # Alsa in/output supporT -, withAom ? withFullDeps # AV1 reference encoder -, withAppKit ? withHeadlessDeps && stdenv.isDarwin # Apple AppKit framework +, withAlsa ? withHeadlessDeps && stdenv.hostPlatform.isLinux # Alsa in/output supporT +, withAmf ? lib.meta.availableOn stdenv.hostPlatform amf # AMD Media Framework video encoding +, withAom ? withHeadlessDeps # AV1 reference encoder +, withAppKit ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple AppKit framework , withAribcaption ? withFullDeps && lib.versionAtLeast version "6.1" # ARIB STD-B24 Caption Decoder/Renderer , withAss ? withHeadlessDeps && stdenv.hostPlatform == stdenv.buildPlatform # (Advanced) SubStation Alpha subtitle rendering -, withAudioToolbox ? withHeadlessDeps && stdenv.isDarwin # Apple AudioToolbox -, withAvFoundation ? withHeadlessDeps && stdenv.isDarwin # Apple AVFoundation framework +, withAudioToolbox ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple AudioToolbox +, withAvFoundation ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple AVFoundation framework , withAvisynth ? withFullDeps # AviSynth script files reading , withBluray ? withFullDeps # BluRay reading , withBs2b ? withFullDeps # bs2b DSP library , withBzlib ? withHeadlessDeps , withCaca ? withFullDeps # Textual display (ASCII art) -, withCelt ? withFullDeps # CELT decoder +, withCelt ? withHeadlessDeps # CELT decoder , withChromaprint ? withFullDeps # Audio fingerprinting , withCodec2 ? withFullDeps # codec2 en/decoding -, withCoreImage ? withHeadlessDeps && stdenv.isDarwin # Apple CoreImage framework +, withCoreImage ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple CoreImage framework , withCuda ? withFullDeps && withNvcodec , withCudaLLVM ? withFullDeps , withCuvid ? withHeadlessDeps && withNvcodec , withDav1d ? withHeadlessDeps # AV1 decoder (focused on speed and correctness) -, withDc1394 ? withFullDeps && !stdenv.isDarwin # IIDC-1394 grabbing (ieee 1394) +, withDc1394 ? withFullDeps && !stdenv.hostPlatform.isDarwin # IIDC-1394 grabbing (ieee 1394) , withDrm ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD) # libdrm support , withDvdnav ? withFullDeps && withGPL && lib.versionAtLeast version "7" # needed for DVD demuxing , withDvdread ? withFullDeps && withGPL && lib.versionAtLeast version "7" # needed for DVD demuxing @@ -69,12 +70,15 @@ , withGsm ? withFullDeps # GSM de/encoder , withHarfbuzz ? withHeadlessDeps && lib.versionAtLeast version "6.1" # Needed for drawtext filter , withIconv ? withHeadlessDeps -, withJack ? withFullDeps && !stdenv.isDarwin # Jack audio +, withIlbc ? withFullDeps # iLBC de/encoding +, withJack ? withFullDeps && !stdenv.hostPlatform.isDarwin # Jack audio , withJxl ? withFullDeps && lib.versionAtLeast version "5" # JPEG XL de/encoding , withLadspa ? withFullDeps # LADSPA audio filtering +, withLcms2 ? withFullDeps # ICC profile support via lcms2 , withLzma ? withHeadlessDeps # xz-utils +, withMetal ? false # Unfree and requires manual downloading of files , withMfx ? withFullDeps && (with stdenv.hostPlatform; isLinux && !isAarch) # Hardware acceleration via intel-media-sdk/libmfx -, withModplug ? withFullDeps && !stdenv.isDarwin # ModPlug support +, withModplug ? withFullDeps && !stdenv.hostPlatform.isDarwin # ModPlug support , withMp3lame ? withHeadlessDeps # LAME MP3 encoder , withMysofa ? withFullDeps # HRTF support via SOFAlizer , withNvdec ? withHeadlessDeps && withNvcodec @@ -84,41 +88,45 @@ , withOpencl ? withFullDeps , withOpencoreAmrnb ? withFullDeps && withVersion3 # AMR-NB de/encoder , withOpencoreAmrwb ? withFullDeps && withVersion3 # AMR-WB decoder -, withOpengl ? withFullDeps && !stdenv.isDarwin # OpenGL rendering +, withOpengl ? withFullDeps && !stdenv.hostPlatform.isDarwin # OpenGL rendering , withOpenh264 ? withFullDeps # H.264/AVC encoder -, withOpenjpeg ? withFullDeps # JPEG 2000 de/encoder +, withOpenjpeg ? withHeadlessDeps # JPEG 2000 de/encoder , withOpenmpt ? withFullDeps # Tracked music files decoder , withOpus ? withHeadlessDeps # Opus de/encoder -, withPlacebo ? withFullDeps && !stdenv.isDarwin # libplacebo video processing library -, withPulse ? withSmallDeps && stdenv.isLinux # Pulseaudio input support +, withPlacebo ? withFullDeps && !stdenv.hostPlatform.isDarwin # libplacebo video processing library +, withPulse ? withSmallDeps && stdenv.hostPlatform.isLinux # Pulseaudio input support , withQrencode ? withFullDeps && lib.versionAtLeast version "7" # QR encode generation , withQuirc ? withFullDeps && lib.versionAtLeast version "7" # QR decoding , withRav1e ? withFullDeps # AV1 encoder (focused on speed and safety) , withRtmp ? withFullDeps # RTMP[E] support -, withSamba ? withFullDeps && !stdenv.isDarwin && withGPLv3 # Samba protocol +, withRubberband ? withFullDeps && withGPL # Rubberband filter +, withSamba ? withFullDeps && !stdenv.hostPlatform.isDarwin && withGPLv3 # Samba protocol , withSdl2 ? withSmallDeps -, withShaderc ? withFullDeps && !stdenv.isDarwin && lib.versionAtLeast version "5.0" +, withShaderc ? withFullDeps && !stdenv.hostPlatform.isDarwin && lib.versionAtLeast version "5.0" +, withShine ? withFullDeps # Fixed-point MP3 encoding +, withSnappy ? withFullDeps # Snappy compression, needed for hap encoding , withSoxr ? withHeadlessDeps # Resampling via soxr , withSpeex ? withHeadlessDeps # Speex de/encoder , withSrt ? withHeadlessDeps # Secure Reliable Transport (SRT) protocol , withSsh ? withHeadlessDeps # SFTP protocol , withSvg ? withFullDeps # SVG protocol -, withSvtav1 ? withHeadlessDeps && !stdenv.isAarch64 && !stdenv.hostPlatform.isMinGW # AV1 encoder/decoder (focused on speed and correctness) +, withSvtav1 ? withHeadlessDeps && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isMinGW # AV1 encoder/decoder (focused on speed and correctness) , withTensorflow ? false # Tensorflow dnn backend support (Increases closure size by ~390 MiB) , withTheora ? withHeadlessDeps # Theora encoder -, withV4l2 ? withHeadlessDeps && stdenv.isLinux # Video 4 Linux support +, withTwolame ? withFullDeps # MP2 encoding +, withV4l2 ? withHeadlessDeps && stdenv.hostPlatform.isLinux # Video 4 Linux support , withV4l2M2m ? withV4l2 , withVaapi ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD) # Vaapi hardware acceleration , withVdpau ? withSmallDeps && !stdenv.hostPlatform.isMinGW # Vdpau hardware acceleration -, withVideoToolbox ? withHeadlessDeps && stdenv.isDarwin # Apple VideoToolbox +, withVideoToolbox ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple VideoToolbox , withVidStab ? withFullDeps && withGPL # Video stabilization -, withVmaf ? withFullDeps && !stdenv.isAarch64 && lib.versionAtLeast version "5" # Netflix's VMAF (Video Multi-Method Assessment Fusion) +, withVmaf ? withFullDeps && !stdenv.hostPlatform.isAarch64 && lib.versionAtLeast version "5" # Netflix's VMAF (Video Multi-Method Assessment Fusion) , withVoAmrwbenc ? withFullDeps && withVersion3 # AMR-WB encoder , withVorbis ? withHeadlessDeps # Vorbis de/encoding, native encoder exists , withVpl ? false # Hardware acceleration via intel libvpl , withVpx ? withHeadlessDeps && stdenv.buildPlatform == stdenv.hostPlatform # VP8 & VP9 de/encoding -, withVulkan ? withSmallDeps && !stdenv.isDarwin -, withWebp ? withFullDeps # WebP encoder +, withVulkan ? withSmallDeps && !stdenv.hostPlatform.isDarwin +, withWebp ? withHeadlessDeps # WebP encoder , withX264 ? withHeadlessDeps && withGPL # H.264/AVC encoder , withX265 ? withHeadlessDeps && withGPL # H.265/HEVC encoder , withXavs ? withFullDeps && withGPL # AVS encoder @@ -126,8 +134,8 @@ , withXcbShape ? withFullDeps # X11 grabbing shape rendering , withXcbShm ? withFullDeps # X11 grabbing shm communication , withXcbxfixes ? withFullDeps # X11 grabbing mouse rendering -, withXevd ? withFullDeps && lib.versionAtLeast version "7" && stdenv.hostPlatform.isx86 # MPEG-5 EVC decoding -, withXeve ? withFullDeps && lib.versionAtLeast version "7" && stdenv.hostPlatform.isx86 # MPEG-5 EVC encoding +, withXevd ? withFullDeps && lib.versionAtLeast version "7" && !xevd.meta.broken # MPEG-5 EVC decoding +, withXeve ? withFullDeps && lib.versionAtLeast version "7" && !xeve.meta.broken # MPEG-5 EVC encoding , withXlib ? withFullDeps # Xlib support , withXml2 ? withFullDeps # libxml2 support, for IMF and DASH demuxers , withXvid ? withHeadlessDeps && withGPL # Xvid encoder, native encoder exists @@ -214,6 +222,8 @@ * External libraries options */ , alsa-lib +, amf +, amf-headers , avisynthplus , bzip2 , celt @@ -234,6 +244,7 @@ , intel-media-sdk , ladspaH , lame +, lcms2 , libaom , libaribcaption , libass @@ -247,6 +258,7 @@ , libGL , libGLU , libiconv +, libilbc , libjack2 , libjxl , libmodplug @@ -288,9 +300,13 @@ , quirc , rav1e , rtmpdump +, rubberband +, twolame , samba , SDL2 , shaderc +, shine +, snappy , soxr , speex , srt @@ -312,11 +328,13 @@ /* * Darwin frameworks */ +, Accelerate , AppKit , AudioToolbox , AVFoundation , CoreImage , VideoToolbox +, xcode # unfree contains metalcc and metallib /* * Testing */ @@ -395,84 +413,61 @@ stdenv.mkDerivation (finalAttrs: { --replace /usr/local/lib/frei0r-1 ${frei0r}/lib/frei0r-1 ''; - patches = map (patch: fetchpatch2 patch) ([ ] - ++ optionals (versionOlder version "5") [ - { - name = "libsvtav1-1.5.0-compat-compressed_ten_bit_format.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/031f1561cd286596cdb374da32f8aa816ce3b135"; - hash = "sha256-agJgzIzrBTQBAypuCmGXXFo7vw6Iodw5Ny5O5QCKCn8="; - } - { - # Backport fix for binutils-2.41. - name = "binutils-2.41.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/effadce6c756247ea8bae32dc13bb3e6f464f0eb"; - hash = "sha256-vLSltvZVMcQ0CnkU0A29x6fJSywE8/aU+Mp9os8DZYY="; - } - # The upstream patch isn’t for ffmpeg 4, but it will apply with a few tweaks. - # Fixes a crash when built with clang 16 due to UB in ff_seek_frame_binary. - { - name = "utils-fix_crash_in_ff_seek_frame_binary.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/ab792634197e364ca1bb194f9abe36836e42f12d"; - hash = "sha256-vqqVACjbCcGL9Qvmg1QArSKqVmOqr8BEr+OxTBDt6mA="; - postFetch = '' - substituteInPlace "$out" \ - --replace libavformat/seek.c libavformat/utils.c \ - --replace 'const AVInputFormat *const ' 'const AVInputFormat *' - ''; - } - ] - ++ (lib.optionals (lib.versionAtLeast version "5" && lib.versionOlder version "6") [ - { - name = "fix_build_failure_due_to_libjxl_version_to_new"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/75b1a555a70c178a9166629e43ec2f6250219eb2"; - hash = "sha256-+2kzfPJf5piim+DqEgDuVEEX5HLwRsxq0dWONJ4ACrU="; - } - { - name = "5.x-CVE-2024-31585.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/8711cea3841fc385cccb1e7255176479e865cd4d"; - hash = "sha256-WT+ly/l04yM/tRVbhkESA3sDDjwvtd/Cg2y8tQo4ApI="; - } - { - name = "CVE-2024-31582.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/99debe5f823f45a482e1dc08de35879aa9c74bd2"; - hash = "sha256-+CQ9FXR6Vr/AmsbXFiCUXZcxKj1s8nInEdke/Oc/kUA="; - } - { - name = "CVE-2024-31578.patch"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/3bb00c0a420c3ce83c6fafee30270d69622ccad7"; - hash = "sha256-oZMZysBA+/gwaGEM1yvI+8wCadXWE7qLRL6Emap3b8Q="; - } - ]) - ++ (lib.optionals (lib.versionAtLeast version "6.1" && lib.versionOlder version "6.2") [ - { # this can be removed post 6.1 + patches = [] + ++ optionals (lib.versionAtLeast version "6.1" && lib.versionOlder version "6.2") [ + (fetchpatch2 { # this can be removed post 6.1 name = "fix_build_failure_due_to_PropertyKey_EncoderID"; url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/cb049d377f54f6b747667a93e4b719380c3e9475"; hash = "sha256-sxRXKKgUak5vsQTiV7ge8vp+N22CdTIvuczNgVRP72c="; - } - { - name = "fix_vulkan_av1"; - url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/e06ce6d2b45edac4a2df04f304e18d4727417d24"; - hash = "sha256-73mlX1rdJrguw7OXaSItfHtI7gflDrFj+7SepVvvUIg="; - } - { + }) + (fetchpatch2 { name = "CVE-2024-31582.patch"; url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/99debe5f823f45a482e1dc08de35879aa9c74bd2"; hash = "sha256-+CQ9FXR6Vr/AmsbXFiCUXZcxKj1s8nInEdke/Oc/kUA="; - } - { + }) + (fetchpatch2 { name = "CVE-2024-31578.patch"; url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/3bb00c0a420c3ce83c6fafee30270d69622ccad7"; hash = "sha256-oZMZysBA+/gwaGEM1yvI+8wCadXWE7qLRL6Emap3b8Q="; - } - ]) - ++ (lib.optionals (lib.versionAtLeast version "7.0" && lib.versionOlder version "7.0.1") [ - { + }) + (fetchpatch2 { + name = "CVE-2023-49501.patch"; + url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/4adb93dff05dd947878c67784d98c9a4e13b57a7"; + hash = "sha256-7cwktto3fPMDGvCZCVtB01X8Q9S/4V4bDLUICSNfGgw="; + }) + (fetchpatch2 { + name = "CVE-2023-49502.patch"; + url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/737ede405b11a37fdd61d19cf25df296a0cb0b75"; + hash = "sha256-mpSJwR9TX5ENjjCKvzuM/9e1Aj/AOiQW0+72oOMl9v8="; + }) + (fetchpatch2 { + name = "CVE-2023-50007.patch"; + url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/b1942734c7cbcdc9034034373abcc9ecb9644c47"; + hash = "sha256-v0hNcqBtm8GCGAU9UbRUCE0slodOjZCHrkS8e4TrVcQ="; + }) + (fetchpatch2 { + name = "CVE-2023-50008.patch"; + url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/5f87a68cf70dafeab2fb89b42e41a4c29053b89b"; + hash = "sha256-sqUUSOPTPLwu2h8GbAw4SfEf+0oWioz52BcpW1n4v3Y="; + }) + ] + ++ optionals (lib.versionAtLeast version "7.0" && lib.versionOlder version "7.0.1") [ + (fetchpatch2 { # Will likely be obsolete in >7.0 name = "fate_avoid_dependency_on_samples"; url = "https://git.ffmpeg.org/gitweb/ffmpeg.git/patch/7b7b7819bd21cc92ac07f6696b0e7f26fa8f9834"; hash = "sha256-TKI289XqtG86Sj9s7mVYvmkjAuRXeK+2cYYEDkg6u6I="; - } - ])); + }) + ] + ++ optionals (lib.versionAtLeast version "7.0") [ + ./0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch + + # Expose a private API for Chromium / Qt WebEngine. + (fetchpatch2 { + url = "https://gitlab.archlinux.org/archlinux/packaging/packages/ffmpeg/-/raw/a02c1a15706ea832c0d52a4d66be8fb29499801a/add-av_stream_get_first_dts-for-chromium.patch"; + hash = "sha256-DbH6ieJwDwTjKOdQ04xvRcSLeeLP2Z2qEmqeo8HsPr4="; + }) + ]; configurePlatforms = []; setOutputFlags = false; # Only accepts some of them @@ -557,6 +552,7 @@ stdenv.mkDerivation (finalAttrs: { * External libraries */ (enableFeature withAlsa "alsa") + (enableFeature withAmf "amf") (enableFeature withAom "libaom") (enableFeature withAppKit "appkit") ] ++ optionals (versionAtLeast version "6.1") [ @@ -599,12 +595,19 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withHarfbuzz "libharfbuzz") ] ++ [ (enableFeature withIconv "iconv") + (enableFeature withIlbc "libilbc") (enableFeature withJack "libjack") ] ++ optionals (versionAtLeast finalAttrs.version "5.0") [ (enableFeature withJxl "libjxl") ] ++ [ (enableFeature withLadspa "ladspa") + ] ++ optionals (versionAtLeast version "5.1") [ + (enableFeature withLcms2 "lcms2") + ] ++ [ (enableFeature withLzma "lzma") + ] ++ optionals (versionAtLeast version "5.0") [ + (enableFeature withMetal "metal") + ] ++ [ (enableFeature withMfx "libmfx") (enableFeature withModplug "libmodplug") (enableFeature withMp3lame "libmp3lame") @@ -630,11 +633,14 @@ stdenv.mkDerivation (finalAttrs: { ] ++ [ (enableFeature withRav1e "librav1e") (enableFeature withRtmp "librtmp") + (enableFeature withRubberband "librubberband") (enableFeature withSamba "libsmbclient") (enableFeature withSdl2 "sdl2") ] ++ optionals (versionAtLeast version "5.0") [ (enableFeature withShaderc "libshaderc") ] ++ [ + (enableFeature withShine "libshine") + (enableFeature withSnappy "libsnappy") (enableFeature withSoxr "libsoxr") (enableFeature withSpeex "libspeex") (enableFeature withSrt "libsrt") @@ -643,6 +649,7 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withSvtav1 "libsvtav1") (enableFeature withTensorflow "libtensorflow") (enableFeature withTheora "libtheora") + (enableFeature withTwolame "libtwolame") (enableFeature withV4l2 "libv4l2") (enableFeature withV4l2M2m "v4l2-m2m") (enableFeature withVaapi "vaapi") @@ -689,6 +696,9 @@ stdenv.mkDerivation (finalAttrs: { ] ++ optionals stdenv.cc.isClang [ "--cc=clang" "--cxx=clang++" + ] ++ optionals withMetal [ + "--metalcc=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metal" + "--metallib=${xcode}/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/metallib" ]; # ffmpeg embeds the configureFlags verbatim in its binaries and because we @@ -697,17 +707,21 @@ stdenv.mkDerivation (finalAttrs: { # such references except for data. postConfigure = let toStrip = map placeholder (lib.remove "data" finalAttrs.outputs) # We want to keep references to the data dir. - ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.stdenv.cc; + ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) buildPackages.stdenv.cc + ++ lib.optional withMetal xcode; in "remove-references-to ${lib.concatStringsSep " " (map (o: "-t ${o}") toStrip)} config.h"; strictDeps = true; - nativeBuildInputs = [ removeReferencesTo addOpenGLRunpath perl pkg-config texinfo yasm ] + nativeBuildInputs = [ removeReferencesTo addDriverRunpath perl pkg-config yasm ] + # Texinfo version 7.1 introduced breaking changes, which older versions of ffmpeg do not handle. + ++ (if versionOlder version "5" then [ texinfo6 ] else [ texinfo ]) ++ optionals withCudaLLVM [ clang ]; buildInputs = [] ++ optionals withAlsa [ alsa-lib ] + ++ optionals withAmf [ amf-headers ] ++ optionals withAom [ libaom ] ++ optionals withAppKit [ AppKit ] ++ optionals withAribcaption [ libaribcaption ] @@ -740,9 +754,11 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withGsm [ gsm ] ++ optionals withHarfbuzz [ harfbuzz ] ++ optionals withIconv [ libiconv ] # On Linux this should be in libc, do we really need it? + ++ optionals withIlbc [ libilbc ] ++ optionals withJack [ libjack2 ] ++ optionals withJxl [ libjxl ] ++ optionals withLadspa [ ladspaH ] + ++ optionals withLcms2 [ lcms2 ] ++ optionals withLzma [ xz ] ++ optionals withMfx [ intel-media-sdk ] ++ optionals withModplug [ libmodplug ] @@ -763,9 +779,12 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withQuirc [ quirc ] ++ optionals withRav1e [ rav1e ] ++ optionals withRtmp [ rtmpdump ] + ++ optionals withRubberband ([ rubberband ] ++ lib.optional stdenv.hostPlatform.isDarwin Accelerate) ++ optionals withSamba [ samba ] ++ optionals withSdl2 [ SDL2 ] ++ optionals withShaderc [ shaderc ] + ++ optionals withShine [ shine ] + ++ optionals withSnappy [ snappy ] ++ optionals withSoxr [ soxr ] ++ optionals withSpeex [ speex ] ++ optionals withSrt [ srt ] @@ -774,6 +793,7 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withSvtav1 [ svt-av1 ] ++ optionals withTensorflow [ libtensorflow ] ++ optionals withTheora [ libtheora ] + ++ optionals withTwolame [ twolame ] ++ optionals withV4l2 [ libv4l ] ++ optionals withVaapi [ (if withSmallDeps then libva else libva-minimal) ] ++ optionals withVdpau [ libvdpau ] @@ -807,7 +827,7 @@ stdenv.mkDerivation (finalAttrs: { # Fails with SIGABRT otherwise FIXME: Why? checkPhase = let - ldLibraryPathEnv = if stdenv.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; + ldLibraryPathEnv = if stdenv.hostPlatform.isDarwin then "DYLD_LIBRARY_PATH" else "LD_LIBRARY_PATH"; libsToLink = [ ] ++ optional buildAvcodec "libavcodec" ++ optional buildAvdevice "libavdevice" @@ -835,10 +855,10 @@ stdenv.mkDerivation (finalAttrs: { ''; # Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found. - # See the explanation in addOpenGLRunpath. - postFixup = optionalString (stdenv.isLinux && withLib) '' - addOpenGLRunpath ${placeholder "lib"}/lib/libavcodec.so - addOpenGLRunpath ${placeholder "lib"}/lib/libavutil.so + # See the explanation in addDriverRunpath. + postFixup = optionalString (stdenv.hostPlatform.isLinux && withLib) '' + addDriverRunpath ${placeholder "lib"}/lib/libavcodec.so + addDriverRunpath ${placeholder "lib"}/lib/libavutil.so '' # https://trac.ffmpeg.org/ticket/10809 + optionalString (versionAtLeast version "5.0" && withVulkan && !stdenv.hostPlatform.isMinGW) '' @@ -879,7 +899,10 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.all; # See https://github.com/NixOS/nixpkgs/pull/295344#issuecomment-1992263658 broken = stdenv.hostPlatform.isMinGW && stdenv.hostPlatform.is64bit; - maintainers = with maintainers; [ atemu arthsmn jopejoe1 ]; + maintainers = with maintainers; [ atemu jopejoe1 emily ]; mainProgram = "ffmpeg"; }; +} // lib.optionalAttrs withCudaLLVM { + # remove once https://github.com/NixOS/nixpkgs/issues/318674 is addressed properly + hardeningDisable = [ "zerocallusedregs" ]; }) |