Skip to content

ScreenCaptureKit macOS xcode13.3 beta3

Alex Soto edited this page Mar 3, 2022 · 1 revision

#ScreenCaptureKit.framework

diff -ruN /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h
--- /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h	2022-01-29 07:17:10.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCError.h	2022-02-13 22:56:56.000000000 -0500
@@ -6,12 +6,13 @@
 //
 
 #import <Foundation/Foundation.h>
+extern NSString *const __nonnull SCStreamErrorDomain;
 
 NS_ASSUME_NONNULL_BEGIN
-typedef NS_ENUM (NSInteger, SCStreamErrorCode) {
-    SCStreamErrorUserDeclined = -3801,                           // The user did not allow TCCs to start capture
+typedef NS_ERROR_ENUM (SCStreamErrorDomain, SCStreamErrorCode) {
+    SCStreamErrorUserDeclined = -3801,                           // The user chose not to authorize capture
     SCStreamErrorFailedToStart = -3802,                          // The stream failed to start
-    SCStreamErrorEntitlements = -3803,                           // The stream failed due to missing entitlements
+    SCStreamErrorMissingEntitlements = -3803,                    // The stream failed due to missing entitlements
     SCStreamErrorFailedApplicationConnectionInvalid = -3804,     // Failed during recording application connection invalid
     SCStreamErrorFailedApplicationConnectionInterrupted = -3805, // Failed during recording appliation connection interrupted
     SCStreamErrorFailedNoMatchingApplicationContext = -3806,     // Failed during recording context id does not match application
@@ -19,7 +20,7 @@
     SCStreamErrorAttemptToStopStreamState = -3808,               // Failed due to attempting to stop a stream thats already in a recording state
     SCStreamErrorAttemptToUpdateFilterState = -3809,             // Failed due to attempting to update the filter on a stream
     SCStreamErrorAttemptToConfigState = -3810,                   // Failed due to attempting to update stream config on a stream
-    SCStreamErrorFailedToStartCaptureStack = -3811,              // Failed to start due to video/audio capture failure
+    SCStreamErrorInternalError = -3811,                          // Failed to start due to video/audio capture failure
     SCStreamErrorInvalidParameter = -3812,                       // Failed due to invalid parameter
     SCStreamErrorNoWindowList = -3813,                           // Failed due to no window list
     SCStreamErrorNoDisplayList = -3814,                          // Failed due to no display list
diff -ruN /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCShareableContent.h /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCShareableContent.h
--- /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCShareableContent.h	2022-02-03 17:11:08.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCShareableContent.h	2022-02-17 18:15:24.000000000 -0500
@@ -28,6 +28,7 @@
  */
 @property (readonly) pid_t processID;
 - (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
 @end
 
 API_AVAILABLE(macos(12.3))
@@ -62,6 +63,7 @@
  */
 @property (readonly, getter=isOnScreen) BOOL onScreen;
 - (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
 @end
 
 API_AVAILABLE(macos(12.3))
@@ -86,6 +88,7 @@
  */
 @property (readonly) CGRect frame;
 - (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
 @end
 
 API_AVAILABLE(macos(12.3))
@@ -95,7 +98,7 @@
 @param completionHandler the call back that will hand you back a SCShareableContent object
 @discussion this method will create a SCShareableContent object that is called on the supplied queue. The SCShareableContent will contain the windows, displays and applications that are available to capture
 */
-+ (void)getShareableContentWithCompletionHandler:(void(^)(SCShareableContent * _Nullable shareableContent, NSError * _Nullable error))completionHandler;
++ (void)getShareableContentWithCompletionHandler:(void(^)(SCShareableContent * _Nullable shareableContent, NSError * _Nullable error))completionHandler NS_SWIFT_ASYNC(1) NS_SWIFT_ASYNC_NAME(getter:current());
 
 /*!
 @abstract getShareableContentExcludingDesktopWindows:onScreenWindowsOnly:completionHandler
@@ -139,6 +142,7 @@
  */
 @property (readonly) NSArray<SCRunningApplication *> *applications;
 - (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
 @end
 
 NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h
--- /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h	2022-02-03 17:11:08.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/SCStream.h	2022-02-17 18:15:24.000000000 -0500
@@ -14,21 +14,31 @@
 
 /*!
  @typedef SCFrameStatus
- @abstract SCStream status.
- @constant SCFrameStatusFrameComplete new frame was generated.
- @constant SCFrameStatusFrameIdle new frame was not generated because the display did not change.
- @constant SCFrameStatusFrameBlank new frame was not generated because the display has gone blank.
- @constant SCFrameStatusFrameSuspended new frame was not generated because updates haves been suspended
- @constant SCFrameStatusFrameStarted new frame that is indicated as the first frame sent after the stream has started.
- @constant SCFrameStatusFrameStopped the stream was stopped.
+ @abstract SCFrameStatus denotes the status of frame sample buffer.
+ @constant SCFrameStatusComplete new frame was generated.
+ @constant SCFrameStatusIdle new frame was not generated because the display did not change.
+ @constant SCFrameStatusBlank new frame was not generated because the display has gone blank.
+ @constant SCFrameStatusSuspended new frame was not generated because updates haves been suspended
+ @constant SCFrameStatusStarted new frame that is indicated as the first frame sent after the stream has started.
+ @constant SCFrameStatusStopped the stream was stopped.
 */
 typedef NS_ENUM(NSInteger, SCFrameStatus) {
-    SCFrameStatusFrameComplete,
-    SCFrameStatusFrameIdle,
-    SCFrameStatusFrameBlank,
-    SCFrameStatusFrameSuspended,
-    SCFrameStatusFrameStarted,
-    SCFrameStatusFrameStopped
+    SCFrameStatusComplete,
+    SCFrameStatusIdle,
+    SCFrameStatusBlank,
+    SCFrameStatusSuspended,
+    SCFrameStatusStarted,
+    SCFrameStatusStopped
+};
+
+/*!
+ @typedef SCStreamOutputType
+ @constant SCStreamOutputTypeScreen screen sample output type.
+ @discussion
+    SCStreamOutputTypeScreen is a screen capture sample buffer. This sample buffer that is wrapping a CVPixelBuffer that is backed by an IOSurface. The width and height of the sample buffer is what is definied 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 mulitiple 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.
+*/
+typedef NS_ENUM(NSInteger, SCStreamOutputType) {
+    SCStreamOutputTypeScreen
 };
 
 /*!
@@ -50,7 +60,7 @@
  @param excluded the SCWindow(s) you wish to exclude from the passed in SCDisplay
  @discussion this method will create a SCContentFilter that captures the SCDisplay, excluding the passed in excluded SCWindow(s)
 */
-- (instancetype)initWithDisplay:(SCDisplay *)display excludingWindows:(nullable NSArray<SCWindow *>*)excluded;
+- (instancetype)initWithDisplay:(SCDisplay *)display excludingWindows:(NSArray<SCWindow *>*)excluded;
 
 /*!
  @abstract initWithDisplay:includingWindows
@@ -67,7 +77,7 @@
  @param exceptingWindows the NSSet of SCWindows that you wish to be an exception to the filter
  @discussion This method creates a SCContentFilter that captures all windows owned by the passed in SCRunningApplications. Any windows that are an exception to the filter will not be shown if their owning application is in the provided list and will be shown otherwise.
 */
-- (instancetype)initWithDisplay:(SCDisplay *)display includingApplications:(NSArray<SCRunningApplication *>*)applications exceptingWindows:(nullable NSArray<SCWindow *>*)exceptingWindows;
+- (instancetype)initWithDisplay:(SCDisplay *)display includingApplications:(NSArray<SCRunningApplication *>*)applications exceptingWindows:(NSArray<SCWindow *>*)exceptingWindows;
 
 /*!
  @abstract initWithDisplay:excludingApplications:exceptingWindows
@@ -76,7 +86,7 @@
  @param exceptingWindows the NSSet of SCWindows that you wish to be an exception to the filter
  @discussion This method creates a SCContentFilter that captures all windows not owned by the passed in SCRunningApplications. Any windows that are an exception to the filter will be shown if their owning application is in the provided list and will not be shown otherwise.
 */
-- (instancetype)initWithDisplay:(SCDisplay *)display excludingApplications:(NSArray<SCRunningApplication *>*)applications exceptingWindows:(nullable NSArray<SCWindow *>*)exceptingWindows;
+- (instancetype)initWithDisplay:(SCDisplay *)display excludingApplications:(NSArray<SCRunningApplication *>*)applications exceptingWindows:(NSArray<SCWindow *>*)exceptingWindows;
 
 @end
 
@@ -97,9 +107,9 @@
 @property(nonatomic, assign) size_t height;
 
 /*!
- @abstract SCStreamProperty that specifies the desired minimum time in seconds between frame updates, allowing you to throttle the rate at which updates are received. The default value is 0, meaning that updates are not throttled.
+ @abstract SCStreamProperty that specifies the desired minimum time in seconds between frame updates, allowing you to throttle the rate at which updates are received. 
  */
-@property(nonatomic, assign) float minimumFrameTime;
+@property(nonatomic, assign) CMTime minimumFrameInterval;
 
 /*!
  @abstract SCStreamProperty for output pixel format. Supported pixel formats are:
@@ -139,7 +149,7 @@
 /*!
  @abstract SCStreamProperty that specifies the number of frames to keep in the queue.  If not set the default value is 3 frames.  Specifying more frames uses more memory, but may allow you to process frame data without stalling the display stream and should not exceed 8 frames.
  */
-@property(nonatomic, assign) NSUInteger queueDepth;
+@property(nonatomic, assign) NSInteger queueDepth;
 
 /*!
  @abstract SCStreamProperty that specifies the YCbCr matrix applied to the output surface.  The value must be one of the strings specified in https://developer.apple.com/documentation/coregraphics/quartz_display_services/display_stream_ycbcr_to_rgb_conversion_matrix_options. Should only be used if your pixel format is 420v or 420f.
@@ -167,52 +177,74 @@
 API_AVAILABLE(macos(12.3))
 typedef NSString * SCStreamFrameInfo NS_TYPED_ENUM;
 /*!
- @key SCStreamFrameInfoStatusKey
+ @key SCStreamFrameInfoStatus
  @abstract The key for the CFDictionary attached to the CMSampleBuffer that denotes the frames SCFrameStatus
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoStatusKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoStatus API_AVAILABLE(macos(12.3));
 
 /*!
- @key SCStreamFrameInfoDisplayTimeKey
+ @key SCStreamFrameInfoDisplayTime
  @abstract The key for the CFDictionary attached to the CMSampleBuffer for the mach absolute time when the event occurred. For a frame event, this is when the frame was displayed by the window server.
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoDisplayTimeKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoDisplayTime API_AVAILABLE(macos(12.3));
 
 /*!
- @key SCStreamFrameInfoScaleFactorKey
+ @key SCStreamFrameInfoScaleFactor
  @abstract The key for the CFDictionary attached to the CMSampleBuffer for the display resolution associated with the frame. Display resolution is the pixel to point scaling factor. It should be in the range of [1, 4].
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoScaleFactorKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoScaleFactor API_AVAILABLE(macos(12.3));
 
 /*!
- @key SCStreamFrameInfoContentScaleKey
+ @key SCStreamFrameInfoContentScale
  @abstract The key for the CFDictionary attached to the CMSampleBuffer for the content scale associated with the frame. Content scale is the scaling factor from original content size to its size in surface.
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoContentScaleKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoContentScale API_AVAILABLE(macos(12.3));
 
 /*!
- @key SCStreamFrameInfoContentRectKey
+ @key SCStreamFrameInfoContentRect
  @abstract The key for the CFDictionary attached to the CMSampleBuffer for the content rect associated with the frame. Content rect is the size and location of content in points in surface.
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoContentRectKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoContentRect API_AVAILABLE(macos(12.3));
 
 /*!
  @key SCStreamFrameInfoDirtyRects
  @abstract The key for the CFDictionary attached to the CMSampleBuffer for an array of rectangles that is the union of both rectangles that were redrawn and rectangles that were moved. This is an array of CGRect in NSValue.
  */
-extern SCStreamFrameInfo const SCStreamFrameInfoDirtyRectsKey API_AVAILABLE(macos(12.3));
+extern SCStreamFrameInfo const SCStreamFrameInfoDirtyRects API_AVAILABLE(macos(12.3));
 
+@protocol SCStreamOutput;
 API_AVAILABLE(macos(12.3))
 @interface SCStream : NSObject
 - (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
 /*!
- @abstract initWithFilter:captureOutputProperties:delegate:
+ @abstract initWithFilter:configuration:delegate:
  @param contentFilter the requested content filter to be captured
  @param streamConfig the requested stream configuration to be applied to the SCStream
  @param delegate the SCStream delegate object
  @discussion this method create a SCStream object that has the particular output settings for the content stream
 */
-- (instancetype)initWithFilter:(SCContentFilter *)contentFilter captureOutputProperties:(SCStreamConfiguration *)streamConfig delegate:(id<SCStreamDelegate> _Nullable)delegate;
+- (instancetype)initWithFilter:(SCContentFilter *)contentFilter configuration:(SCStreamConfiguration *)streamConfig delegate:(id<SCStreamDelegate> _Nullable)delegate;
+
+/*!
+ @abstract addStreamOutput:type:sampleHandlerQueue:error:
+ @param output an object that adheres to the SCStreamOutput protocol that will recieved the frames and call its delegte frame call back on its sample handler queue
+ @param type the SCStreamOutput type
+ @param sampleHandlerQueue the return queue for the sample handler
+ @param error the error pertaining to the add stream output
+ @discussion An SCStreamOutput protocol object instance can only be added to a session using -addStreamOutput: Returns a BOOL denoting if the remove was successful
+*/
+- (BOOL)addStreamOutput:(id<SCStreamOutput>)output type:(SCStreamOutputType)type sampleHandlerQueue:(dispatch_queue_t _Nullable)sampleHandlerQueue error:(NSError **)error NS_SWIFT_ASYNC_NAME (addStreamOutput(_:type:sampleHandlerQueue:)) NS_SWIFT_NAME (addStreamOutput(_:type:sampleHandlerQueue:));
+
+/*!
+ @abstract removeStreamOutput:type:error:
+ @param output an object that adheres to the SCStreamOutput protocol that will recieved the frames and call its delegte frame call back on its sample handler queue
+ @param type the SCStreamOutput type
+ @param error the error pertaining to the removing stream output
+ @discussion An SCStreamOutput protocol object instance can only be removed to a session using -addStreamOutput: Returns a BOOL denoting if the remove was successful
+*/
+
+- (BOOL)removeStreamOutput:(id<SCStreamOutput>)output type:(SCStreamOutputType)type error:(NSError **)error NS_SWIFT_ASYNC_NAME(removeStreamOutput(_:type:)) NS_SWIFT_NAME(removeStreamOutput(_:type:));
 
 /*!
  @abstract updateContentFilter:completionHandler:
@@ -220,42 +252,43 @@
  @param completionHandler the handler to be called when the function completes
  @discussion this method will update the content filter for a content stream. A completion handler will be called when the update is complete with an error denoting if the update has failed.
 */
-- (void)updateContentFilter:(SCContentFilter *)contentFilter completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
+- (void)updateContentFilter:(SCContentFilter *)contentFilter completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler NS_SWIFT_ASYNC_NAME(updateContentFilter(_:)) NS_SWIFT_NAME(updateContentFilter(_:completionHandler:));
 
 /*!
- @abstract updateContentFilter:completionHandler:
+ @abstract updateConfiguration:completionHandler:
  @param streamConfig the requested content filter to be updated
  @param completionHandler the handler to be called when the function completes
  @discussion this method will update the stream configuration for a content stream. A completion handler will be called when the update is complete with an error denoting if the update has failed.
 */
-- (void)updateStreamConfiguration:(SCStreamConfiguration *)streamConfig completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
+- (void)updateConfiguration:(SCStreamConfiguration *)streamConfig completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler NS_SWIFT_ASYNC_NAME(updateConfiguration(_:)) NS_SWIFT_NAME(updateConfiguration(_:completionHandler:));
 
 /*!
  @abstract startCaptureWithFrameHandler:completionHandler:
- @param frameHandler he requested stream configuration to be applied to the SCStream
  @param completionHandler the handler to be called when the function completes
  @discussion this method starts the content stream. The handler will be called when the content stream start has completed with an error denoting if the start has failed.
 */
-- (void)startCaptureWithFrameHandler:(void (^)(SCStream *stream, CMSampleBufferRef sampleBuffer))frameHandler completionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
+- (void)startCaptureWithCompletionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
 
 /*!
  @abstract stopWithCompletionHandler:
  @param completionHandler the handler to be called when the function completes
  @discussion this method stops the content stream. The handler will be called when the content stream stop has completed with an error denoting if the stop has failed.
 */
-- (void)stopWithCompletionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
+- (void)stopCaptureWithCompletionHandler:(nullable void (^)(NSError *_Nullable error))completionHandler;
 
 @end
 
-/*!
- @typedef SCStreamBufferFrameAvailableHandler
- @abstract Content stream frame available handler block.
- @param stream the SCStream that this handler is being called for
- @param sampleBuffer the CMSampleBufferRef for the captured frame contents.
- */
 API_AVAILABLE(macos(12.3))
-typedef void (^SCStreamBufferFrameAvailableHandler)(SCStream *stream, CMSampleBufferRef sampleBuffer);
-
+@protocol SCStreamOutput <NSObject>
+@optional
+/*!
+ @abstract stream:didOutputSampleBuffer:ofType:
+ @param sampleBuffer the sample buffer
+ @param type the sample buffer type
+ @discussion protocol method for passing back screen sample buffers
+*/
+- (void)stream:(SCStream *)stream didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer ofType:(SCStreamOutputType)type;
+@end
 /*!
  @abstract SCStreamDelegate
  @discussion SCStreamDelegate is the object that adheres to the SCStream delegate call backs
@@ -263,7 +296,6 @@
 API_AVAILABLE(macos(12.3))
 @protocol SCStreamDelegate <NSObject>
 @optional
-
 /*!
  @abstract stream:didStopStreamWithError:
  @param stream the SCStream object
diff -ruN /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h
--- /Applications/Xcode_13.3.0-beta2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h	2022-01-29 07:17:11.000000000 -0500
+++ /Applications/Xcode_13.3.0-beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ScreenCaptureKit.framework/Headers/ScreenCaptureKit.h	2022-02-13 22:56:56.000000000 -0500
@@ -2,7 +2,6 @@
 //  ScreenCaptureKit.h
 //  ScreenCaptureKit
 //
-//  Created by Johnny Trenh on 9/29/21.
 //  Copyright © 2021 Apple Inc. All rights reserved.
 //
 
Clone this wiki locally