ffmpeg: add additional nvidia options (#338687)

This commit is contained in:
Johannes Jöns 2024-09-22 00:18:54 +00:00 committed by GitHub
commit 71d97d6e0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View File

@ -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; })
);

View File

@ -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.
@ -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)
@ -81,6 +82,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 +335,12 @@
, CoreImage
, VideoToolbox
, xcode # unfree contains metalcc and metallib
/*
* Cuda Packages
*/
, cuda_cudart
, cuda_nvcc
, libnpp
/*
* Testing
*/
@ -570,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")
@ -610,6 +619,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")
@ -715,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 ]
@ -735,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 ]
@ -762,6 +774,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 ]