objc2-screen-capture-kit 0.3.2

Bindings to the ScreenCaptureKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;

use crate::*;

/// 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.
///
///
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamoutputtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCStreamOutputType(pub NSInteger);
impl SCStreamOutputType {
    #[doc(alias = "SCStreamOutputTypeScreen")]
    pub const Screen: Self = Self(0);
    #[doc(alias = "SCStreamOutputTypeAudio")]
    pub const Audio: Self = Self(1);
    #[doc(alias = "SCStreamOutputTypeMicrophone")]
    pub const Microphone: Self = Self(2);
}

unsafe impl Encode for SCStreamOutputType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCStreamOutputType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// SCFrameStatus denotes the status of frame sample buffer.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scframestatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCFrameStatus(pub NSInteger);
impl SCFrameStatus {
    #[doc(alias = "SCFrameStatusComplete")]
    pub const Complete: Self = Self(0);
    #[doc(alias = "SCFrameStatusIdle")]
    pub const Idle: Self = Self(1);
    #[doc(alias = "SCFrameStatusBlank")]
    pub const Blank: Self = Self(2);
    #[doc(alias = "SCFrameStatusSuspended")]
    pub const Suspended: Self = Self(3);
    #[doc(alias = "SCFrameStatusStarted")]
    pub const Started: Self = Self(4);
    #[doc(alias = "SCFrameStatusStopped")]
    pub const Stopped: Self = Self(5);
}

unsafe impl Encode for SCFrameStatus {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCFrameStatus {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// SCPresenterOverlayAlertSetting denotes the setting that can be set to determine when to show the presenter overlay alert for any stream
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scpresenteroverlayalertsetting?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCPresenterOverlayAlertSetting(pub NSInteger);
impl SCPresenterOverlayAlertSetting {
    #[doc(alias = "SCPresenterOverlayAlertSettingSystem")]
    pub const System: Self = Self(0);
    #[doc(alias = "SCPresenterOverlayAlertSettingNever")]
    pub const Never: Self = Self(1);
    #[doc(alias = "SCPresenterOverlayAlertSettingAlways")]
    pub const Always: Self = Self(2);
}

unsafe impl Encode for SCPresenterOverlayAlertSetting {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCPresenterOverlayAlertSetting {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// SCStreamTypeWindow window stream
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamtype?language=objc)
// NS_ENUM
#[deprecated = "Use SCShareableContentStyle instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCStreamType(pub NSInteger);
impl SCStreamType {
    #[doc(alias = "SCStreamTypeWindow")]
    #[deprecated = "Use SCShareableContentStyle instead"]
    pub const Window: Self = Self(0);
    #[doc(alias = "SCStreamTypeDisplay")]
    #[deprecated = "Use SCShareableContentStyle instead"]
    pub const Display: Self = Self(1);
}

unsafe impl Encode for SCStreamType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCStreamType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccaptureresolutiontype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCCaptureResolutionType(pub NSInteger);
impl SCCaptureResolutionType {
    #[doc(alias = "SCCaptureResolutionAutomatic")]
    pub const Automatic: Self = Self(0);
    #[doc(alias = "SCCaptureResolutionBest")]
    pub const Best: Self = Self(1);
    #[doc(alias = "SCCaptureResolutionNominal")]
    pub const Nominal: Self = Self(2);
}

unsafe impl Encode for SCCaptureResolutionType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCCaptureResolutionType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccapturedynamicrange?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCCaptureDynamicRange(pub NSInteger);
impl SCCaptureDynamicRange {
    #[doc(alias = "SCCaptureDynamicRangeSDR")]
    pub const SDR: Self = Self(0);
    #[doc(alias = "SCCaptureDynamicRangeHDRLocalDisplay")]
    pub const HDRLocalDisplay: Self = Self(1);
    #[doc(alias = "SCCaptureDynamicRangeHDRCanonicalDisplay")]
    pub const HDRCanonicalDisplay: Self = Self(2);
}

unsafe impl Encode for SCCaptureDynamicRange {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCCaptureDynamicRange {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// SCContentFilter
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/sccontentfilter?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SCContentFilter;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for SCContentFilter {}
);

impl SCContentFilter {
    extern_methods!(
        /// streamType type of stream
        #[deprecated = "Use style instead"]
        #[unsafe(method(streamType))]
        #[unsafe(method_family = none)]
        pub unsafe fn streamType(&self) -> SCStreamType;

        #[cfg(feature = "SCShareableContent")]
        /// style of stream
        #[unsafe(method(style))]
        #[unsafe(method_family = none)]
        pub unsafe fn style(&self) -> SCShareableContentStyle;

        /// Pixel to points scaling factor
        #[unsafe(method(pointPixelScale))]
        #[unsafe(method_family = none)]
        pub unsafe fn pointPixelScale(&self) -> c_float;

        #[cfg(feature = "objc2-core-foundation")]
        /// Size and location of content in points
        #[unsafe(method(contentRect))]
        #[unsafe(method_family = none)]
        pub unsafe fn contentRect(&self) -> CGRect;

        /// 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
        #[unsafe(method(includeMenuBar))]
        #[unsafe(method_family = none)]
        pub unsafe fn includeMenuBar(&self) -> bool;

        /// Setter for [`includeMenuBar`][Self::includeMenuBar].
        #[unsafe(method(setIncludeMenuBar:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIncludeMenuBar(&self, include_menu_bar: bool);

        #[cfg(feature = "SCShareableContent")]
        /// SCDisplays that are included in the content filter
        #[unsafe(method(includedDisplays))]
        #[unsafe(method_family = none)]
        pub unsafe fn includedDisplays(&self) -> Retained<NSArray<SCDisplay>>;

        #[cfg(feature = "SCShareableContent")]
        /// Applications that are included in the content filter
        #[unsafe(method(includedApplications))]
        #[unsafe(method_family = none)]
        pub unsafe fn includedApplications(&self) -> Retained<NSArray<SCRunningApplication>>;

        #[cfg(feature = "SCShareableContent")]
        /// Windows that are included in the content filter
        #[unsafe(method(includedWindows))]
        #[unsafe(method_family = none)]
        pub unsafe fn includedWindows(&self) -> Retained<NSArray<SCWindow>>;

        #[cfg(feature = "SCShareableContent")]
        /// initWithDesktopIndependentWindow:
        ///
        /// Parameter `window`: the independent SCWindow you wish to capture
        ///
        /// this method will create a SCContentFilter that captures just the independent window passed in.
        #[unsafe(method(initWithDesktopIndependentWindow:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDesktopIndependentWindow(
            this: Allocated<Self>,
            window: &SCWindow,
        ) -> Retained<Self>;

