diff --git a/meson.build b/meson.build index 787f578232..455e9edde2 100644 --- a/meson.build +++ b/meson.build @@ -1575,6 +1575,12 @@ if features['cocoa'] and features['swift'] 'video/out/mac/window.swift') endif +macos_10_15_4_features = get_option('macos-10-15-4-features').require( + macos_sdk_version.version_compare('>= 10.15.4'), + error_message: 'A macos sdk version >= 10.15.4 could not be found!', +) +features += {'macos-10-15-4-features': macos_10_15_4_features.allowed()} + macos_11_features = get_option('macos-11-features').require( macos_sdk_version.version_compare('>= 11'), error_message: 'A macos sdk version >= 11 could not be found!', diff --git a/meson_options.txt b/meson_options.txt index 788231ad60..53c6ac3c0f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -106,6 +106,7 @@ option('videotoolbox-pl', type: 'feature', value: 'auto', description: 'Videotoo option('vulkan-interop', type: 'feature', value: 'auto', description: 'Vulkan graphics interop') # 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-12-features', type: 'feature', value: 'auto', description: 'macOS 12 SDK Features') option('macos-cocoa-cb', type: 'feature', value: 'auto', description: 'macOS libmpv backend') diff --git a/osdep/mac/meson.build b/osdep/mac/meson.build index 4358173c17..9116d81476 100644 --- a/osdep/mac/meson.build +++ b/osdep/mac/meson.build @@ -19,6 +19,10 @@ if get_option('optimization') != '0' swift_flags += '-O' endif +if macos_10_15_4_features.allowed() + swift_flags += ['-D', 'HAVE_MACOS_10_15_4_FEATURES'] +endif + if macos_11_features.allowed() swift_flags += ['-D', 'HAVE_MACOS_11_FEATURES'] endif diff --git a/video/out/cocoa_cb_common.swift b/video/out/cocoa_cb_common.swift index b2910dba85..4b4250c565 100644 --- a/video/out/cocoa_cb_common.swift +++ b/video/out/cocoa_cb_common.swift @@ -135,7 +135,6 @@ class CocoaCB: Common, EventSubscriber { case MAC_CSP_AUTO: return colorSpace case MAC_CSP_DISPLAY_P3: return CGColorSpace(name: CGColorSpace.displayP3) case MAC_CSP_DISPLAY_P3_HLG: return CGColorSpace(name: CGColorSpace.displayP3_HLG) - case MAC_CSP_DISPLAY_P3_PQ: return CGColorSpace(name: CGColorSpace.displayP3_PQ) case MAC_CSP_DCI_P3: return CGColorSpace(name: CGColorSpace.dcip3) case MAC_CSP_BT_2020: return CGColorSpace(name: CGColorSpace.itur_2020) case MAC_CSP_BT_709: return CGColorSpace(name: CGColorSpace.itur_709) @@ -146,6 +145,15 @@ class CocoaCB: Common, EventSubscriber { default: break } +#if HAVE_MACOS_10_15_4_FEATURES + if #available(macOS 10.15.4, *) { + switch outputCsp { + case MAC_CSP_DISPLAY_P3_PQ: return CGColorSpace(name: CGColorSpace.displayP3_PQ) + default: break + } + } +#endif + #if HAVE_MACOS_11_FEATURES if #available(macOS 11.0, *) { switch outputCsp {