objc2_av_foundation/generated/AVCaptureSession.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "dispatch2")]
6use dispatch2::*;
7use objc2::__framework_prelude::*;
8#[cfg(feature = "objc2-core-foundation")]
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-media")]
11use objc2_core_media::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16extern "C" {
17 /// Posted when an unexpected error occurs while an AVCaptureSession instance is running.
18 ///
19 ///
20 /// The notification object is the AVCaptureSession instance that encountered a runtime error. The userInfo dictionary contains an NSError for the key AVCaptureSessionErrorKey.
21 ///
22 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessionruntimeerrornotification?language=objc)
23 pub static AVCaptureSessionRuntimeErrorNotification: &'static NSNotificationName;
24}
25
26extern "C" {
27 /// The key used to provide an NSError describing the failure condition in an AVCaptureSessionRuntimeErrorNotification.
28 ///
29 ///
30 /// AVCaptureSessionErrorKey may be found in the userInfo dictionary provided with an AVCaptureSessionRuntimeErrorNotification. The NSError associated with the notification gives greater detail on the nature of the error, and in some cases recovery suggestions.
31 ///
32 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessionerrorkey?language=objc)
33 pub static AVCaptureSessionErrorKey: &'static NSString;
34}
35
36extern "C" {
37 /// Posted when an instance of AVCaptureSession successfully starts running.
38 ///
39 ///
40 /// Clients may observe the AVCaptureSessionDidStartRunningNotification to know when an instance of AVCaptureSession starts running.
41 ///
42 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessiondidstartrunningnotification?language=objc)
43 pub static AVCaptureSessionDidStartRunningNotification: &'static NSNotificationName;
44}
45
46extern "C" {
47 /// Posted when an instance of AVCaptureSession stops running.
48 ///
49 ///
50 /// Clients may observe the AVCaptureSessionDidStopRunningNotification to know when an instance of AVCaptureSession stops running. An AVCaptureSession instance may stop running automatically due to external system conditions, such as the device going to sleep, or being locked by a user.
51 ///
52 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessiondidstoprunningnotification?language=objc)
53 pub static AVCaptureSessionDidStopRunningNotification: &'static NSNotificationName;
54}
55
56extern "C" {
57 /// Posted when an instance of AVCaptureSession becomes interrupted.
58 ///
59 ///
60 /// Clients may observe the AVCaptureSessionWasInterruptedNotification to know when an instance of AVCaptureSession has been interrupted, for example, by an incoming phone call, or alarm, or another application taking control of needed hardware resources. When appropriate, the AVCaptureSession instance will stop running automatically in response to an interruption.
61 ///
62 /// Beginning in iOS 9.0, the AVCaptureSessionWasInterruptedNotification userInfo dictionary contains an AVCaptureSessionInterruptionReasonKey indicating the reason for the interruption.
63 ///
64 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessionwasinterruptednotification?language=objc)
65 pub static AVCaptureSessionWasInterruptedNotification: &'static NSNotificationName;
66}
67
68/// Constants indicating interruption reason. One of these is returned with the ``AVCaptureSessionWasInterruptedNotification`` (see ``AVCaptureSessionInterruptionReasonKey``).
69///
70/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionreason?language=objc)
71// NS_ENUM
72#[repr(transparent)]
73#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
74pub struct AVCaptureSessionInterruptionReason(pub NSInteger);
75impl AVCaptureSessionInterruptionReason {
76 /// An interruption caused by the app being sent to the background while using a camera. Camera usage is prohibited while in the background. Beginning in iOS 9.0, ``AVCaptureSession`` no longer produces an ``AVCaptureSessionRuntimeErrorNotification`` if you attempt to start running a camera while in the background. Instead, it sends an ``AVCaptureSessionWasInterruptedNotification`` with ``AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground``. Provided you don't explicitly call ``AVCaptureSession/stopRunning``, your ``AVCaptureSession/startRunning`` request is preserved, and when your app comes back to foreground, you receive ``AVCaptureSessionInterruptionEndedNotification`` and your session starts running.
77 #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground")]
78 pub const VideoDeviceNotAvailableInBackground: Self = Self(1);
79 /// An interruption caused by the audio hardware temporarily being made unavailable, for instance, for a phone call, or alarm.
80 #[doc(alias = "AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient")]
81 pub const AudioDeviceInUseByAnotherClient: Self = Self(2);
82 /// An interruption caused by the video device temporarily being made unavailable, for instance, when stolen away by another ``AVCaptureSession``.
83 #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient")]
84 pub const VideoDeviceInUseByAnotherClient: Self = Self(3);
85 /// An interruption caused when the app is running in a multi-app layout, causing resource contention and degraded recording quality of service. Given your present ``AVCaptureSession`` configuration, the session may only be run if your app occupies the full screen.
86 #[doc(
87 alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"
88 )]
89 pub const VideoDeviceNotAvailableWithMultipleForegroundApps: Self = Self(4);
90 /// An interruption caused by the video device temporarily being made unavailable due to system pressure, such as thermal duress. See ``AVCaptureDevice/systemPressureState`` for more information.
91 #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure")]
92 pub const VideoDeviceNotAvailableDueToSystemPressure: Self = Self(5);
93 /// An interruption caused by a ``SCVideoStreamAnalyzer`` when it detects sensitive content on an associated ``AVCaptureDeviceInput``. To resume your capture session, call your analyzer's ``SCVideoStreamAnalyzer/continueStream`` method.
94 #[doc(alias = "AVCaptureSessionInterruptionReasonSensitiveContentMitigationActivated")]
95 pub const SensitiveContentMitigationActivated: Self = Self(6);
96}
97
98unsafe impl Encode for AVCaptureSessionInterruptionReason {
99 const ENCODING: Encoding = NSInteger::ENCODING;
100}
101
102unsafe impl RefEncode for AVCaptureSessionInterruptionReason {
103 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
104}
105
106extern "C" {
107 /// The key used to provide an NSNumber describing the interruption reason in an AVCaptureSessionWasInterruptedNotification.
108 ///
109 ///
110 /// AVCaptureSessionInterruptionReasonKey may be found in the userInfo dictionary provided with an AVCaptureSessionWasInterruptedNotification. The NSNumber associated with the notification tells you why the interruption occurred.
111 ///
112 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionreasonkey?language=objc)
113 pub static AVCaptureSessionInterruptionReasonKey: &'static NSString;
114}
115
116extern "C" {
117 /// The key used to provide an AVCaptureSystemPressureState indicating the system pressure level and contributing factors that caused the interruption.
118 ///
119 ///
120 /// This key is only present when the AVCaptureSessionInterruptionReasonKey equals AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure.
121 ///
122 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionsystempressurestatekey?language=objc)
123 pub static AVCaptureSessionInterruptionSystemPressureStateKey: &'static NSString;
124}
125
126extern "C" {
127 /// Posted when an instance of AVCaptureSession ceases to be interrupted.
128 ///
129 ///
130 /// Clients may observe the AVCaptureSessionInterruptionEndedNotification to know when an instance of AVCaptureSession ceases to be interrupted, for example, when a phone call ends, and hardware resources needed to run the session are again available. When appropriate, the AVCaptureSession instance that was previously stopped in response to an interruption will automatically restart once the interruption ends.
131 ///
132 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionendednotification?language=objc)
133 pub static AVCaptureSessionInterruptionEndedNotification: &'static NSNotificationName;
134}
135
136/// Constants indicating video orientation, for use with AVCaptureVideoPreviewLayer (see AVCaptureVideoPreviewLayer.h) and AVCaptureConnection (see below).
137///
138///
139/// Indicates that video should be oriented vertically, home button on the bottom.
140///
141/// Indicates that video should be oriented vertically, home button on the top.
142///
143/// Indicates that video should be oriented horizontally, home button on the right.
144///
145/// Indicates that video should be oriented horizontally, home button on the left.
146///
147/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideoorientation?language=objc)
148// NS_ENUM
149#[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
150#[repr(transparent)]
151#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
152pub struct AVCaptureVideoOrientation(pub NSInteger);
153impl AVCaptureVideoOrientation {
154 #[doc(alias = "AVCaptureVideoOrientationPortrait")]
155 #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
156 pub const Portrait: Self = Self(1);
157 #[doc(alias = "AVCaptureVideoOrientationPortraitUpsideDown")]
158 #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
159 pub const PortraitUpsideDown: Self = Self(2);
160 #[doc(alias = "AVCaptureVideoOrientationLandscapeRight")]
161 #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
162 pub const LandscapeRight: Self = Self(3);
163 #[doc(alias = "AVCaptureVideoOrientationLandscapeLeft")]
164 #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
165 pub const LandscapeLeft: Self = Self(4);
166}
167
168unsafe impl Encode for AVCaptureVideoOrientation {
169 const ENCODING: Encoding = NSInteger::ENCODING;
170}
171
172unsafe impl RefEncode for AVCaptureVideoOrientation {
173 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
174}
175
176extern_class!(
177 /// AVCaptureSession is the central hub of the AVFoundation capture classes.
178 ///
179 ///
180 /// To perform a real-time capture, a client may instantiate AVCaptureSession and add appropriate AVCaptureInputs, such as AVCaptureDeviceInput, and outputs, such as AVCaptureMovieFileOutput. [AVCaptureSession startRunning] starts the flow of data from the inputs to the outputs, and [AVCaptureSession stopRunning] stops the flow. A client may set the sessionPreset property to customize the quality level or bitrate of the output.
181 ///
182 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesession?language=objc)
183 #[unsafe(super(NSObject))]
184 #[derive(Debug, PartialEq, Eq, Hash)]
185 pub struct AVCaptureSession;
186);
187
188extern_conformance!(
189 unsafe impl NSObjectProtocol for AVCaptureSession {}
190);
191
192impl AVCaptureSession {
193 extern_methods!(
194 #[cfg(feature = "AVCaptureSessionPreset")]
195 /// Returns whether the receiver can be configured with the given preset.
196 ///
197 ///
198 /// Parameter `preset`: An AVCaptureSession preset.
199 ///
200 /// Returns: YES if the receiver can be set to the given preset, NO otherwise.
201 ///
202 ///
203 /// An AVCaptureSession instance can be associated with a preset that configures its inputs and outputs to fulfill common use cases. This method can be used to determine if the receiver supports the desired preset given its current input and output configuration. The receiver's sessionPreset property may only be set to a certain preset if this method returns YES for that preset.
204 #[unsafe(method(canSetSessionPreset:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn canSetSessionPreset(&self, preset: &AVCaptureSessionPreset) -> bool;
207
208 #[cfg(feature = "AVCaptureSessionPreset")]
209 /// Indicates the session preset currently in use by the receiver.
210 ///
211 ///
212 /// The value of this property is an AVCaptureSessionPreset indicating the current session preset in use by the receiver. The sessionPreset property may be set while the receiver is running.
213 #[unsafe(method(sessionPreset))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn sessionPreset(&self) -> Retained<AVCaptureSessionPreset>;
216
217 #[cfg(feature = "AVCaptureSessionPreset")]
218 /// Setter for [`sessionPreset`][Self::sessionPreset].
219 ///
220 /// This is [copied][objc2_foundation::NSCopying::copy] when set.
221 #[unsafe(method(setSessionPreset:))]
222 #[unsafe(method_family = none)]
223 pub unsafe fn setSessionPreset(&self, session_preset: &AVCaptureSessionPreset);
224
225 #[cfg(feature = "AVCaptureInput")]
226 /// An NSArray of AVCaptureInputs currently added to the receiver.
227 ///
228 ///
229 /// The value of this property is an NSArray of AVCaptureInputs currently added to the receiver. Clients can add AVCaptureInputs to a session by calling -addInput:.
230 #[unsafe(method(inputs))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn inputs(&self) -> Retained<NSArray<AVCaptureInput>>;
233
234 #[cfg(feature = "AVCaptureInput")]
235 /// Returns whether the proposed input can be added to the receiver.
236 ///
237 ///
238 /// Parameter `input`: An AVCaptureInput instance.
239 ///
240 /// Returns: YES if the proposed input can be added to the receiver, NO otherwise.
241 ///
242 ///
243 /// An AVCaptureInput instance can only be added to a session using -addInput: if -canAddInput: returns YES, otherwise an NSInvalidArgumentException is thrown.
244 #[unsafe(method(canAddInput:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn canAddInput(&self, input: &AVCaptureInput) -> bool;
247
248 #[cfg(feature = "AVCaptureInput")]
249 /// Adds an AVCaptureInput to the session.
250 ///
251 ///
252 /// Parameter `input`: An AVCaptureInput instance.
253 ///
254 ///
255 /// An AVCaptureInput instance can only be added to a session using -addInput: if -canAddInput: returns YES, otherwise an NSInvalidArgumentException is thrown. -addInput: may be called while the session is running.
256 #[unsafe(method(addInput:))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn addInput(&self, input: &AVCaptureInput);
259
260 #[cfg(feature = "AVCaptureInput")]
261 /// Removes an AVCaptureInput from the session.
262 ///
263 ///
264 /// Parameter `input`: An AVCaptureInput instance.
265 ///
266 ///
267 /// -removeInput: may be called while the session is running.
268 #[unsafe(method(removeInput:))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn removeInput(&self, input: &AVCaptureInput);
271
272 #[cfg(feature = "AVCaptureOutputBase")]
273 /// An NSArray of AVCaptureOutputs currently added to the receiver.
274 ///
275 ///
276 /// The value of this property is an NSArray of AVCaptureOutputs currently added to the receiver. Clients can add AVCaptureOutputs to a session by calling -addOutput:.
277 #[unsafe(method(outputs))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn outputs(&self) -> Retained<NSArray<AVCaptureOutput>>;
280
281 #[cfg(feature = "AVCaptureOutputBase")]
282 /// Returns whether the proposed output can be added to the receiver.
283 ///
284 ///
285 /// Parameter `output`: An AVCaptureOutput instance.
286 ///
287 /// Returns: YES if the proposed output can be added to the receiver, NO otherwise.
288 ///
289 ///
290 /// An AVCaptureOutput instance can only be added to a session using -addOutput: if -canAddOutput: returns YES, otherwise an NSInvalidArgumentException is thrown.
291 ///
292 /// On iOS and Mac Catalyst, some limitations to adding combinations of different types of outputs apply:
293 /// - A maximum of one output of each type may be added. For applications linked on or after iOS 16.0, this restriction no longer applies to AVCaptureVideoDataOutputs. When adding more than one AVCaptureVideoDataOutput, AVCaptureSession.hardwareCost must be taken into account.
294 /// - A session cannot contain both an AVCaptureStillImageOutput and an AVCapturePhotoOutput at the same time.
295 /// - Prior to iOS 16.0, an AVCaptureVideoDataOutput and an AVCaptureMovieFileOutput may be added to the same session, but only one may have its connection active. When both have their connections enabled, the AVCaptureMovieFileOutput "wins" and the AVCaptureVideoDataOutput's connection becomes inactive. For applications linked on or after iOS 16.0, this restriction has been lifted. When adding multiple AVCaptureVideoDataOutputs or a combination of AVCaptureVideoDataOutputs and an AVCaptureMovieFileOutput, AVCaptureSession.hardwareCost must be taken into account.
296 /// - Similarly, prior to iOS 16.0, an AVCaptureAudioDataOutput and an AVCaptureMovieFileOutput may be added to the same session, but only one may have its connection active. When both have their connections enabled, the AVCaptureMovieFileOutput "wins" and the AVCaptureAudioDataOutput's connection becomes inactive. For applications linked on or after iOS 16.0, this restriction has been lifted.
297 #[unsafe(method(canAddOutput:))]
298 #[unsafe(method_family = none)]
299 pub unsafe fn canAddOutput(&self, output: &AVCaptureOutput) -> bool;
300
301 #[cfg(feature = "AVCaptureOutputBase")]
302 /// Adds an AVCaptureOutput to the session.
303 ///
304 ///
305 /// Parameter `output`: An AVCaptureOutput instance.
306 ///
307 ///
308 /// An AVCaptureOutput instance can only be added to a session using -addOutput: if -canAddOutput: returns YES, otherwise an NSInvalidArgumentException is thrown. -addOutput: may be called while the session is running.
309 #[unsafe(method(addOutput:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn addOutput(&self, output: &AVCaptureOutput);
312
313 #[cfg(feature = "AVCaptureOutputBase")]
314 /// Removes an AVCaptureOutput from the session.
315 ///
316 ///
317 /// Parameter `output`: An AVCaptureOutput instance.
318 ///
319 ///
320 /// -removeOutput: may be called while the session is running.
321 #[unsafe(method(removeOutput:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn removeOutput(&self, output: &AVCaptureOutput);
324
325 #[cfg(feature = "AVCaptureInput")]
326 /// Adds an AVCaptureInput to the session without forming any connections.
327 ///
328 ///
329 /// Parameter `input`: An AVCaptureInput instance.
330 ///
331 ///
332 /// An AVCaptureInput instance can only be added to a session using -addInputWithNoConnections: if -canAddInput: returns YES, otherwise an NSInvalidArgumentException is thrown. -addInputWithNoConnections: may be called while the session is running. The -addInput: method is the preferred method for adding an input to an AVCaptureSession. -addInputWithNoConnections: may be called if you need fine-grained control over which inputs are connected to which outputs.
333 #[unsafe(method(addInputWithNoConnections:))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn addInputWithNoConnections(&self, input: &AVCaptureInput);
336
337 #[cfg(feature = "AVCaptureOutputBase")]
338 /// Adds an AVCaptureOutput to the session without forming any connections.
339 ///
340 ///
341 /// Parameter `output`: An AVCaptureOutput instance.
342 ///
343 ///
344 /// An AVCaptureOutput instance can only be added to a session using -addOutputWithNoConnections: if -canAddOutput: returns YES, otherwise an NSInvalidArgumentException is thrown. -addOutputWithNoConnections: may be called while the session is running. The -addOutput: method is the preferred method for adding an output to an AVCaptureSession. -addOutputWithNoConnections: may be called if you need fine-grained control over which inputs are connected to which outputs.
345 #[unsafe(method(addOutputWithNoConnections:))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn addOutputWithNoConnections(&self, output: &AVCaptureOutput);
348
349 /// An NSArray of AVCaptureConnections currently added to the receiver.
350 ///
351 ///
352 /// The value of this property is an NSArray of AVCaptureConnections currently added to the receiver. Connections are formed implicitly by the receiver when a client calls -addInput: or -addOutput:. Connections are formed explicitly when a client calls -addConnection:.
353 #[unsafe(method(connections))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn connections(&self) -> Retained<NSArray<AVCaptureConnection>>;
356
357 /// Returns whether the proposed connection can be added to the receiver.
358 ///
359 ///
360 /// Parameter `connection`: An AVCaptureConnection instance.
361 ///
362 ///
363 /// An AVCaptureConnection instance can only be added to a session using -addConnection: if -canAddConnection: returns YES, otherwise an NSInvalidArgumentException is thrown. When using -addInput: or -addOutput:, connections are formed automatically between all compatible inputs and outputs. Manually adding connections is only necessary when adding an input or output with no connections.
364 #[unsafe(method(canAddConnection:))]
365 #[unsafe(method_family = none)]
366 pub unsafe fn canAddConnection(&self, connection: &AVCaptureConnection) -> bool;
367
368 /// Adds an AVCaptureConnection to the session.
369 ///
370 ///
371 /// Parameter `connection`: An AVCaptureConnection instance.
372 ///
373 ///
374 /// An AVCaptureConnection instance can only be added to a session using -addConnection: if canAddConnection: returns YES, otherwise an NSInvalidArgumentException is thrown. When using -addInput: or -addOutput:, connections are formed automatically between all compatible inputs and outputs. Manually adding connections is only necessary when adding an input or output with no connections. -addConnection: may be called while the session is running.
375 #[unsafe(method(addConnection:))]
376 #[unsafe(method_family = none)]
377 pub unsafe fn addConnection(&self, connection: &AVCaptureConnection);
378
379 /// Removes an AVCaptureConnection from the session.
380 ///
381 ///
382 /// Parameter `connection`: An AVCaptureConnection instance.
383 ///
384 ///
385 /// -removeConnection: may be called while the session is running.
386 #[unsafe(method(removeConnection:))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn removeConnection(&self, connection: &AVCaptureConnection);
389
390 /// Indicates whether session controls are supported on this platform.
391 ///
392 ///
393 /// `AVCaptureControl`s are only supported on platforms with necessary hardware.
394 #[unsafe(method(supportsControls))]
395 #[unsafe(method_family = none)]
396 pub unsafe fn supportsControls(&self) -> bool;
397
398 /// Specifies the maximum number of controls that can be added to a session.
399 #[unsafe(method(maxControlsCount))]
400 #[unsafe(method_family = none)]
401 pub unsafe fn maxControlsCount(&self) -> NSInteger;
402
403 #[cfg(feature = "dispatch2")]
404 /// Sets the receiver's controls delegate that receives events about the session's controls and the dispatch queue on which the delegate is called.
405 ///
406 ///
407 /// Parameter `controlsDelegate`: An object conforming to the `AVCaptureSessionControlsDelegate` protocol that receives events about the session's controls.
408 ///
409 /// Parameter `controlsDelegateCallbackQueue`: A dispatch queue on which all delegate methods are called.
410 ///
411 ///
412 /// Users can interact with an `AVCaptureSession`'s controls by performing specific gestures to enable their visibility. A delegate may be specified to be informed when the controls can be interacted with and are dismissed. All delegate methods will be called on the specified dispatch queue.
413 ///
414 /// A serial dispatch queue must be used to guarantee that delegate callbacks will be delivered in order. The `controlsDelegateCallbackQueue` parameter may not be `NULL`, except when setting the `controlsDelegate` to `nil` otherwise `-setControlsDelegate:queue:` throws an `NSInvalidArgumentException`.
415 ///
416 /// # Safety
417 ///
418 /// `controls_delegate_callback_queue` possibly has additional threading requirements.
419 #[unsafe(method(setControlsDelegate:queue:))]
420 #[unsafe(method_family = none)]
421 pub unsafe fn setControlsDelegate_queue(
422 &self,
423 controls_delegate: Option<&ProtocolObject<dyn AVCaptureSessionControlsDelegate>>,
424 controls_delegate_callback_queue: Option<&DispatchQueue>,
425 );
426
427 /// The receiver's controls delegate.
428 ///
429 ///
430 /// The value of this property is an object conforming to the `AVCaptureSessionControlsDelegate` protocol that receives events about the session's controls. The delegate is set using the `-setControlsDelegate:queue:` method.
431 ///
432 /// A controls delegate must be specified for controls to become active.
433 #[unsafe(method(controlsDelegate))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn controlsDelegate(
436 &self,
437 ) -> Option<Retained<ProtocolObject<dyn AVCaptureSessionControlsDelegate>>>;
438
439 #[cfg(feature = "dispatch2")]
440 /// The dispatch queue on which all controls delegate methods will be called.
441 ///
442 ///
443 /// The value of this property is a `dispatch_queue_t`. The queue is set using the `-setControlsDelegate:queue:` method.
444 #[unsafe(method(controlsDelegateCallbackQueue))]
445 #[unsafe(method_family = none)]
446 pub unsafe fn controlsDelegateCallbackQueue(&self) -> Option<Retained<DispatchQueue>>;
447
448 #[cfg(feature = "AVCaptureControl")]
449 /// An `NSArray` of `AVCaptureControl`s currently added to the session.
450 ///
451 ///
452 /// The value of this property is an `NSArray` of `AVCaptureControl`s currently added to the session. Clients can add `AVCaptureControl`s to a session by calling `-addControl:`.
453 #[unsafe(method(controls))]
454 #[unsafe(method_family = none)]
455 pub unsafe fn controls(&self) -> Retained<NSArray<AVCaptureControl>>;
456
457 #[cfg(feature = "AVCaptureControl")]
458 /// Returns whether the proposed control can be added to the session.
459 ///
460 ///
461 /// Parameter `control`: An `AVCaptureControl` instance.
462 ///
463 /// Returns: `YES` if the proposed control can be added to the session, `NO` otherwise.
464 ///
465 ///
466 /// An `AVCaptureControl` instance can only be added to a session using `-addControl:` if `-canAddControl:` returns `YES`. For example, some platforms do not support controls. Instances of `AVCaptureSlider`, `AVCaptureToggle` and `AVCaptureIndexPicker` must have an action and an action queue set before being added to a session.
467 #[unsafe(method(canAddControl:))]
468 #[unsafe(method_family = none)]
469 pub unsafe fn canAddControl(&self, control: &AVCaptureControl) -> bool;
470
471 #[cfg(feature = "AVCaptureControl")]
472 /// Adds an `AVCaptureControl` instance to the session.
473 ///
474 ///
475 /// Parameter `control`: An `AVCaptureControl` instance.
476 ///
477 ///
478 /// An `AVCaptureControl` instance can only be added to a session using `-addControl:` if `-canAddControl:` returns `YES`, otherwise an `NSInvalidArgumentException` is thrown. `-addControl:` may be called while the session is running.
479 ///
480 /// For an `AVCaptureControl` instance to become active, an `AVCaptureSessionControlsDelegate` must be set on the session.
481 #[unsafe(method(addControl:))]
482 #[unsafe(method_family = none)]
483 pub unsafe fn addControl(&self, control: &AVCaptureControl);
484
485 #[cfg(feature = "AVCaptureControl")]
486 /// Removes an `AVCaptureControl` instance from the session.
487 ///
488 ///
489 /// Parameter `control`: An `AVCaptureControl` instance.
490 ///
491 ///
492 /// `-removeControl:` may be called while the session is running.
493 #[unsafe(method(removeControl:))]
494 #[unsafe(method_family = none)]
495 pub unsafe fn removeControl(&self, control: &AVCaptureControl);
496
497 /// When paired with commitConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
498 ///
499 ///
500 /// -beginConfiguration / -commitConfiguration are AVCaptureSession's mechanism for batching multiple configuration operations on a running session into atomic updates. After calling [session beginConfiguration], clients may add or remove outputs, alter the sessionPreset, or configure individual AVCaptureInput or Output properties. All changes will be pended until the client calls [session commitConfiguration], at which time they will be applied together. -beginConfiguration / -commitConfiguration pairs may be nested, and will only be applied when the outermost commit is invoked. If you've called -beginConfiguration, you must call -commitConfiguration before invoking -startRunning or -stopRunning, otherwise an NSGenericException is thrown.
501 #[unsafe(method(beginConfiguration))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn beginConfiguration(&self);
504
505 /// When preceded by beginConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
506 ///
507 ///
508 /// -beginConfiguration / -commitConfiguration are AVCaptureSession's mechanism for batching multiple configuration operations on a running session into atomic updates. After calling [session beginConfiguration], clients may add or remove outputs, alter the sessionPreset, or configure individual AVCaptureInput or Output properties. All changes will be pended until the client calls [session commitConfiguration], at which time they will be applied together. -beginConfiguration / -commitConfiguration pairs may be nested, and will only be applied when the outermost commit is invoked. If you've called -beginConfiguration, you must call -commitConfiguration before invoking -startRunning or -stopRunning, otherwise an NSGenericException is thrown.
509 #[unsafe(method(commitConfiguration))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn commitConfiguration(&self);
512
513 /// Indicates whether the session is currently running.
514 ///
515 ///
516 /// The value of this property is a BOOL indicating whether the receiver is running. Clients can key value observe the value of this property to be notified when the session automatically starts or stops running.
517 #[unsafe(method(isRunning))]
518 #[unsafe(method_family = none)]
519 pub unsafe fn isRunning(&self) -> bool;
520
521 /// Indicates whether the session is being interrupted.
522 ///
523 ///
524 /// The value of this property is a BOOL indicating whether the receiver is currently being interrupted, such as by a phone call or alarm. Clients can key value observe the value of this property to be notified when the session ceases to be interrupted and again has access to needed hardware resources.
525 #[unsafe(method(isInterrupted))]
526 #[unsafe(method_family = none)]
527 pub unsafe fn isInterrupted(&self) -> bool;
528
529 /// Returns whether the session can be configured to use the camera while multitasking.
530 ///
531 ///
532 /// This property can be used to determine whether multitaskingCameraAccessEnabled may be set to YES. When this property changes from YES to NO, multitaskingCameraAccessEnabled also reverts to NO.
533 ///
534 /// Prior to iOS 18, this property returns YES on iPads that support Stage Manager with an extended display. In applications linked on or after iOS 18, this property returns YES for video conferencing applications (apps that use "voip" as one of their UIBackgroundModes).
535 ///
536 /// This property also returns YES for iOS applications that have the com.apple.developer.avfoundation.multitasking-camera-access entitlement.
537 ///
538 /// This property returns YES on Apple TV.
539 ///
540 /// This property is key-value observable.
541 #[unsafe(method(isMultitaskingCameraAccessSupported))]
542 #[unsafe(method_family = none)]
543 pub unsafe fn isMultitaskingCameraAccessSupported(&self) -> bool;
544
545 /// Indicates whether the session is configured to use the camera while multitasking.
546 ///
547 ///
548 /// The default value is NO. This property may only be set if -isMultitaskingCameraAccessSupported returns YES. This property must be set before the session starts running.
549 ///
550 /// AVCaptureSessions that are configured to use the camera while multitasking will not be interrupted with AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps.
551 ///
552 /// For applications that have the com.apple.developer.avfoundation.multitasking-camera-access entitlement, this property defaults to YES if -isMultitaskingCameraAccessSupported returns YES.
553 ///
554 /// To learn about best practices for using the camera while multitasking, refer to the Accessing the Camera While Multitasking article on developer.apple.com. See https://developer.apple.com/documentation/avkit/accessing_the_camera_while_multitasking
555 /// .
556 ///
557 /// This property is key-value observable.
558 #[unsafe(method(isMultitaskingCameraAccessEnabled))]
559 #[unsafe(method_family = none)]
560 pub unsafe fn isMultitaskingCameraAccessEnabled(&self) -> bool;
561
562 /// Setter for [`isMultitaskingCameraAccessEnabled`][Self::isMultitaskingCameraAccessEnabled].
563 #[unsafe(method(setMultitaskingCameraAccessEnabled:))]
564 #[unsafe(method_family = none)]
565 pub unsafe fn setMultitaskingCameraAccessEnabled(
566 &self,
567 multitasking_camera_access_enabled: bool,
568 );
569
570 /// Indicates whether the receiver will use the application's AVAudioSession for recording.
571 ///
572 ///
573 /// The value of this property is a BOOL indicating whether the receiver is currently using the application's AVAudioSession (see AVAudioSession.h). Prior to iOS 7, AVCaptureSession uses its own audio session, which can lead to unwanted interruptions when interacting with the application's audio session. In applications linked on or after iOS 7, AVCaptureSession shares the application's audio session, allowing for simultaneous play back and recording without unwanted interruptions. Clients desiring the pre-iOS 7 behavior may opt out by setting usesApplicationAudioSession to NO. The default value is YES.
574 #[unsafe(method(usesApplicationAudioSession))]
575 #[unsafe(method_family = none)]
576 pub unsafe fn usesApplicationAudioSession(&self) -> bool;
577
578 /// Setter for [`usesApplicationAudioSession`][Self::usesApplicationAudioSession].
579 #[unsafe(method(setUsesApplicationAudioSession:))]
580 #[unsafe(method_family = none)]
581 pub unsafe fn setUsesApplicationAudioSession(&self, uses_application_audio_session: bool);
582
583 /// Indicates whether the receiver should configure the application's audio session for recording.
584 ///
585 ///
586 /// The value of this property is a BOOL indicating whether the receiver should configure the application's audio session when needed for optimal recording. When set to YES, the receiver ensures the application's audio session is set to the PlayAndRecord category, and picks an appropriate microphone and polar pattern to match the video camera being used. When set to NO, and -usesApplicationAudioSession is set to YES, the receiver will use the application's audio session, but will not change any of its properties. If the session is not set up correctly for input, audio recording may fail. The default value is YES.
587 #[unsafe(method(automaticallyConfiguresApplicationAudioSession))]
588 #[unsafe(method_family = none)]
589 pub unsafe fn automaticallyConfiguresApplicationAudioSession(&self) -> bool;
590
591 /// Setter for [`automaticallyConfiguresApplicationAudioSession`][Self::automaticallyConfiguresApplicationAudioSession].
592 #[unsafe(method(setAutomaticallyConfiguresApplicationAudioSession:))]
593 #[unsafe(method_family = none)]
594 pub unsafe fn setAutomaticallyConfiguresApplicationAudioSession(
595 &self,
596 automatically_configures_application_audio_session: bool,
597 );
598
599 /// Indicates whether the receiver should configure the application's audio session to mix with others.
600 ///
601 ///
602 /// The value of this property is a BOOL indicating whether the receiver should configure the application's audio session to mix with, instead of interrupting, any ongoing audio sessions. It has no effect when usesApplicationAudioSession is set to NO. It also has no effect on Live Photo movie complement capture (where music is always mixed with). The default value is NO.
603 #[unsafe(method(configuresApplicationAudioSessionToMixWithOthers))]
604 #[unsafe(method_family = none)]
605 pub unsafe fn configuresApplicationAudioSessionToMixWithOthers(&self) -> bool;
606
607 /// Setter for [`configuresApplicationAudioSessionToMixWithOthers`][Self::configuresApplicationAudioSessionToMixWithOthers].
608 #[unsafe(method(setConfiguresApplicationAudioSessionToMixWithOthers:))]
609 #[unsafe(method_family = none)]
610 pub unsafe fn setConfiguresApplicationAudioSessionToMixWithOthers(
611 &self,
612 configures_application_audio_session_to_mix_with_others: bool,
613 );
614
615 /// Indicates whether the receiver should configure the application's audio session for bluetooth high quality recording.
616 ///
617 /// The value of this property is a `BOOL` indicating whether the receiver should configure the application's audio session for bluetooth high quality recording (AirPods as a high quality microphone). When this property is set to `true`, the ``AVCaptureSession`` will opt in for high quality bluetooth recording, allowing users of your app to select AirPods as the active mic source for capture. This property has no effect when ``usesApplicationAudioSession`` is set to `false`. The default value is `false`.
618 #[unsafe(method(configuresApplicationAudioSessionForBluetoothHighQualityRecording))]
619 #[unsafe(method_family = none)]
620 pub unsafe fn configuresApplicationAudioSessionForBluetoothHighQualityRecording(
621 &self,
622 ) -> bool;
623
624 /// Setter for [`configuresApplicationAudioSessionForBluetoothHighQualityRecording`][Self::configuresApplicationAudioSessionForBluetoothHighQualityRecording].
625 #[unsafe(method(setConfiguresApplicationAudioSessionForBluetoothHighQualityRecording:))]
626 #[unsafe(method_family = none)]
627 pub unsafe fn setConfiguresApplicationAudioSessionForBluetoothHighQualityRecording(
628 &self,
629 configures_application_audio_session_for_bluetooth_high_quality_recording: bool,
630 );
631
632 /// Indicates whether the receiver automatically configures its video device's activeFormat and activeColorSpace properties, preferring wide color for photos.
633 ///
634 ///
635 /// The default value is YES. By default, the receiver automatically adjusts its source video AVCaptureDevice's activeFormat and activeColorSpace properties based on the supportedColorSpaces of the device's formats and the current AVCaptureSession topology. Wide color spaces are preferred over sRGB if an AVCapturePhotoOutput is present in the session. If you wish to set AVCaptureDevice's activeColorSpace manually, and prevent the AVCaptureSession from undoing your work, you must set automaticallyConfiguresCaptureDeviceForWideColor to NO. If the receiver's sessionPreset is set to AVCaptureSessionPresetInputPriority, the session will not alter the capture device's activeFormat, but might still alter its activeColorSpace.
636 #[unsafe(method(automaticallyConfiguresCaptureDeviceForWideColor))]
637 #[unsafe(method_family = none)]
638 pub unsafe fn automaticallyConfiguresCaptureDeviceForWideColor(&self) -> bool;
639
640 /// Setter for [`automaticallyConfiguresCaptureDeviceForWideColor`][Self::automaticallyConfiguresCaptureDeviceForWideColor].
641 #[unsafe(method(setAutomaticallyConfiguresCaptureDeviceForWideColor:))]
642 #[unsafe(method_family = none)]
643 pub unsafe fn setAutomaticallyConfiguresCaptureDeviceForWideColor(
644 &self,
645 automatically_configures_capture_device_for_wide_color: bool,
646 );
647
648 /// Starts an AVCaptureSession instance running.
649 ///
650 ///
651 /// Clients invoke -startRunning to start the flow of data from inputs to outputs connected to the AVCaptureSession instance. This call blocks until the session object has completely started up or failed. A failure to start running is reported through the AVCaptureSessionRuntimeErrorNotification mechanism. If you've called -beginConfiguration, you must call -commitConfiguration before invoking -startRunning, otherwise an NSGenericException is thrown.
652 #[unsafe(method(startRunning))]
653 #[unsafe(method_family = none)]
654 pub unsafe fn startRunning(&self);
655
656 /// Stops an AVCaptureSession instance that is currently running.
657 ///
658 ///
659 /// Clients invoke -stopRunning to stop the flow of data from inputs to outputs connected to the AVCaptureSession instance. This call blocks until the session object has completely stopped. -stopRunning may not be called while the session is being configured. If you've called -beginConfiguration, you must call -commitConfiguration before invoking -stopRunning, otherwise an NSGenericException is thrown.
660 #[unsafe(method(stopRunning))]
661 #[unsafe(method_family = none)]
662 pub unsafe fn stopRunning(&self);
663
664 #[cfg(feature = "objc2-core-media")]
665 /// Provides the clock being used for synchronization.
666 ///
667 /// synchronizationClock is readonly. Use synchronizationClock to synchronize AVCaptureOutput data with external data sources (e.g motion samples). All capture output sample buffer timestamps are on the synchronizationClock timebase.
668 ///
669 /// For example, if you want to reverse synchronize the output timestamps to the original timestamps, you can do the following: In captureOutput:didOutputSampleBuffer:fromConnection:
670 ///
671 /// AVCaptureInputPort *port = [[connection inputPorts] objectAtIndex:0];
672 /// CMClockRef originalClock = [port clock];
673 ///
674 /// CMTime syncedPTS = CMSampleBufferGetPresentationTime( sampleBuffer );
675 /// CMTime originalPTS = CMSyncConvertTime( syncedPTS, [session synchronizationClock], originalClock );
676 ///
677 /// This property is key-value observable.
678 #[unsafe(method(synchronizationClock))]
679 #[unsafe(method_family = none)]
680 pub unsafe fn synchronizationClock(&self) -> Option<Retained<CMClock>>;
681
682 #[cfg(feature = "objc2-core-media")]
683 /// Provides the clock being used for synchronization.
684 ///
685 /// Deprecated. Please use synchronizationClock instead.
686 #[deprecated]
687 #[unsafe(method(masterClock))]
688 #[unsafe(method_family = none)]
689 pub unsafe fn masterClock(&self) -> Option<Retained<CMClock>>;
690
691 /// Indicates the percentage of the session's available hardware budget currently in use.
692 ///
693 ///
694 /// The value of this property is a float from 0.0 => 1.0 indicating how much of the session's available hardware is in use as a percentage, given the currently connected inputs and outputs and the features for which you've opted in. When your hardwareCost is greater than 1.0, the capture session cannot run your desired configuration due to hardware constraints, so you receive an AVCaptureSessionRuntimeErrorNotification when attempting to start it running. Default value is 0.
695 ///
696 /// Contributors to hardwareCost include:
697 /// - Whether the source device's active format uses the full sensor (4:3) or a crop (16:9). Cropped formats require lower hardware bandwidth, and therefore lower the cost.
698 /// - The max frame rate supported by the source device's active format. The higher the max frame rate, the higher the cost.
699 /// - Whether the source device's active format is binned or not. Binned formats require substantially less hardware bandwidth, and therefore result in a lower cost.
700 /// - The number of sources configured to deliver streaming disparity / depth via AVCaptureDepthDataOutput. The higher the number of cameras configured to produce depth, the higher the cost.
701 /// For AVCaptureMultiCamSessions, all of the source devices' active formats contribute to hardwareCost.
702 /// In order to reduce hardwareCost, consider picking a sensor-cropped activeFormat, or a binned format. You may also use AVCaptureDeviceInput's videoMinFrameDurationOverride property to artificially limit the max frame rate (which is the reciprocal of the min frame duration) of a source device to a lower value. By doing so, you only pay the hardware cost for the max frame rate you intend to use.
703 ///
704 /// AVCaptureMultiCamSessions always computes this hardwareCost. AVCaptureSessions only computes a non-zero hardwareCost when multiple AVCaptureVideoDataOutputs or an AVCaptureMovieFileOutput and one or more AVCaptureVideoDataOutputs are added to the session.
705 #[unsafe(method(hardwareCost))]
706 #[unsafe(method_family = none)]
707 pub unsafe fn hardwareCost(&self) -> c_float;
708
709 /// A `BOOL` value that indicates whether the session supports manually running deferred start.
710 ///
711 /// Deferred Start is a feature that allows you to control, on a per-output basis, whether output objects start when or after the session is started. The session defers starting an output when its ``deferredStartEnabled`` property is set to `true`, and starts it after the session is started.
712 ///
713 /// You can only set the ``automaticallyRunsDeferredStart`` property value to `false` if the session supports manual deferred start.
714 #[unsafe(method(isManualDeferredStartSupported))]
715 #[unsafe(method_family = none)]
716 pub unsafe fn isManualDeferredStartSupported(&self) -> bool;
717
718 /// A `BOOL` value that indicates whether deferred start runs automatically.
719 ///
720 /// Deferred Start is a feature that allows you to control, on a per-output basis, whether output objects start when or after the session is started. The session defers starting an output when its ``AVCaptureOutput/deferredStartEnabled`` property is set to `true`, and starts it after the session is started.
721 ///
722 /// When this value is `true`, ``AVCaptureSession`` automatically runs deferred start. If only ``AVCaptureVideoPreviewLayer`` objects have ``AVCaptureVideoPreviewLayer/deferredStartEnabled`` set to `false`, the session runs deferred start a short time after displaying the first frame. If there are ``AVCaptureOutput`` objects that have ``AVCaptureOutput/deferredStartEnabled`` set to `false`, then the session waits until each output that provides streaming data to your app sends its first frame.
723 ///
724 /// If you set this value to `false`, call ``runDeferredStartWhenNeeded`` to indicate when to run deferred start.
725 ///
726 /// By default, for apps that are linked on or after iOS 26, this value is `true`.
727 ///
728 /// - Note: If ``manualDeferredStartSupported`` is `false`, setting this property value to `false` results in the session throwing an `NSInvalidArgumentException`.
729 ///
730 /// - Note: Set this value before committing the configuration.
731 #[unsafe(method(automaticallyRunsDeferredStart))]
732 #[unsafe(method_family = none)]
733 pub unsafe fn automaticallyRunsDeferredStart(&self) -> bool;
734
735 /// Setter for [`automaticallyRunsDeferredStart`][Self::automaticallyRunsDeferredStart].
736 #[unsafe(method(setAutomaticallyRunsDeferredStart:))]
737 #[unsafe(method_family = none)]
738 pub unsafe fn setAutomaticallyRunsDeferredStart(
739 &self,
740 automatically_runs_deferred_start: bool,
741 );
742
743 /// Tells the session to run deferred start when appropriate.
744 ///
745 /// For best perceived startup performance, call this after displaying the first frame, so that deferred start processing doesn't interfere with other initialization operations. For example, if using a
746 /// <doc
747 /// ://com.apple.documentation/documentation/quartzcore/cametallayer> to draw camera frames, add a `presentHandler` (using
748 /// <doc
749 /// ://com.apple.documentation/metal/mtldrawable/addpresentedhandler>) to the first drawable and call ``runDeferredStartWhenNeeded`` from there.
750 ///
751 /// If one or more outputs need to start to perform a capture operation, and ``runDeferredStartWhenNeeded`` has not run yet, the session runs the deferred start on your app's behalf. Only call this method once for each configuration commit - after the first call, subsequent calls to ``runDeferredStartWhenNeeded`` have no effect. The deferred start runs asynchronously, so this method returns immediately.
752 ///
753 /// - Note: You can only call this when ``automaticallyRunsDeferredStart`` is `false`. Otherwise, the session throws an `NSInvalidArgumentException`.
754 ///
755 /// - Important: To avoid blocking your app's UI, don't call this method from the application's main actor or queue.
756 #[unsafe(method(runDeferredStartWhenNeeded))]
757 #[unsafe(method_family = none)]
758 pub unsafe fn runDeferredStartWhenNeeded(&self);
759
760 /// A delegate object that observes events about deferred start.
761 ///
762 /// Call the ``setDeferredStartDelegate:deferredStartDelegateCallbackQueue:`` method to set the deferred start delegate for a session.
763 #[unsafe(method(deferredStartDelegate))]
764 #[unsafe(method_family = none)]
765 pub unsafe fn deferredStartDelegate(
766 &self,
767 ) -> Option<Retained<ProtocolObject<dyn AVCaptureSessionDeferredStartDelegate>>>;
768
769 #[cfg(feature = "dispatch2")]
770 /// The dispatch queue on which the session calls deferred start delegate methods.
771 ///
772 /// Call the ``setDeferredStartDelegate:deferredStartDelegateCallbackQueue:`` method to specify the dispatch queue on which to call the deferred start delegate methods.
773 #[unsafe(method(deferredStartDelegateCallbackQueue))]
774 #[unsafe(method_family = none)]
775 pub unsafe fn deferredStartDelegateCallbackQueue(&self) -> Option<Retained<DispatchQueue>>;
776
777 #[cfg(feature = "dispatch2")]
778 /// Sets a delegate object for the session to call when performing deferred start.
779 ///
780 /// This delegate receives a call to the ``AVCaptureSessionDeferredStartDelegate/sessionWillRunDeferredStart:`` method when deferred start is about to run. It is non-blocking, so by the time this method is called, the deferred start may already be underway. If you want your app to perform initialization (potentially) concurrently with deferred start (e.g. user-facing camera features that are not needed to display the first preview frame, but are available to the user as soon as possible) it may be done in the delegate's ``AVCaptureSessionDeferredStartDelegate/sessionWillRunDeferredStart:`` method. To wait until deferred start is finished to perform some remaining initialization work, use the ``AVCaptureSessionDeferredStartDelegate/sessionDidRunDeferredStart:`` method instead.
781 ///
782 /// The delegate receives a call to the ``AVCaptureSessionDeferredStartDelegate/sessionDidRunDeferredStart:`` method when the deferred start finishes running. This allows you to run less-critical application initialization code. For example, if you've deferred an ``AVCapturePhotoOutput`` by setting its ``AVCaptureOutput/deferredStartEnabled`` property to `true`, and you'd like to do some app-specific initialization related to still capture, here might be a good place to put it.
783 ///
784 /// If the delegate is non-nil, the session still calls the ``AVCaptureSessionDeferredStartDelegate/sessionWillRunDeferredStart:`` and ``AVCaptureSessionDeferredStartDelegate/sessionDidRunDeferredStart:`` methods regardless of the value of the session's ``automaticallyRunsDeferredStart`` property.
785 ///
786 /// To minimize the capture session's startup latency, defer all unnecessary work until after the session starts. This delegate provides callbacks for you to schedule deferred work without impacting session startup performance.
787 ///
788 /// To perform initialization prior to deferred start but after the user interface displays, set ``automaticallyRunsDeferredStart`` to `false`, and then run the custom initialization prior to calling ``runDeferredStartWhenNeeded``.
789 ///
790 /// If ``deferredStartDelegate`` is not `NULL`, the session throws an exception if ``deferredStartDelegateCallbackQueue`` is `nil`.
791 ///
792 /// - Parameter deferredStartDelegate: An object conforming to the ``AVCaptureSessionDeferredStartDelegate`` protocol that receives events about deferred start.
793 /// - Parameter deferredStartDelegateCallbackQueue: A dispatch queue on which deferredStart delegate methods are called.
794 ///
795 /// # Safety
796 ///
797 /// `deferred_start_delegate_callback_queue` possibly has additional threading requirements.
798 #[unsafe(method(setDeferredStartDelegate:deferredStartDelegateCallbackQueue:))]
799 #[unsafe(method_family = none)]
800 pub unsafe fn setDeferredStartDelegate_deferredStartDelegateCallbackQueue(
801 &self,
802 deferred_start_delegate: Option<
803 &ProtocolObject<dyn AVCaptureSessionDeferredStartDelegate>,
804 >,
805 deferred_start_delegate_callback_queue: Option<&DispatchQueue>,
806 );
807 );
808}
809
810/// Methods declared on superclass `NSObject`.
811impl AVCaptureSession {
812 extern_methods!(
813 #[unsafe(method(init))]
814 #[unsafe(method_family = init)]
815 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
816
817 #[unsafe(method(new))]
818 #[unsafe(method_family = new)]
819 pub unsafe fn new() -> Retained<Self>;
820 );
821}
822
823extern_protocol!(
824 /// Defines an interface for delegates of `AVCaptureSession` to receive events about the session's controls.
825 ///
826 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioncontrolsdelegate?language=objc)
827 pub unsafe trait AVCaptureSessionControlsDelegate: NSObjectProtocol {
828 /// Called when the controls of an `AVCaptureSession` instance become active and are available for interaction.
829 ///
830 ///
831 /// Parameter `session`: The `AVCaptureSession` instance whose controls are active.
832 ///
833 ///
834 /// Delegates receive this message when the controls of an `AVCaptureSession` instance become active and are available for interaction.
835 #[unsafe(method(sessionControlsDidBecomeActive:))]
836 #[unsafe(method_family = none)]
837 unsafe fn sessionControlsDidBecomeActive(&self, session: &AVCaptureSession);
838
839 /// Called when the controls of an `AVCaptureSession` instance will enter a fullscreen appearance.
840 ///
841 ///
842 /// Parameter `session`: The `AVCaptureSession` instance whose controls will enter a fullscreen appearance.
843 ///
844 ///
845 /// When the controls enter a fullscreen appearance, applications are encouraged to hide portions of their user interface including zoom or exposure sliders and shutter buttons. Few on-screen elements should be visible so users can focus on the controls they are interacting with and view the camera preview unobstructed.
846 #[unsafe(method(sessionControlsWillEnterFullscreenAppearance:))]
847 #[unsafe(method_family = none)]
848 unsafe fn sessionControlsWillEnterFullscreenAppearance(&self, session: &AVCaptureSession);
849
850 /// Called when the controls of an `AVCaptureSession` instance will exit a fullscreen appearance.
851 ///
852 ///
853 /// Parameter `session`: The `AVCaptureSession` instance whose controls will exit a fullscreen appearance.
854 ///
855 ///
856 /// Delegates receive this message when the controls of an `AVCaptureSession` instance should resume showing portions of their user interface that were hidden in response to receiving `-sessionControlsWillEnterFullscreenAppearance:`. This message is sent before `sessionControlsDidBecomeInactive:`.
857 #[unsafe(method(sessionControlsWillExitFullscreenAppearance:))]
858 #[unsafe(method_family = none)]
859 unsafe fn sessionControlsWillExitFullscreenAppearance(&self, session: &AVCaptureSession);
860
861 /// Called when the controls of an `AVCaptureSession` instance become inactive and are no longer available for interaction.
862 ///
863 ///
864 /// Parameter `session`: The `AVCaptureSession` instance whose controls are inactive.
865 ///
866 ///
867 /// Delegates receive this message when the controls of an `AVCaptureSession` instance become inactive and are no longer available for interaction.
868 #[unsafe(method(sessionControlsDidBecomeInactive:))]
869 #[unsafe(method_family = none)]
870 unsafe fn sessionControlsDidBecomeInactive(&self, session: &AVCaptureSession);
871 }
872);
873
874extern_protocol!(
875 /// Defines an interface for delegates of the capture session to receive events about the session's deferred start.
876 ///
877 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessiondeferredstartdelegate?language=objc)
878 pub unsafe trait AVCaptureSessionDeferredStartDelegate: NSObjectProtocol {
879 /// This method gets called by the session when deferred start is about to run.
880 ///
881 /// Delegates receive this message when the session has finished the deferred start. This message will be sent regardless of whether the session's ``AVCaptureSession/automaticallyRunsDeferredStart`` property is set. See ``AVCaptureSession/setDeferredStartDelegate:deferredStartDelegateCallbackQueue:`` documentation for more information.
882 ///
883 /// - Parameter session: The ``AVCaptureSession`` instance that runs the deferred start.
884 #[unsafe(method(sessionWillRunDeferredStart:))]
885 #[unsafe(method_family = none)]
886 unsafe fn sessionWillRunDeferredStart(&self, session: &AVCaptureSession);
887
888 /// This method gets called by the session when deferred start has finished running.
889 ///
890 /// - Parameter session: The ``AVCaptureSession`` instance that runs the deferred start.
891 #[unsafe(method(sessionDidRunDeferredStart:))]
892 #[unsafe(method_family = none)]
893 unsafe fn sessionDidRunDeferredStart(&self, session: &AVCaptureSession);
894 }
895);
896
897extern_class!(
898 /// A subclass of AVCaptureSession which supports simultaneous capture from multiple inputs of the same media type.
899 ///
900 ///
901 /// AVCaptureMultiCamSession's sessionPreset is always AVCaptureSessionPresetInputPriority and may not be set to any other value. Each input's device.activeFormat must be set manually to achieve the desired quality of service.
902 ///
903 /// AVCaptureMultiCamSession supports dynamic enabling and disabling of individual camera inputs without interrupting preview. In order to stop an individual camera input, set the enabled property on all of its connections or connected ports to NO. When the last active connection or port is disabled, the source camera stops streaming to save power and bandwidth. Other inputs streaming data through the session are unaffected.
904 ///
905 /// Prior to iOS 26, AVCaptureMultiCamSession requires all input devices to have an activeFormat where multiCamSupported returns YES. In applications linked on or after iOS 26, this requirement is not enforced when only a single input device is used.
906 ///
907 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemulticamsession?language=objc)
908 #[unsafe(super(AVCaptureSession, NSObject))]
909 #[derive(Debug, PartialEq, Eq, Hash)]
910 pub struct AVCaptureMultiCamSession;
911);
912
913extern_conformance!(
914 unsafe impl NSObjectProtocol for AVCaptureMultiCamSession {}
915);
916
917impl AVCaptureMultiCamSession {
918 extern_methods!(
919 /// Indicates whether multicam session is supported on this platform.
920 ///
921 ///
922 /// AVCaptureMultiCamSession is intended to be used with multiple cameras and is only supported on platforms with sufficient hardware bandwidth, system memory, and thermal performance. For single-camera use cases, AVCaptureSession should be used instead.
923 #[unsafe(method(isMultiCamSupported))]
924 #[unsafe(method_family = none)]
925 pub unsafe fn isMultiCamSupported() -> bool;
926
927 /// Indicates the percentage of the session's available hardware budget currently in use.
928 ///
929 ///
930 /// The value of this property is a float from 0.0 => 1.0 indicating how much of the session's available hardware is in use as a percentage, given the currently connected inputs and outputs and the features for which you've opted in. When your hardwareCost is greater than 1.0, the capture session cannot run your desired configuration due to hardware constraints, so you receive an AVCaptureSessionRuntimeErrorNotification when attempting to start it running. Default value is 0.
931 ///
932 /// Contributors to hardwareCost include:
933 /// - Whether the source devices' active formats use the full sensor (4:3) or a crop (16:9). Cropped formats require lower hardware bandwidth, and therefore lower the cost.
934 /// - The max frame rate supported by the source devices' active formats. The higher the max frame rate, the higher the cost.
935 /// - Whether the source devices' active formats are binned or not. Binned formats require substantially less hardware bandwidth, and therefore result in a lower cost.
936 /// - The number of sources configured to deliver streaming disparity / depth via AVCaptureDepthDataOutput. The higher the number of cameras configured to produce depth, the higher the cost.
937 /// In order to reduce hardwareCost, consider picking a sensor-cropped activeFormat, or a binned format. You may also use AVCaptureDeviceInput's videoMinFrameDurationOverride property to artificially limit the max frame rate (which is the reciprocal of the min frame duration) of a source device to a lower value. By doing so, you only pay the hardware cost for the max frame rate you intend to use.
938 #[unsafe(method(hardwareCost))]
939 #[unsafe(method_family = none)]
940 pub unsafe fn hardwareCost(&self) -> c_float;
941
942 /// Indicates the system pressure cost of your current configuration.
943 ///
944 ///
945 /// The value of this property is a float whose nominal range is 0.0 => 1.0 indicating the system pressure cost of your current configuration. When your systemPressureCost is greater than 1.0, the capture session cannot run sustainably. It may be able to run for a brief period before needing to stop due to high system pressure. While running in an unsustainable configuration, you may monitor the session's systemPressureState and reduce pressure by reducing the frame rate, throttling your use of the GPU, etc. When the session reaches critical system pressure state, it must temporarily shut down, and you receive an AVCaptureSessionWasInterruptedNotification indicating the reason your session needed to stop. When system pressure alleviates, the session interruption ends.
946 #[unsafe(method(systemPressureCost))]
947 #[unsafe(method_family = none)]
948 pub unsafe fn systemPressureCost(&self) -> c_float;
949 );
950}
951
952/// Methods declared on superclass `NSObject`.
953impl AVCaptureMultiCamSession {
954 extern_methods!(
955 #[unsafe(method(init))]
956 #[unsafe(method_family = init)]
957 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
958
959 #[unsafe(method(new))]
960 #[unsafe(method_family = new)]
961 pub unsafe fn new() -> Retained<Self>;
962 );
963}
964
965/// Constants indicating video field mode, for use with AVCaptureConnection's videoFieldMode property (see below).
966///
967///
968/// Indicates that both top and bottom video fields in interlaced content should be passed thru.
969///
970/// Indicates that only the top video field in interlaced content should be passed thru.
971///
972/// Indicates that the bottom video field only in interlaced content should be passed thru.
973///
974/// Indicates that top and bottom video fields in interlaced content should be deinterlaced.
975///
976/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avvideofieldmode?language=objc)
977// NS_ENUM
978#[repr(transparent)]
979#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
980pub struct AVVideoFieldMode(pub NSInteger);
981impl AVVideoFieldMode {
982 #[doc(alias = "AVVideoFieldModeBoth")]
983 pub const Both: Self = Self(0);
984 #[doc(alias = "AVVideoFieldModeTopOnly")]
985 pub const TopOnly: Self = Self(1);
986 #[doc(alias = "AVVideoFieldModeBottomOnly")]
987 pub const BottomOnly: Self = Self(2);
988 #[doc(alias = "AVVideoFieldModeDeinterlace")]
989 pub const Deinterlace: Self = Self(3);
990}
991
992unsafe impl Encode for AVVideoFieldMode {
993 const ENCODING: Encoding = NSInteger::ENCODING;
994}
995
996unsafe impl RefEncode for AVVideoFieldMode {
997 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
998}
999
1000extern_class!(
1001 /// AVCaptureConnection represents a connection between an AVCaptureInputPort or ports, and an AVCaptureOutput or AVCaptureVideoPreviewLayer present in an AVCaptureSession.
1002 ///
1003 ///
1004 /// AVCaptureInputs have one or more AVCaptureInputPorts. AVCaptureOutputs can accept data from one or more sources (example - an AVCaptureMovieFileOutput accepts both video and audio data). AVCaptureVideoPreviewLayers can accept data from one AVCaptureInputPort whose mediaType is AVMediaTypeVideo. When an input or output is added to a session, or a video preview layer is associated with a session, the session greedily forms connections between all the compatible AVCaptureInputs' ports and AVCaptureOutputs or AVCaptureVideoPreviewLayers. Iterating through an output's connections or a video preview layer's sole connection, a client may enable or disable the flow of data from a given input to a given output or preview layer.
1005 ///
1006 /// Connections involving audio expose an array of AVCaptureAudioChannel objects, which can be used for monitoring levels.
1007 ///
1008 /// Connections involving video expose video specific properties, such as videoMirrored and videoRotationAngle.
1009 ///
1010 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureconnection?language=objc)
1011 #[unsafe(super(NSObject))]
1012 #[derive(Debug, PartialEq, Eq, Hash)]
1013 pub struct AVCaptureConnection;
1014);
1015
1016extern_conformance!(
1017 unsafe impl NSObjectProtocol for AVCaptureConnection {}
1018);
1019
1020impl AVCaptureConnection {
1021 extern_methods!(
1022 #[unsafe(method(init))]
1023 #[unsafe(method_family = init)]
1024 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1025
1026 #[unsafe(method(new))]
1027 #[unsafe(method_family = new)]
1028 pub unsafe fn new() -> Retained<Self>;
1029
1030 #[cfg(all(feature = "AVCaptureInput", feature = "AVCaptureOutputBase"))]
1031 /// Returns an AVCaptureConnection instance describing a connection between the specified inputPorts and the specified output.
1032 ///
1033 ///
1034 /// Parameter `ports`: An array of AVCaptureInputPort objects associated with AVCaptureInput objects.
1035 ///
1036 /// Parameter `output`: An AVCaptureOutput object.
1037 ///
1038 /// Returns: An AVCaptureConnection instance joining the specified inputPorts to the specified output port.
1039 ///
1040 ///
1041 /// This method returns an instance of AVCaptureConnection that may be subsequently added to an AVCaptureSession instance using AVCaptureSession's -addConnection: method. When using -addInput: or -addOutput:, connections are formed between all compatible inputs and outputs automatically. You do not need to manually create and add connections to the session unless you use the primitive -addInputWithNoConnections: or -addOutputWithNoConnections: methods.
1042 #[unsafe(method(connectionWithInputPorts:output:))]
1043 #[unsafe(method_family = none)]
1044 pub unsafe fn connectionWithInputPorts_output(
1045 ports: &NSArray<AVCaptureInputPort>,
1046 output: &AVCaptureOutput,
1047 ) -> Retained<Self>;
1048
1049 #[cfg(all(
1050 feature = "AVCaptureInput",
1051 feature = "AVCaptureVideoPreviewLayer",
1052 feature = "objc2-quartz-core"
1053 ))]
1054 #[cfg(not(target_os = "watchos"))]
1055 /// Returns an AVCaptureConnection instance describing a connection between the specified inputPort and the specified AVCaptureVideoPreviewLayer instance.
1056 ///
1057 ///
1058 /// Parameter `port`: An AVCaptureInputPort object associated with an AVCaptureInput object.
1059 ///
1060 /// Parameter `layer`: An AVCaptureVideoPreviewLayer object.
1061 ///
1062 /// Returns: An AVCaptureConnection instance joining the specified inputPort to the specified video preview layer.
1063 ///
1064 ///
1065 /// This method returns an instance of AVCaptureConnection that may be subsequently added to an AVCaptureSession instance using AVCaptureSession's -addConnection: method. When using AVCaptureVideoPreviewLayer's -initWithSession: or -setSession:, a connection is formed between the first compatible input port and the video preview layer automatically. You do not need to manually create and add connections to the session unless you use AVCaptureVideoPreviewLayer's primitive -initWithSessionWithNoConnection: or -setSessionWithNoConnection: methods.
1066 #[unsafe(method(connectionWithInputPort:videoPreviewLayer:))]
1067 #[unsafe(method_family = none)]
1068 pub unsafe fn connectionWithInputPort_videoPreviewLayer(
1069 port: &AVCaptureInputPort,
1070 layer: &AVCaptureVideoPreviewLayer,
1071 ) -> Retained<Self>;
1072
1073 #[cfg(all(feature = "AVCaptureInput", feature = "AVCaptureOutputBase"))]
1074 /// Returns an AVCaptureConnection instance describing a connection between the specified inputPorts and the specified output.
1075 ///
1076 ///
1077 /// Parameter `ports`: An array of AVCaptureInputPort objects associated with AVCaptureInput objects.
1078 ///
1079 /// Parameter `output`: An AVCaptureOutput object.
1080 ///
1081 /// Returns: An AVCaptureConnection instance joining the specified inputPorts to the specified output port.
1082 ///
1083 ///
1084 /// This method returns an instance of AVCaptureConnection that may be subsequently added to an AVCaptureSession instance using AVCaptureSession's -addConnection: method. When using -addInput: or -addOutput:, connections are formed between all compatible inputs and outputs automatically. You do not need to manually create and add connections to the session unless you use the primitive -addInputWithNoConnections: or -addOutputWithNoConnections: methods.
1085 #[unsafe(method(initWithInputPorts:output:))]
1086 #[unsafe(method_family = init)]
1087 pub unsafe fn initWithInputPorts_output(
1088 this: Allocated<Self>,
1089 ports: &NSArray<AVCaptureInputPort>,
1090 output: &AVCaptureOutput,
1091 ) -> Retained<Self>;
1092
1093 #[cfg(all(
1094 feature = "AVCaptureInput",
1095 feature = "AVCaptureVideoPreviewLayer",
1096 feature = "objc2-quartz-core"
1097 ))]
1098 #[cfg(not(target_os = "watchos"))]
1099 /// Returns an AVCaptureConnection instance describing a connection between the specified inputPort
1100 /// and the specified AVCaptureVideoPreviewLayer instance.
1101 ///
1102 ///
1103 /// Parameter `port`: An AVCaptureInputPort object associated with an AVCaptureInput object.
1104 ///
1105 /// Parameter `layer`: An AVCaptureVideoPreviewLayer object.
1106 ///
1107 /// Returns: An AVCaptureConnection instance joining the specified inputPort to the specified video preview layer.
1108 ///
1109 ///
1110 /// This method returns an instance of AVCaptureConnection that may be subsequently added to an AVCaptureSession instance using AVCaptureSession's -addConnection: method. When using AVCaptureVideoPreviewLayer's -initWithSession: or -setSession:, a connection is formed between the first compatible input port and the video preview layer automatically. You do not need to manually create and add connections to the session unless you use AVCaptureVideoPreviewLayer's primitive -initWithSessionWithNoConnection: or -setSessionWithNoConnection: methods.
1111 #[unsafe(method(initWithInputPort:videoPreviewLayer:))]
1112 #[unsafe(method_family = init)]
1113 pub unsafe fn initWithInputPort_videoPreviewLayer(
1114 this: Allocated<Self>,
1115 port: &AVCaptureInputPort,
1116 layer: &AVCaptureVideoPreviewLayer,
1117 ) -> Retained<Self>;
1118
1119 #[cfg(feature = "AVCaptureInput")]
1120 /// An array of AVCaptureInputPort instances providing data through this connection.
1121 ///
1122 ///
1123 /// An AVCaptureConnection may involve one or more AVCaptureInputPorts producing data to the connection's AVCaptureOutput. This property is read-only. An AVCaptureConnection's inputPorts remain static for the life of the object.
1124 #[unsafe(method(inputPorts))]
1125 #[unsafe(method_family = none)]
1126 pub unsafe fn inputPorts(&self) -> Retained<NSArray<AVCaptureInputPort>>;
1127
1128 #[cfg(feature = "AVCaptureOutputBase")]
1129 /// The AVCaptureOutput instance consuming data from this connection's inputPorts.
1130 ///
1131 ///
1132 /// An AVCaptureConnection may involve one or more AVCaptureInputPorts producing data to the connection's AVCaptureOutput. This property is read-only. An AVCaptureConnection's output remains static for the life of the object. Note that a connection can either be to an output or a video preview layer, but never to both.
1133 #[unsafe(method(output))]
1134 #[unsafe(method_family = none)]
1135 pub unsafe fn output(&self) -> Option<Retained<AVCaptureOutput>>;
1136
1137 #[cfg(all(feature = "AVCaptureVideoPreviewLayer", feature = "objc2-quartz-core"))]
1138 #[cfg(not(target_os = "watchos"))]
1139 /// The AVCaptureVideoPreviewLayer instance consuming data from this connection's inputPort.
1140 ///
1141 ///
1142 /// An AVCaptureConnection may involve one AVCaptureInputPort producing data to an AVCaptureVideoPreviewLayer object. This property is read-only. An AVCaptureConnection's videoPreviewLayer remains static for the life of the object. Note that a connection can either be to an output or a video preview layer, but never to both.
1143 #[unsafe(method(videoPreviewLayer))]
1144 #[unsafe(method_family = none)]
1145 pub unsafe fn videoPreviewLayer(&self) -> Option<Retained<AVCaptureVideoPreviewLayer>>;
1146
1147 /// Indicates whether the connection's output should consume data.
1148 ///
1149 ///
1150 /// The value of this property is a BOOL that determines whether the receiver's output should consume data from its connected inputPorts when a session is running. Clients can set this property to stop the flow of data to a given output during capture. The default value is YES.
1151 #[unsafe(method(isEnabled))]
1152 #[unsafe(method_family = none)]
1153 pub unsafe fn isEnabled(&self) -> bool;
1154
1155 /// Setter for [`isEnabled`][Self::isEnabled].
1156 #[unsafe(method(setEnabled:))]
1157 #[unsafe(method_family = none)]
1158 pub unsafe fn setEnabled(&self, enabled: bool);
1159
1160 /// Indicates whether the receiver's output is currently capable of consuming data through this connection.
1161 ///
1162 ///
1163 /// The value of this property is a BOOL that determines whether the receiver's output can consume data provided through this connection. This property is read-only. Clients may key-value observe this property to know when a session's configuration forces a connection to become inactive. The default value is YES.
1164 ///
1165 /// Prior to iOS 11, the audio connection feeding an AVCaptureAudioDataOutput is made inactive when using AVCaptureSessionPresetPhoto or the equivalent photo format using -[AVCaptureDevice activeFormat]. On iOS 11 and later, the audio connection feeding AVCaptureAudioDataOutput is active for all presets and device formats.
1166 #[unsafe(method(isActive))]
1167 #[unsafe(method_family = none)]
1168 pub unsafe fn isActive(&self) -> bool;
1169
1170 /// An array of AVCaptureAudioChannel objects representing individual channels of audio data flowing through the connection.
1171 ///
1172 ///
1173 /// This property is only applicable to AVCaptureConnection instances involving audio. In such connections, the audioChannels array contains one AVCaptureAudioChannel object for each channel of audio data flowing through this connection.
1174 #[unsafe(method(audioChannels))]
1175 #[unsafe(method_family = none)]
1176 pub unsafe fn audioChannels(&self) -> Retained<NSArray<AVCaptureAudioChannel>>;
1177
1178 /// Indicates whether the connection supports setting the videoMirrored property.
1179 ///
1180 ///
1181 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMirrored property may only be set if
1182 /// -isVideoMirroringSupported returns YES.
1183 #[unsafe(method(isVideoMirroringSupported))]
1184 #[unsafe(method_family = none)]
1185 pub unsafe fn isVideoMirroringSupported(&self) -> bool;
1186
1187 /// Indicates whether the video flowing through the connection should be mirrored about its vertical axis.
1188 ///
1189 ///
1190 /// This property is only applicable to AVCaptureConnection instances involving video. if -isVideoMirroringSupported returns YES, videoMirrored may be set to flip the video about its vertical axis and produce a mirror-image effect. This property may not be set unless -isVideoMirroringSupported returns YES, otherwise a NSInvalidArgumentException is thrown. This property may not be set if -automaticallyAdjustsVideoMirroring returns YES, otherwise an NSInvalidArgumentException is thrown.
1191 #[unsafe(method(isVideoMirrored))]
1192 #[unsafe(method_family = none)]
1193 pub unsafe fn isVideoMirrored(&self) -> bool;
1194
1195 /// Setter for [`isVideoMirrored`][Self::isVideoMirrored].
1196 #[unsafe(method(setVideoMirrored:))]
1197 #[unsafe(method_family = none)]
1198 pub unsafe fn setVideoMirrored(&self, video_mirrored: bool);
1199
1200 /// Specifies whether or not the value of
1201 /// "
1202 /// videoMirrored" can change based on configuration of the session.
1203 ///
1204 ///
1205 /// For some session configurations, video data flowing through the connection will be mirrored by default. When the value of this property is YES, the value of
1206 /// "
1207 /// videoMirrored" may change depending on the configuration of the session, for example after switching to a different AVCaptureDeviceInput. The default value is YES.
1208 #[unsafe(method(automaticallyAdjustsVideoMirroring))]
1209 #[unsafe(method_family = none)]
1210 pub unsafe fn automaticallyAdjustsVideoMirroring(&self) -> bool;
1211
1212 /// Setter for [`automaticallyAdjustsVideoMirroring`][Self::automaticallyAdjustsVideoMirroring].
1213 #[unsafe(method(setAutomaticallyAdjustsVideoMirroring:))]
1214 #[unsafe(method_family = none)]
1215 pub unsafe fn setAutomaticallyAdjustsVideoMirroring(
1216 &self,
1217 automatically_adjusts_video_mirroring: bool,
1218 );
1219
1220 #[cfg(feature = "objc2-core-foundation")]
1221 /// Returns whether the connection supports the given rotation angle in degrees.
1222 ///
1223 ///
1224 /// Parameter `videoRotationAngle`: A video rotation angle to be checked.
1225 ///
1226 /// Returns: YES if the connection supports the given video rotation angle, NO otherwise.
1227 ///
1228 ///
1229 /// The connection's videoRotationAngle property can only be set to a certain angle if this method returns YES for that angle. Only rotation angles of 0, 90, 180 and 270 are supported.
1230 #[unsafe(method(isVideoRotationAngleSupported:))]
1231 #[unsafe(method_family = none)]
1232 pub unsafe fn isVideoRotationAngleSupported(&self, video_rotation_angle: CGFloat) -> bool;
1233
1234 #[cfg(feature = "objc2-core-foundation")]
1235 /// Indicates whether the video flowing through the connection should be rotated with a given angle in degrees.
1236 ///
1237 ///
1238 /// This property is only applicable to AVCaptureConnection instances involving video or depth. -setVideoRotationAngle: throws an NSInvalidArgumentException if set to an unsupported value (see -isVideoRotationAngleSupported:). Note that setting videoRotationAngle does not necessarily result in physical rotation of video buffers. For instance, a video connection to an AVCaptureMovieFileOutput handles orientation using a Quicktime track matrix. In the AVCapturePhotoOutput, orientation is handled using Exif tags. And the AVCaptureVideoPreviewLayer applies transforms to its contents to perform rotations. However, the AVCaptureVideoDataOutput and AVCaptureDepthDataOutput do output physically rotated video buffers. Setting a video rotation angle for an output that does physically rotate buffers requires a lengthy configuration of the capture render pipeline and should be done before calling -[AVCaptureSession startRunning].
1239 ///
1240 /// Starting with the Spring 2024 iPad line, the default value of videoRotationAngle is 180 degrees for video data on Front Camera as compared to 0 degrees on previous devices. So clients using AVCaptureVideoDataOutput and AVCaptureDepthDataOutput should set videoRotationAngle to 0 to avoid the physical buffer rotation described above. And clients rotating video data by themselves must account for the default value of videoRotationAngle when applying angles (videoRotationAngleForHorizonLevelPreview, videoRotationAngleForHorizonLevelCapture) from AVCaptureDeviceRotationCoordinator. Note that this change in default value is currently limited to these iPads, however it is recommended that clients rotating video data themselves incorporate the default rotation value into their workflows for all devices.
1241 #[unsafe(method(videoRotationAngle))]
1242 #[unsafe(method_family = none)]
1243 pub unsafe fn videoRotationAngle(&self) -> CGFloat;
1244
1245 #[cfg(feature = "objc2-core-foundation")]
1246 /// Setter for [`videoRotationAngle`][Self::videoRotationAngle].
1247 #[unsafe(method(setVideoRotationAngle:))]
1248 #[unsafe(method_family = none)]
1249 pub unsafe fn setVideoRotationAngle(&self, video_rotation_angle: CGFloat);
1250
1251 /// Indicates whether the connection supports setting the videoOrientation property.
1252 ///
1253 ///
1254 /// This property is deprecated. Use -isVideoRotationAngleSupported: instead.
1255 #[deprecated = "Use -isVideoRotationAngleSupported: instead"]
1256 #[unsafe(method(isVideoOrientationSupported))]
1257 #[unsafe(method_family = none)]
1258 pub unsafe fn isVideoOrientationSupported(&self) -> bool;
1259
1260 /// Indicates whether the video flowing through the connection should be rotated to a given orientation.
1261 ///
1262 ///
1263 /// This property is deprecated. Use -videoRotationAngle instead. This property may only be set if -isVideoOrientationSupported returns YES, otherwise an NSInvalidArgumentException is thrown.
1264 #[deprecated = "Use -videoRotationAngle instead"]
1265 #[unsafe(method(videoOrientation))]
1266 #[unsafe(method_family = none)]
1267 pub unsafe fn videoOrientation(&self) -> AVCaptureVideoOrientation;
1268
1269 /// Setter for [`videoOrientation`][Self::videoOrientation].
1270 #[deprecated = "Use -videoRotationAngle instead"]
1271 #[unsafe(method(setVideoOrientation:))]
1272 #[unsafe(method_family = none)]
1273 pub unsafe fn setVideoOrientation(&self, video_orientation: AVCaptureVideoOrientation);
1274
1275 /// Indicates whether the connection supports setting the videoFieldMode property.
1276 ///
1277 ///
1278 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoFieldMode property may only be set if -isVideoFieldModeSupported returns YES.
1279 #[unsafe(method(isVideoFieldModeSupported))]
1280 #[unsafe(method_family = none)]
1281 pub unsafe fn isVideoFieldModeSupported(&self) -> bool;
1282
1283 /// Indicates how interlaced video flowing through the connection should be treated.
1284 ///
1285 ///
1286 /// This property is only applicable to AVCaptureConnection instances involving video. If -isVideoFieldModeSupported returns YES, videoFieldMode may be set to affect interlaced video content flowing through the connection.
1287 #[unsafe(method(videoFieldMode))]
1288 #[unsafe(method_family = none)]
1289 pub unsafe fn videoFieldMode(&self) -> AVVideoFieldMode;
1290
1291 /// Setter for [`videoFieldMode`][Self::videoFieldMode].
1292 #[unsafe(method(setVideoFieldMode:))]
1293 #[unsafe(method_family = none)]
1294 pub unsafe fn setVideoFieldMode(&self, video_field_mode: AVVideoFieldMode);
1295
1296 /// Indicates whether the connection supports setting the videoMinFrameDuration property.
1297 ///
1298 ///
1299 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMinFrameDuration property may only be set if -isVideoMinFrameDurationSupported returns YES.
1300 ///
1301 /// This property is deprecated on iOS, where min and max frame rate adjustments are applied exclusively at the AVCaptureDevice using the activeVideoMinFrameDuration and activeVideoMaxFrameDuration properties. On macOS, frame rate adjustments are supported both at the AVCaptureDevice and at AVCaptureConnection, enabling connections to output different frame rates.
1302 #[deprecated = "Use AVCaptureDevice's activeFormat.videoSupportedFrameRateRanges instead."]
1303 #[unsafe(method(isVideoMinFrameDurationSupported))]
1304 #[unsafe(method_family = none)]
1305 pub unsafe fn isVideoMinFrameDurationSupported(&self) -> bool;
1306
1307 #[cfg(feature = "objc2-core-media")]
1308 /// Indicates the minimum time interval at which the receiver should output consecutive video frames.
1309 ///
1310 ///
1311 /// The value of this property is a CMTime specifying the minimum duration of each video frame output by the receiver, placing a lower bound on the amount of time that should separate consecutive frames. This is equivalent to the reciprocal of the maximum frame rate. A value of kCMTimeZero or kCMTimeInvalid indicates an unlimited maximum frame rate. The default value is kCMTimeInvalid.
1312 ///
1313 /// This property is deprecated on iOS, where min and max frame rate adjustments are applied exclusively at the AVCaptureDevice using the activeVideoMinFrameDuration and activeVideoMaxFrameDuration properties. On macOS, frame rate adjustments are supported both at the AVCaptureDevice and at AVCaptureConnection, enabling connections to output different frame rates.
1314 #[deprecated = "Use AVCaptureDevice's activeVideoMinFrameDuration instead."]
1315 #[unsafe(method(videoMinFrameDuration))]
1316 #[unsafe(method_family = none)]
1317 pub unsafe fn videoMinFrameDuration(&self) -> CMTime;
1318
1319 #[cfg(feature = "objc2-core-media")]
1320 /// Setter for [`videoMinFrameDuration`][Self::videoMinFrameDuration].
1321 #[deprecated = "Use AVCaptureDevice's activeVideoMinFrameDuration instead."]
1322 #[unsafe(method(setVideoMinFrameDuration:))]
1323 #[unsafe(method_family = none)]
1324 pub unsafe fn setVideoMinFrameDuration(&self, video_min_frame_duration: CMTime);
1325
1326 /// Indicates whether the connection supports setting the videoMaxFrameDuration property.
1327 ///
1328 ///
1329 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMaxFrameDuration property may only be set if -isVideoMaxFrameDurationSupported returns YES.
1330 ///
1331 /// This property is deprecated on iOS, where min and max frame rate adjustments are applied exclusively at the AVCaptureDevice using the activeVideoMinFrameDuration and activeVideoMaxFrameDuration properties. On macOS, frame rate adjustments are supported both at the AVCaptureDevice and at AVCaptureConnection, enabling connections to output different frame rates.
1332 #[deprecated = "Use AVCaptureDevice's activeFormat.videoSupportedFrameRateRanges instead."]
1333 #[unsafe(method(isVideoMaxFrameDurationSupported))]
1334 #[unsafe(method_family = none)]
1335 pub unsafe fn isVideoMaxFrameDurationSupported(&self) -> bool;
1336
1337 #[cfg(feature = "objc2-core-media")]
1338 /// Indicates the maximum time interval at which the receiver should output consecutive video frames.
1339 ///
1340 ///
1341 /// The value of this property is a CMTime specifying the maximum duration of each video frame output by the receiver, placing an upper bound on the amount of time that should separate consecutive frames. This is equivalent to the reciprocal of the minimum frame rate. A value of kCMTimeZero or kCMTimeInvalid indicates an unlimited minimum frame rate. The default value is kCMTimeInvalid.
1342 ///
1343 /// This property is deprecated on iOS, where min and max frame rate adjustments are applied exclusively at the AVCaptureDevice using the activeVideoMinFrameDuration and activeVideoMaxFrameDuration properties. On macOS, frame rate adjustments are supported both at the AVCaptureDevice and at AVCaptureConnection, enabling connections to output different frame rates.
1344 #[deprecated = "Use AVCaptureDevice's activeVideoMaxFrameDuration instead."]
1345 #[unsafe(method(videoMaxFrameDuration))]
1346 #[unsafe(method_family = none)]
1347 pub unsafe fn videoMaxFrameDuration(&self) -> CMTime;
1348
1349 #[cfg(feature = "objc2-core-media")]
1350 /// Setter for [`videoMaxFrameDuration`][Self::videoMaxFrameDuration].
1351 #[deprecated = "Use AVCaptureDevice's activeVideoMaxFrameDuration instead."]
1352 #[unsafe(method(setVideoMaxFrameDuration:))]
1353 #[unsafe(method_family = none)]
1354 pub unsafe fn setVideoMaxFrameDuration(&self, video_max_frame_duration: CMTime);
1355
1356 #[cfg(feature = "objc2-core-foundation")]
1357 /// Indicates the maximum video scale and crop factor supported by the receiver.
1358 ///
1359 ///
1360 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMaxScaleAndCropFactor property specifies the maximum CGFloat value that may be used when setting the videoScaleAndCropFactor property.
1361 #[unsafe(method(videoMaxScaleAndCropFactor))]
1362 #[unsafe(method_family = none)]
1363 pub unsafe fn videoMaxScaleAndCropFactor(&self) -> CGFloat;
1364
1365 #[cfg(feature = "objc2-core-foundation")]
1366 /// Indicates the current video scale and crop factor in use by the receiver.
1367 ///
1368 ///
1369 /// This property only applies to AVCaptureStillImageOutput connections. In such connections, the videoScaleAndCropFactor property may be set to a value in the range of 1.0 to videoMaxScaleAndCropFactor. At a factor of 1.0, the image is its original size. At a factor greater than 1.0, the image is scaled by the factor and center-cropped to its original dimensions. This factor is applied in addition to any magnification from AVCaptureDevice's videoZoomFactor property.
1370 ///
1371 ///
1372 /// See: -[AVCaptureDevice videoZoomFactor]
1373 #[unsafe(method(videoScaleAndCropFactor))]
1374 #[unsafe(method_family = none)]
1375 pub unsafe fn videoScaleAndCropFactor(&self) -> CGFloat;
1376
1377 #[cfg(feature = "objc2-core-foundation")]
1378 /// Setter for [`videoScaleAndCropFactor`][Self::videoScaleAndCropFactor].
1379 #[unsafe(method(setVideoScaleAndCropFactor:))]
1380 #[unsafe(method_family = none)]
1381 pub unsafe fn setVideoScaleAndCropFactor(&self, video_scale_and_crop_factor: CGFloat);
1382
1383 #[cfg(feature = "AVCaptureDevice")]
1384 /// Indicates the stabilization mode to apply to video flowing through the receiver when it is supported.
1385 ///
1386 ///
1387 /// This property is only applicable to AVCaptureConnection instances involving video. On devices where the video stabilization feature is supported, only a subset of available source formats may be available for stabilization. By setting the preferredVideoStabilizationMode property to a value other than AVCaptureVideoStabilizationModeOff, video flowing through the receiver is stabilized when the mode is available. Enabling video stabilization introduces additional latency into the video capture pipeline and may consume more system memory depending on the stabilization mode and format. If the preferred stabilization mode isn't available, the activeVideoStabilizationMode will be set to AVCaptureVideoStabilizationModeOff. Clients may key-value observe the activeVideoStabilizationMode property to know which stabilization mode is in use or when it is off. The default value is AVCaptureVideoStabilizationModeOff. When setting this property to AVCaptureVideoStabilizationModeAuto, an appropriate stabilization mode will be chosen based on the format and frame rate. For apps linked before iOS 6.0, the default value is AVCaptureVideoStabilizationModeStandard for a video connection attached to an AVCaptureMovieFileOutput instance. For apps linked on or after iOS 6.0, the default value is always AVCaptureVideoStabilizationModeOff. Setting a video stabilization mode using this property may change the value of enablesVideoStabilizationWhenAvailable.
1388 #[unsafe(method(preferredVideoStabilizationMode))]
1389 #[unsafe(method_family = none)]
1390 pub unsafe fn preferredVideoStabilizationMode(&self) -> AVCaptureVideoStabilizationMode;
1391
1392 #[cfg(feature = "AVCaptureDevice")]
1393 /// Setter for [`preferredVideoStabilizationMode`][Self::preferredVideoStabilizationMode].
1394 #[unsafe(method(setPreferredVideoStabilizationMode:))]
1395 #[unsafe(method_family = none)]
1396 pub unsafe fn setPreferredVideoStabilizationMode(
1397 &self,
1398 preferred_video_stabilization_mode: AVCaptureVideoStabilizationMode,
1399 );
1400
1401 #[cfg(feature = "AVCaptureDevice")]
1402 /// Indicates the stabilization mode currently being applied to video flowing through the receiver.
1403 ///
1404 ///
1405 /// This property is only applicable to AVCaptureConnection instances involving video. On devices where the video stabilization feature is supported, only a subset of available source formats may be stabilized. The activeVideoStabilizationMode property returns a value other than AVCaptureVideoStabilizationModeOff if video stabilization is currently in use. This property never returns AVCaptureVideoStabilizationModeAuto. This property is key-value observable.
1406 #[unsafe(method(activeVideoStabilizationMode))]
1407 #[unsafe(method_family = none)]
1408 pub unsafe fn activeVideoStabilizationMode(&self) -> AVCaptureVideoStabilizationMode;
1409
1410 /// Indicates whether the connection supports video stabilization.
1411 ///
1412 ///
1413 /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the -enablesVideoStabilizationWhenAvailable property may only be set if -supportsVideoStabilization returns YES. This property returns YES if the connection's input device has one or more formats that support video stabilization and the connection's output supports video stabilization. See [AVCaptureDeviceFormat isVideoStabilizationModeSupported:] to check which video stabilization modes are supported by the active device format.
1414 #[unsafe(method(isVideoStabilizationSupported))]
1415 #[unsafe(method_family = none)]
1416 pub unsafe fn isVideoStabilizationSupported(&self) -> bool;
1417
1418 /// Indicates whether stabilization is currently being applied to video flowing through the receiver.
1419 ///
1420 ///
1421 /// This property is only applicable to AVCaptureConnection instances involving video. On devices where the video stabilization feature is supported, only a subset of available source formats and resolutions may be available for stabilization. The videoStabilizationEnabled property returns YES if video stabilization is currently in use. This property is key-value observable. This property is deprecated. Use activeVideoStabilizationMode instead.
1422 #[deprecated = "Use activeVideoStabilizationMode instead."]
1423 #[unsafe(method(isVideoStabilizationEnabled))]
1424 #[unsafe(method_family = none)]
1425 pub unsafe fn isVideoStabilizationEnabled(&self) -> bool;
1426
1427 /// Indicates whether stabilization should be applied to video flowing through the receiver when the feature is available.
1428 ///
1429 ///
1430 /// This property is only applicable to AVCaptureConnection instances involving video. On devices where the video stabilization feature is supported, only a subset of available source formats and resolutions may be available for stabilization. By setting the enablesVideoStabilizationWhenAvailable property to YES, video flowing through the receiver is stabilized when available. Enabling video stabilization may introduce additional latency into the video capture pipeline. Clients may key-value observe the videoStabilizationEnabled property to know when stabilization is in use or not. The default value is NO. For apps linked before iOS 6.0, the default value is YES for a video connection attached to an AVCaptureMovieFileOutput instance. For apps linked on or after iOS 6.0, the default value is always NO. This property is deprecated. Use preferredVideoStabilizationMode instead.
1431 #[deprecated = "Use preferredVideoStabilizationMode instead."]
1432 #[unsafe(method(enablesVideoStabilizationWhenAvailable))]
1433 #[unsafe(method_family = none)]
1434 pub unsafe fn enablesVideoStabilizationWhenAvailable(&self) -> bool;
1435
1436 /// Setter for [`enablesVideoStabilizationWhenAvailable`][Self::enablesVideoStabilizationWhenAvailable].
1437 #[deprecated = "Use preferredVideoStabilizationMode instead."]
1438 #[unsafe(method(setEnablesVideoStabilizationWhenAvailable:))]
1439 #[unsafe(method_family = none)]
1440 pub unsafe fn setEnablesVideoStabilizationWhenAvailable(
1441 &self,
1442 enables_video_stabilization_when_available: bool,
1443 );
1444
1445 /// Indicates whether the connection supports camera intrinsic matrix delivery.
1446 ///
1447 ///
1448 /// This property is only applicable to AVCaptureConnection instances involving video. For such connections, the cameraIntrinsicMatrixDeliveryEnabled property may only be set to YES if -isCameraIntrinsicMatrixDeliverySupported returns YES. This property returns YES if both the connection's input device format and the connection's output support camera intrinsic matrix delivery. Only the AVCaptureVideoDataOutput's connection supports this property. Note that if video stabilization is enabled (preferredVideoStabilizationMode is set to something other than AVCaptureVideoStabilizationModeOff), camera intrinsic matrix delivery is not supported. Starting in iOS 14.3, camera intrinsics are delivered with video buffers on which geometric distortion correction is applied.
1449 #[unsafe(method(isCameraIntrinsicMatrixDeliverySupported))]
1450 #[unsafe(method_family = none)]
1451 pub unsafe fn isCameraIntrinsicMatrixDeliverySupported(&self) -> bool;
1452
1453 /// Indicates whether camera intrinsic matrix delivery should be enabled.
1454 ///
1455 ///
1456 /// This property is only applicable to AVCaptureConnection instances involving video. Refer to property cameraIntrinsicMatrixDeliverySupported before setting this property. When this property is set to YES, the receiver's output will add the kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix sample buffer attachment to all vended sample buffers. This property must be set before the session starts running.
1457 #[unsafe(method(isCameraIntrinsicMatrixDeliveryEnabled))]
1458 #[unsafe(method_family = none)]
1459 pub unsafe fn isCameraIntrinsicMatrixDeliveryEnabled(&self) -> bool;
1460
1461 /// Setter for [`isCameraIntrinsicMatrixDeliveryEnabled`][Self::isCameraIntrinsicMatrixDeliveryEnabled].
1462 #[unsafe(method(setCameraIntrinsicMatrixDeliveryEnabled:))]
1463 #[unsafe(method_family = none)]
1464 pub unsafe fn setCameraIntrinsicMatrixDeliveryEnabled(
1465 &self,
1466 camera_intrinsic_matrix_delivery_enabled: bool,
1467 );
1468 );
1469}
1470
1471extern_class!(
1472 /// AVCaptureAudioChannel represents a single channel of audio flowing through an AVCaptureSession.
1473 ///
1474 ///
1475 /// An AVCaptureConnection from an input producing audio to an output receiving audio exposes an array of AVCaptureAudioChannel objects, one for each channel of audio available. Iterating through these audio channel objects, a client may poll for audio levels. Instances of AVCaptureAudioChannel cannot be created directly.
1476 ///
1477 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaudiochannel?language=objc)
1478 #[unsafe(super(NSObject))]
1479 #[derive(Debug, PartialEq, Eq, Hash)]
1480 pub struct AVCaptureAudioChannel;
1481);
1482
1483extern_conformance!(
1484 unsafe impl NSObjectProtocol for AVCaptureAudioChannel {}
1485);
1486
1487impl AVCaptureAudioChannel {
1488 extern_methods!(
1489 #[unsafe(method(init))]
1490 #[unsafe(method_family = init)]
1491 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1492
1493 #[unsafe(method(new))]
1494 #[unsafe(method_family = new)]
1495 pub unsafe fn new() -> Retained<Self>;
1496
1497 /// A measurement of the instantaneous average power level of the audio flowing through the receiver.
1498 ///
1499 ///
1500 /// A client may poll an AVCaptureAudioChannel object for its current averagePowerLevel to get its instantaneous average power level in decibels. This property is not key-value observable.
1501 #[unsafe(method(averagePowerLevel))]
1502 #[unsafe(method_family = none)]
1503 pub unsafe fn averagePowerLevel(&self) -> c_float;
1504
1505 /// A measurement of the peak/hold level of the audio flowing through the receiver.
1506 ///
1507 ///
1508 /// A client may poll an AVCaptureAudioChannel object for its current peakHoldLevel to get its most recent peak hold level in decibels. This property is not key-value observable.
1509 #[unsafe(method(peakHoldLevel))]
1510 #[unsafe(method_family = none)]
1511 pub unsafe fn peakHoldLevel(&self) -> c_float;
1512
1513 /// A property indicating the current volume (gain) of the receiver.
1514 ///
1515 ///
1516 /// The volume property indicates the current volume or gain of the receiver as a floating point value between 0.0 -> 1.0. If you desire to boost the gain in software, you may specify a a value greater than 1.0.
1517 #[unsafe(method(volume))]
1518 #[unsafe(method_family = none)]
1519 pub unsafe fn volume(&self) -> c_float;
1520
1521 /// Setter for [`volume`][Self::volume].
1522 #[unsafe(method(setVolume:))]
1523 #[unsafe(method_family = none)]
1524 pub unsafe fn setVolume(&self, volume: c_float);
1525
1526 /// A property indicating whether the receiver is currently enabled for data capture.
1527 ///
1528 ///
1529 /// By default, all AVCaptureAudioChannel objects exposed by a connection are enabled. You may set enabled to NO to stop the flow of data for a particular AVCaptureAudioChannel.
1530 #[unsafe(method(isEnabled))]
1531 #[unsafe(method_family = none)]
1532 pub unsafe fn isEnabled(&self) -> bool;
1533
1534 /// Setter for [`isEnabled`][Self::isEnabled].
1535 #[unsafe(method(setEnabled:))]
1536 #[unsafe(method_family = none)]
1537 pub unsafe fn setEnabled(&self, enabled: bool);
1538 );
1539}