objc2_screen_capture_kit/generated/
SCRecordingOutput.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-av-foundation")]
7use objc2_av_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15    /// SCRecordingOutputConfiguration
16    ///
17    /// SCRecordingOutputConfiguration is an object that encapsulates the configuration for recording.
18    ///
19    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutputconfiguration?language=objc)
20    #[unsafe(super(NSObject))]
21    #[derive(Debug, PartialEq, Eq, Hash)]
22    pub struct SCRecordingOutputConfiguration;
23);
24
25extern_conformance!(
26    unsafe impl NSObjectProtocol for SCRecordingOutputConfiguration {}
27);
28
29impl SCRecordingOutputConfiguration {
30    extern_methods!(
31        /// Specifies output URL to save the recording.
32        #[unsafe(method(outputURL))]
33        #[unsafe(method_family = none)]
34        pub unsafe fn outputURL(&self) -> Retained<NSURL>;
35
36        /// Setter for [`outputURL`][Self::outputURL].
37        ///
38        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
39        #[unsafe(method(setOutputURL:))]
40        #[unsafe(method_family = none)]
41        pub unsafe fn setOutputURL(&self, output_url: &NSURL);
42
43        #[cfg(feature = "objc2-av-foundation")]
44        /// Specifies video codec for the recording output, default is AVVideoCodecTypeH264, supported values can be obtained using availableVideoCodecTypes
45        #[unsafe(method(videoCodecType))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn videoCodecType(&self) -> Retained<AVVideoCodecType>;
48
49        #[cfg(feature = "objc2-av-foundation")]
50        /// Setter for [`videoCodecType`][Self::videoCodecType].
51        ///
52        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
53        #[unsafe(method(setVideoCodecType:))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn setVideoCodecType(&self, video_codec_type: &AVVideoCodecType);
56
57        #[cfg(feature = "objc2-av-foundation")]
58        /// Specifies file type for the recording output, default is AVFileTypeMPEG4, supported values can be obtained using availableOutputFileTypes
59        #[unsafe(method(outputFileType))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn outputFileType(&self) -> Retained<AVFileType>;
62
63        #[cfg(feature = "objc2-av-foundation")]
64        /// Setter for [`outputFileType`][Self::outputFileType].
65        ///
66        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
67        #[unsafe(method(setOutputFileType:))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn setOutputFileType(&self, output_file_type: &AVFileType);
70
71        #[cfg(feature = "objc2-av-foundation")]
72        /// Returns an array of supported video codec formats that can be specified in SCRecordingOutputConfiguration for videoCodecType
73        #[unsafe(method(availableVideoCodecTypes))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn availableVideoCodecTypes(&self) -> Retained<NSArray<AVVideoCodecType>>;
76
77        #[cfg(feature = "objc2-av-foundation")]
78        /// Returns an array of supported file types that can be specified in SCRecordingOutputConfiguration for outputFileType
79        /// Provides the file types AVCaptureAudioFileOutput can write.
80        #[unsafe(method(availableOutputFileTypes))]
81        #[unsafe(method_family = none)]
82        pub unsafe fn availableOutputFileTypes(&self) -> Retained<NSArray<AVFileType>>;
83    );
84}
85
86/// Methods declared on superclass `NSObject`.
87impl SCRecordingOutputConfiguration {
88    extern_methods!(
89        #[unsafe(method(init))]
90        #[unsafe(method_family = init)]
91        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
92
93        #[unsafe(method(new))]
94        #[unsafe(method_family = new)]
95        pub unsafe fn new() -> Retained<Self>;
96    );
97}
98
99extern_protocol!(
100    /// Defines an interface for delegates of SCRecordingOutput to respond to events that occur in the process of recording to file.
101    ///
102    /// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutputdelegate?language=objc)
103    pub unsafe trait SCRecordingOutputDelegate: NSObjectProtocol {
104        /// recordingOutputDidStartRecording:
105        ///
106        /// Parameter `recordingOutput`: the SCRecordingOutput object
107        ///
108        /// notifies the delegate that recording has succesfully started.
109        #[optional]
110        #[unsafe(method(recordingOutputDidStartRecording:))]
111        #[unsafe(method_family = none)]
112        unsafe fn recordingOutputDidStartRecording(&self, recording_output: &SCRecordingOutput);
113
114        /// recordingOutput:didFailWithError:
115        ///
116        /// Parameter `recordingOutput`: the SCRecordingOutput object
117        ///
118        /// Parameter `error`: error describing why the recording failed.
119        ///
120        /// notifies the delegate that recording has failed with error associated.
121        #[optional]
122        #[unsafe(method(recordingOutput:didFailWithError:))]
123        #[unsafe(method_family = none)]
124        unsafe fn recordingOutput_didFailWithError(
125            &self,
126            recording_output: &SCRecordingOutput,
127            error: &NSError,
128        );
129
130        /// recordingOutputDidFinishRecording:
131        ///
132        /// notifies the delegate that recording has finished successfully.
133        #[optional]
134        #[unsafe(method(recordingOutputDidFinishRecording:))]
135        #[unsafe(method_family = none)]
136        unsafe fn recordingOutputDidFinishRecording(&self, recording_output: &SCRecordingOutput);
137    }
138);
139
140extern_class!(
141    /// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutput?language=objc)
142    #[unsafe(super(NSObject))]
143    #[derive(Debug, PartialEq, Eq, Hash)]
144    pub struct SCRecordingOutput;
145);
146
147extern_conformance!(
148    unsafe impl NSObjectProtocol for SCRecordingOutput {}
149);
150
151impl SCRecordingOutput {
152    extern_methods!(
153        #[cfg(feature = "objc2-core-media")]
154        /// Indicates current duration of recording to the output file.
155        #[unsafe(method(recordedDuration))]
156        #[unsafe(method_family = none)]
157        pub unsafe fn recordedDuration(&self) -> CMTime;
158
159        /// Indicates current size, in bytes, of the data recorded to the output file.
160        #[unsafe(method(recordedFileSize))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn recordedFileSize(&self) -> NSInteger;
163
164        /// initialize SCRecordingOutput object with SCRecordingOutputConfiguration and SCRecordingOutputDelegate
165        ///
166        /// Parameter `recordingOutputConfiguration`: the requested recording configuration to be applied to the SCRecordingOutput
167        ///
168        /// Parameter `delegate`: object conforming SCRecordingOutputDelegate protocol. Clients must specify a delegate so that they can be notified about recording event.
169        ///
170        /// Client can create a SCRecordingOutput with this initializer and add to SCStream to record all captured media into one recording file given output url specified in recordingOutputConfig. The recording will be using H264 and file format is MPEG-4.
171        #[unsafe(method(initWithConfiguration:delegate:))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn initWithConfiguration_delegate(
174            this: Allocated<Self>,
175            recording_output_configuration: &SCRecordingOutputConfiguration,
176            delegate: &ProtocolObject<dyn SCRecordingOutputDelegate>,
177        ) -> Retained<Self>;
178    );
179}
180
181/// Methods declared on superclass `NSObject`.
182impl SCRecordingOutput {
183    extern_methods!(
184        #[unsafe(method(init))]
185        #[unsafe(method_family = init)]
186        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
187
188        #[unsafe(method(new))]
189        #[unsafe(method_family = new)]
190        pub unsafe fn new() -> Retained<Self>;
191    );
192}