From 8f64c5d9fcce5981b8ea2a861566e382ddbc9731 Mon Sep 17 00:00:00 2001 From: Zane van Iperen Date: Sun, 16 May 2021 08:05:03 +1000 Subject: [PATCH 1/2] ffmpeg_4: fix build error on darwin See https://trac.ffmpeg.org/ticket/9242 --- pkgs/development/libraries/ffmpeg/4.nix | 3 ++ ...toolboxenc-define-TARGET_CPU_ARM64-t.patch | 35 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch diff --git a/pkgs/development/libraries/ffmpeg/4.nix b/pkgs/development/libraries/ffmpeg/4.nix index c765cdf73c5..3a1b1c489c0 100644 --- a/pkgs/development/libraries/ffmpeg/4.nix +++ b/pkgs/development/libraries/ffmpeg/4.nix @@ -9,4 +9,7 @@ callPackage ./generic.nix (rec { branch = "4.4"; sha256 = "03kxc29y8190k4y8s8qdpsghlbpmchv1m8iqygq2qn0vfm4ka2a2"; darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ]; + + /* Work around https://trac.ffmpeg.org/ticket/9242 */ + patches = [ ./v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch ]; } // args) diff --git a/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch b/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch new file mode 100644 index 00000000000..c0c2c1fb23b --- /dev/null +++ b/pkgs/development/libraries/ffmpeg/v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch @@ -0,0 +1,35 @@ +From 5b562aaddbc6e7a94a079c2e88230b205a7f4d73 Mon Sep 17 00:00:00 2001 +From: Zane van Iperen +Date: Sat, 15 May 2021 19:33:52 +1000 +Subject: [PATCH v2] avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if + not provided by the SDK + +Fixes build failure on older SDKs without it. + +Fixes #9242 + +Signed-off-by: Zane van Iperen +--- + libavcodec/videotoolboxenc.c | 4 ++++ + 1 file changed, 4 insertions(+) + +NB: This is untested, I do not have a Mac to try it on. + +diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c +index 58239e0ab9..f063a86e73 100644 +--- a/libavcodec/videotoolboxenc.c ++++ b/libavcodec/videotoolboxenc.c +@@ -50,6 +50,10 @@ enum { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange = 'xf20' }; + enum { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange = 'x420' }; + #endif + ++#ifndef TARGET_CPU_ARM64 ++# define TARGET_CPU_ARM64 0 ++#endif ++ + typedef OSStatus (*getParameterSetAtIndex)(CMFormatDescriptionRef videoDesc, + size_t parameterSetIndex, + const uint8_t **parameterSetPointerOut, +-- +2.29.3 + From 3e43d42f87388db13783701993e96f115501cd27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 16 May 2021 09:31:27 +0200 Subject: [PATCH 2/2] ffmpeg_4: only apply the patch on darwin It's not a big deal, but why rebuild the linux dependencies now. --- pkgs/development/libraries/ffmpeg/4.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/ffmpeg/4.nix b/pkgs/development/libraries/ffmpeg/4.nix index 3a1b1c489c0..df3d0732393 100644 --- a/pkgs/development/libraries/ffmpeg/4.nix +++ b/pkgs/development/libraries/ffmpeg/4.nix @@ -1,6 +1,7 @@ { callPackage # Darwin frameworks , Cocoa, CoreMedia, VideoToolbox +, stdenv, lib , ... }@args: @@ -11,5 +12,6 @@ callPackage ./generic.nix (rec { darwinFrameworks = [ Cocoa CoreMedia VideoToolbox ]; /* Work around https://trac.ffmpeg.org/ticket/9242 */ - patches = [ ./v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch ]; + patches = lib.optional stdenv.isDarwin + ./v2-0001-avcodec-videotoolboxenc-define-TARGET_CPU_ARM64-t.patch; } // args)