        #[cfg(feature = "SCShareableContent")]
        /// initWithDisplay:excludingWindows
        ///
        /// Parameter `display`: the SCDisplay you wish to capture
        ///
        /// Parameter `excluded`: the SCWindow(s) you wish to exclude from the passed in SCDisplay
        ///
        /// 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.
        #[unsafe(method(initWithDisplay:excludingWindows:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDisplay_excludingWindows(
            this: Allocated<Self>,
            display: &SCDisplay,
            excluded: &NSArray<SCWindow>,
        ) -> Retained<Self>;

        #[cfg(feature = "SCShareableContent")]
        /// initWithDisplay:includingWindows
        ///
        /// Parameter `display`: the SCDisplay you wish to capture
        ///
        /// Parameter `includedWindows`: a set of SCWindows you wish to capture
        ///
        /// This method will create a SCContentFilter that captures a group of SCWindows. The desktop background and dock will be excluded with this content filter.
        #[unsafe(method(initWithDisplay:includingWindows:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDisplay_includingWindows(
            this: Allocated<Self>,
            display: &SCDisplay,
            included_windows: &NSArray<SCWindow>,
        ) -> Retained<Self>;

        #[cfg(feature = "SCShareableContent")]
        /// initWithDisplay:includingApplications:exceptingWindows
        ///
        /// Parameter `display`: the SCDisplay you wish to capture
        ///
        /// Parameter `applications`: the NSSet of SCRunningApplications that you wish to capture
        ///
        /// Parameter `exceptingWindows`: the NSSet of SCWindows that you wish to be an exception to the filter
        ///
        /// 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.
        #[unsafe(method(initWithDisplay:includingApplications:exceptingWindows:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDisplay_includingApplications_exceptingWindows(
            this: Allocated<Self>,
            display: &SCDisplay,
            applications: &NSArray<SCRunningApplication>,
            excepting_windows: &NSArray<SCWindow>,
        ) -> Retained<Self>;

