Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
ef72751d by Alexandre Janniaux at 2026-04-14T18:52:20+02:00
aout: avaudiosession: fix compilation with older Apple SDKs

The setSupportsMultichannelContent method is not available on older
SDKs.

- - - - -
7ac24e43 by Alexandre Janniaux at 2026-04-14T18:52:20+02:00
aout: avsamplebuffer: fix compilation with older Apple SDKs

Add compile-time SDK version guards and @available runtime checks for
delaysRateChangeUntilHasSufficientMediaData (macOS 11.3+/iOS 14.5+/
tvOS 14.5+/watchOS 7.4+) and
AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification
(macOS 12.0+/iOS 15.0+/tvOS 15.0+/watchOS 8.0+) which are not
visible in older SDKs.

- - - - -


2 changed files:

- modules/audio_output/apple/avaudiosession_common.m
- modules/audio_output/apple/avsamplebuffer.m


Changes:

=====================================
modules/audio_output/apple/avaudiosession_common.m
=====================================
@@ -74,6 +74,9 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession 
*instance,
 
     if (spatial_audio)
     {
+#if (TARGET_OS_IOS   && defined(__IPHONE_15_0) && 
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0) || \
+    (TARGET_OS_TV    && defined(__TVOS_15_0)   && __TV_OS_VERSION_MAX_ALLOWED  
   >= __TVOS_15_0) || \
+    (TARGET_OS_WATCH && defined(__WATCHOS_8_0) && 
__WATCH_OS_VERSION_MAX_ALLOWED  >= __WATCHOS_8_0)
         if (@available(iOS 15.0, watchOS 8.0, tvOS 15.0, *))
         {
             /* Not mandatory, SpatialAudio can work without it. It just 
signals to
@@ -81,6 +84,7 @@ avas_PrepareFormat(audio_output_t *p_aout, AVAudioSession 
*instance,
             [instance 
setSupportsMultichannelContent:aout_FormatNbChannels(fmt) > 2
                                                error:nil];
         }
+#endif
     }
     else if (channel_count == 2 && aout_FormatNbChannels(fmt) > 2)
     {


=====================================
modules/audio_output/apple/avsamplebuffer.m
=====================================
@@ -507,7 +507,13 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, 
size_t sizeInBytes)
         goto error;
     }
 
-    _sync.delaysRateChangeUntilHasSufficientMediaData = NO;
+#if (TARGET_OS_OSX   && defined(__MAC_11_3)     && 
MAC_OS_X_VERSION_MAX_ALLOWED    >= __MAC_11_3) || \
+    (TARGET_OS_IOS   && defined(__IPHONE_14_5)  && 
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_5) || \
+    (TARGET_OS_TV    && defined(__TVOS_14_5)     && 
__TV_OS_VERSION_MAX_ALLOWED     >= __TVOS_14_5) || \
+    (TARGET_OS_WATCH && defined(__WATCHOS_7_4)   && 
__WATCH_OS_VERSION_MAX_ALLOWED  >= __WATCHOS_7_4)
+    if (@available(macOS 11.3, iOS 14.5, tvOS 14.5, watchOS 7.4, *))
+        _sync.delaysRateChangeUntilHasSufficientMediaData = NO;
+#endif
     [_sync addRenderer:_renderer];
 
     _stopped = NO;
@@ -523,6 +529,10 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, 
size_t sizeInBytes)
                     selector:@selector(flushedAutomatically:)
                         
name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification
                       object:nil];
+#if (TARGET_OS_OSX   && defined(__MAC_12_0)    && MAC_OS_X_VERSION_MAX_ALLOWED 
   >= __MAC_12_0) || \
+    (TARGET_OS_IOS   && defined(__IPHONE_15_0) && 
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0) || \
+    (TARGET_OS_TV    && defined(__TVOS_15_0)   && __TV_OS_VERSION_MAX_ALLOWED  
   >= __TVOS_15_0) || \
+    (TARGET_OS_WATCH && defined(__WATCHOS_8_0) && 
__WATCH_OS_VERSION_MAX_ALLOWED  >= __WATCHOS_8_0)
     if (@available(macOS 12.0, iOS 15.0, tvOS 15.0, watchOS 8.0, *))
     {
         [notifCenter addObserver:self
@@ -530,6 +540,7 @@ customBlock_Free(void *refcon, void *doomedMemoryBlock, 
size_t sizeInBytes)
                             
name:AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification
                           object:nil];
     }
+#endif
 
     return YES;
 error:



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/093ad617ba0bf1bf4fc34517dfc8f737a561c3bd...7ac24e43efbe7b0b839f41e68e1cf760c5986a52

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/compare/093ad617ba0bf1bf4fc34517dfc8f737a561c3bd...7ac24e43efbe7b0b839f41e68e1cf760c5986a52
You're receiving this email because of your account on code.videolan.org.


_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to