From 49e79fb61529569688fd51af1c22a7ba805cbf9c Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 25 Oct 2024 00:32:02 +0100 Subject: [PATCH 1/4] ffmpeg_{4,6,7}: clean up old Darwin SDK pattern --- pkgs/development/libraries/ffmpeg/default.nix | 8 -------- pkgs/development/libraries/ffmpeg/generic.nix | 15 ++------------- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/default.nix b/pkgs/development/libraries/ffmpeg/default.nix index eac16d659dac9..d07551608a54d 100644 --- a/pkgs/development/libraries/ffmpeg/default.nix +++ b/pkgs/development/libraries/ffmpeg/default.nix @@ -9,14 +9,6 @@ let initArgs: ffmpegVariant: callPackage ./generic.nix ( { - inherit (darwin.apple_sdk.frameworks) - Accelerate - AppKit - AudioToolbox - AVFoundation - CoreImage - VideoToolbox - ; inherit (darwin) xcode; inherit (cudaPackages) cuda_cudart cuda_nvcc libnpp; } diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index f6f85b5b8e2a4..6dc9daa4ea0c6 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -333,14 +333,8 @@ , zlib , zvbi /* - * Darwin frameworks + * Darwin */ -, Accelerate -, AppKit -, AudioToolbox -, AVFoundation -, CoreImage -, VideoToolbox , xcode # unfree contains metalcc and metallib /* * Cuda Packages @@ -735,12 +729,9 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withAlsa [ alsa-lib ] ++ optionals withAmf [ amf-headers ] ++ optionals withAom [ libaom ] - ++ optionals withAppKit [ AppKit ] ++ optionals withAribb24 [ aribb24 ] ++ optionals withAribcaption [ libaribcaption ] ++ optionals withAss [ libass ] - ++ optionals withAudioToolbox [ AudioToolbox ] - ++ optionals withAvFoundation [ AVFoundation ] ++ optionals withAvisynth [ avisynthplus ] ++ optionals withBluray [ libbluray ] ++ optionals withBs2b [ libbs2b ] @@ -750,7 +741,6 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withCelt [ celt ] ++ optionals withChromaprint [ chromaprint ] ++ optionals withCodec2 [ codec2 ] - ++ optionals withCoreImage [ CoreImage ] ++ optionals withCudaNVCC [ cuda_cudart cuda_nvcc ] ++ optionals withDav1d [ dav1d ] ++ optionals withDc1394 [ libdc1394 libraw1394 ] @@ -794,7 +784,7 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withQuirc [ quirc ] ++ optionals withRav1e [ rav1e ] ++ optionals withRtmp [ rtmpdump ] - ++ optionals withRubberband ([ rubberband ] ++ lib.optional stdenv.hostPlatform.isDarwin Accelerate) + ++ optionals withRubberband [ rubberband ] ++ optionals withSamba [ samba ] ++ optionals withSdl2 [ SDL2 ] ++ optionals withShaderc [ shaderc ] @@ -812,7 +802,6 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withV4l2 [ libv4l ] ++ optionals withVaapi [ (if withSmallDeps then libva else libva-minimal) ] ++ optionals withVdpau [ libvdpau ] - ++ optionals withVideoToolbox [ VideoToolbox ] ++ optionals withVidStab [ vid-stab ] ++ optionals withVmaf [ libvmaf ] ++ optionals withVoAmrwbenc [ vo-amrwbenc ] From 151d5da2e624159658d90e563e325b0c3844dfa2 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 25 Oct 2024 00:32:02 +0100 Subject: [PATCH 2/4] ffmpeg_{4,6,7}: remove redundant Darwin framework feature flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All of these are supplied in the standard environment as part of the SDK now, so there’s no closure difference at build or runtime and no reason to turn them off. --- pkgs/development/libraries/ffmpeg/generic.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 6dc9daa4ea0c6..5259fb9df4aa2 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -36,12 +36,9 @@ , 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 , withAribb24 ? withFullDeps # ARIB text and caption decoding , 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.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 @@ -51,7 +48,6 @@ , withCelt ? withHeadlessDeps # CELT decoder , withChromaprint ? withFullDeps # Audio fingerprinting , withCodec2 ? withFullDeps # codec2 en/decoding -, withCoreImage ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple CoreImage framework , withCuda ? withFullDeps && withNvcodec , withCudaLLVM ? withFullDeps , withCudaNVCC ? withFullDeps && withUnfree && config.cudaSupport @@ -121,7 +117,6 @@ , withV4l2M2m ? withV4l2 , withVaapi ? withHeadlessDeps && (with stdenv; isLinux || isFreeBSD) # Vaapi hardware acceleration , withVdpau ? withSmallDeps && !stdenv.hostPlatform.isMinGW # Vdpau hardware acceleration -, withVideoToolbox ? withHeadlessDeps && stdenv.hostPlatform.isDarwin # Apple VideoToolbox , withVidStab ? withHeadlessDeps && withGPL # Video stabilization , withVmaf ? withFullDeps && !stdenv.hostPlatform.isAarch64 && lib.versionAtLeast version "5" # Netflix's VMAF (Video Multi-Method Assessment Fusion) , withVoAmrwbenc ? withFullDeps && withVersion3 # AMR-WB encoder @@ -554,14 +549,11 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withAlsa "alsa") (enableFeature withAmf "amf") (enableFeature withAom "libaom") - (enableFeature withAppKit "appkit") (enableFeature withAribb24 "libaribb24") ] ++ optionals (versionAtLeast version "6.1") [ (enableFeature withAribcaption "libaribcaption") ] ++ [ (enableFeature withAss "libass") - (enableFeature withAudioToolbox "audiotoolbox") - (enableFeature withAvFoundation "avfoundation") (enableFeature withAvisynth "avisynth") (enableFeature withBluray "libbluray") (enableFeature withBs2b "libbs2b") @@ -571,7 +563,6 @@ stdenv.mkDerivation (finalAttrs: { (enableFeature withCelt "libcelt") (enableFeature withChromaprint "chromaprint") (enableFeature withCodec2 "libcodec2") - (enableFeature withCoreImage "coreimage") (enableFeature withCuda "cuda") (enableFeature withCudaLLVM "cuda-llvm") (enableFeature withCudaNVCC "cuda-nvcc") @@ -661,7 +652,6 @@ stdenv.mkDerivation (finalAttrs: { ] ++ optionals (versionAtLeast version "6.0") [ (enableFeature withVpl "libvpl") ] ++ [ - (enableFeature withVideoToolbox "videotoolbox") (enableFeature withVidStab "libvidstab") # Actual min. version 2.0 (enableFeature withVmaf "libvmaf") (enableFeature withVoAmrwbenc "libvo-amrwbenc") From 927d45eccfd8e5f922d7a35c273bad359f035b73 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 25 Oct 2024 00:32:02 +0100 Subject: [PATCH 3/4] ffmpeg_{4,6,7}: build with `apple-sdk_15` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Upstream is pretty good about using availability checks, and there are runtime‐checked features for macOS 10.13, 11, and 12 that are only available if we build with a modern SDK. This impacts, e.g. hardware‐accelerated video decoding in mpv. FFmpeg should still continue to build and run on all our supported macOS releases, with runtime functionality being no worse than before on older versions. --- pkgs/development/libraries/ffmpeg/generic.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 5259fb9df4aa2..53d2c700317fb 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -330,6 +330,7 @@ /* * Darwin */ +, apple-sdk_15 , xcode # unfree contains metalcc and metallib /* * Cuda Packages @@ -716,6 +717,7 @@ stdenv.mkDerivation (finalAttrs: { ++ optionals withCudaNVCC [ cuda_nvcc ]; buildInputs = [] + ++ optionals stdenv.hostPlatform.isDarwin [ apple-sdk_15 ] ++ optionals withAlsa [ alsa-lib ] ++ optionals withAmf [ amf-headers ] ++ optionals withAom [ libaom ] From 2f31fd064f926b1f6534fe9d1ac134fc243ec591 Mon Sep 17 00:00:00 2001 From: Emily Date: Sat, 26 Oct 2024 13:59:55 +0100 Subject: [PATCH 4/4] ffmpeg_7: remove obsolete macOS 10.12 SDK patch --- ...tion.m-macOS-SDK-10.12-compatibility.patch | 25 ------------------- pkgs/development/libraries/ffmpeg/generic.nix | 1 - 2 files changed, 26 deletions(-) delete mode 100644 pkgs/development/libraries/ffmpeg/0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch diff --git a/pkgs/development/libraries/ffmpeg/0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch b/pkgs/development/libraries/ffmpeg/0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch deleted file mode 100644 index 60004b1766ca2..0000000000000 --- a/pkgs/development/libraries/ffmpeg/0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch +++ /dev/null @@ -1,25 +0,0 @@ -From a804dd05351716b1fd9a7c2b7ed636613edd9c0f Mon Sep 17 00:00:00 2001 -From: toonn -Date: Fri, 21 Jun 2024 18:59:49 +0000 -Subject: [PATCH] avfoundation.m: macOS SDK 10.12 compatibility - ---- - libavdevice/avfoundation.m | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m -index d9b17ccdae..2a1f66d751 100644 ---- a/libavdevice/avfoundation.m -+++ b/libavdevice/avfoundation.m -@@ -762,7 +762,7 @@ static int get_audio_config(AVFormatContext *s) - return 0; - } - --static NSArray* getDevicesWithMediaType(AVMediaType mediaType) { -+static NSArray* getDevicesWithMediaType(NSString * mediaType) { - #if ((TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)) - NSMutableArray *deviceTypes = nil; - if (mediaType == AVMediaTypeVideo) { --- -2.44.0 - diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix index 53d2c700317fb..52104529e162a 100644 --- a/pkgs/development/libraries/ffmpeg/generic.nix +++ b/pkgs/development/libraries/ffmpeg/generic.nix @@ -455,7 +455,6 @@ stdenv.mkDerivation (finalAttrs: { }) ] ++ optionals (lib.versionAtLeast version "7.1") [ - ./0001-avfoundation.m-macOS-SDK-10.12-compatibility.patch ./fix-fate-ffmpeg-spec-disposition-7.1.patch # Expose a private API for Chromium / Qt WebEngine.