        #[cfg(feature = "SCShareableContent")]
        /// initWithDisplay:excludingApplications:exceptingWindows
        ///
        /// Parameter `display`: the SCDisplay you wish to capture
        ///
        /// Parameter `applications`: the NSSet of SCRunningApplications that you do not wish to capture
        ///
        /// Parameter `exceptingWindows`: the NSSet of SCWindows that you wish to be an exception to the filter
        ///
        /// 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.
        #[unsafe(method(initWithDisplay:excludingApplications:exceptingWindows:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDisplay_excludingApplications_exceptingWindows(
            this: Allocated<Self>,
            display: &SCDisplay,
            applications: &NSArray<SCRunningApplication>,
            excepting_windows: &NSArray<SCWindow>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl SCContentFilter {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// Client can use SCStreamConfigurationPreset to create SCStreamConfiguration with suggested values of properties for various use cases
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamconfigurationpreset?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SCStreamConfigurationPreset(pub NSInteger);
impl SCStreamConfigurationPreset {
    #[doc(alias = "SCStreamConfigurationPresetCaptureHDRStreamLocalDisplay")]
    pub const CaptureHDRStreamLocalDisplay: Self = Self(0);
    #[doc(alias = "SCStreamConfigurationPresetCaptureHDRStreamCanonicalDisplay")]
    pub const CaptureHDRStreamCanonicalDisplay: Self = Self(1);
    #[doc(alias = "SCStreamConfigurationPresetCaptureHDRScreenshotLocalDisplay")]
    pub const CaptureHDRScreenshotLocalDisplay: Self = Self(2);
    #[doc(alias = "SCStreamConfigurationPresetCaptureHDRScreenshotCanonicalDisplay")]
    pub const CaptureHDRScreenshotCanonicalDisplay: Self = Self(3);
    #[doc(alias = "SCStreamConfigurationPresetCaptureHDRRecordingPreservedSDRHDR10")]
    pub const CaptureHDRRecordingPreservedSDRHDR10: Self = Self(4);
}

unsafe impl Encode for SCStreamConfigurationPreset {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for SCStreamConfigurationPreset {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// SCStreamConfiguration
    ///
    /// SCStreamConfiguration is an object that encapsulates the SCStream properties such as output width, height, pixelformat and others.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamconfiguration?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SCStreamConfiguration;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for SCStreamConfiguration {}
);

impl SCStreamConfiguration {
    extern_methods!(
        /// SCStreamProperty for output width as measured in pixels. Default is set to 1920.
        #[unsafe(method(width))]
        #[unsafe(method_family = none)]
        pub unsafe fn width(&self) -> usize;

        /// Setter for [`width`][Self::width].
        #[unsafe(method(setWidth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWidth(&self, width: usize);

        /// SCStreamProperty for output height as measured in pixels. Default is set to 1080.
        #[unsafe(method(height))]
        #[unsafe(method_family = none)]
        pub unsafe fn height(&self) -> usize;

        /// Setter for [`height`][Self::height].
        #[unsafe(method(setHeight:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeight(&self, height: usize);

        #[cfg(feature = "objc2-core-media")]
        /// 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.
        #[unsafe(method(minimumFrameInterval))]
        #[unsafe(method_family = none)]
        pub unsafe fn minimumFrameInterval(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`minimumFrameInterval`][Self::minimumFrameInterval].
        #[unsafe(method(setMinimumFrameInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinimumFrameInterval(&self, minimum_frame_interval: CMTime);

        /// SCStreamProperty for output pixel format. Supported pixel formats are:
        /// 'BGRA': Packed Little Endian ARGB8888
        /// '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
        #[unsafe(method(pixelFormat))]
        #[unsafe(method_family = none)]
        pub unsafe fn pixelFormat(&self) -> OSType;

        /// Setter for [`pixelFormat`][Self::pixelFormat].
        #[unsafe(method(setPixelFormat:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPixelFormat(&self, pixel_format: OSType);

        /// 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.
        #[unsafe(method(scalesToFit))]
        #[unsafe(method_family = none)]
        pub unsafe fn scalesToFit(&self) -> bool;

        /// Setter for [`scalesToFit`][Self::scalesToFit].
        #[unsafe(method(setScalesToFit:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setScalesToFit(&self, scales_to_fit: bool);

        /// SCStreamProperty that specifies whether the  stream preserves the aspect ratio of the source pixel data. By default the aspect ratio is preserved.
        #[unsafe(method(preservesAspectRatio))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservesAspectRatio(&self) -> bool;

        /// Setter for [`preservesAspectRatio`][Self::preservesAspectRatio].
        #[unsafe(method(setPreservesAspectRatio:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreservesAspectRatio(&self, preserves_aspect_ratio: bool);

        /// SCStreamProperty the name of the stream
        #[unsafe(method(streamName))]
        #[unsafe(method_family = none)]
        pub unsafe fn streamName(&self) -> Option<Retained<NSString>>;

        /// Setter for [`streamName`][Self::streamName].
        #[unsafe(method(setStreamName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setStreamName(&self, stream_name: Option<&NSString>);

        /// SCStreamProperty that specifies whether the cursor should appear in the stream.  By default the cursor is visible.
        #[unsafe(method(showsCursor))]
        #[unsafe(method_family = none)]
        pub unsafe fn showsCursor(&self) -> bool;

        /// Setter for [`showsCursor`][Self::showsCursor].
        #[unsafe(method(setShowsCursor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowsCursor(&self, shows_cursor: bool);

        /// 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.
        #[unsafe(method(showMouseClicks))]
        #[unsafe(method_family = none)]
        pub unsafe fn showMouseClicks(&self) -> bool;

        /// Setter for [`showMouseClicks`][Self::showMouseClicks].
        #[unsafe(method(setShowMouseClicks:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShowMouseClicks(&self, show_mouse_clicks: bool);

        #[cfg(feature = "objc2-core-graphics")]
        /// SCStreamProperty for background color. By default the background color is clear.
        ///
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(backgroundColor))]
        #[unsafe(method_family = none)]
        pub unsafe fn backgroundColor(&self) -> Retained<CGColor>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`backgroundColor`][Self::backgroundColor].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setBackgroundColor:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBackgroundColor(&self, background_color: &CGColor);

        #[cfg(feature = "objc2-core-foundation")]
        /// 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.
        #[unsafe(method(sourceRect))]
        #[unsafe(method_family = none)]
        pub unsafe fn sourceRect(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`sourceRect`][Self::sourceRect].
        #[unsafe(method(setSourceRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSourceRect(&self, source_rect: CGRect);

        #[cfg(feature = "objc2-core-foundation")]
        /// 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.
        #[unsafe(method(destinationRect))]
        #[unsafe(method_family = none)]
        pub unsafe fn destinationRect(&self) -> CGRect;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`destinationRect`][Self::destinationRect].
        #[unsafe(method(setDestinationRect:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDestinationRect(&self, destination_rect: CGRect);

