Skip to content

ScreenCaptureKit macOS xcode16.0 b1

Rolf Bjarne Kvinge edited this page Jul 3, 2024 · 2 revisions

#ScreenCaptureKit.framework

Rolf

diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h	2024-04-16 04:38:11
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h	2024-06-01 03:46:10
@@ -31,6 +31,8 @@
     SCStreamErrorUserStopped API_AVAILABLE(macos(12.3)) = -3817,                            // The stream was stopped by the user
     SCStreamErrorFailedToStartAudioCapture API_AVAILABLE(macos(13.0)) = -3818, // The stream failed to start audio
     SCStreamErrorFailedToStopAudioCapture API_AVAILABLE(macos(13.0)) = -3819,   // The stream failed to stop audio
+    SCStreamErrorFailedToStartMicrophoneCapture API_AVAILABLE(macos(15.0)) = -3820, // The stream failed to start microphone
+    SCStreamErrorSystemStoppedStream API_AVAILABLE(macos(15.0)) = -3821, // The stream was stopped by the system
 };
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCRecordingOutput.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCRecordingOutput.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCRecordingOutput.h	1970-01-01 01:00:00
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCRecordingOutput.h	2024-06-01 03:46:10
@@ -0,0 +1,112 @@
+//
+//  SCRecordingOutput.h
+//  ScreenCaptureKit
+//
+//  Created by Jiangyu on 10/25/23.
+//  Copyright © 2023 Apple Inc. All rights reserved.
+//
+
+#ifndef SCRecordingOutput_h
+#define SCRecordingOutput_h
+
+#import <CoreMedia/CMTime.h>
+#import <AVFoundation/AVVideoSettings.h>
+#import <AVFoundation/AVMediaFormat.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class SCRecordingOutput;
+
+/*!
+ @abstract SCRecordingOutputConfiguration
+ @discussion SCRecordingOutputConfiguration is an object that encapsulates the configuration for recording.
+*/
+API_AVAILABLE(macos(15.0))
+@interface SCRecordingOutputConfiguration : NSObject
+
+/*!
+ @abstract Specifies output URL to save the recording.
+ */
+@property(nonatomic, copy) NSURL *outputURL;
+
+/*!
+ @abstract Specifies video codec for the recording output, default is AVVideoCodecTypeH264, supported values can be obtained using availableVideoCodecTypes
+ */
+@property(nonatomic, copy) AVVideoCodecType videoCodecType;
+
+/*!
+ @abstract Specifies file type for the recording output, default is AVFileTypeMPEG4, supported values can be obtained using availableOutputFileTypes
+ */
+@property(nonatomic, copy) AVFileType outputFileType;
+
+/*!
+ @abstract Returns an array of supported video codec formats that can be specified in SCRecordingOutputConfiguration for videoCodecType
+ */
+@property(nonatomic, readonly) NSArray<AVVideoCodecType> *availableVideoCodecTypes;
+
+/*!
+ @abstract Returns an array of supported file types that can be specified in SCRecordingOutputConfiguration for outputFileType
+    Provides the file types AVCaptureAudioFileOutput can write.
+ */
+@property(nonatomic, readonly) NSArray<AVFileType> *availableOutputFileTypes;
+
+@end
+
+/*!
+ @protocol SCRecordingOutputDelegate
+ @abstract
+    Defines an interface for delegates of SCRecordingOutput to respond to events that occur in the process of recording to file.
+ */
+API_AVAILABLE(macos(15.0))
+@protocol SCRecordingOutputDelegate <NSObject>
+
+@optional
+/*!
+ @abstract recordingOutputDidStartRecording:
+ @param recordingOutput the SCRecordingOutput object
+ @discussion notifies the delegate that recording has succesfully started.
+*/
+- (void)recordingOutputDidStartRecording:(SCRecordingOutput *)recordingOutput;
+
+/*!
+ @abstract recordingOutput:didFailWithError:
+ @param recordingOutput the SCRecordingOutput object
+ @param error error describing why the recording failed.
+ @discussion notifies the delegate that recording has failed with error associated.
+*/
+- (void)recordingOutput:(SCRecordingOutput *)recordingOutput didFailWithError:(NSError *)error;
+
+/*!
+ @abstract recordingOutputDidFinishRecording:
+ @discussion notifies the delegate that recording has finished successfully.
+*/
+- (void)recordingOutputDidFinishRecording:(SCRecordingOutput *)recordingOutput;
+
+@end
+
+API_AVAILABLE(macos(15.0))
+@interface SCRecordingOutput : NSObject
+/*!
+ @abstract Indicates current duration of recording to the output file.
+ */
+@property(nonatomic, readonly) CMTime recordedDuration;
+
+/*!
+ @abstract Indicates current size, in bytes, of the data recorded to the output file.
+ */
+@property(nonatomic, readonly) NSInteger recordedFileSize;
+
+/*!
+ @method initWithConfiguration:delegate:
+ @abstract initialize SCRecordingOutput object with SCRecordingOutputConfiguration and SCRecordingOutputDelegate
+ @param recordingOutputConfiguration the requested recording configuration to be applied to the SCRecordingOutput
+ @parame delegate object conforming SCRecordingOutputDelegate protocol. Clients must specify a delegate so that they can be notified about recording event.
+ @discussion Client can create a SCRecordingOutput with this initializer and add to SCStream to record all captured media into one recording file given output url specified in recordingOutputConfig. The recording will be using H264 and file format is MPEG-4.
+*/
+- (instancetype)initWithConfiguration:(SCRecordingOutputConfiguration *)recordingOutputConfiguration delegate:(id<SCRecordingOutputDelegate>)delegate;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif /* SCRecordingOutput_h */
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h	2024-04-16 04:38:11
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h	2024-06-01 03:46:10
@@ -19,12 +20,15 @@
  @discussion
     SCStreamOutputTypeScreen is a screen capture sample buffer. This sample buffer that is wrapping a CMSampleBuffer that is backed by an IOSurface. The width and height of the sample buffer is what is defined in the SCStreamConfiguration for width and height. The sample buffer will be called back on the provided queue when adding a SCStreamOutput. The pixel format of the sample buffer will be what is defined in the SCStreamConfiguration. In the case of multiple window capture, the width and height will be that of the display passed in for the filter. The background color of multiwindow sample buffers will be default black and can be set through the SCStreamConfiguration.
  @constant SCStreamOutputTypeAudio audio sample output type.
