From d45c5ab2951fe02aabfe2b7bfce5c80ba4138a1b Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Sat, 31 Aug 2024 23:17:28 +0200 Subject: [PATCH 1/2] ffmpeg: add npp option --- pkgs/development/libraries/ffmpeg/default.nix | 7 ++++++- pkgs/development/libraries/ffmpeg/generic.nix | 11 ++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/default.nix b/pkgs/development/libraries/ffmpeg/default.nix index f6a6403435e8..e700ec8d4ba5 100644 --- a/pkgs/development/libraries/ffmpeg/default.nix +++ b/pkgs/development/libraries/ffmpeg/default.nix @@ -1,4 +1,8 @@ -{ callPackage, darwin }: +{ + callPackage, + darwin, + cudaPackages, +}: let mkFFmpeg = @@ -14,6 +18,7 @@ let VideoToolbox ; inherit (darwin) xcode; + inherit (cudaPackages) cuda_cudart cuda_nvcc libnpp; } // (initArgs // { inherit ffmpegVariant; }) ); diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 5367a4439f21..746d08398ba9 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, buildPackages, removeReferencesTo, addDriverRunpath, pkg-config, perl, texinfo, texinfo6, yasm +{ lib, config, 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. @@ -81,6 +81,7 @@ , withModplug ? withFullDeps && !stdenv.isDarwin # ModPlug support , withMp3lame ? withHeadlessDeps # LAME MP3 encoder , withMysofa ? withFullDeps # HRTF support via SOFAlizer +, withNpp ? withFullDeps && withUnfree && config.cudaSupport # Nvidia Performance Primitives-based code , withNvdec ? withHeadlessDeps && withNvcodec , withNvenc ? withHeadlessDeps && withNvcodec , withOpenal ? withFullDeps # OpenAL 1.1 capture support @@ -333,6 +334,12 @@ , CoreImage , VideoToolbox , xcode # unfree contains metalcc and metallib +/* + * Cuda Packages + */ +, cuda_cudart +, cuda_nvcc +, libnpp /* * Testing */ @@ -610,6 +617,7 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withModplug "libmodplug") (enableFeature withMp3lame "libmp3lame") (enableFeature withMysofa "libmysofa") + (enableFeature withNpp "libnpp") (enableFeature withNvdec "nvdec") (enableFeature withNvenc "nvenc") (enableFeature withOpenal "openal") @@ -762,6 +770,7 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withModplug [ libmodplug ] ++ optionals withMp3lame [ lame ] ++ optionals withMysofa [ libmysofa ] + ++ optionals withNpp [ libnpp cuda_cudart cuda_nvcc ] ++ optionals withOpenal [ openal ] ++ optionals withOpencl [ ocl-icd opencl-headers ] ++ optionals (withOpencoreAmrnb || withOpencoreAmrwb) [ opencore-amr ] From 18d3b57fa0b3ef18a7b10fe021d8d0f26d43641d Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Sat, 31 Aug 2024 23:18:41 +0200 Subject: [PATCH 2/2] ffmpeg: add CudaNVCC option --- pkgs/development/libraries/ffmpeg/generic.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 746d08398ba9..b5ebc344a559 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -52,6 +52,7 @@ , withCoreImage ? withHeadlessDeps && stdenv.isDarwin # Apple CoreImage framework , withCuda ? withFullDeps && withNvcodec , withCudaLLVM ? withFullDeps +, withCudaNVCC ? withFullDeps && withUnfree && config.cudaSupport , withCuvid ? withHeadlessDeps && withNvcodec , withDav1d ? withHeadlessDeps # AV1 decoder (focused on speed and correctness) , withDc1394 ? withFullDeps && !stdenv.isDarwin # IIDC-1394 grabbing (ieee 1394) @@ -577,6 +578,7 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withCoreImage "coreimage") (enableFeature withCuda "cuda") (enableFeature withCudaLLVM "cuda-llvm") + (enableFeature withCudaNVCC "cuda-nvcc") (enableFeature withCuvid "cuvid") (enableFeature withDav1d "libdav1d") (enableFeature withDc1394 "libdc1394") @@ -723,7 +725,8 @@ stdenv.mkDerivation (finalAttrs: { 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 ]; + ++ optionals withCudaLLVM [ clang ] + ++ optionals withCudaNVCC [ cuda_nvcc ]; buildInputs = [] ++ optionals withAlsa [ alsa-lib ] @@ -743,6 +746,7 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withChromaprint [ chromaprint ] ++ optionals withCodec2 [ codec2 ] ++ optionals withCoreImage [ CoreImage ] + ++ optionals withCudaNVCC [ cuda_cudart cuda_nvcc ] ++ optionals withDav1d [ dav1d ] ++ optionals withDc1394 [ libdc1394 libraw1394 ] ++ optionals withDrm [ libdrm ]