        /// 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.
        #[unsafe(method(queueDepth))]
        #[unsafe(method_family = none)]
        pub unsafe fn queueDepth(&self) -> NSInteger;

        /// Setter for [`queueDepth`][Self::queueDepth].
        #[unsafe(method(setQueueDepth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setQueueDepth(&self, queue_depth: NSInteger);

        #[cfg(feature = "objc2-core-foundation")]
        /// 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.
        ///
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(colorMatrix))]
        #[unsafe(method_family = none)]
        pub unsafe fn colorMatrix(&self) -> Retained<CFString>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`colorMatrix`][Self::colorMatrix].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setColorMatrix:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColorMatrix(&self, color_matrix: &CFString);

        #[cfg(feature = "objc2-core-foundation")]
        /// 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
        /// https://developer.apple.com/documentation/coregraphics/cgcolorspace/color_space_names.
        ///
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(colorSpaceName))]
        #[unsafe(method_family = none)]
        pub unsafe fn colorSpaceName(&self) -> Retained<CFString>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`colorSpaceName`][Self::colorSpaceName].
        ///
        /// # Safety
        ///
        /// This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setColorSpaceName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setColorSpaceName(&self, color_space_name: &CFString);

        /// SCStreamProperty that specifies whether the audio will be captured.  By default audio is not captured.
        #[unsafe(method(capturesAudio))]
        #[unsafe(method_family = none)]
        pub unsafe fn capturesAudio(&self) -> bool;

        /// Setter for [`capturesAudio`][Self::capturesAudio].
        #[unsafe(method(setCapturesAudio:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCapturesAudio(&self, captures_audio: bool);

        /// SCStreamProperty to specify the sample rate for audio. Default is set to 48000.
        #[unsafe(method(sampleRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn sampleRate(&self) -> NSInteger;

        /// Setter for [`sampleRate`][Self::sampleRate].
        #[unsafe(method(setSampleRate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSampleRate(&self, sample_rate: NSInteger);

        /// SCStreamProperty to specify channel count. Default is set to two.
        #[unsafe(method(channelCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn channelCount(&self) -> NSInteger;

        /// Setter for [`channelCount`][Self::channelCount].
        #[unsafe(method(setChannelCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setChannelCount(&self, channel_count: NSInteger);

        /// SCAudioProperty whether to exclude audio from current process. Default is set to NO.
        #[unsafe(method(excludesCurrentProcessAudio))]
        #[unsafe(method_family = none)]
        pub unsafe fn excludesCurrentProcessAudio(&self) -> bool;

        /// Setter for [`excludesCurrentProcessAudio`][Self::excludesCurrentProcessAudio].
        #[unsafe(method(setExcludesCurrentProcessAudio:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setExcludesCurrentProcessAudio(&self, excludes_current_process_audio: bool);

        /// SCStreamProperty to ignore framing on windows in the display sharing case (will ignore shadows).
        #[unsafe(method(ignoreShadowsDisplay))]
        #[unsafe(method_family = none)]
        pub unsafe fn ignoreShadowsDisplay(&self) -> bool;

        /// Setter for [`ignoreShadowsDisplay`][Self::ignoreShadowsDisplay].
        #[unsafe(method(setIgnoreShadowsDisplay:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIgnoreShadowsDisplay(&self, ignore_shadows_display: bool);

        /// SCStreamProperty to ignore framing on windows in the single window sharing case (will ignore shadows).
        #[unsafe(method(ignoreShadowsSingleWindow))]
        #[unsafe(method_family = none)]
        pub unsafe fn ignoreShadowsSingleWindow(&self) -> bool;

        /// Setter for [`ignoreShadowsSingleWindow`][Self::ignoreShadowsSingleWindow].
        #[unsafe(method(setIgnoreShadowsSingleWindow:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIgnoreShadowsSingleWindow(&self, ignore_shadows_single_window: bool);

        /// captureResolution Choose between automatic, best, and nominal.
        #[unsafe(method(captureResolution))]
        #[unsafe(method_family = none)]
        pub unsafe fn captureResolution(&self) -> SCCaptureResolutionType;

        /// Setter for [`captureResolution`][Self::captureResolution].
        #[unsafe(method(setCaptureResolution:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCaptureResolution(&self, capture_resolution: SCCaptureResolutionType);

        /// SCStreamProperty to capture only the shadows of windows.
        #[unsafe(method(capturesShadowsOnly))]
        #[unsafe(method_family = none)]
        pub unsafe fn capturesShadowsOnly(&self) -> bool;

        /// Setter for [`capturesShadowsOnly`][Self::capturesShadowsOnly].
        #[unsafe(method(setCapturesShadowsOnly:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCapturesShadowsOnly(&self, captures_shadows_only: bool);

        /// SCStreamProperty to ensure partially transparent areas on windows are backed by a solid white color so that the resulting image is fully opaque.
        #[unsafe(method(shouldBeOpaque))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldBeOpaque(&self) -> bool;

        /// Setter for [`shouldBeOpaque`][Self::shouldBeOpaque].
        #[unsafe(method(setShouldBeOpaque:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShouldBeOpaque(&self, should_be_opaque: bool);

        /// SCStreamProperty to ignore framing on windows in the display sharing case (will ignore shadows).
        #[unsafe(method(ignoreGlobalClipDisplay))]
        #[unsafe(method_family = none)]
        pub unsafe fn ignoreGlobalClipDisplay(&self) -> bool;

        /// Setter for [`ignoreGlobalClipDisplay`][Self::ignoreGlobalClipDisplay].
        #[unsafe(method(setIgnoreGlobalClipDisplay:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIgnoreGlobalClipDisplay(&self, ignore_global_clip_display: bool);

        /// 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).
        #[unsafe(method(ignoreGlobalClipSingleWindow))]
        #[unsafe(method_family = none)]
        pub unsafe fn ignoreGlobalClipSingleWindow(&self) -> bool;

        /// Setter for [`ignoreGlobalClipSingleWindow`][Self::ignoreGlobalClipSingleWindow].
        #[unsafe(method(setIgnoreGlobalClipSingleWindow:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIgnoreGlobalClipSingleWindow(
            &self,
            ignore_global_clip_single_window: bool,
        );

        /// SCStreamProperty that informs the system if a privacy alert should be shown when using presenter overlay for a stream. Defaults to SCPresenterOverlayAlertSettingSystem;
        #[unsafe(method(presenterOverlayPrivacyAlertSetting))]
        #[unsafe(method_family = none)]
        pub unsafe fn presenterOverlayPrivacyAlertSetting(&self) -> SCPresenterOverlayAlertSetting;

        /// Setter for [`presenterOverlayPrivacyAlertSetting`][Self::presenterOverlayPrivacyAlertSetting].
        #[unsafe(method(setPresenterOverlayPrivacyAlertSetting:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPresenterOverlayPrivacyAlertSetting(
            &self,
            presenter_overlay_privacy_alert_setting: SCPresenterOverlayAlertSetting,
        );

        /// SCStreamProperty to show the child windows in display bound windows and applications sharing.  Child windows are included by default.
        #[unsafe(method(includeChildWindows))]
        #[unsafe(method_family = none)]
        pub unsafe fn includeChildWindows(&self) -> bool;

        /// Setter for [`includeChildWindows`][Self::includeChildWindows].
        #[unsafe(method(setIncludeChildWindows:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIncludeChildWindows(&self, include_child_windows: bool);

        /// SCStreamProperty that specifies whether the microphone audio will be captured.  By default microphone is not captured.
        #[unsafe(method(captureMicrophone))]
        #[unsafe(method_family = none)]
        pub unsafe fn captureMicrophone(&self) -> bool;

        /// Setter for [`captureMicrophone`][Self::captureMicrophone].
        #[unsafe(method(setCaptureMicrophone:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCaptureMicrophone(&self, capture_microphone: bool);

        /// 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.
        #[unsafe(method(microphoneCaptureDeviceID))]
        #[unsafe(method_family = none)]
        pub unsafe fn microphoneCaptureDeviceID(&self) -> Option<Retained<NSString>>;

        /// Setter for [`microphoneCaptureDeviceID`][Self::microphoneCaptureDeviceID].
        #[unsafe(method(setMicrophoneCaptureDeviceID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMicrophoneCaptureDeviceID(
            &self,
            microphone_capture_device_id: Option<&NSString>,
        );

        /// 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.
        #[unsafe(method(captureDynamicRange))]
        #[unsafe(method_family = none)]
        pub unsafe fn captureDynamicRange(&self) -> SCCaptureDynamicRange;

        /// Setter for [`captureDynamicRange`][Self::captureDynamicRange].
        #[unsafe(method(setCaptureDynamicRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCaptureDynamicRange(&self, capture_dynamic_range: SCCaptureDynamicRange);

        /// Returns an instance of SCStreamConfiguration corresponding to the given preset
        ///
        /// Parameter `preset`: The enum identifier for the desired preset
        ///
        /// 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.
        #[unsafe(method(streamConfigurationWithPreset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn streamConfigurationWithPreset(
            preset: SCStreamConfigurationPreset,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl SCStreamConfiguration {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfo?language=objc)