+ @constant SCStreamOutputTypeMicrophone microphone audio sample output type.
  @discussion
- SCStreamOutputTypeAudio is a audio capture sample buffer. This sample buffer that is wrapping a audio buffer list. The format of the audio buffer is based on sampleRate and channelCount set in SCStreamConfiguration.
+ SCStreamOutputTypeAudio is an audio capture sample buffer. This sample buffer that is wrapping an audio buffer list. The format of the audio buffer is based on sampleRate and channelCount set in SCStreamConfiguration.
+ SCStreamOutputTypeMicrophone is a microphone audio capture sample buffer. This sample buffer that is wrapping an audio buffer list. The format of the audio buffer is based on the selected microphone capture device's native format.
 */
 typedef NS_ENUM(NSInteger, SCStreamOutputType) {
     SCStreamOutputTypeScreen,
-    SCStreamOutputTypeAudio API_AVAILABLE(macos(13.0))
+    SCStreamOutputTypeAudio API_AVAILABLE(macos(13.0)),
+    SCStreamOutputTypeMicrophone API_AVAILABLE(macos(15.0))
 };
 
 /*!
@@ -68,7 +72,7 @@
 typedef NS_ENUM(NSInteger, SCStreamType) {
     SCStreamTypeWindow,
     SCStreamTypeDisplay
-};
+} API_DEPRECATED("Use SCShareableContentStyle instead", macos(14.0, 15.0));
 
 typedef NS_ENUM(NSInteger, SCCaptureResolutionType) {
     SCCaptureResolutionAutomatic,
@@ -77,6 +81,19 @@
 };
 
 /*!
+ @typedef SCCaptureDynamicRange
+ @abstract SCCaptureDynamicRange client can specify whether the captured screen output will be SDR or HDR. When SCCaptureDynamicRangeHDR is set, the output screen capture buffer pixel format and color space will be updated in order to support HDR.
+ @constant SCCaptureDynamicRangeSDR by default, screen capture output will be SDR.
+ @constant SCCaptureDynamicRangeHDRLocalDisplay by default, screen capture output will be HDR, optimized for rendering on the local captured display
+ @constant SCCaptureDynamicRangeHDRCanonicalDisplay by default, screen capture output will be HDR, optimized for rendering on any HDR display
+*/
+typedef NS_ENUM(NSInteger, SCCaptureDynamicRange) {
+    SCCaptureDynamicRangeSDR,
+    SCCaptureDynamicRangeHDRLocalDisplay,
+    SCCaptureDynamicRangeHDRCanonicalDisplay
+} API_AVAILABLE(macos(15.0));
+
+/*!
  @abstract SCContentFilter
  @discussion SCContentFilter is a object that determines the exact content to be captured in the SCStream. It can be filtered through displays, windows, excluded windows or applications.
 */
@@ -90,16 +107,16 @@
 /*!
  @abstract style of stream
  */
