objc2_screen_capture_kit/generated/SCStream.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12#[cfg(feature = "objc2-core-media")]
13use objc2_core_media::*;
14use objc2_foundation::*;
15
16use crate::*;
17
18/// 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.
19///
20///
21///
22/// 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.
23/// 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.
24///
25/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamoutputtype?language=objc)
26// NS_ENUM
27#[repr(transparent)]
28#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
29pub struct SCStreamOutputType(pub NSInteger);
30impl SCStreamOutputType {
31 #[doc(alias = "SCStreamOutputTypeScreen")]
32 pub const Screen: Self = Self(0);
33 #[doc(alias = "SCStreamOutputTypeAudio")]
34 pub const Audio: Self = Self(1);
35 #[doc(alias = "SCStreamOutputTypeMicrophone")]
36 pub const Microphone: Self = Self(2);
37}
38
39unsafe impl Encode for SCStreamOutputType {
40 const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for SCStreamOutputType {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// SCFrameStatus denotes the status of frame sample buffer.
48///
49/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scframestatus?language=objc)
50// NS_ENUM
51#[repr(transparent)]
52#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
53pub struct SCFrameStatus(pub NSInteger);
54impl SCFrameStatus {
55 #[doc(alias = "SCFrameStatusComplete")]
56 pub const Complete: Self = Self(0);
57 #[doc(alias = "SCFrameStatusIdle")]
58 pub const Idle: Self = Self(1);
59 #[doc(alias = "SCFrameStatusBlank")]
60 pub const Blank: Self = Self(2);
61 #[doc(alias = "SCFrameStatusSuspended")]
62 pub const Suspended: Self = Self(3);
63 #[doc(alias = "SCFrameStatusStarted")]
64 pub const Started: Self = Self(4);
65 #[doc(alias = "SCFrameStatusStopped")]
66 pub const Stopped: Self = Self(5);
67}
68
69unsafe impl Encode for SCFrameStatus {
70 const ENCODING: Encoding = NSInteger::ENCODING;
71}
72
73unsafe impl RefEncode for SCFrameStatus {
74 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
75}
76
77/// SCPresenterOverlayAlertSetting denotes the setting that can be set to determine when to show the presenter overlay alert for any stream
78///
79/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scpresenteroverlayalertsetting?language=objc)
80// NS_ENUM
81#[repr(transparent)]
82#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
83pub struct SCPresenterOverlayAlertSetting(pub NSInteger);
84impl SCPresenterOverlayAlertSetting {
85 #[doc(alias = "SCPresenterOverlayAlertSettingSystem")]
86 pub const System: Self = Self(0);
87 #[doc(alias = "SCPresenterOverlayAlertSettingNever")]
88 pub const Never: Self = Self(1);
89 #[doc(alias = "SCPresenterOverlayAlertSettingAlways")]
90 pub const Always: Self = Self(2);
91}
92
93unsafe impl Encode for SCPresenterOverlayAlertSetting {
94 const ENCODING: Encoding = NSInteger::ENCODING;
95}
96
97unsafe impl RefEncode for SCPresenterOverlayAlertSetting {
98 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101/// SCStreamTypeWindow window stream
102///
103/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamtype?language=objc)
104// NS_ENUM
105#[deprecated = "Use SCShareableContentStyle instead"]
106#[repr(transparent)]
107#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
108pub struct SCStreamType(pub NSInteger);
109impl SCStreamType {
110 #[doc(alias = "SCStreamTypeWindow")]
111 #[deprecated = "Use SCShareableContentStyle instead"]
112 pub const Window: Self = Self(0);
113 #[doc(alias = "SCStreamTypeDisplay")]
114 #[deprecated = "Use SCShareableContentStyle instead"]
115 pub const Display: Self = Self(1);
116}
117
118unsafe impl Encode for SCStreamType {
119 const ENCODING: Encoding = NSInteger::ENCODING;
120}
121
122unsafe impl RefEncode for SCStreamType {
123 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
124}
125
126/// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccaptureresolutiontype?language=objc)
127// NS_ENUM
128#[repr(transparent)]
129#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
130pub struct SCCaptureResolutionType(pub NSInteger);
131impl SCCaptureResolutionType {
132 #[doc(alias = "SCCaptureResolutionAutomatic")]
133 pub const Automatic: Self = Self(0);
134 #[doc(alias = "SCCaptureResolutionBest")]
135 pub const Best: Self = Self(1);
136 #[doc(alias = "SCCaptureResolutionNominal")]
137 pub const Nominal: Self = Self(2);
138}
139
140unsafe impl Encode for SCCaptureResolutionType {
141 const ENCODING: Encoding = NSInteger::ENCODING;
142}
143
144unsafe impl RefEncode for SCCaptureResolutionType {
145 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
146}
147
148/// 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.
149///
150/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccapturedynamicrange?language=objc)
151// NS_ENUM
152#[repr(transparent)]
153#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
154pub struct SCCaptureDynamicRange(pub NSInteger);
155impl SCCaptureDynamicRange {
156 #[doc(alias = "SCCaptureDynamicRangeSDR")]
157 pub const SDR: Self = Self(0);
158 #[doc(alias = "SCCaptureDynamicRangeHDRLocalDisplay")]
159 pub const HDRLocalDisplay: Self = Self(1);
160 #[doc(alias = "SCCaptureDynamicRangeHDRCanonicalDisplay")]
161 pub const HDRCanonicalDisplay: Self = Self(2);
162}
163
164unsafe impl Encode for SCCaptureDynamicRange {
165 const ENCODING: Encoding = NSInteger::ENCODING;
166}
167
168unsafe impl RefEncode for SCCaptureDynamicRange {
169 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
170}
171
172extern_class!(
173 /// SCContentFilter
174 ///
175 /// 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.
176 ///
177 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentfilter?language=objc)
178 #[unsafe(super(NSObject))]
179 #[derive(Debug, PartialEq, Eq, Hash)]
180 pub struct SCContentFilter;
181);
182
183extern_conformance!(
184 unsafe impl NSObjectProtocol for SCContentFilter {}
185);
186
187impl SCContentFilter {
188 extern_methods!(
189 /// streamType type of stream
190 #[deprecated = "Use style instead"]
191 #[unsafe(method(streamType))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn streamType(&self) -> SCStreamType;
194
195 #[cfg(feature = "SCShareableContent")]
196 /// style of stream
197 #[unsafe(method(style))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn style(&self) -> SCShareableContentStyle;
200
201 /// Pixel to points scaling factor
202 #[unsafe(method(pointPixelScale))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn pointPixelScale(&self) -> c_float;
205
206 #[cfg(feature = "objc2-core-foundation")]
207 /// Size and location of content in points
208 #[unsafe(method(contentRect))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn contentRect(&self) -> CGRect;
211
212 /// 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
213 #[unsafe(method(includeMenuBar))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn includeMenuBar(&self) -> bool;
216
217 /// Setter for [`includeMenuBar`][Self::includeMenuBar].
218 #[unsafe(method(setIncludeMenuBar:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn setIncludeMenuBar(&self, include_menu_bar: bool);
221
222 #[cfg(feature = "SCShareableContent")]
223 /// SCDisplays that are included in the content filter
224 #[unsafe(method(includedDisplays))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn includedDisplays(&self) -> Retained<NSArray<SCDisplay>>;
227
228 #[cfg(feature = "SCShareableContent")]
229 /// Applications that are included in the content filter
230 #[unsafe(method(includedApplications))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn includedApplications(&self) -> Retained<NSArray<SCRunningApplication>>;
233
234 #[cfg(feature = "SCShareableContent")]
235 /// Windows that are included in the content filter
236 #[unsafe(method(includedWindows))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn includedWindows(&self) -> Retained<NSArray<SCWindow>>;
239
240 #[cfg(feature = "SCShareableContent")]
241 /// initWithDesktopIndependentWindow:
242 ///
243 /// Parameter `window`: the independent SCWindow you wish to capture
244 ///
245 /// this method will create a SCContentFilter that captures just the independent window passed in.
246 #[unsafe(method(initWithDesktopIndependentWindow:))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn initWithDesktopIndependentWindow(
249 this: Allocated<Self>,
250 window: &SCWindow,
251 ) -> Retained<Self>;
252
253 #[cfg(feature = "SCShareableContent")]
254 /// initWithDisplay:excludingWindows
255 ///
256 /// Parameter `display`: the SCDisplay you wish to capture
257 ///
258 /// Parameter `excluded`: the SCWindow(s) you wish to exclude from the passed in SCDisplay
259 ///
260 /// This method will create a SCContentFilter that captures the SCDisplay, excluding the passed in excluded SCWindow(s). The desktop background and dock will be included with this content filter.
261 #[unsafe(method(initWithDisplay:excludingWindows:))]
262 #[unsafe(method_family = init)]
263 pub unsafe fn initWithDisplay_excludingWindows(
264 this: Allocated<Self>,
265 display: &SCDisplay,
266 excluded: &NSArray<SCWindow>,
267 ) -> Retained<Self>;
268
269 #[cfg(feature = "SCShareableContent")]
270 /// initWithDisplay:includingWindows
271 ///
272 /// Parameter `display`: the SCDisplay you wish to capture
273 ///
274 /// Parameter `includedWindows`: a set of SCWindows you wish to capture
275 ///
276 /// This method will create a SCContentFilter that captures a group of SCWindows. The desktop background and dock will be excluded with this content filter.
277 #[unsafe(method(initWithDisplay:includingWindows:))]
278 #[unsafe(method_family = init)]
279 pub unsafe fn initWithDisplay_includingWindows(
280 this: Allocated<Self>,
281 display: &SCDisplay,
282 included_windows: &NSArray<SCWindow>,
283 ) -> Retained<Self>;
284
285 #[cfg(feature = "SCShareableContent")]
286 /// initWithDisplay:includingApplications:exceptingWindows
287 ///
288 /// Parameter `display`: the SCDisplay you wish to capture
289 ///
290 /// Parameter `applications`: the NSSet of SCRunningApplications that you wish to capture
291 ///
292 /// Parameter `exceptingWindows`: the NSSet of SCWindows that you wish to be an exception to the filter
293 ///
294 /// 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. The desktop background and dock will be excluded with this content filter.
295 #[unsafe(method(initWithDisplay:includingApplications:exceptingWindows:))]
296 #[unsafe(method_family = init)]
297 pub unsafe fn initWithDisplay_includingApplications_exceptingWindows(
298 this: Allocated<Self>,
299 display: &SCDisplay,
300 applications: &NSArray<SCRunningApplication>,
301 excepting_windows: &NSArray<SCWindow>,
302 ) -> Retained<Self>;
303
304 #[cfg(feature = "SCShareableContent")]
305 /// initWithDisplay:excludingApplications:exceptingWindows
306 ///
307 /// Parameter `display`: the SCDisplay you wish to capture
308 ///
309 /// Parameter `applications`: the NSSet of SCRunningApplications that you do not wish to capture
310 ///
311 /// Parameter `exceptingWindows`: the NSSet of SCWindows that you wish to be an exception to the filter
312 ///
313 /// 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. The desktop background and dock will be included with this content filter.
314 #[unsafe(method(initWithDisplay:excludingApplications:exceptingWindows:))]
315 #[unsafe(method_family = init)]
316 pub unsafe fn initWithDisplay_excludingApplications_exceptingWindows(
317 this: Allocated<Self>,
318 display: &SCDisplay,
319 applications: &NSArray<SCRunningApplication>,
320 excepting_windows: &NSArray<SCWindow>,
321 ) -> Retained<Self>;
322 );
323}
324
325/// Methods declared on superclass `NSObject`.
326impl SCContentFilter {
327 extern_methods!(
328 #[unsafe(method(init))]
329 #[unsafe(method_family = init)]
330 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
331
332 #[unsafe(method(new))]
333 #[unsafe(method_family = new)]
334 pub unsafe fn new() -> Retained<Self>;
335 );
336}
337
338/// Client can use SCStreamConfigurationPreset to create SCStreamConfiguration with suggested values of properties for various use cases
339///
340/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamconfigurationpreset?language=objc)
341// NS_ENUM
342#[repr(transparent)]
343#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
344pub struct SCStreamConfigurationPreset(pub NSInteger);
345impl SCStreamConfigurationPreset {
346 #[doc(alias = "SCStreamConfigurationPresetCaptureHDRStreamLocalDisplay")]
347 pub const CaptureHDRStreamLocalDisplay: Self = Self(0);
348 #[doc(alias = "SCStreamConfigurationPresetCaptureHDRStreamCanonicalDisplay")]
349 pub const CaptureHDRStreamCanonicalDisplay: Self = Self(1);
350 #[doc(alias = "SCStreamConfigurationPresetCaptureHDRScreenshotLocalDisplay")]
351 pub const CaptureHDRScreenshotLocalDisplay: Self = Self(2);
352 #[doc(alias = "SCStreamConfigurationPresetCaptureHDRScreenshotCanonicalDisplay")]
353 pub const CaptureHDRScreenshotCanonicalDisplay: Self = Self(3);
354 #[doc(alias = "SCStreamConfigurationPresetCaptureHDRRecordingPreservedSDRHDR10")]
355 pub const CaptureHDRRecordingPreservedSDRHDR10: Self = Self(4);
356}
357
358unsafe impl Encode for SCStreamConfigurationPreset {
359 const ENCODING: Encoding = NSInteger::ENCODING;
360}
361
362unsafe impl RefEncode for SCStreamConfigurationPreset {
363 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
364}
365
366extern_class!(
367 /// SCStreamConfiguration
368 ///
369 /// SCStreamConfiguration is an object that encapsulates the SCStream properties such as output width, height, pixelformat and others.
370 ///
371 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration?language=objc)
372 #[unsafe(super(NSObject))]
373 #[derive(Debug, PartialEq, Eq, Hash)]
374 pub struct SCStreamConfiguration;
375);
376
377extern_conformance!(
378 unsafe impl NSObjectProtocol for SCStreamConfiguration {}
379);
380
381impl SCStreamConfiguration {
382 extern_methods!(
383 /// SCStreamProperty for output width as measured in pixels. Default is set to 1920.
384 #[unsafe(method(width))]
385 #[unsafe(method_family = none)]
386 pub unsafe fn width(&self) -> usize;
387
388 /// Setter for [`width`][Self::width].
389 #[unsafe(method(setWidth:))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn setWidth(&self, width: usize);
392
393 /// SCStreamProperty for output height as measured in pixels. Default is set to 1080.
394 #[unsafe(method(height))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn height(&self) -> usize;
397
398 /// Setter for [`height`][Self::height].
399 #[unsafe(method(setHeight:))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn setHeight(&self, height: usize);
402
403 #[cfg(feature = "objc2-core-media")]
404 /// 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 1/60, meaning that updates are coming in at or up to 60fps. Set this to kCMTimeZero to capture at display's native refresh rate.
405 #[unsafe(method(minimumFrameInterval))]
406 #[unsafe(method_family = none)]
407 pub unsafe fn minimumFrameInterval(&self) -> CMTime;
408
409 #[cfg(feature = "objc2-core-media")]
410 /// Setter for [`minimumFrameInterval`][Self::minimumFrameInterval].
411 #[unsafe(method(setMinimumFrameInterval:))]
412 #[unsafe(method_family = none)]
413 pub unsafe fn setMinimumFrameInterval(&self, minimum_frame_interval: CMTime);
414
415 /// SCStreamProperty for output pixel format. Supported pixel formats are:
416 /// 'BGRA': Packed Little Endian ARGB8888
417 /// 'l10r': Packed Little Endian ARGB2101010
418 /// '420v': 2-plane "video" range YCbCr 4:2:0
419 /// '420f': 2-plane "full" range YCbCr 4:2:0
420 /// 'xf44': 2 plane "full" range YCbCr10 4:4:4
421 /// 'RGhA': 64 bit RGBA IEEE half-precision float, 16-bit little-endian
422 /// See https://developer.apple.com/documentation/coregraphics/1455170-cgdisplaystreamcreate
423 #[unsafe(method(pixelFormat))]
424 #[unsafe(method_family = none)]
425 pub unsafe fn pixelFormat(&self) -> OSType;
426
427 /// Setter for [`pixelFormat`][Self::pixelFormat].
428 #[unsafe(method(setPixelFormat:))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn setPixelFormat(&self, pixel_format: OSType);
431
432 /// SCStreamProperty for output to be always scaled to fit into the provided width and height. For use for independent window capture. When true, the output scales up and down. When false, the output only scales down.
433 #[unsafe(method(scalesToFit))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn scalesToFit(&self) -> bool;
436
437 /// Setter for [`scalesToFit`][Self::scalesToFit].
438 #[unsafe(method(setScalesToFit:))]
439 #[unsafe(method_family = none)]
440 pub unsafe fn setScalesToFit(&self, scales_to_fit: bool);
441
442 /// SCStreamProperty that specifies whether the stream preserves the aspect ratio of the source pixel data. By default the aspect ratio is preserved.
443 #[unsafe(method(preservesAspectRatio))]
444 #[unsafe(method_family = none)]
445 pub unsafe fn preservesAspectRatio(&self) -> bool;
446
447 /// Setter for [`preservesAspectRatio`][Self::preservesAspectRatio].
448 #[unsafe(method(setPreservesAspectRatio:))]
449 #[unsafe(method_family = none)]
450 pub unsafe fn setPreservesAspectRatio(&self, preserves_aspect_ratio: bool);
451
452 /// SCStreamProperty the name of the stream
453 #[unsafe(method(streamName))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn streamName(&self) -> Option<Retained<NSString>>;
456
457 /// Setter for [`streamName`][Self::streamName].
458 #[unsafe(method(setStreamName:))]
459 #[unsafe(method_family = none)]
460 pub unsafe fn setStreamName(&self, stream_name: Option<&NSString>);
461
462 /// SCStreamProperty that specifies whether the cursor should appear in the stream. By default the cursor is visible.
463 #[unsafe(method(showsCursor))]
464 #[unsafe(method_family = none)]
465 pub unsafe fn showsCursor(&self) -> bool;
466
467 /// Setter for [`showsCursor`][Self::showsCursor].
468 #[unsafe(method(setShowsCursor:))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn setShowsCursor(&self, shows_cursor: bool);
471
472 /// 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.
473 #[unsafe(method(showMouseClicks))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn showMouseClicks(&self) -> bool;
476
477 /// Setter for [`showMouseClicks`][Self::showMouseClicks].
478 #[unsafe(method(setShowMouseClicks:))]
479 #[unsafe(method_family = none)]
480 pub unsafe fn setShowMouseClicks(&self, show_mouse_clicks: bool);
481
482 #[cfg(feature = "objc2-core-graphics")]
483 /// SCStreamProperty for background color. By default the background color is clear.
484 ///
485 /// # Safety
486 ///
487 /// This is not retained internally, you must ensure the object is still alive.
488 #[unsafe(method(backgroundColor))]
489 #[unsafe(method_family = none)]
490 pub unsafe fn backgroundColor(&self) -> Retained<CGColor>;
491
492 #[cfg(feature = "objc2-core-graphics")]
493 /// Setter for [`backgroundColor`][Self::backgroundColor].
494 ///
495 /// # Safety
496 ///
497 /// This is unretained, you must ensure the object is kept alive while in use.
498 #[unsafe(method(setBackgroundColor:))]
499 #[unsafe(method_family = none)]
500 pub unsafe fn setBackgroundColor(&self, background_color: &CGColor);
501
502 #[cfg(feature = "objc2-core-foundation")]
503 /// SCStreamProperty that specifies that the stream only samples a subset of the frame input. For display streams, if not set, then the entire display is streamed. For independent window streams, if not set, then the entire window is streamed. The rectangle is specified in points in the display’s logical coordinate system.
504 #[unsafe(method(sourceRect))]
505 #[unsafe(method_family = none)]
506 pub unsafe fn sourceRect(&self) -> CGRect;
507
508 #[cfg(feature = "objc2-core-foundation")]
509 /// Setter for [`sourceRect`][Self::sourceRect].
510 #[unsafe(method(setSourceRect:))]
511 #[unsafe(method_family = none)]
512 pub unsafe fn setSourceRect(&self, source_rect: CGRect);
513
514 #[cfg(feature = "objc2-core-foundation")]
515 /// SCStreamProperty that specifies that the stream outputs the frame data into a subset of the output IOSurface object. For both display streams and independent window streams, if not set, then the entire output surface is used. The rectangle is specified in pixels in the display's coordinate system.
516 #[unsafe(method(destinationRect))]
517 #[unsafe(method_family = none)]
518 pub unsafe fn destinationRect(&self) -> CGRect;
519
520 #[cfg(feature = "objc2-core-foundation")]
521 /// Setter for [`destinationRect`][Self::destinationRect].
522 #[unsafe(method(setDestinationRect:))]
523 #[unsafe(method_family = none)]
524 pub unsafe fn setDestinationRect(&self, destination_rect: CGRect);
525
526 /// SCStreamProperty that specifies the number of frames to keep in the queue. If not set the default value is 8 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.
527 #[unsafe(method(queueDepth))]
528 #[unsafe(method_family = none)]
529 pub unsafe fn queueDepth(&self) -> NSInteger;
530
531 /// Setter for [`queueDepth`][Self::queueDepth].
532 #[unsafe(method(setQueueDepth:))]
533 #[unsafe(method_family = none)]
534 pub unsafe fn setQueueDepth(&self, queue_depth: NSInteger);
535
536 #[cfg(feature = "objc2-core-foundation")]
537 /// 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.
538 ///
539 /// # Safety
540 ///
541 /// This is not retained internally, you must ensure the object is still alive.
542 #[unsafe(method(colorMatrix))]
543 #[unsafe(method_family = none)]
544 pub unsafe fn colorMatrix(&self) -> Retained<CFString>;
545
546 #[cfg(feature = "objc2-core-foundation")]
547 /// Setter for [`colorMatrix`][Self::colorMatrix].
548 ///
549 /// # Safety
550 ///
551 /// This is unretained, you must ensure the object is kept alive while in use.
552 #[unsafe(method(setColorMatrix:))]
553 #[unsafe(method_family = none)]
554 pub unsafe fn setColorMatrix(&self, color_matrix: &CFString);
555
556 #[cfg(feature = "objc2-core-foundation")]
557 /// SCStreamProperty that specifies the color space of the output buffer. If not set the output buffer uses the same color space as the display. The value must be one of the strings specified in
558 /// https://developer.apple.com/documentation/coregraphics/cgcolorspace/color_space_names.
559 ///
560 /// # Safety
561 ///
562 /// This is not retained internally, you must ensure the object is still alive.
563 #[unsafe(method(colorSpaceName))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn colorSpaceName(&self) -> Retained<CFString>;
566
567 #[cfg(feature = "objc2-core-foundation")]
568 /// Setter for [`colorSpaceName`][Self::colorSpaceName].
569 ///
570 /// # Safety
571 ///
572 /// This is unretained, you must ensure the object is kept alive while in use.
573 #[unsafe(method(setColorSpaceName:))]
574 #[unsafe(method_family = none)]
575 pub unsafe fn setColorSpaceName(&self, color_space_name: &CFString);
576
577 /// SCStreamProperty that specifies whether the audio will be captured. By default audio is not captured.
578 #[unsafe(method(capturesAudio))]
579 #[unsafe(method_family = none)]
580 pub unsafe fn capturesAudio(&self) -> bool;
581
582 /// Setter for [`capturesAudio`][Self::capturesAudio].
583 #[unsafe(method(setCapturesAudio:))]
584 #[unsafe(method_family = none)]
585 pub unsafe fn setCapturesAudio(&self, captures_audio: bool);
586
587 /// SCStreamProperty to specify the sample rate for audio. Default is set to 48000.
588 #[unsafe(method(sampleRate))]
589 #[unsafe(method_family = none)]
590 pub unsafe fn sampleRate(&self) -> NSInteger;
591
592 /// Setter for [`sampleRate`][Self::sampleRate].
593 #[unsafe(method(setSampleRate:))]
594 #[unsafe(method_family = none)]
595 pub unsafe fn setSampleRate(&self, sample_rate: NSInteger);
596
597 /// SCStreamProperty to specify channel count. Default is set to two.
598 #[unsafe(method(channelCount))]
599 #[unsafe(method_family = none)]
600 pub unsafe fn channelCount(&self) -> NSInteger;
601
602 /// Setter for [`channelCount`][Self::channelCount].
603 #[unsafe(method(setChannelCount:))]
604 #[unsafe(method_family = none)]
605 pub unsafe fn setChannelCount(&self, channel_count: NSInteger);
606
607 /// SCAudioProperty whether to exclude audio from current process. Default is set to NO.
608 #[unsafe(method(excludesCurrentProcessAudio))]
609 #[unsafe(method_family = none)]
610 pub unsafe fn excludesCurrentProcessAudio(&self) -> bool;
611
612 /// Setter for [`excludesCurrentProcessAudio`][Self::excludesCurrentProcessAudio].
613 #[unsafe(method(setExcludesCurrentProcessAudio:))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn setExcludesCurrentProcessAudio(&self, excludes_current_process_audio: bool);
616
617 /// SCStreamProperty to ignore framing on windows in the display sharing case (will ignore shadows).
618 #[unsafe(method(ignoreShadowsDisplay))]
619 #[unsafe(method_family = none)]
620 pub unsafe fn ignoreShadowsDisplay(&self) -> bool;
621
622 /// Setter for [`ignoreShadowsDisplay`][Self::ignoreShadowsDisplay].
623 #[unsafe(method(setIgnoreShadowsDisplay:))]
624 #[unsafe(method_family = none)]
625 pub unsafe fn setIgnoreShadowsDisplay(&self, ignore_shadows_display: bool);
626
627 /// SCStreamProperty to ignore framing on windows in the single window sharing case (will ignore shadows).
628 #[unsafe(method(ignoreShadowsSingleWindow))]
629 #[unsafe(method_family = none)]
630 pub unsafe fn ignoreShadowsSingleWindow(&self) -> bool;
631
632 /// Setter for [`ignoreShadowsSingleWindow`][Self::ignoreShadowsSingleWindow].
633 #[unsafe(method(setIgnoreShadowsSingleWindow:))]
634 #[unsafe(method_family = none)]
635 pub unsafe fn setIgnoreShadowsSingleWindow(&self, ignore_shadows_single_window: bool);
636
637 /// captureResolution Choose between automatic, best, and nominal.
638 #[unsafe(method(captureResolution))]
639 #[unsafe(method_family = none)]
640 pub unsafe fn captureResolution(&self) -> SCCaptureResolutionType;
641
642 /// Setter for [`captureResolution`][Self::captureResolution].
643 #[unsafe(method(setCaptureResolution:))]
644 #[unsafe(method_family = none)]
645 pub unsafe fn setCaptureResolution(&self, capture_resolution: SCCaptureResolutionType);
646
647 /// SCStreamProperty to capture only the shadows of windows.
648 #[unsafe(method(capturesShadowsOnly))]
649 #[unsafe(method_family = none)]
650 pub unsafe fn capturesShadowsOnly(&self) -> bool;
651
652 /// Setter for [`capturesShadowsOnly`][Self::capturesShadowsOnly].
653 #[unsafe(method(setCapturesShadowsOnly:))]
654 #[unsafe(method_family = none)]
655 pub unsafe fn setCapturesShadowsOnly(&self, captures_shadows_only: bool);
656
657 /// SCStreamProperty to ensure partially transparent areas on windows are backed by a solid white color so that the resulting image is fully opaque.
658 #[unsafe(method(shouldBeOpaque))]
659 #[unsafe(method_family = none)]
660 pub unsafe fn shouldBeOpaque(&self) -> bool;
661
662 /// Setter for [`shouldBeOpaque`][Self::shouldBeOpaque].
663 #[unsafe(method(setShouldBeOpaque:))]
664 #[unsafe(method_family = none)]
665 pub unsafe fn setShouldBeOpaque(&self, should_be_opaque: bool);
666
667 /// SCStreamProperty to ignore framing on windows in the display sharing case (will ignore shadows).
668 #[unsafe(method(ignoreGlobalClipDisplay))]
669 #[unsafe(method_family = none)]
670 pub unsafe fn ignoreGlobalClipDisplay(&self) -> bool;
671
672 /// Setter for [`ignoreGlobalClipDisplay`][Self::ignoreGlobalClipDisplay].
673 #[unsafe(method(setIgnoreGlobalClipDisplay:))]
674 #[unsafe(method_family = none)]
675 pub unsafe fn setIgnoreGlobalClipDisplay(&self, ignore_global_clip_display: bool);
676
677 /// SCStreamProperty to ignore global clipping when on single window share. When set to true, single window captures that are partially off the screen will not be clipped. (will ignore window placement in display context).
678 #[unsafe(method(ignoreGlobalClipSingleWindow))]
679 #[unsafe(method_family = none)]
680 pub unsafe fn ignoreGlobalClipSingleWindow(&self) -> bool;
681
682 /// Setter for [`ignoreGlobalClipSingleWindow`][Self::ignoreGlobalClipSingleWindow].
683 #[unsafe(method(setIgnoreGlobalClipSingleWindow:))]
684 #[unsafe(method_family = none)]
685 pub unsafe fn setIgnoreGlobalClipSingleWindow(
686 &self,
687 ignore_global_clip_single_window: bool,
688 );
689
690 /// SCStreamProperty that informs the system if a privacy alert should be shown when using presenter overlay for a stream. Defaults to SCPresenterOverlayAlertSettingSystem;
691 #[unsafe(method(presenterOverlayPrivacyAlertSetting))]
692 #[unsafe(method_family = none)]
693 pub unsafe fn presenterOverlayPrivacyAlertSetting(&self) -> SCPresenterOverlayAlertSetting;
694
695 /// Setter for [`presenterOverlayPrivacyAlertSetting`][Self::presenterOverlayPrivacyAlertSetting].
696 #[unsafe(method(setPresenterOverlayPrivacyAlertSetting:))]
697 #[unsafe(method_family = none)]
698 pub unsafe fn setPresenterOverlayPrivacyAlertSetting(
699 &self,
700 presenter_overlay_privacy_alert_setting: SCPresenterOverlayAlertSetting,
701 );
702
703 /// SCStreamProperty to show the child windows in display bound windows and applications sharing. Child windows are included by default.
704 #[unsafe(method(includeChildWindows))]
705 #[unsafe(method_family = none)]
706 pub unsafe fn includeChildWindows(&self) -> bool;
707
708 /// Setter for [`includeChildWindows`][Self::includeChildWindows].
709 #[unsafe(method(setIncludeChildWindows:))]
710 #[unsafe(method_family = none)]
711 pub unsafe fn setIncludeChildWindows(&self, include_child_windows: bool);
712
713 /// SCStreamProperty that specifies whether the microphone audio will be captured. By default microphone is not captured.
714 #[unsafe(method(captureMicrophone))]
715 #[unsafe(method_family = none)]
716 pub unsafe fn captureMicrophone(&self) -> bool;
717
718 /// Setter for [`captureMicrophone`][Self::captureMicrophone].
719 #[unsafe(method(setCaptureMicrophone:))]
720 #[unsafe(method_family = none)]
721 pub unsafe fn setCaptureMicrophone(&self, capture_microphone: bool);
722
723 /// 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. For Mac Catalyst apps, the System Default Microphone will be captured.
724 #[unsafe(method(microphoneCaptureDeviceID))]
725 #[unsafe(method_family = none)]
726 pub unsafe fn microphoneCaptureDeviceID(&self) -> Option<Retained<NSString>>;
727
728 /// Setter for [`microphoneCaptureDeviceID`][Self::microphoneCaptureDeviceID].
729 #[unsafe(method(setMicrophoneCaptureDeviceID:))]
730 #[unsafe(method_family = none)]
731 pub unsafe fn setMicrophoneCaptureDeviceID(
732 &self,
733 microphone_capture_device_id: Option<&NSString>,
734 );
735
736 /// 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.
737 #[unsafe(method(captureDynamicRange))]
738 #[unsafe(method_family = none)]
739 pub unsafe fn captureDynamicRange(&self) -> SCCaptureDynamicRange;
740
741 /// Setter for [`captureDynamicRange`][Self::captureDynamicRange].
742 #[unsafe(method(setCaptureDynamicRange:))]
743 #[unsafe(method_family = none)]
744 pub unsafe fn setCaptureDynamicRange(&self, capture_dynamic_range: SCCaptureDynamicRange);
745
746 /// Returns an instance of SCStreamConfiguration corresponding to the given preset
747 ///
748 /// Parameter `preset`: The enum identifier for the desired preset
749 ///
750 /// 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.
751 #[unsafe(method(streamConfigurationWithPreset:))]
752 #[unsafe(method_family = none)]
753 pub unsafe fn streamConfigurationWithPreset(
754 preset: SCStreamConfigurationPreset,
755 ) -> Retained<Self>;
756 );
757}
758
759/// Methods declared on superclass `NSObject`.
760impl SCStreamConfiguration {
761 extern_methods!(
762 #[unsafe(method(init))]
763 #[unsafe(method_family = init)]
764 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
765
766 #[unsafe(method(new))]
767 #[unsafe(method_family = new)]
768 pub unsafe fn new() -> Retained<Self>;
769 );
770}
771
772/// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfo?language=objc)
773// NS_TYPED_ENUM
774pub type SCStreamFrameInfo = NSString;
775
776extern "C" {
777 /// SCStreamFrameInfoStatus
778 ///
779 /// The key for the CFDictionary attached to the CMSampleBuffer that denotes the frames SCFrameStatus
780 ///
781 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfostatus?language=objc)
782 pub static SCStreamFrameInfoStatus: &'static SCStreamFrameInfo;
783}
784
785extern "C" {
786 /// SCStreamFrameInfoDisplayTime
787 ///
788 /// 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.
789 ///
790 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfodisplaytime?language=objc)
791 pub static SCStreamFrameInfoDisplayTime: &'static SCStreamFrameInfo;
792}
793
794extern "C" {
795 /// SCStreamFrameInfoScaleFactor
796 ///
797 /// 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].
798 ///
799 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoscalefactor?language=objc)
800 pub static SCStreamFrameInfoScaleFactor: &'static SCStreamFrameInfo;
801}
802
803extern "C" {
804 /// SCStreamFrameInfoContentScale
805 ///
806 /// 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.
807 ///
808 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfocontentscale?language=objc)
809 pub static SCStreamFrameInfoContentScale: &'static SCStreamFrameInfo;
810}
811
812extern "C" {
813 /// SCStreamFrameInfoContentRect
814 ///
815 /// 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.
816 ///
817 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfocontentrect?language=objc)
818 pub static SCStreamFrameInfoContentRect: &'static SCStreamFrameInfo;
819}
820
821extern "C" {
822 /// SCStreamFrameInfoDirtyRects
823 ///
824 /// 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. The CGRects elements are specified in pixels.
825 ///
826 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfodirtyrects?language=objc)
827 pub static SCStreamFrameInfoDirtyRects: &'static SCStreamFrameInfo;
828}
829
830extern "C" {
831 /// SCStreamFrameInfoScreenRect
832 ///
833 /// The key for the CFDictionary attached to the CMSampleBuffer for the onscreen location of the captured content
834 ///
835 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoscreenrect?language=objc)
836 pub static SCStreamFrameInfoScreenRect: &'static SCStreamFrameInfo;
837}
838
839extern "C" {
840 /// SCStreamFrameInfoBoundingRect
841 ///
842 /// The key for the CFDictionary attached to the CMSampleBuffer for the bounding rect associated with the frame. Bounding rect is the size and location of smallest bounding box containing all captured windows in points and in surface coordinates.
843 ///
844 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoboundingrect?language=objc)
845 pub static SCStreamFrameInfoBoundingRect: &'static SCStreamFrameInfo;
846}
847
848extern "C" {
849 /// SCStreamFrameInfoPresenterOverlayContentRect
850 ///
851 /// The key for the CFDictionary attached to the CMSampleBuffer for the content rect associated with the frame while in presenter overlay. In presenter overlay small, this content rect is the size and location of smallest bounding box containing all captured windows plus small overlay window in points and in surface coordinates.
852 /// In presenter overlay large, this content rect is the size and location of shared content in points and in surface coordinates.
853 ///
854 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfopresenteroverlaycontentrect?language=objc)
855 pub static SCStreamFrameInfoPresenterOverlayContentRect: &'static SCStreamFrameInfo;
856}
857
858extern_class!(
859 /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstream?language=objc)
860 #[unsafe(super(NSObject))]
861 #[derive(Debug, PartialEq, Eq, Hash)]
862 pub struct SCStream;
863);
864
865extern_conformance!(
866 unsafe impl NSObjectProtocol for SCStream {}
867);
868
869impl SCStream {
870 extern_methods!(
871 #[cfg(feature = "objc2-core-media")]
872 /// Synchronization clock used for media capture.
873 #[unsafe(method(synchronizationClock))]
874 #[unsafe(method_family = none)]
875 pub unsafe fn synchronizationClock(&self) -> Option<Retained<CMClock>>;
876
877 #[unsafe(method(init))]
878 #[unsafe(method_family = init)]
879 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
880
881 #[unsafe(method(new))]
882 #[unsafe(method_family = new)]
883 pub unsafe fn new() -> Retained<Self>;
884
885 /// initWithFilter:configuration:delegate:
886 ///
887 /// Parameter `contentFilter`: the requested content filter to be captured
888 ///
889 /// Parameter `streamConfig`: the requested stream configuration to be applied to the SCStream
890 ///
891 /// Parameter `delegate`: the SCStream delegate object
892 ///
893 /// this method create a SCStream object that has the particular output settings for the content stream
894 #[unsafe(method(initWithFilter:configuration:delegate:))]
895 #[unsafe(method_family = init)]
896 pub unsafe fn initWithFilter_configuration_delegate(
897 this: Allocated<Self>,
898 content_filter: &SCContentFilter,
899 stream_config: &SCStreamConfiguration,
900 delegate: Option<&ProtocolObject<dyn SCStreamDelegate>>,
901 ) -> Retained<Self>;
902
903 #[cfg(feature = "dispatch2")]
904 /// addStreamOutput:type:sampleHandlerQueue:error:
905 ///
906 /// Parameter `output`: an object that adheres to the SCStreamOutput protocol that will receive the frames and call its delegate frame call back on its sample handler queue
907 ///
908 /// Parameter `type`: the SCStreamOutput type
909 ///
910 /// Parameter `sampleHandlerQueue`: the return queue for the sample handler
911 ///
912 /// Parameter `error`: the error pertaining to the add stream output
913 ///
914 /// An SCStreamOutput protocol object instance can only be added to a session using -addStreamOutput: Returns a BOOL denoting if the add was successful
915 ///
916 /// # Safety
917 ///
918 /// `sample_handler_queue` possibly has additional threading requirements.
919 #[unsafe(method(addStreamOutput:type:sampleHandlerQueue:error:_))]
920 #[unsafe(method_family = none)]
921 pub unsafe fn addStreamOutput_type_sampleHandlerQueue_error(
922 &self,
923 output: &ProtocolObject<dyn SCStreamOutput>,
924 r#type: SCStreamOutputType,
925 sample_handler_queue: Option<&DispatchQueue>,
926 ) -> Result<(), Retained<NSError>>;
927
928 /// removeStreamOutput:type:error:
929 ///
930 /// Parameter `output`: an object that adheres to the SCStreamOutput protocol that will received the frames and call its delegate frame call back on its sample handler queue
931 ///
932 /// Parameter `type`: the SCStreamOutput type
933 ///
934 /// Parameter `error`: the error pertaining to the removing stream output
935 ///
936 /// An SCStreamOutput protocol object instance can only be removed to a session using -addStreamOutput: Returns a BOOL denoting if the remove was successful
937 #[unsafe(method(removeStreamOutput:type:error:_))]
938 #[unsafe(method_family = none)]
939 pub unsafe fn removeStreamOutput_type_error(
940 &self,
941 output: &ProtocolObject<dyn SCStreamOutput>,
942 r#type: SCStreamOutputType,
943 ) -> Result<(), Retained<NSError>>;
944
945 #[cfg(feature = "block2")]
946 /// updateContentFilter:completionHandler:
947 ///
948 /// Parameter `contentFilter`: the requested content filter to be updated
949 ///
950 /// Parameter `completionHandler`: the handler to be called when the function completes
951 ///
952 /// 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.
953 #[unsafe(method(updateContentFilter:completionHandler:))]
954 #[unsafe(method_family = none)]
955 pub unsafe fn updateContentFilter_completionHandler(
956 &self,
957 content_filter: &SCContentFilter,
958 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
959 );
960
961 #[cfg(feature = "block2")]
962 /// updateConfiguration:completionHandler:
963 ///
964 /// Parameter `streamConfig`: the requested content filter to be updated
965 ///
966 /// Parameter `completionHandler`: the handler to be called when the function completes
967 ///
968 /// 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.
969 #[unsafe(method(updateConfiguration:completionHandler:))]
970 #[unsafe(method_family = none)]
971 pub unsafe fn updateConfiguration_completionHandler(
972 &self,
973 stream_config: &SCStreamConfiguration,
974 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
975 );
976
977 #[cfg(feature = "block2")]
978 /// startCaptureWithCompletionHandler:
979 ///
980 /// Parameter `completionHandler`: the handler to be called when the function completes
981 ///
982 /// 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.
983 #[unsafe(method(startCaptureWithCompletionHandler:))]
984 #[unsafe(method_family = none)]
985 pub unsafe fn startCaptureWithCompletionHandler(
986 &self,
987 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
988 );
989
990 #[cfg(feature = "block2")]
991 /// stopCaptureWithCompletionHandler:
992 ///
993 /// Parameter `completionHandler`: the handler to be called when the function completes
994 ///
995 /// 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.
996 #[unsafe(method(stopCaptureWithCompletionHandler:))]
997 #[unsafe(method_family = none)]
998 pub unsafe fn stopCaptureWithCompletionHandler(
999 &self,
1000 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
1001 );
1002
1003 #[cfg(feature = "SCRecordingOutput")]
1004 /// 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.
1005 ///
1006 /// Parameter `recordingOutput`: an SCRecordingOutput that including configuration of recording, and delegate for recording event.
1007 ///
1008 /// Parameter `error`: the error pertaining to the add recording output
1009 ///
1010 /// 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.
1011 #[unsafe(method(addRecordingOutput:error:_))]
1012 #[unsafe(method_family = none)]
1013 pub unsafe fn addRecordingOutput_error(
1014 &self,
1015 recording_output: &SCRecordingOutput,
1016 ) -> Result<(), Retained<NSError>>;
1017
1018 #[cfg(feature = "SCRecordingOutput")]
1019 /// Remove SCRecordingOutput from the SCStream. Stops Recording if the stream is currently recording.
1020 ///
1021 /// Parameter `recordingOutput`: an SCRecordingOutput that including configuration of recording, and delegate for recording event.
1022 ///
1023 /// Parameter `error`: the error pertaining to the remove recording output
1024 ///
1025 /// 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.
1026 #[unsafe(method(removeRecordingOutput:error:_))]
1027 #[unsafe(method_family = none)]
1028 pub unsafe fn removeRecordingOutput_error(
1029 &self,
1030 recording_output: &SCRecordingOutput,
1031 ) -> Result<(), Retained<NSError>>;
1032 );
1033}
1034
1035extern_protocol!(
1036 /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamoutput?language=objc)
1037 pub unsafe trait SCStreamOutput: NSObjectProtocol {
1038 #[cfg(feature = "objc2-core-media")]
1039 /// stream:didOutputSampleBuffer:ofType:
1040 ///
1041 /// Parameter `sampleBuffer`: the sample buffer
1042 ///
1043 /// Parameter `type`: the sample buffer type
1044 ///
1045 /// protocol method for passing back screen sample buffers
1046 #[optional]
1047 #[unsafe(method(stream:didOutputSampleBuffer:ofType:))]
1048 #[unsafe(method_family = none)]
1049 unsafe fn stream_didOutputSampleBuffer_ofType(
1050 &self,
1051 stream: &SCStream,
1052 sample_buffer: &CMSampleBuffer,
1053 r#type: SCStreamOutputType,
1054 );
1055 }
1056);
1057
1058extern_protocol!(
1059 /// SCStreamDelegate
1060 ///
1061 /// SCStreamDelegate is the object that adheres to the SCStream delegate call backs
1062 ///
1063 /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamdelegate?language=objc)
1064 pub unsafe trait SCStreamDelegate: NSObjectProtocol {
1065 /// stream:didStopStreamWithError:
1066 ///
1067 /// Parameter `stream`: the SCStream object
1068 ///
1069 /// Parameter `error`: the error denoted by the stopping of the stream
1070 ///
1071 /// notifies the delegate that the stream has stopped and the error associated with it
1072 #[optional]
1073 #[unsafe(method(stream:didStopWithError:))]
1074 #[unsafe(method_family = none)]
1075 unsafe fn stream_didStopWithError(&self, stream: &SCStream, error: &NSError);
1076
1077 /// outputVideoEffectDidStartForStream:
1078 ///
1079 /// Parameter `stream`: the SCStream object
1080 ///
1081 /// notifies the delegate that the stream's overlay video effect has started.
1082 #[optional]
1083 #[unsafe(method(outputVideoEffectDidStartForStream:))]
1084 #[unsafe(method_family = none)]
1085 unsafe fn outputVideoEffectDidStartForStream(&self, stream: &SCStream);
1086
1087 /// stream:outputVideoEffectDidStart:
1088 ///
1089 /// Parameter `stream`: the SCStream object
1090 ///
1091 /// notifies the delegate that the stream's overlay video effect has stopped.
1092 #[optional]
1093 #[unsafe(method(outputVideoEffectDidStopForStream:))]
1094 #[unsafe(method_family = none)]
1095 unsafe fn outputVideoEffectDidStopForStream(&self, stream: &SCStream);
1096
1097 /// streamDidBecomeActive:
1098 ///
1099 /// Parameter `stream`: the SCStream object
1100 ///
1101 /// notifies the delegate the first time any window that was being shared in the stream is re-opened after all the windows being shared are closed. When all the windows being shared are closed, the client will receive streamDidBecomeInactive:.
1102 #[optional]
1103 #[unsafe(method(streamDidBecomeActive:))]
1104 #[unsafe(method_family = none)]
1105 unsafe fn streamDidBecomeActive(&self, stream: &SCStream);
1106
1107 /// streamDidBecomeInactive:
1108 ///
1109 /// Parameter `stream`: the SCStream object
1110 ///
1111 /// notifies the delegate that all the windows that are currently being shared are exited. This callback occurs for all content filter types.
1112 #[optional]
1113 #[unsafe(method(streamDidBecomeInactive:))]
1114 #[unsafe(method_family = none)]
1115 unsafe fn streamDidBecomeInactive(&self, stream: &SCStream);
1116 }
1117);