// NS_TYPED_ENUM
pub type SCStreamFrameInfo = NSString;

extern "C" {
    /// SCStreamFrameInfoStatus
    ///
    /// The key for the CFDictionary attached to the CMSampleBuffer that denotes the frames SCFrameStatus
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfostatus?language=objc)
    pub static SCStreamFrameInfoStatus: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoDisplayTime
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfodisplaytime?language=objc)
    pub static SCStreamFrameInfoDisplayTime: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoScaleFactor
    ///
    /// 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].
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoscalefactor?language=objc)
    pub static SCStreamFrameInfoScaleFactor: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoContentScale
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfocontentscale?language=objc)
    pub static SCStreamFrameInfoContentScale: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoContentRect
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfocontentrect?language=objc)
    pub static SCStreamFrameInfoContentRect: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoDirtyRects
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfodirtyrects?language=objc)
    pub static SCStreamFrameInfoDirtyRects: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoScreenRect
    ///
    /// The key for the CFDictionary attached to the CMSampleBuffer for the onscreen location of the captured content
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoscreenrect?language=objc)
    pub static SCStreamFrameInfoScreenRect: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoBoundingRect
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfoboundingrect?language=objc)
    pub static SCStreamFrameInfoBoundingRect: &'static SCStreamFrameInfo;
}

