Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ScreenCaptureKit] Add support for Xcode 15 beta 8 #18965

224 changes: 224 additions & 0 deletions src/screencapturekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,48 @@ enum SCStreamOutputType : long {
Audio,
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Native]
public enum SCStreamType : long {
Window,
Display,
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Native]
public enum SCPresenterOverlayAlertSetting : long {
System,
Never,
Always,
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Native]
public enum SCCaptureResolutionType : long {
Automatic,
Best,
Nominal,
}

[Flags, NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Native]
public enum SCContentSharingPickerMode : ulong {
SingleWindow = 1 << 0,
MultipleWindows = 1 << 1,
SingleApplication = 1 << 2,
MultipleApplications = 1 << 3,
SingleDisplay = 1 << 4,
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Native]
public enum SCShareableContentStyle : long {
None,
Window,
Display,
Application,
}

[NoiOS, NoTV, NoWatch, Mac (12, 3), NoMacCatalyst]
[Static]
interface SCStreamFrameInfoKeys {
Expand All @@ -90,6 +132,10 @@ interface SCStreamFrameInfoKeys {
[Mac (13, 1)]
[Field ("SCStreamFrameInfoScreenRect")]
NSString ScreenRect { get; }

[Mac (14, 0)]
[Field ("SCStreamFrameInfoBoundingRect")]
NSString BoundingRect { get; }
}

[NoiOS, NoTV, NoWatch, Mac (12, 3), NoMacCatalyst]
Expand Down Expand Up @@ -187,6 +233,11 @@ interface SCShareableContent {

[Export ("applications")]
SCRunningApplication [] Applications { get; }

[Mac (14, 0)]
[Static]
[Export ("infoForFilter:")]
SCShareableContentInfo GetInfo (SCContentFilter filter);
}

[NoiOS, NoTV, NoWatch, Mac (12, 3), NoMacCatalyst]
Expand All @@ -212,6 +263,24 @@ interface SCContentFilter {
[Internal]
[Export ("initWithDisplay:excludingApplications:exceptingWindows:")]
NativeHandle InitWithDisplayExcludingApplications (SCDisplay display, SCRunningApplication [] excludingApplications, SCWindow [] exceptingWindows);

// per docs, the following selectors are available for 12.3+
// but return types are SCStreamType and SCShareableContentStyle are 14.0+
haritha-mohan marked this conversation as resolved.
Show resolved Hide resolved
[Mac (14, 0)]
[Export ("streamType")]
SCStreamType StreamType { get; }

[Mac (14, 0)]
[Export ("style")]
SCShareableContentStyle Style { get; }

[Mac (14, 0)]
[Export ("pointPixelScale")]
float PointPixelScale { get; }

[Mac (14, 0)]
[Export ("contentRect")]
CGRect ContentRect { get; }
}

[NoiOS, NoTV, NoWatch, Mac (12, 3), NoMacCatalyst]
Expand Down Expand Up @@ -273,6 +342,47 @@ interface SCStreamConfiguration {
[Mac (13, 0)]
[Export ("excludesCurrentProcessAudio")]
bool ExcludesCurrentProcessAudio { get; set; }

[Mac (14, 0)]
[Export ("preservesAspectRatio")]
bool PreservesAspectRatio { get; set; }

[Mac (14, 0)]
[NullAllowed]
[Export ("streamName", ArgumentSemantic.Strong)]
string StreamName { get; set; }

[Mac (14, 0)]
[Export ("ignoreShadowsDisplay")]
bool IgnoreShadowsDisplay { get; set; }

[Mac (14, 0)]
[Export ("ignoreShadowsSingleWindow")]
bool IgnoreShadowsSingleWindow { get; set; }

[Mac (14, 0)]
[Export ("captureResolution", ArgumentSemantic.Assign)]
SCCaptureResolutionType CaptureResolution { get; set; }

[Mac (14, 0)]
[Export ("capturesShadowsOnly")]
bool CapturesShadowsOnly { get; set; }

[Mac (14, 0)]
[Export ("shouldBeOpaque")]
bool ShouldBeOpaque { get; set; }

[Mac (14, 0)]
[Export ("ignoreGlobalClipDisplay")]
bool IgnoreGlobalClipDisplay { get; set; }

[Mac (14, 0)]
[Export ("ignoreGlobalClipSingleWindow")]
bool IgnoreGlobalClipSingleWindow { get; set; }

[Mac (14, 0)]
[Export ("presenterOverlayPrivacyAlertSetting", ArgumentSemantic.Assign)]
SCPresenterOverlayAlertSetting PresenterOverlayPrivacyAlertSetting { get; set; }
}

[NoiOS, NoTV, NoWatch, Mac (12, 3), NoMacCatalyst]
Expand Down Expand Up @@ -324,6 +434,14 @@ interface SCStreamDelegate {

[Export ("stream:didStopWithError:")]
void DidStop (SCStream stream, NSError error);

[Mac (14, 0)]
[Export ("outputVideoEffectDidStartForStream:")]
void OutputVideoEffectDidStart (SCStream stream);

[Mac (14, 0)]
[Export ("outputVideoEffectDidStopForStream:")]
void OutputVideoEffectDidStop (SCStream stream);
}

interface ISCStreamOutput { }
Expand All @@ -335,4 +453,110 @@ interface SCStreamOutput {
[Export ("stream:didOutputSampleBuffer:ofType:")]
void DidOutputSampleBuffer (SCStream stream, CMSampleBuffer sampleBuffer, SCStreamOutputType type);
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[BaseType (typeof (NSObject))]
interface SCContentSharingPickerConfiguration {
[Export ("allowedPickerModes", ArgumentSemantic.Assign)]
SCContentSharingPickerMode AllowedPickerModes { get; set; }

[Export ("excludedWindowIDs", ArgumentSemantic.Strong)]
NSNumber [] ExcludedWindowIds { get; set; }

[Export ("excludedBundleIDs", ArgumentSemantic.Strong)]
string [] ExcludedBundleIds { get; set; }

[Export ("allowsChangingSelectedContent")]
bool AllowsChangingSelectedContent { get; set; }
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SCContentSharingPicker {
[Static]
[Export ("sharedPicker")]
SCContentSharingPicker SharedPicker { get; }

[Export ("defaultConfiguration", ArgumentSemantic.Copy)]
SCContentSharingPickerConfiguration DefaultConfiguration { get; set; }

[NullAllowed]
[BindAs (typeof (int))]
[Export ("maximumStreamCount", ArgumentSemantic.Strong)]
NSNumber MaximumStreamCount { get; set; }

[Export ("active")]
bool Active { [Bind ("isActive")] get; set; }

[Export ("addObserver:")]
void AddObserver (ISCContentSharingPickerObserver observer);

[Export ("removeObserver:")]
void RemoveObserver (ISCContentSharingPickerObserver observer);

[Export ("setConfiguration:forStream:")]
void SetConfiguration ([NullAllowed] SCContentSharingPickerConfiguration pickerConfig, SCStream stream);

[Export ("present")]
void Present ();

[Export ("presentPickerUsingContentStyle:")]
void Present (SCShareableContentStyle contentStyle);

[Export ("presentPickerForStream:")]
void Present (SCStream stream);

[Export ("presentPickerForStream:usingContentStyle:")]
void Present (SCStream stream, SCShareableContentStyle contentStyle);
}

interface ISCContentSharingPickerObserver { }

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[Protocol]
[Model]
[BaseType (typeof (NSObject))]
interface SCContentSharingPickerObserver {
[Abstract]
[Export ("contentSharingPicker:didCancelForStream:")]
void DidCancel (SCContentSharingPicker picker, [NullAllowed] SCStream stream);

[Abstract]
[Export ("contentSharingPicker:didUpdateWithFilter:forStream:")]
void DidUpdate (SCContentSharingPicker picker, SCContentFilter filter, [NullAllowed] SCStream stream);

[Abstract]
[Export ("contentSharingPickerStartDidFailWithError:")]
void DidFail (NSError error);
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SCShareableContentInfo {
[Export ("style")]
SCShareableContentStyle Style { get; }

[Export ("pointPixelScale")]
float PointPixelScale { get; }

[Export ("contentRect")]
CGRect ContentRect { get; }
}

[NoiOS, NoTV, NoWatch, Mac (14, 0), NoMacCatalyst]
[BaseType (typeof (NSObject))]
[DisableDefaultCtor]
interface SCScreenshotManager {
[Static]
[Export ("captureSampleBufferWithFilter:configuration:completionHandler:")]
[Async]
void CaptureSampleBuffer (SCContentFilter contentFilter, SCStreamConfiguration config, [NullAllowed] Action<CMSampleBuffer, NSError> completionHandler);

[Static]
[Export ("captureImageWithFilter:configuration:completionHandler:")]
[Async]
void CaptureImage (SCContentFilter contentFilter, SCStreamConfiguration config, [NullAllowed] Action<CGImage, NSError> completionHandler);
}
}

This file was deleted.

This file was deleted.

Loading
Loading