ffmpeg: make nvidia dependencies explicit

This commit is contained in:
jopejoe1 2024-02-29 22:11:35 +01:00
parent 887dd17f45
commit 984c056f86

View File

@ -47,12 +47,14 @@
, withCelt ? withFullDeps # CELT decoder , withCelt ? withFullDeps # CELT decoder
, withChromaprint ? withFullDeps # Audio fingerprinting , withChromaprint ? withFullDeps # Audio fingerprinting
, withCoreImage ? withHeadlessDeps && stdenv.isDarwin # Apple CoreImage framework , withCoreImage ? withHeadlessDeps && stdenv.isDarwin # Apple CoreImage framework
, withCuda ? withFullDeps && (with stdenv; (!isDarwin && !hostPlatform.isAarch && !hostPlatform.isRiscV)) , withCuda ? withFullDeps && withNvcodec
, withCudaLLVM ? withFullDeps , withCudaLLVM ? withFullDeps
, withCuvid ? withHeadlessDeps && withNvcodec
, withDav1d ? withHeadlessDeps # AV1 decoder (focused on speed and correctness) , withDav1d ? withHeadlessDeps # AV1 decoder (focused on speed and correctness)
, withDc1394 ? withFullDeps && !stdenv.isDarwin # IIDC-1394 grabbing (ieee 1394) , withDc1394 ? withFullDeps && !stdenv.isDarwin # IIDC-1394 grabbing (ieee 1394)
, withDrm ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD) # libdrm support , withDrm ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD) # libdrm support
, withFdkAac ? withFullDeps && (!withGPL || withUnfree) # Fraunhofer FDK AAC de/encoder , withFdkAac ? withFullDeps && (!withGPL || withUnfree) # Fraunhofer FDK AAC de/encoder
, withNvcodec ? withHeadlessDeps && (with stdenv; !isDarwin && !isAarch32 && !hostPlatform.isRiscV && hostPlatform == buildPlatform) # dynamically linked Nvidia code
, withFlite ? withFullDeps # Voice Synthesis , withFlite ? withFullDeps # Voice Synthesis
, withFontconfig ? withHeadlessDeps # Needed for drawtext filter , withFontconfig ? withHeadlessDeps # Needed for drawtext filter
, withFreetype ? withHeadlessDeps # Needed for drawtext filter , withFreetype ? withHeadlessDeps # Needed for drawtext filter
@ -70,8 +72,8 @@
, withModplug ? withFullDeps && !stdenv.isDarwin # ModPlug support , withModplug ? withFullDeps && !stdenv.isDarwin # ModPlug support
, withMp3lame ? withHeadlessDeps # LAME MP3 encoder , withMp3lame ? withHeadlessDeps # LAME MP3 encoder
, withMysofa ? withFullDeps # HRTF support via SOFAlizer , withMysofa ? withFullDeps # HRTF support via SOFAlizer
, withNvdec ? withHeadlessDeps && (with stdenv; !isDarwin && hostPlatform == buildPlatform && !isAarch32 && !hostPlatform.isRiscV) , withNvdec ? withHeadlessDeps && withNvcodec
, withNvenc ? withHeadlessDeps && (with stdenv; !isDarwin && hostPlatform == buildPlatform && !isAarch32 && !hostPlatform.isRiscV) , withNvenc ? withHeadlessDeps && withNvcodec
, withOgg ? withHeadlessDeps # Ogg container used by vorbis & theora , withOgg ? withHeadlessDeps # Ogg container used by vorbis & theora
, withOpenal ? withFullDeps # OpenAL 1.1 capture support , withOpenal ? withFullDeps # OpenAL 1.1 capture support
, withOpencl ? withFullDeps , withOpencl ? withFullDeps
@ -356,6 +358,11 @@ assert buildAvformat -> buildAvcodec && buildAvutil; # configure flag since 0.6
assert buildPostproc -> buildAvutil; assert buildPostproc -> buildAvutil;
assert buildSwscale -> buildAvutil; assert buildSwscale -> buildAvutil;
/*
* External Library dependencies
*/
assert (withCuda || withCuvid || withNvdec || withNvenc) -> withNvcodec;
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
pname = "ffmpeg" + (optionalString (ffmpegVariant != "small") "-${ffmpegVariant}"); pname = "ffmpeg" + (optionalString (ffmpegVariant != "small") "-${ffmpegVariant}");
inherit version; inherit version;
@ -509,10 +516,12 @@ stdenv.mkDerivation (finalAttrs: {
(enableFeature withCoreImage "coreimage") (enableFeature withCoreImage "coreimage")
(enableFeature withCuda "cuda") (enableFeature withCuda "cuda")
(enableFeature withCudaLLVM "cuda-llvm") (enableFeature withCudaLLVM "cuda-llvm")
(enableFeature withCuvid "cuvid")
(enableFeature withDav1d "libdav1d") (enableFeature withDav1d "libdav1d")
(enableFeature withDc1394 "libdc1394") (enableFeature withDc1394 "libdc1394")
(enableFeature withDrm "libdrm") (enableFeature withDrm "libdrm")
(enableFeature withFdkAac "libfdk-aac") (enableFeature withFdkAac "libfdk-aac")
(enableFeature withNvcodec "ffnvcodec")
(enableFeature withFlite "libflite") (enableFeature withFlite "libflite")
(enableFeature withFontconfig "fontconfig") (enableFeature withFontconfig "fontconfig")
(enableFeature withFontconfig "libfontconfig") (enableFeature withFontconfig "libfontconfig")
@ -533,7 +542,6 @@ stdenv.mkDerivation (finalAttrs: {
(enableFeature withModplug "libmodplug") (enableFeature withModplug "libmodplug")
(enableFeature withMp3lame "libmp3lame") (enableFeature withMp3lame "libmp3lame")
(enableFeature withMysofa "libmysofa") (enableFeature withMysofa "libmysofa")
(enableFeature withNvdec "cuvid")
(enableFeature withNvdec "nvdec") (enableFeature withNvdec "nvdec")
(enableFeature withNvenc "nvenc") (enableFeature withNvenc "nvenc")
(enableFeature withOpenal "openal") (enableFeature withOpenal "openal")
@ -642,6 +650,7 @@ stdenv.mkDerivation (finalAttrs: {
++ optionals withDc1394 [ libdc1394 libraw1394 ] ++ optionals withDc1394 [ libdc1394 libraw1394 ]
++ optionals withDrm [ libdrm ] ++ optionals withDrm [ libdrm ]
++ optionals withFdkAac [ fdk_aac ] ++ optionals withFdkAac [ fdk_aac ]
++ optionals withNvcodec [ (if (lib.versionAtLeast version "6") then nv-codec-headers-12 else nv-codec-headers) ]
++ optionals withFlite [ flite ] ++ optionals withFlite [ flite ]
++ optionals withFontconfig [ fontconfig ] ++ optionals withFontconfig [ fontconfig ]
++ optionals withFreetype [ freetype ] ++ optionals withFreetype [ freetype ]
@ -659,7 +668,6 @@ stdenv.mkDerivation (finalAttrs: {
++ optionals withModplug [ libmodplug ] ++ optionals withModplug [ libmodplug ]
++ optionals withMp3lame [ lame ] ++ optionals withMp3lame [ lame ]
++ optionals withMysofa [ libmysofa ] ++ optionals withMysofa [ libmysofa ]
++ optionals (withNvdec || withNvenc) [ (if (lib.versionAtLeast version "6") then nv-codec-headers-12 else nv-codec-headers) ]
++ optionals withOgg [ libogg ] ++ optionals withOgg [ libogg ]
++ optionals withOpenal [ openal ] ++ optionals withOpenal [ openal ]
++ optionals withOpencl [ ocl-icd opencl-headers ] ++ optionals withOpencl [ ocl-icd opencl-headers ]