extern "C" {
    /// SCStreamFrameInfoPresenterOverlayContentRect
    ///
    /// 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.
    /// In presenter overlay large, this content rect is the size and location of shared content in points and in surface coordinates.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamframeinfopresenteroverlaycontentrect?language=objc)
    pub static SCStreamFrameInfoPresenterOverlayContentRect: &'static SCStreamFrameInfo;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstream?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SCStream;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for SCStream {}
);

impl SCStream {
    extern_methods!(
        #[cfg(feature = "objc2-core-media")]
        /// Synchronization clock used for media capture.
        #[unsafe(method(synchronizationClock))]
        #[unsafe(method_family = none)]
        pub unsafe fn synchronizationClock(&self) -> Option<Retained<CMClock>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        /// initWithFilter:configuration:delegate:
        ///
        /// Parameter `contentFilter`: the requested content filter to be captured
        ///
        /// Parameter `streamConfig`: the requested stream configuration to be applied to the SCStream
        ///
        /// Parameter `delegate`: the SCStream delegate object
        ///
        /// this method create a SCStream object that has the particular output settings for the content stream
        #[unsafe(method(initWithFilter:configuration:delegate:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFilter_configuration_delegate(
            this: Allocated<Self>,
            content_filter: &SCContentFilter,
            stream_config: &SCStreamConfiguration,
            delegate: Option<&ProtocolObject<dyn SCStreamDelegate>>,
        ) -> Retained<Self>;

