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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-av-foundation")]
use objc2_av_foundation::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// SCRecordingOutputConfiguration
///
/// SCRecordingOutputConfiguration is an object that encapsulates the configuration for recording.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutputconfiguration?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SCRecordingOutputConfiguration;
);
extern_conformance!(
unsafe impl NSObjectProtocol for SCRecordingOutputConfiguration {}
);
impl SCRecordingOutputConfiguration {
extern_methods!(
/// Specifies output URL to save the recording.
#[unsafe(method(outputURL))]
#[unsafe(method_family = none)]
pub unsafe fn outputURL(&self) -> Retained<NSURL>;
/// Setter for [`outputURL`][Self::outputURL].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setOutputURL:))]
#[unsafe(method_family = none)]
pub unsafe fn setOutputURL(&self, output_url: &NSURL);
#[cfg(feature = "objc2-av-foundation")]
/// Specifies video codec for the recording output, default is AVVideoCodecTypeH264, supported values can be obtained using availableVideoCodecTypes
#[unsafe(method(videoCodecType))]
#[unsafe(method_family = none)]
pub unsafe fn videoCodecType(&self) -> Retained<AVVideoCodecType>;
#[cfg(feature = "objc2-av-foundation")]
/// Setter for [`videoCodecType`][Self::videoCodecType].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setVideoCodecType:))]
#[unsafe(method_family = none)]
pub unsafe fn setVideoCodecType(&self, video_codec_type: &AVVideoCodecType);
#[cfg(feature = "objc2-av-foundation")]
/// Specifies file type for the recording output, default is AVFileTypeMPEG4, supported values can be obtained using availableOutputFileTypes
#[unsafe(method(outputFileType))]
#[unsafe(method_family = none)]
pub unsafe fn outputFileType(&self) -> Retained<AVFileType>;
#[cfg(feature = "objc2-av-foundation")]
/// Setter for [`outputFileType`][Self::outputFileType].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setOutputFileType:))]
#[unsafe(method_family = none)]
pub unsafe fn setOutputFileType(&self, output_file_type: &AVFileType);
#[cfg(feature = "objc2-av-foundation")]
/// Returns an array of supported video codec formats that can be specified in SCRecordingOutputConfiguration for videoCodecType
#[unsafe(method(availableVideoCodecTypes))]
#[unsafe(method_family = none)]
pub unsafe fn availableVideoCodecTypes(&self) -> Retained<NSArray<AVVideoCodecType>>;
#[cfg(feature = "objc2-av-foundation")]
/// Returns an array of supported file types that can be specified in SCRecordingOutputConfiguration for outputFileType
/// Provides the file types AVCaptureAudioFileOutput can write.
#[unsafe(method(availableOutputFileTypes))]
#[unsafe(method_family = none)]
pub unsafe fn availableOutputFileTypes(&self) -> Retained<NSArray<AVFileType>>;
);
}
/// Methods declared on superclass `NSObject`.
impl SCRecordingOutputConfiguration {
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>;
);
}
extern_protocol!(
/// Defines an interface for delegates of SCRecordingOutput to respond to events that occur in the process of recording to file.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutputdelegate?language=objc)
pub unsafe trait SCRecordingOutputDelegate: NSObjectProtocol {
/// recordingOutputDidStartRecording:
///
/// Parameter `recordingOutput`: the SCRecordingOutput object
///
/// notifies the delegate that recording has succesfully started.
#[optional]
#[unsafe(method(recordingOutputDidStartRecording:))]
#[unsafe(method_family = none)]
unsafe fn recordingOutputDidStartRecording(&self, recording_output: &SCRecordingOutput);
/// recordingOutput:didFailWithError:
///
/// Parameter `recordingOutput`: the SCRecordingOutput object
///
/// Parameter `error`: error describing why the recording failed.
///
/// notifies the delegate that recording has failed with error associated.
#[optional]
#[unsafe(method(recordingOutput:didFailWithError:))]
#[unsafe(method_family = none)]
unsafe fn recordingOutput_didFailWithError(
&self,
recording_output: &SCRecordingOutput,
error: &NSError,
);
/// recordingOutputDidFinishRecording:
///
/// notifies the delegate that recording has finished successfully.
#[optional]
#[unsafe(method(recordingOutputDidFinishRecording:))]
#[unsafe(method_family = none)]
unsafe fn recordingOutputDidFinishRecording(&self, recording_output: &SCRecordingOutput);
}
);
extern_class!(
/// [Apple's documentation](https://developer.apple.com/documentation/screencapturekit/screcordingoutput?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct SCRecordingOutput;
);
extern_conformance!(
unsafe impl NSObjectProtocol for SCRecordingOutput {}
);
impl SCRecordingOutput {
extern_methods!(
#[cfg(feature = "objc2-core-media")]
/// Indicates current duration of recording to the output file.
#[unsafe(method(recordedDuration))]
#[unsafe(method_family = none)]
pub unsafe fn recordedDuration(&self) -> CMTime;
/// Indicates current size, in bytes, of the data recorded to the output file.
#[unsafe(method(recordedFileSize))]
#[unsafe(method_family = none)]
pub unsafe fn recordedFileSize(&self) -> NSInteger;
/// initialize SCRecordingOutput object with SCRecordingOutputConfiguration and SCRecordingOutputDelegate
///
/// Parameter `recordingOutputConfiguration`: the requested recording configuration to be applied to the SCRecordingOutput
///
/// Parameter `delegate`: object conforming SCRecordingOutputDelegate protocol. Clients must specify a delegate so that they can be notified about recording event.
///
/// 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.
#[unsafe(method(initWithConfiguration:delegate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithConfiguration_delegate(
this: Allocated<Self>,
recording_output_configuration: &SCRecordingOutputConfiguration,
delegate: &ProtocolObject<dyn SCRecordingOutputDelegate>,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl SCRecordingOutput {
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>;
);
}