PR #24034 opened by Gabriel Balaich (ninbura)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24034
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24034.patch

# Summary of changes

Fixes the build regression from c2802e520a reported on ffmpeg-devel mailing 
list:
https://lists.ffmpeg.org/archives/list/[email protected]/thread/S7PGVSGNLIZ2WRYV6VOBAD3RWYUNWA3H/

The IOKit port guard checked the SDK version (__MAC_OS_X_VERSION_MAX_ALLOWED) 
instead of the deployment target (__MAC_OS_X_VERSION_MIN_REQUIRED), so any 
macOS 12+ SDK selected kIOMainPortDefault even when targeting older releases, 
which no longer compiles.



>From 058a3e204fd4c31dfc76e37e5591c44d3c94bea9 Mon Sep 17 00:00:00 2001
From: Gabriel Balaich <[email protected]>
Date: Thu, 6 Aug 2026 12:21:37 -0600
Subject: [PATCH] avdevice/avfoundation: fix build with deployment targets
 below macOS 12

c2802e520a selected kIOMainPortDefault whenever the SDK is new enough
(__MAC_OS_X_VERSION_MAX_ALLOWED), but that symbol is only available
since macOS 12, so building with a newer SDK against an older
deployment target failed with -Wunguarded-availability-new.

Check the deployment target (__MAC_OS_X_VERSION_MIN_REQUIRED) instead
and keep using the equivalent kIOMasterPortDefault when targeting
older releases.

See: 
https://lists.ffmpeg.org/archives/list/[email protected]/thread/S7PGVSGNLIZ2WRYV6VOBAD3RWYUNWA3H/
Reported-by: Helmut K. C. Tessarek <[email protected]>
Signed-off-by: Gabriel Balaich <[email protected]>
---
 libavdevice/avfoundation.m | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m
index 88b814ecf1..4516388dd4 100644
--- a/libavdevice/avfoundation.m
+++ b/libavdevice/avfoundation.m
@@ -30,8 +30,9 @@
 #import <AVFoundation/AVFoundation.h>
 #if HAVE_IOKIT
 #   import <IOKit/IOKitLib.h>
-    /* kIOMainPortDefault replaced kIOMasterPortDefault in the macOS 12 SDK. */
-#   if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && 
__MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
+    /* kIOMainPortDefault is only available since macOS 12; fall back to the
+     * equivalent kIOMasterPortDefault when targeting older releases. */
+#   if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && 
__MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
 #       define AVF_IO_MAIN_PORT_DEFAULT kIOMainPortDefault
 #   else
 #       define AVF_IO_MAIN_PORT_DEFAULT kIOMasterPortDefault
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to