        #[cfg(feature = "dispatch2")]
        /// addStreamOutput:type:sampleHandlerQueue:error:
        ///
        /// 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
        ///
        /// Parameter `type`: the SCStreamOutput type
        ///
        /// Parameter `sampleHandlerQueue`: the return queue for the sample handler
        ///
        /// Parameter `error`: the error pertaining to the add stream output
        ///
        /// An SCStreamOutput protocol object instance can only be added to a session using -addStreamOutput: Returns a BOOL denoting if the add was successful
        ///
        /// # Safety
        ///
        /// `sample_handler_queue` possibly has additional threading requirements.
        #[unsafe(method(addStreamOutput:type:sampleHandlerQueue:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn addStreamOutput_type_sampleHandlerQueue_error(
            &self,
            output: &ProtocolObject<dyn SCStreamOutput>,
            r#type: SCStreamOutputType,
            sample_handler_queue: Option<&DispatchQueue>,
        ) -> Result<(), Retained<NSError>>;

        /// removeStreamOutput:type:error:
        ///
        /// 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
        ///
        /// Parameter `type`: the SCStreamOutput type
        ///
        /// Parameter `error`: the error pertaining to the removing stream output
        ///
        /// An SCStreamOutput protocol object instance can only be removed to a session using -addStreamOutput: Returns a BOOL denoting if the remove was successful
        #[unsafe(method(removeStreamOutput:type:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeStreamOutput_type_error(
            &self,
            output: &ProtocolObject<dyn SCStreamOutput>,
            r#type: SCStreamOutputType,
        ) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "block2")]
        /// updateContentFilter:completionHandler:
        ///
        /// Parameter `contentFilter`: the requested content filter to be updated
        ///
        /// Parameter `completionHandler`: the handler to be called when the function completes
        ///
        /// 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.
        #[unsafe(method(updateContentFilter:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateContentFilter_completionHandler(
            &self,
            content_filter: &SCContentFilter,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        /// updateConfiguration:completionHandler:
        ///
        /// Parameter `streamConfig`: the requested content filter to be updated
        ///
        /// Parameter `completionHandler`: the handler to be called when the function completes
        ///
        /// 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.
        #[unsafe(method(updateConfiguration:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateConfiguration_completionHandler(
            &self,
            stream_config: &SCStreamConfiguration,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        /// startCaptureWithCompletionHandler:
        ///
        /// Parameter `completionHandler`: the handler to be called when the function completes
        ///
        /// 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.
        #[unsafe(method(startCaptureWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn startCaptureWithCompletionHandler(
            &self,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        /// stopCaptureWithCompletionHandler:
        ///
        /// Parameter `completionHandler`: the handler to be called when the function completes
        ///
        /// 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.
        #[unsafe(method(stopCaptureWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopCaptureWithCompletionHandler(
            &self,
            completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "SCRecordingOutput")]
        /// 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.
        ///
        /// Parameter `recordingOutput`: an SCRecordingOutput that including configuration of recording, and delegate for recording event.
        ///
        /// Parameter `error`: the error pertaining to the add recording output
        ///
        /// 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.
        #[unsafe(method(addRecordingOutput:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn addRecordingOutput_error(
            &self,
            recording_output: &SCRecordingOutput,
        ) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "SCRecordingOutput")]
        /// Remove SCRecordingOutput from the SCStream. Stops Recording if the stream is currently recording.
        ///
        /// Parameter `recordingOutput`: an SCRecordingOutput that including configuration of recording, and delegate for recording event.
        ///
        /// Parameter `error`: the error pertaining to the remove recording output
        ///
        /// 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.
        #[unsafe(method(removeRecordingOutput:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeRecordingOutput_error(
            &self,
            recording_output: &SCRecordingOutput,
        ) -> Result<(), Retained<NSError>>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamoutput?language=objc)
    pub unsafe trait SCStreamOutput: NSObjectProtocol {
        #[cfg(feature = "objc2-core-media")]
        /// stream:didOutputSampleBuffer:ofType:
        ///
        /// Parameter `sampleBuffer`: the sample buffer
        ///
        /// Parameter `type`: the sample buffer type
        ///
        /// protocol method for passing back screen sample buffers
        #[optional]
        #[unsafe(method(stream:didOutputSampleBuffer:ofType:))]
        #[unsafe(method_family = none)]
        unsafe fn stream_didOutputSampleBuffer_ofType(
            &self,
            stream: &SCStream,
            sample_buffer: &CMSampleBuffer,
            r#type: SCStreamOutputType,
        );
    }
);