-@property (nonatomic, readonly) SCShareableContentStyle style;
+@property (nonatomic, readonly) SCShareableContentStyle style API_AVAILABLE(macos(14.0));
 /*!
  @abstract Pixel to points scaling factor
  */
-@property (nonatomic, readonly) float pointPixelScale;
+@property (nonatomic, readonly) float pointPixelScale API_AVAILABLE(macos(14.0));
 
 /*!
  @abstract Size and location of content in points
  */
-@property (nonatomic, readonly) CGRect contentRect;
+@property (nonatomic, readonly) CGRect contentRect API_AVAILABLE(macos(14.0));
 
 /*!
  @abstract To include menu bar as part of the capture. This property has no effect for the desktop independent window filter. For content filters created with initWithDisplay:excluding, the default value is YES. Display excluding content filters contains the desktop and dock. For content filters created with initWithDisplay:including, the default value is NO. Display including content filters do not contain the desktop and dock
@@ -155,7 +172,23 @@
 */
 API_AVAILABLE(macos(12.3))
 @interface SCStreamConfiguration : NSObject
+
 /*!
+ @typedef SCStreamConfigurationPreset
+ @abstract Client can use SCStreamConfigurationPreset to create SCStreamConfiguration with suggested values of properties for various use cases
+ @constant SCStreamConfigurationPresetCaptureHDRLocalDisplay using this preset will help client set suggested values for captureDynamicRange, pixelFormat, ColorSpace, colorMatrix in order to get HDR capture output with SCStream, optimized for rendering on the local captured display.
+ @constant SCStreamConfigurationPresetCaptureHDRCanonicalDisplay using this preset will help client set suggested values for captureDynamicRange, pixelFormat, ColorSpace, colorMatrix in order to get HDR capture output with SCStream, optimized for rendering on canonical HDR display
+ @constant SCStreamConfigurationPresetCaptureHDRScreenshotLocalDisplay using this preset will help client set suggested values for captureDynamicRange, pixelFormat, ColorSpace in order to get HDR screenshot with SCScreenshotManager, optimized for rendering on the local captured display.
+ @constant SCStreamConfigurationPresetCaptureHDRScreenshotCanonicalDisplay using this preset will help client set suggested values for captureDynamicRange, pixelFormat, ColorSpace in order to get HDR screenshot with SCScreenshotManager, optimized for rendering on canonical HDR display
+*/
+typedef NS_ENUM(NSInteger, SCStreamConfigurationPreset) {
+    SCStreamConfigurationPresetCaptureHDRStreamLocalDisplay,
+    SCStreamConfigurationPresetCaptureHDRStreamCanonicalDisplay,
+    SCStreamConfigurationPresetCaptureHDRScreenshotLocalDisplay,
+    SCStreamConfigurationPresetCaptureHDRScreenshotCanonicalDisplay
+} NS_SWIFT_NAME(SCStreamConfiguration.Preset) API_AVAILABLE(macos(15.0));
+
+/*!
  @abstract SCStreamProperty for output width as measured in pixels. Default is set to 1920.
  */
 @property(nonatomic, assign) size_t width;
@@ -176,6 +209,8 @@
  'l10r': Packed Little Endian ARGB2101010
  '420v': 2-plane "video" range YCbCr 4:2:0
  '420f': 2-plane "full" range YCbCr 4:2:0
+ 'xf44': 2 plane "full" range YCbCr10 4:4:4
+ 'RGhA': 64 bit RGBA IEEE half-precision float, 16-bit little-endian
  See https://developer.apple.com/documentation/coregraphics/1455170-cgdisplaystreamcreate
  */
 @property(nonatomic, assign) OSType pixelFormat;
@@ -201,6 +236,11 @@
 @property(nonatomic, assign) BOOL showsCursor;
 
 /*!
+ @abstract SCStreamProperty that specifies whether to draw a circle around the cursor click, default is NO. This property will not be affected by showsCursor. This property currently applies when pixelFormat is set to BGRA.
+ */
+@property (nonatomic, assign) BOOL showMouseClicks API_AVAILABLE(macos(15.0));
+
+/*!
  @abstract SCStreamProperty for background color. By default the background color is clear.
  */
 @property(nonatomic, assign) CGColorRef backgroundColor;
@@ -296,6 +336,29 @@
  */
 @property(nonatomic, assign) BOOL includeChildWindows API_AVAILABLE(macos(14.2));
 
