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:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn setDelegate(
204 &self,
205 delegate: Option<&ProtocolObject<dyn RPScreenRecorderDelegate>>,
206 );
207
208 #[unsafe(method(isAvailable))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn isAvailable(&self) -> bool;
211
212 #[unsafe(method(isRecording))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn isRecording(&self) -> bool;
215
216 #[unsafe(method(isMicrophoneEnabled))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn isMicrophoneEnabled(&self) -> bool;
219
220 #[unsafe(method(setMicrophoneEnabled:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setMicrophoneEnabled(&self, microphone_enabled: bool);
224
225 #[unsafe(method(isCameraEnabled))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn isCameraEnabled(&self) -> bool;
228
229 #[unsafe(method(setCameraEnabled:))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn setCameraEnabled(&self, camera_enabled: bool);
233
234 #[unsafe(method(cameraPosition))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn cameraPosition(&self) -> RPCameraPosition;
237
238 #[unsafe(method(setCameraPosition:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn setCameraPosition(&self, camera_position: RPCameraPosition);
242
243 #[cfg(feature = "objc2-app-kit")]
244 #[cfg(target_os = "macos")]
245 #[unsafe(method(cameraPreviewView))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn cameraPreviewView(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
248 );
249}
250
251impl RPScreenRecorder {
253 extern_methods!(
254 #[unsafe(method(new))]
255 #[unsafe(method_family = new)]
256 pub unsafe fn new() -> Retained<Self>;
257 );
258}
259
260extern_protocol!(
261 pub unsafe trait RPScreenRecorderDelegate: NSObjectProtocol {
263 #[cfg(all(feature = "RPPreviewViewController", feature = "objc2-app-kit"))]
264 #[cfg(target_os = "macos")]
265 #[deprecated = "No longer supported"]
273 #[optional]
274 #[unsafe(method(screenRecorder:didStopRecordingWithError:previewViewController:))]
275 #[unsafe(method_family = none)]
276 unsafe fn screenRecorder_didStopRecordingWithError_previewViewController(
277 &self,
278 screen_recorder: &RPScreenRecorder,
279 error: &NSError,
280 preview_view_controller: Option<&RPPreviewViewController>,
281 );
282
283 #[cfg(all(feature = "RPPreviewViewController", feature = "objc2-app-kit"))]
284 #[cfg(target_os = "macos")]
285 #[optional]
286 #[unsafe(method(screenRecorder:didStopRecordingWithPreviewViewController:error:))]
287 #[unsafe(method_family = none)]
288 unsafe fn screenRecorder_didStopRecordingWithPreviewViewController_error(
289 &self,
290 screen_recorder: &RPScreenRecorder,
291 preview_view_controller: Option<&RPPreviewViewController>,
292 error: Option<&NSError>,
293 );
294
295 #[optional]
299 #[unsafe(method(screenRecorderDidChangeAvailability:))]
300 #[unsafe(method_family = none)]
301 unsafe fn screenRecorderDidChangeAvailability(&self, screen_recorder: &RPScreenRecorder);
302 }
303);