From ba4467199c576d977092fd0e6e84f9a4f62159e9 Mon Sep 17 00:00:00 2001 From: gxalpha Date: Sat, 21 Oct 2023 20:38:26 +0200 Subject: [PATCH] plugins: Remove old macOS version ifdefs 8dd20dfd335dd07d2f1678c9cdf67894e09beab4 introduced an explicit check for the available macOS SDK, meaning that we can be sure that the macOS 13.1 SDK is available. As such, we do not require ifdef guards for the availability of functions that are older than 13.1. --- plugins/mac-avcapture/av-capture.mm | 2 -- plugins/mac-capture/mac-sck-common.h | 2 -- plugins/mac-capture/mac-sck-common.m | 7 +------ plugins/mac-capture/mac-sck-video-capture.m | 4 ---- plugins/mac-capture/plugin-main.c | 2 -- plugins/mac-videotoolbox/encoder.c | 8 -------- 6 files changed, 1 insertion(+), 24 deletions(-) diff --git a/plugins/mac-avcapture/av-capture.mm b/plugins/mac-avcapture/av-capture.mm index e6d55877e..8183aa93a 100644 --- a/plugins/mac-avcapture/av-capture.mm +++ b/plugins/mac-avcapture/av-capture.mm @@ -2038,11 +2038,9 @@ static obs_properties_t *av_capture_properties(void *data) NSMutableArray *device_types = [NSMutableArray arrayWithObjects:AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeExternalUnknown, nil]; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 if (__builtin_available(macOS 13.0, *)) { [device_types addObject:AVCaptureDeviceTypeDeskViewCamera]; } -#endif AVCaptureDeviceDiscoverySession *video_discovery = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:device_types mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified]; diff --git a/plugins/mac-capture/mac-sck-common.h b/plugins/mac-capture/mac-sck-common.h index 7574d9e9a..15ed6e583 100644 --- a/plugins/mac-capture/mac-sck-common.h +++ b/plugins/mac-capture/mac-sck-common.h @@ -1,7 +1,6 @@ #include #include -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120300 // __MAC_12_3 #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunguarded-availability-new" @@ -85,4 +84,3 @@ void screen_stream_video_update(struct screen_capture *sc, CMSampleBufferRef sam void screen_stream_audio_update(struct screen_capture *sc, CMSampleBufferRef sample_buffer); #pragma clang diagnostic pop -#endif diff --git a/plugins/mac-capture/mac-sck-common.m b/plugins/mac-capture/mac-sck-common.m index 0343eccf2..f9f6de7d0 100644 --- a/plugins/mac-capture/mac-sck-common.m +++ b/plugins/mac-capture/mac-sck-common.m @@ -18,14 +18,11 @@ bool is_screen_capture_available(void) if (self.sc != NULL) { if (type == SCStreamOutputTypeScreen && !self.sc->audio_only) { screen_stream_video_update(self.sc, sampleBuffer); - } -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 - else if (@available(macOS 13.0, *)) { + } else if (@available(macOS 13.0, *)) { if (type == SCStreamOutputTypeAudio) { screen_stream_audio_update(self.sc, sampleBuffer); } } -#endif } } @@ -33,11 +30,9 @@ bool is_screen_capture_available(void) { NSString *errorMessage; switch (error.code) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 case SCStreamErrorUserStopped: errorMessage = @"User stopped stream."; break; -#endif case SCStreamErrorNoCaptureSource: errorMessage = @"Stream stopped as no capture source was not found."; break; diff --git a/plugins/mac-capture/mac-sck-video-capture.m b/plugins/mac-capture/mac-sck-video-capture.m index 524270da0..24d400bca 100644 --- a/plugins/mac-capture/mac-sck-video-capture.m +++ b/plugins/mac-capture/mac-sck-video-capture.m @@ -185,11 +185,9 @@ static bool init_screen_stream(struct screen_capture *sc) [sc->stream_properties setPixelFormat:l10r_type]; if (@available(macOS 13.0, *)) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 [sc->stream_properties setCapturesAudio:YES]; [sc->stream_properties setExcludesCurrentProcessAudio:YES]; [sc->stream_properties setChannelCount:2]; -#endif } else { if (sc->capture_type != ScreenCaptureWindowStream) { sc->disp = NULL; @@ -216,7 +214,6 @@ static bool init_screen_stream(struct screen_capture *sc) return !did_add_output; } -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 if (@available(macOS 13.0, *)) { did_add_output = [sc->disp addStreamOutput:sc->capture_delegate type:SCStreamOutputTypeAudio sampleHandlerQueue:nil @@ -228,7 +225,6 @@ static bool init_screen_stream(struct screen_capture *sc) return !did_add_output; } } -#endif os_event_init(&sc->disp_finished, OS_EVENT_TYPE_MANUAL); os_event_init(&sc->stream_start_completed, OS_EVENT_TYPE_MANUAL); diff --git a/plugins/mac-capture/plugin-main.c b/plugins/mac-capture/plugin-main.c index e1adff35d..fd28a5525 100644 --- a/plugins/mac-capture/plugin-main.c +++ b/plugins/mac-capture/plugin-main.c @@ -16,7 +16,6 @@ extern bool is_screen_capture_available() WEAK_IMPORT_ATTRIBUTE; bool obs_module_load(void) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120300 // __MAC_12_3 if (is_screen_capture_available()) { extern struct obs_source_info sck_video_capture_info; obs_register_source(&sck_video_capture_info); @@ -31,7 +30,6 @@ bool obs_module_load(void) obs_register_source(&sck_audio_capture_info); } } -#endif obs_register_source(&display_capture_info); obs_register_source(&window_capture_info); obs_register_source(&coreaudio_input_capture_info); diff --git a/plugins/mac-videotoolbox/encoder.c b/plugins/mac-videotoolbox/encoder.c index 965a9c740..f8b3ae0da 100644 --- a/plugins/mac-videotoolbox/encoder.c +++ b/plugins/mac-videotoolbox/encoder.c @@ -141,12 +141,10 @@ static CFStringRef obs_to_vt_profile(CMVideoCodecType codec_type, } if (strcmp(profile, "main10") == 0) return kVTProfileLevel_HEVC_Main10_AutoLevel; -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120300 // macOS 12.3 if (__builtin_available(macOS 12.3, *)) { if (strcmp(profile, "main42210") == 0) return kVTProfileLevel_HEVC_Main42210_AutoLevel; } -#endif // macOS 12.3 return kVTProfileLevel_HEVC_Main_AutoLevel; #else (void)format; @@ -300,7 +298,6 @@ static OSStatus session_set_bitrate(VTCompressionSessionRef session, can_limit_bitrate = true; if (__builtin_available(macOS 13.0, *)) { -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000 if (is_apple_silicon) { compressionPropertyKey = kVTCompressionPropertyKey_ConstantBitRate; @@ -310,11 +307,6 @@ static OSStatus session_set_bitrate(VTCompressionSessionRef session, "CBR support for VideoToolbox encoder requires Apple Silicon. " "Will use ABR instead."); } -#else - VT_LOG(LOG_WARNING, - "CBR support for VideoToolbox not available in this build of OBS. " - "Will use ABR instead."); -#endif } else { VT_LOG(LOG_WARNING, "CBR support for VideoToolbox encoder requires macOS 13 or newer. "