0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

plugins: Remove old macOS version ifdefs

8dd20dfd33 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.
This commit is contained in:
gxalpha 2023-10-21 20:38:26 +02:00 committed by Ryan Foster
parent d017cb6718
commit ba4467199c
6 changed files with 1 additions and 24 deletions

View File

@ -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];

View File

@ -1,7 +1,6 @@
#include <AvailabilityMacros.h>
#include <Cocoa/Cocoa.h>
#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

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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. "