Browse Source

mac-avcapture: Add additional capture presets

This adds additional capture presets, including 3840x2160 and
1920x1080, in addition to the preset "High."
Doug Kelly 4 years ago
parent
commit
b1efb005ab
1 changed files with 13 additions and 2 deletions
  1. 13 2
      plugins/mac-avcapture/av-capture.mm

+ 13 - 2
plugins/mac-avcapture/av-capture.mm

@@ -1,3 +1,4 @@
+#import <AvailabilityMacros.h>
 #import <AVFoundation/AVFoundation.h>
 #import <CoreFoundation/CoreFoundation.h>
 #import <CoreMedia/CoreMedia.h>
@@ -1230,8 +1231,13 @@ static void *av_capture_create(obs_data_t *settings, obs_source_t *source)
 static NSArray *presets(void)
 {
 	return @[
-		//AVCaptureSessionPresetiFrame1280x720,
-		//AVCaptureSessionPresetiFrame960x540,
+	//AVCaptureSessionPresetiFrame1280x720,
+	//AVCaptureSessionPresetiFrame960x540,
+#if defined(MAC_OS_X_VERSION_10_15) && \
+	MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
+		AVCaptureSessionPreset3840x2160,
+		AVCaptureSessionPreset1920x1080,
+#endif
 		AVCaptureSessionPreset1280x720, AVCaptureSessionPreset960x540,
 		AVCaptureSessionPreset640x480, AVCaptureSessionPreset352x288,
 		AVCaptureSessionPreset320x240, AVCaptureSessionPresetHigh,
@@ -1252,6 +1258,11 @@ static NSString *preset_names(NSString *preset)
 		AVCaptureSessionPreset640x480: @"640x480",
 		AVCaptureSessionPreset960x540: @"960x540",
 		AVCaptureSessionPreset1280x720: @"1280x720",
+#if defined(MAC_OS_X_VERSION_10_15) && \
+	MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_15
+		AVCaptureSessionPreset1920x1080: @"1920x1080",
+		AVCaptureSessionPreset3840x2160: @"3840x2160",
+#endif
 		AVCaptureSessionPresetHigh: @"High",
 	};
 	NSString *name = preset_names[preset];