objc2_replay_kit/generated/
RPScreenRecorder.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-media")]
10use objc2_core_media::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct RPCameraPosition(pub NSInteger);
20impl RPCameraPosition {
21 #[doc(alias = "RPCameraPositionFront")]
22 pub const Front: Self = Self(1);
23 #[doc(alias = "RPCameraPositionBack")]
24 pub const Back: Self = Self(2);
25}
26
27unsafe impl Encode for RPCameraPosition {
28 const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for RPCameraPosition {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(NSObject))]
40 #[derive(Debug, PartialEq, Eq, Hash)]
41 pub struct RPScreenRecorder;
42);
43
44extern_conformance!(
45 unsafe impl NSObjectProtocol for RPScreenRecorder {}
46);
47
48impl RPScreenRecorder {
49 extern_methods!(
50 #[unsafe(method(sharedRecorder))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn sharedRecorder() -> Retained<RPScreenRecorder>;
53
54 #[unsafe(method(init))]
55 #[unsafe(method_family = init)]
56 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
57
58 #[cfg(feature = "block2")]
59 #[deprecated = "Use microphoneEnabled property"]
68 #[unsafe(method(startRecordingWithMicrophoneEnabled:handler:))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn startRecordingWithMicrophoneEnabled_handler(
71 &self,
72 microphone_enabled: bool,
73 handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
74 );
75
76 #[cfg(feature = "block2")]
77 #[unsafe(method(startRecordingWithHandler:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn startRecordingWithHandler(
83 &self,
84 handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
85 );
86
87 #[cfg(all(
88 feature = "RPPreviewViewController",
89 feature = "block2",
90 feature = "objc2-app-kit"
91 ))]
92 #[cfg(target_os = "macos")]
93 #[unsafe(method(stopRecordingWithHandler:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn stopRecordingWithHandler(
99 &self,
100 handler: Option<&block2::DynBlock<dyn Fn(*mut RPPreviewViewController, *mut NSError)>>,
101 );
102
103 #[cfg(feature = "block2")]
104 #[unsafe(method(stopRecordingWithOutputURL:completionHandler:))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn stopRecordingWithOutputURL_completionHandler(
112 &self,
113 url: &NSURL,
114 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
115 );
116
117 #[cfg(feature = "block2")]
118 #[unsafe(method(discardRecordingWithHandler:))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn discardRecordingWithHandler(&self, handler: &block2::DynBlock<dyn Fn()>);
122
123 #[cfg(all(
124 feature = "RPBroadcastExtension",
125 feature = "block2",
126 feature = "objc2-core-media"
127 ))]
128 #[unsafe(method(startCaptureWithHandler:completionHandler:))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn startCaptureWithHandler_completionHandler(
134 &self,
135 capture_handler: Option<
136 &block2::DynBlock<
137 dyn Fn(NonNull<CMSampleBuffer>, RPSampleBufferType, *mut NSError),
138 >,
139 >,
140 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
141 );
142
143 #[cfg(feature = "block2")]
144 #[unsafe(method(stopCaptureWithHandler:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn stopCaptureWithHandler(
150 &self,
151 handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
152 );
153
154 #[cfg(feature = "block2")]
155 #[unsafe(method(startClipBufferingWithCompletionHandler:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn startClipBufferingWithCompletionHandler(
161 &self,
162 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
163 );
164
165 #[cfg(feature = "block2")]
166 #[unsafe(method(stopClipBufferingWithCompletionHandler:))]
170 #[unsafe(method_family = none)]
171 pub unsafe fn stopClipBufferingWithCompletionHandler(
172 &self,
173 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
174 );
175
176 #[cfg(feature = "block2")]
177 #[unsafe(method(exportClipToURL:duration:completionHandler:))]
185 #[unsafe(method_family = none)]
186 pub unsafe fn exportClipToURL_duration_completionHandler(
187 &self,
188 url: &NSURL,
189 duration: NSTimeInterval,
190 completion_handler: Option<&block2::DynBlock<dyn Fn(*mut NSError)>>,
191 );
192
193 #[unsafe(method(delegate))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn delegate(
196 &self,
197 ) -> Option<Retained<ProtocolObject<dyn RPScreenRecorderDelegate>>>;
198
199 #[unsafe(method(setDelegate:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn setDelegate(
205 &self,
206 delegate: Option<&ProtocolObject<dyn RPScreenRecorderDelegate>>,
207 );
208
209 #[unsafe(method(isAvailable))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn isAvailable(&self) -> bool;
212
213 #[unsafe(method(isRecording))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn isRecording(&self) -> bool;
216
217 #[unsafe(method(isMicrophoneEnabled))]
218 #[unsafe(method_family = none)]
219 pub unsafe fn isMicrophoneEnabled(&self) -> bool;
220
221 #[unsafe(method(setMicrophoneEnabled:))]
223 #[unsafe(method_family = none)]
224 pub unsafe fn setMicrophoneEnabled(&self, microphone_enabled: bool);
225
226 #[unsafe(method(isCameraEnabled))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn isCameraEnabled(&self) -> bool;
229
230 #[unsafe(method(setCameraEnabled:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn setCameraEnabled(&self, camera_enabled: bool);
234
235 #[unsafe(method(cameraPosition))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn cameraPosition(&self) -> RPCameraPosition;
238
239 #[unsafe(method(setCameraPosition:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn setCameraPosition(&self, camera_position: RPCameraPosition);
243
244 #[cfg(feature = "objc2-app-kit")]
245 #[cfg(target_os = "macos")]
246 #[unsafe(method(cameraPreviewView))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn cameraPreviewView(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
249 );
250}
251
252impl RPScreenRecorder {
254 extern_methods!(
255 #[unsafe(method(new))]
256 #[unsafe(method_family = new)]
257 pub unsafe fn new() -> Retained<Self>;
258 );
259}
260
261extern_protocol!(
262 pub unsafe trait RPScreenRecorderDelegate: NSObjectProtocol {
264 #[cfg(all(feature = "RPPreviewViewController", feature = "objc2-app-kit"))]
265 #[cfg(target_os = "macos")]
266 #[deprecated = "No longer supported"]
274 #[optional]
275 #[unsafe(method(screenRecorder:didStopRecordingWithError:previewViewController:))]
276 #[unsafe(method_family = none)]
277 unsafe fn screenRecorder_didStopRecordingWithError_previewViewController(
278 &self,
279 screen_recorder: &RPScreenRecorder,
280 error: &NSError,
281 preview_view_controller: Option<&RPPreviewViewController>,
282 );
283
284 #[cfg(all(feature = "RPPreviewViewController", feature = "objc2-app-kit"))]
285 #[cfg(target_os = "macos")]
286 #[optional]
287 #[unsafe(method(screenRecorder:didStopRecordingWithPreviewViewController:error:))]
288 #[unsafe(method_family = none)]
289 unsafe fn screenRecorder_didStopRecordingWithPreviewViewController_error(
290 &self,
291 screen_recorder: &RPScreenRecorder,
292 preview_view_controller: Option<&RPPreviewViewController>,
293 error: Option<&NSError>,
294 );
295
296 #[optional]
300 #[unsafe(method(screenRecorderDidChangeAvailability:))]
301 #[unsafe(method_family = none)]
302 unsafe fn screenRecorderDidChangeAvailability(&self, screen_recorder: &RPScreenRecorder);
303 }
304);