From 9fb24fb0360893b515798de690c60d0c29adfccd Mon Sep 17 00:00:00 2001 From: hexbabe Date: Mon, 30 Oct 2023 11:16:24 -0400 Subject: [PATCH] Use identifier conditional compilation (hackier) but might work and is still decently readable --- .../AVFoundationBind/AVFoundationBind.m | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m b/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m index 448cee7..7575b7f 100644 --- a/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m +++ b/pkg/avfoundation/AVFoundationBind/AVFoundationBind.m @@ -46,6 +46,8 @@ } \ } while(0) +#define SONOMA_MICROPHONE_TYPE AVCaptureDeviceTypeMicrophone + @interface VideoDataDelegate : NSObject @property (readonly) AVBindDataCallback mCallback; @@ -184,19 +186,19 @@ STATUS AVBindDevices(AVBindMediaType mediaType, PAVBindDevice *ppDevices, int *p AVMediaType _mediaType = mediaType == AVBindMediaTypeVideo ? AVMediaTypeVideo : AVMediaTypeAudio; NSArray *refAllTypes; - if (@available(macOS 14.0, *)) { - refAllTypes = @[ - AVCaptureDeviceTypeBuiltInWideAngleCamera, - AVCaptureDeviceTypeMicrophone, - AVCaptureDeviceTypeExternal, - ]; - } else { - refAllTypes = @[ - AVCaptureDeviceTypeBuiltInWideAngleCamera, - AVCaptureDeviceTypeBuiltInMicrophone, - AVCaptureDeviceTypeExternalUnknown, - ]; - } + #ifdef SONOMA_MICROPHONE_TYPE + refAllTypes = @[ + AVCaptureDeviceTypeBuiltInWideAngleCamera, + AVCaptureDeviceTypeMicrophone, + AVCaptureDeviceTypeExternal, + ]; + #else + refAllTypes = @[ + AVCaptureDeviceTypeBuiltInWideAngleCamera, + AVCaptureDeviceTypeBuiltInMicrophone, + AVCaptureDeviceTypeExternalUnknown, + ]; + #endif