ao_avfoundation: guard features only available on macOS 11.3 and 12

build time and runtime checks.
This commit is contained in:
der richter 2024-06-15 16:51:08 +02:00
parent 55241da4ad
commit bc5ab97d9a
3 changed files with 14 additions and 1 deletions

View File

@ -254,9 +254,11 @@ static int init(struct ao *ao)
}
[p->synchronizer addRenderer:p->renderer];
#if HAVE_MACOS_11_3_FEATURES
if (@available(tvOS 14.5, iOS 14.5, macOS 11.3, *)) {
[p->synchronizer setDelaysRateChangeUntilHasSufficientMediaData:NO];
}
#endif
if (af_fmt_is_spdif(ao->format)) {
MP_FATAL(ao, "avfoundation does not support SPDIF\n");
@ -315,7 +317,11 @@ static int init(struct ao *ao)
p->observer = [[AVObserver alloc] initWithAO:ao];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
#if HAVE_MACOS_12_FEATURES
if (@available(tvOS 15.0, iOS 15.0, macOS 12.0, *)) {
[center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification object:p->renderer];
}
#endif
[center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification object:p->renderer];
return CONTROL_OK;

View File

@ -1587,6 +1587,12 @@ macos_11_features = get_option('macos-11-features').require(
)
features += {'macos-11-features': macos_11_features.allowed()}
macos_11_3_features = get_option('macos-11-3-features').require(
macos_sdk_version.version_compare('>= 11.3'),
error_message: 'A macos sdk version >= 11.3 could not be found!',
)
features += {'macos-11-3-features': macos_11_3_features.allowed()}
macos_12_features = get_option('macos-12-features').require(
macos_sdk_version.version_compare('>= 12'),
error_message: 'A macos sdk version >= 12 could not be found!',

View File

@ -108,6 +108,7 @@ option('vulkan-interop', type: 'feature', value: 'auto', description: 'Vulkan gr
# macOS features
option('macos-10-15-4-features', type: 'feature', value: 'auto', description: 'macOS 10.15.4 SDK Features')
option('macos-11-features', type: 'feature', value: 'auto', description: 'macOS 11 SDK Features')
option('macos-11-3-features', type: 'feature', value: 'auto', description: 'macOS 11.3 SDK Features')
option('macos-12-features', type: 'feature', value: 'auto', description: 'macOS 12 SDK Features')
option('macos-cocoa-cb', type: 'feature', value: 'auto', description: 'macOS libmpv backend')
option('macos-media-player', type: 'feature', value: 'auto', description: 'macOS Media Player support')