From 20b409608ae56709feb634f3dd2c2a0a1834db93 Mon Sep 17 00:00:00 2001 From: Emily Date: Mon, 2 Sep 2024 19:41:24 +0100 Subject: [PATCH] gst_all_1.gst-plugins-bad: add patch for macOS < 12 SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This now references `kVTVideoDecoderReferenceMissingErr`, which was added in the macOS 12 SDK. Unfortunately, our 12.3 SDK doesn’t work to build this package currently. This should hopefully be fixed after the SDK rework. (cherry picked from commit 69b18ff3ea8b8df4b85b0ce58ff2ce26f0e38163) --- .../gstreamer/bad/darwin-old-sdk-fix.patch | 49 +++++++++++++++++++ .../libraries/gstreamer/bad/default.nix | 5 ++ 2 files changed, 54 insertions(+) create mode 100644 pkgs/development/libraries/gstreamer/bad/darwin-old-sdk-fix.patch diff --git a/pkgs/development/libraries/gstreamer/bad/darwin-old-sdk-fix.patch b/pkgs/development/libraries/gstreamer/bad/darwin-old-sdk-fix.patch new file mode 100644 index 0000000000000..b525eaa7d55b8 --- /dev/null +++ b/pkgs/development/libraries/gstreamer/bad/darwin-old-sdk-fix.patch @@ -0,0 +1,49 @@ +From 816f2ccad16413a4961a0001fc02d8874d4fde47 Mon Sep 17 00:00:00 2001 +From: Alessandro Bono +Date: Wed, 10 Jul 2024 15:33:34 +0200 +Subject: [PATCH] vtdec: Use kVTVideoDecoderReferenceMissingErr only when + defined + +The enum value is declared present since macOS 10.8+[1]. Howerver, +the compilation now fails with the 10.15 SDK: +``` +../sys/applemedia/vtdec.c:1219:12: error: use of undeclared identifier 'kVTVideoDecoderReferenceMissingErr'; did you mean 'kVTVideoDecoderMalfunctionErr'? + case kVTVideoDecoderReferenceMissingErr: + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + kVTVideoDecoderMalfunctionErr +/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/VideoToolbox.framework/Headers/VTErrors.h:40:2: note: 'kVTVideoDecoderMalfunctionErr' declared here + kVTVideoDecoderMalfunctionErr = -12911, // c.f. -8960 + ^ +1 error generated. +``` + +Put the enum usage under #ifdef. When missing, the behavior will be +the same as before commit a5c437c6430cdce603e46e09400beb4c5b9f5374. + +[1] https://developer.apple.com/documentation/videotoolbox/kvtvideodecoderreferencemissingerr?language=objc +--- + sys/applemedia/vtdec.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c +index 57fcbf9928a5..517c15365b52 100644 +--- a/sys/applemedia/vtdec.c ++++ b/sys/applemedia/vtdec.c +@@ -1216,12 +1216,14 @@ gst_vtdec_session_output_callback (void *decompression_output_ref_con, + + if (status != noErr) { + switch (status) { ++#ifdef kVTVideoDecoderReferenceMissingErr + case kVTVideoDecoderReferenceMissingErr: + /* ReferenceMissingErr is not critical, when it occurs the frame + * usually has the kVTDecodeInfo_FrameDropped flag set. Log only for debugging purposes. */ + GST_DEBUG_OBJECT (vtdec, "ReferenceMissingErr when decoding frame %d", + frame->decode_frame_number); + break; ++#endif + #ifndef HAVE_IOS + case codecBadDataErr: /* SW decoder on macOS uses a different code from the hardware one... */ + #endif +-- +GitLab + diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index 4ec3c898314a8..46fc02a7b3581 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -127,6 +127,11 @@ stdenv.mkDerivation rec { src = ./fix-paths.patch; inherit (addOpenGLRunpath) driverLink; }) + + # vtdec: Use kVTVideoDecoderReferenceMissingErr only when defined + # + # TODO: Remove this when the build with the newer SDK works. + ./darwin-old-sdk-fix.patch ]; nativeBuildInputs = [