extern_protocol!(
    /// SCStreamDelegate
    ///
    /// SCStreamDelegate is the object that adheres to the SCStream delegate call backs
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/scstreamdelegate?language=objc)
    pub unsafe trait SCStreamDelegate: NSObjectProtocol {
        /// stream:didStopStreamWithError:
        ///
        /// Parameter `stream`: the SCStream object
        ///
        /// Parameter `error`: the error denoted by the stopping of the stream
        ///
        /// notifies the delegate that the stream has stopped and the error associated with it
        #[optional]
        #[unsafe(method(stream:didStopWithError:))]
        #[unsafe(method_family = none)]
        unsafe fn stream_didStopWithError(&self, stream: &SCStream, error: &NSError);

        /// outputVideoEffectDidStartForStream:
        ///
        /// Parameter `stream`: the SCStream object
        ///
        /// notifies the delegate that the stream's overlay video effect has started.
        #[optional]
        #[unsafe(method(outputVideoEffectDidStartForStream:))]
        #[unsafe(method_family = none)]
        unsafe fn outputVideoEffectDidStartForStream(&self, stream: &SCStream);

        /// stream:outputVideoEffectDidStart:
        ///
        /// Parameter `stream`: the SCStream object
        ///
        /// notifies the delegate that the stream's overlay video  effect has stopped.
        #[optional]
        #[unsafe(method(outputVideoEffectDidStopForStream:))]
        #[unsafe(method_family = none)]
        unsafe fn outputVideoEffectDidStopForStream(&self, stream: &SCStream);

        /// streamDidBecomeActive:
        ///
        /// Parameter `stream`: the SCStream object
        ///
        /// 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:.
        #[optional]
        #[unsafe(method(streamDidBecomeActive:))]
        #[unsafe(method_family = none)]
        unsafe fn streamDidBecomeActive(&self, stream: &SCStream);

        /// streamDidBecomeInactive:
        ///
        /// Parameter `stream`: the SCStream object
        ///
        /// notifies the delegate that all the windows that are currently being shared are exited. This callback occurs for all content filter types.
        #[optional]
        #[unsafe(method(streamDidBecomeInactive:))]
        #[unsafe(method_family = none)]
        unsafe fn streamDidBecomeInactive(&self, stream: &SCStream);
    }
);