+/*!
+ @abstract SCStreamProperty that specifies whether the microphone audio will be captured.  By default microphone is not captured.
+ */
+@property(nonatomic, assign) BOOL captureMicrophone API_AVAILABLE(macos(15.0));
+
+/*!
+ @abstract SCStreamProperty that specifies which microphone device to capture. This deviceID is the uniqueID from AVCaptureDevice for the microphone. System Default Microphone will be used if not specified by client.
+ */
+@property(nonatomic, strong, nullable) NSString *microphoneCaptureDeviceID API_AVAILABLE(macos(15.0));
+
+/*!
+ @abstract SCStreamProperty client will choose captureDynamicRange between SCCaptureDynamicRangeSDR, SCCaptureDynamicRangeHDRLocalDisplay,  SCCaptureDynamicRangeHDRCanonicalDisplay. By default, the stream is capturing with SCCaptureDynamicRangeSDR. HDR capture is only supported with Apple Silicon Mac, setting this property on Intel Mac will have no effect. HDR recording is not support yet, adding a recording output to a stream with SCCaptureDynamicRangeHDR set will fail.
+ */
+@property(nonatomic, assign) SCCaptureDynamicRange captureDynamicRange API_AVAILABLE(macos(15.0));
+
+/*!
+ @method streamConfigurationWithPreset:
+ @abstract Returns an instance of SCStreamConfiguration corresponding to the given preset
+ @param preset The enum identifier for the desired preset
+ @discussion The SCStreamConfiguration of the returned object can be used as a guide for creating and configuring an SCStream. If all the suggested properties are respected in creating the SCStream, the resulting capture result will conform to the criteria implied by the preset.
+ */
++ (instancetype)streamConfigurationWithPreset:(SCStreamConfigurationPreset)preset API_AVAILABLE(macos(15.0));
+
 @end
 
 /*!
@@ -432,6 +495,24 @@
 */
 - (void)stopCaptureWithCompletionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
 
+/*!
+ @method addRecordingOutput
+ @abstract Add a SCRecordingOutput to the SCStream. Starts Recording if stream is already capturing, otherwise recording will be started after capture starts. Recording will be written into a file url specified in SCRecordingOutput. Media(Screen/Audio/Microphone) to be recorded will be based on the SCStream configuration.
+ @param recordingOutput an SCRecordingOutput that including configuration of recording, and delegate for recording event.
+ @param error the error pertaining to the add recording output
+ @discussion Returns a BOOL denoting if the add was successful. Currently only support one recordingOutput on a stream. To guarantee the first sample captured in the stream to be written into the recording file, client need to add recordingOutput before startCapture. Delegate for recordingDidStart will be notified in SCRecordingOutput or recordingDidFinishWithError will be notified with an error associated if recording failed to start.
+*/
+- (BOOL)addRecordingOutput:(SCRecordingOutput *)recordingOutput error:(NSError **)error NS_SWIFT_NAME(addRecordingOutput(_:)) API_AVAILABLE(macos(15.0));
+
+/*!
+ @method removeRecordingOutput
+ @abstract Remove SCRecordingOutput from the SCStream. Stops Recording if the stream is currently recording.
+ @param recordingOutput an SCRecordingOutput that including configuration of recording, and delegate for recording event.
+ @param error the error pertaining to the remove recording output
+ @discussion Returns a BOOL denoting if the remove was successful. Delegate for recordingDidFinishWithError will be notified in SCRecordingOutput, associate with an error code if recording failed to finish written to the file. If stopCapture is called without removing recordingOutput, recording will be stopped and finish writting into the file. In case client update the stream configuration during recording, recording will be stopped as well.
+*/
+- (BOOL)removeRecordingOutput:(SCRecordingOutput *)recordingOutput error:(NSError **)error NS_SWIFT_NAME(removeRecordingOutput(_:)) API_AVAILABLE(macos(15.0));
+
 @end
 
 API_AVAILABLE(macos(12.3))
@@ -459,13 +540,6 @@
  @discussion notifies the delegate that the stream has stopped and the error associated with it
 */
 - (void)stream:(SCStream *)stream didStopWithError:(NSError *)error;
-
-/*!
- @abstract userDidStopStream:
- @param stream the SCStream object
- @discussion notifies the delegate that the stream was stopped by the user from the control center module
- */
-- (void)userDidStopStream:(SCStream *)stream NS_SWIFT_NAME(userDidStopStream(_:)) API_AVAILABLE(macos(14.4));
 
 /*!
  @abstract outputVideoEffectDidStartForStream:
diff -ruN /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h
--- /Applications/Xcode_15.4.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h	2024-04-16 04:38:10
+++ /Applications/Xcode_16.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h	2024-06-01 03:46:10
@@ -12,6 +12,7 @@
 #import <ScreenCaptureKit/SCError.h>
 #import <ScreenCaptureKit/SCContentSharingPicker.h>
 #import <ScreenCaptureKit/SCScreenshotManager.h>
+#import <ScreenCaptureKit/SCRecordingOutput.h>
 
 
 
Clone this wiki locally