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///
71/// 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 [session stopRunning], your -startRunning request is preserved, and when your app comes back to foreground, you receive AVCaptureSessionInterruptionEndedNotification and your session starts running.
72///
73/// An interruption caused by the audio hardware temporarily being made unavailable, for instance, for a phone call, or alarm.
74///
75/// An interruption caused by the video device temporarily being made unavailable, for instance, when stolen away by another AVCaptureSession.
76///
77/// 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.
78///
79/// An interruption caused by the video device temporarily being made unavailable due to system pressure, such as thermal duress. See AVCaptureDevice's AVCaptureSystemPressure category for more information.
80///
81/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionreason?language=objc)
82// NS_ENUM
83#[repr(transparent)]
84#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
85pub struct AVCaptureSessionInterruptionReason(pub NSInteger);
86impl AVCaptureSessionInterruptionReason {
87    #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableInBackground")]
88    pub const VideoDeviceNotAvailableInBackground: Self = Self(1);
89    #[doc(alias = "AVCaptureSessionInterruptionReasonAudioDeviceInUseByAnotherClient")]
90    pub const AudioDeviceInUseByAnotherClient: Self = Self(2);
91    #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceInUseByAnotherClient")]
92    pub const VideoDeviceInUseByAnotherClient: Self = Self(3);
93    #[doc(
94        alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps"
95    )]
96    pub const VideoDeviceNotAvailableWithMultipleForegroundApps: Self = Self(4);
97    #[doc(alias = "AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure")]
98    pub const VideoDeviceNotAvailableDueToSystemPressure: Self = Self(5);
99}
100
101unsafe impl Encode for AVCaptureSessionInterruptionReason {
102    const ENCODING: Encoding = NSInteger::ENCODING;
103}
104
105unsafe impl RefEncode for AVCaptureSessionInterruptionReason {
106    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
107}
108
109extern "C" {
110    /// The key used to provide an NSNumber describing the interruption reason in an AVCaptureSessionWasInterruptedNotification.
111    ///
112    ///
113    /// AVCaptureSessionInterruptionReasonKey may be found in the userInfo dictionary provided with an AVCaptureSessionWasInterruptedNotification. The NSNumber associated with the notification tells you why the interruption occurred.
114    ///
115    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionreasonkey?language=objc)
116    pub static AVCaptureSessionInterruptionReasonKey: &'static NSString;
117}
118
119extern "C" {
120    /// The key used to provide an AVCaptureSystemPressureState indicating the system pressure level and contributing factors that caused the interruption.
121    ///
122    ///
123    /// This key is only present when the AVCaptureSessionInterruptionReasonKey equals AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableDueToSystemPressure.
124    ///
125    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionsystempressurestatekey?language=objc)
126    pub static AVCaptureSessionInterruptionSystemPressureStateKey: &'static NSString;
127}
128
129extern "C" {
130    /// Posted when an instance of AVCaptureSession ceases to be interrupted.
131    ///
132    ///
133    /// 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.
134    ///
135    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioninterruptionendednotification?language=objc)
136    pub static AVCaptureSessionInterruptionEndedNotification: &'static NSNotificationName;
137}
138
139/// Constants indicating video orientation, for use with AVCaptureVideoPreviewLayer (see AVCaptureVideoPreviewLayer.h) and AVCaptureConnection (see below).
140///
141///
142/// Indicates that video should be oriented vertically, home button on the bottom.
143///
144/// Indicates that video should be oriented vertically, home button on the top.
145///
146/// Indicates that video should be oriented horizontally, home button on the right.
147///
148/// Indicates that video should be oriented horizontally, home button on the left.
149///
150/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideoorientation?language=objc)
151// NS_ENUM
152#[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
153#[repr(transparent)]
154#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
155pub struct AVCaptureVideoOrientation(pub NSInteger);
156impl AVCaptureVideoOrientation {
157    #[doc(alias = "AVCaptureVideoOrientationPortrait")]
158    #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
159    pub const Portrait: Self = Self(1);
160    #[doc(alias = "AVCaptureVideoOrientationPortraitUpsideDown")]
161    #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
162    pub const PortraitUpsideDown: Self = Self(2);
163    #[doc(alias = "AVCaptureVideoOrientationLandscapeRight")]
164    #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
165    pub const LandscapeRight: Self = Self(3);
166    #[doc(alias = "AVCaptureVideoOrientationLandscapeLeft")]
167    #[deprecated = "Use AVCaptureDeviceRotationCoordinator instead"]
168    pub const LandscapeLeft: Self = Self(4);
169}
170
171unsafe impl Encode for AVCaptureVideoOrientation {
172    const ENCODING: Encoding = NSInteger::ENCODING;
173}
174
175unsafe impl RefEncode for AVCaptureVideoOrientation {
176    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
177}
178
179extern_class!(
180    /// AVCaptureSession is the central hub of the AVFoundation capture classes.
181    ///
182    ///
183    /// 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.
184    ///
185    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesession?language=objc)
186    #[unsafe(super(NSObject))]
187    #[derive(Debug, PartialEq, Eq, Hash)]
188    pub struct AVCaptureSession;
189);
190
191extern_conformance!(
192    unsafe impl NSObjectProtocol for AVCaptureSession {}
193);
194
195impl AVCaptureSession {
196    extern_methods!(
197        #[cfg(feature = "AVCaptureSessionPreset")]
198        /// Returns whether the receiver can be configured with the given preset.
199        ///
200        ///
201        /// Parameter `preset`: An AVCaptureSession preset.
202        ///
203        /// Returns: YES if the receiver can be set to the given preset, NO otherwise.
204        ///
205        ///
206        /// 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.
207        #[unsafe(method(canSetSessionPreset:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn canSetSessionPreset(&self, preset: &AVCaptureSessionPreset) -> bool;
210
211        #[cfg(feature = "AVCaptureSessionPreset")]
212        /// Indicates the session preset currently in use by the receiver.
213        ///
214        ///
215        /// 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.
216        #[unsafe(method(sessionPreset))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn sessionPreset(&self) -> Retained<AVCaptureSessionPreset>;
219
220        #[cfg(feature = "AVCaptureSessionPreset")]
221        /// Setter for [`sessionPreset`][Self::sessionPreset].
222        #[unsafe(method(setSessionPreset:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setSessionPreset(&self, session_preset: &AVCaptureSessionPreset);
225
226        #[cfg(feature = "AVCaptureInput")]
227        /// An NSArray of AVCaptureInputs currently added to the receiver.
228        ///
229        ///
230        /// 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:.
231        #[unsafe(method(inputs))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn inputs(&self) -> Retained<NSArray<AVCaptureInput>>;
234
235        #[cfg(feature = "AVCaptureInput")]
236        /// Returns whether the proposed input can be added to the receiver.
237        ///
238        ///
239        /// Parameter `input`: An AVCaptureInput instance.
240        ///
241        /// Returns: YES if the proposed input can be added to the receiver, NO otherwise.
242        ///
243        ///
244        /// An AVCaptureInput instance can only be added to a session using -addInput: if -canAddInput: returns YES, otherwise an NSInvalidArgumentException is thrown.
245        #[unsafe(method(canAddInput:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn canAddInput(&self, input: &AVCaptureInput) -> bool;
248
249        #[cfg(feature = "AVCaptureInput")]
250        /// Adds an AVCaptureInput to the session.
251        ///
252        ///
253        /// Parameter `input`: An AVCaptureInput instance.
254        ///
255        ///
256        /// 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.
257        #[unsafe(method(addInput:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn addInput(&self, input: &AVCaptureInput);
260
261        #[cfg(feature = "AVCaptureInput")]
262        /// Removes an AVCaptureInput from the session.
263        ///
264        ///
265        /// Parameter `input`: An AVCaptureInput instance.
266        ///
267        ///
268        /// -removeInput: may be called while the session is running.
269        #[unsafe(method(removeInput:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn removeInput(&self, input: &AVCaptureInput);
272
273        #[cfg(feature = "AVCaptureOutputBase")]
274        /// An NSArray of AVCaptureOutputs currently added to the receiver.
275        ///
276        ///
277        /// 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:.
278        #[unsafe(method(outputs))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn outputs(&self) -> Retained<NSArray<AVCaptureOutput>>;
281
282        #[cfg(feature = "AVCaptureOutputBase")]
283        /// Returns whether the proposed output can be added to the receiver.
284        ///
285        ///
286        /// Parameter `output`: An AVCaptureOutput instance.
287        ///
288        /// Returns: YES if the proposed output can be added to the receiver, NO otherwise.
289        ///
290        ///
291        /// An AVCaptureOutput instance can only be added to a session using -addOutput: if -canAddOutput: returns YES, otherwise an NSInvalidArgumentException is thrown.
292        ///
293        /// On iOS and Mac Catalyst, some limitations to adding combinations of different types of outputs apply:
294        /// - 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.
295        /// - A session cannot contain both an AVCaptureStillImageOutput and an AVCapturePhotoOutput at the same time.
296        /// - 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.
297        /// - 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.
298        #[unsafe(method(canAddOutput:))]
299        #[unsafe(method_family = none)]
300        pub unsafe fn canAddOutput(&self, output: &AVCaptureOutput) -> bool;
301
302        #[cfg(feature = "AVCaptureOutputBase")]
303        /// Adds an AVCaptureOutput to the session.
304        ///
305        ///
306        /// Parameter `output`: An AVCaptureOutput instance.
307        ///
308        ///
309        /// 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.
310        #[unsafe(method(addOutput:))]
311        #[unsafe(method_family = none)]
312        pub unsafe fn addOutput(&self, output: &AVCaptureOutput);
313
314        #[cfg(feature = "AVCaptureOutputBase")]
315        /// Removes an AVCaptureOutput from the session.
316        ///
317        ///
318        /// Parameter `output`: An AVCaptureOutput instance.
319        ///
320        ///
321        /// -removeOutput: may be called while the session is running.
322        #[unsafe(method(removeOutput:))]
323        #[unsafe(method_family = none)]
324        pub unsafe fn removeOutput(&self, output: &AVCaptureOutput);
325
326        #[cfg(feature = "AVCaptureInput")]
327        /// Adds an AVCaptureInput to the session without forming any connections.
328        ///
329        ///
330        /// Parameter `input`: An AVCaptureInput instance.
331        ///
332        ///
333        /// 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.
334        #[unsafe(method(addInputWithNoConnections:))]
335        #[unsafe(method_family = none)]
336        pub unsafe fn addInputWithNoConnections(&self, input: &AVCaptureInput);
337
338        #[cfg(feature = "AVCaptureOutputBase")]
339        /// Adds an AVCaptureOutput to the session without forming any connections.
340        ///
341        ///
342        /// Parameter `output`: An AVCaptureOutput instance.
343        ///
344        ///
345        /// 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.
346        #[unsafe(method(addOutputWithNoConnections:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn addOutputWithNoConnections(&self, output: &AVCaptureOutput);
349
350        /// An NSArray of AVCaptureConnections currently added to the receiver.
351        ///
352        ///
353        /// 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:.
354        #[unsafe(method(connections))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn connections(&self) -> Retained<NSArray<AVCaptureConnection>>;
357
358        /// Returns whether the proposed connection can be added to the receiver.
359        ///
360        ///
361        /// Parameter `connection`: An AVCaptureConnection instance.
362        ///
363        ///
364        /// 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.
365        #[unsafe(method(canAddConnection:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn canAddConnection(&self, connection: &AVCaptureConnection) -> bool;
368
369        /// Adds an AVCaptureConnection to the session.
370        ///
371        ///
372        /// Parameter `connection`: An AVCaptureConnection instance.
373        ///
374        ///
375        /// 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.
376        #[unsafe(method(addConnection:))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn addConnection(&self, connection: &AVCaptureConnection);
379
380        /// Removes an AVCaptureConnection from the session.
381        ///
382        ///
383        /// Parameter `connection`: An AVCaptureConnection instance.
384        ///
385        ///
386        /// -removeConnection: may be called while the session is running.
387        #[unsafe(method(removeConnection:))]
388        #[unsafe(method_family = none)]
389        pub unsafe fn removeConnection(&self, connection: &AVCaptureConnection);
390
391        /// Indicates whether session controls are supported on this platform.
392        ///
393        ///
394        /// `AVCaptureControl`s are only supported on platforms with necessary hardware.
395        #[unsafe(method(supportsControls))]
396        #[unsafe(method_family = none)]
397        pub unsafe fn supportsControls(&self) -> bool;
398
399        /// Specifies the maximum number of controls that can be added to a session.
400        #[unsafe(method(maxControlsCount))]
401        #[unsafe(method_family = none)]
402        pub unsafe fn maxControlsCount(&self) -> NSInteger;
403
404        #[cfg(feature = "dispatch2")]
405        /// Sets the receiver's controls delegate that receives events about the session's controls and the dispatch queue on which the delegate is called.
406        ///
407        ///
408        /// Parameter `controlsDelegate`: An object conforming to the `AVCaptureSessionControlsDelegate` protocol that receives events about the session's controls.
409        ///
410        /// Parameter `controlsDelegateCallbackQueue`: A dispatch queue on which all delegate methods are called.
411        ///
412        ///
413        /// 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.
414        ///
415        /// 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`.
416        #[unsafe(method(setControlsDelegate:queue:))]
417        #[unsafe(method_family = none)]
418        pub unsafe fn setControlsDelegate_queue(
419            &self,
420            controls_delegate: Option<&ProtocolObject<dyn AVCaptureSessionControlsDelegate>>,
421            controls_delegate_callback_queue: Option<&DispatchQueue>,
422        );
423
424        /// The receiver's controls delegate.
425        ///
426        ///
427        /// 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.
428        ///
429        /// A controls delegate must be specified for controls to become active.
430        #[unsafe(method(controlsDelegate))]
431        #[unsafe(method_family = none)]
432        pub unsafe fn controlsDelegate(
433            &self,
434        ) -> Option<Retained<ProtocolObject<dyn AVCaptureSessionControlsDelegate>>>;
435
436        #[cfg(feature = "dispatch2")]
437        /// The dispatch queue on which all controls delegate methods will be called.
438        ///
439        ///
440        /// The value of this property is a `dispatch_queue_t`. The queue is set using the `-setControlsDelegate:queue:` method.
441        #[unsafe(method(controlsDelegateCallbackQueue))]
442        #[unsafe(method_family = none)]
443        pub unsafe fn controlsDelegateCallbackQueue(&self) -> Option<Retained<DispatchQueue>>;
444
445        #[cfg(feature = "AVCaptureControl")]
446        /// An `NSArray` of `AVCaptureControl`s currently added to the session.
447        ///
448        ///
449        /// 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:`.
450        #[unsafe(method(controls))]
451        #[unsafe(method_family = none)]
452        pub unsafe fn controls(&self) -> Retained<NSArray<AVCaptureControl>>;
453
454        #[cfg(feature = "AVCaptureControl")]
455        /// Returns whether the proposed control can be added to the session.
456        ///
457        ///
458        /// Parameter `control`: An `AVCaptureControl` instance.
459        ///
460        /// Returns: `YES` if the proposed control can be added to the session, `NO` otherwise.
461        ///
462        ///
463        /// 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.
464        #[unsafe(method(canAddControl:))]
465        #[unsafe(method_family = none)]
466        pub unsafe fn canAddControl(&self, control: &AVCaptureControl) -> bool;
467
468        #[cfg(feature = "AVCaptureControl")]
469        /// Adds an `AVCaptureControl` instance to the session.
470        ///
471        ///
472        /// Parameter `control`: An `AVCaptureControl` instance.
473        ///
474        ///
475        /// 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.
476        ///
477        /// For an `AVCaptureControl` instance to become active, an `AVCaptureSessionControlsDelegate` must be set on the session.
478        #[unsafe(method(addControl:))]
479        #[unsafe(method_family = none)]
480        pub unsafe fn addControl(&self, control: &AVCaptureControl);
481
482        #[cfg(feature = "AVCaptureControl")]
483        /// Removes an `AVCaptureControl` instance from the session.
484        ///
485        ///
486        /// Parameter `control`: An `AVCaptureControl` instance.
487        ///
488        ///
489        /// `-removeControl:` may be called while the session is running.
490        #[unsafe(method(removeControl:))]
491        #[unsafe(method_family = none)]
492        pub unsafe fn removeControl(&self, control: &AVCaptureControl);
493
494        /// When paired with commitConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
495        ///
496        ///
497        /// -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.
498        #[unsafe(method(beginConfiguration))]
499        #[unsafe(method_family = none)]
500        pub unsafe fn beginConfiguration(&self);
501
502        /// When preceded by beginConfiguration, allows a client to batch multiple configuration operations on a running session into atomic updates.
503        ///
504        ///
505        /// -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.
506        #[unsafe(method(commitConfiguration))]
507        #[unsafe(method_family = none)]
508        pub unsafe fn commitConfiguration(&self);
509
510        /// Indicates whether the session is currently running.
511        ///
512        ///
513        /// 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.
514        #[unsafe(method(isRunning))]
515        #[unsafe(method_family = none)]
516        pub unsafe fn isRunning(&self) -> bool;
517
518        /// Indicates whether the session is being interrupted.
519        ///
520        ///
521        /// 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.
522        #[unsafe(method(isInterrupted))]
523        #[unsafe(method_family = none)]
524        pub unsafe fn isInterrupted(&self) -> bool;
525
526        /// Returns whether the session can be configured to use the camera while multitasking.
527        ///
528        ///
529        /// 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.
530        ///
531        /// 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).
532        ///
533        /// This property also returns YES for iOS applications that have the com.apple.developer.avfoundation.multitasking-camera-access entitlement.
534        ///
535        /// This property returns YES on Apple TV.
536        ///
537        /// This property is key-value observable.
538        #[unsafe(method(isMultitaskingCameraAccessSupported))]
539        #[unsafe(method_family = none)]
540        pub unsafe fn isMultitaskingCameraAccessSupported(&self) -> bool;
541
542        /// Indicates whether the session is configured to use the camera while multitasking.
543        ///
544        ///
545        /// 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.
546        ///
547        /// AVCaptureSessions that are configured to use the camera while multitasking will not be interrupted with AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps.
548        ///
549        /// For applications that have the com.apple.developer.avfoundation.multitasking-camera-access entitlement, this property defaults to YES if -isMultitaskingCameraAccessSupported returns YES.
550        ///
551        /// 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
552        /// .
553        ///
554        /// This property is key-value observable.
555        #[unsafe(method(isMultitaskingCameraAccessEnabled))]
556        #[unsafe(method_family = none)]
557        pub unsafe fn isMultitaskingCameraAccessEnabled(&self) -> bool;
558
559        /// Setter for [`isMultitaskingCameraAccessEnabled`][Self::isMultitaskingCameraAccessEnabled].
560        #[unsafe(method(setMultitaskingCameraAccessEnabled:))]
561        #[unsafe(method_family = none)]
562        pub unsafe fn setMultitaskingCameraAccessEnabled(
563            &self,
564            multitasking_camera_access_enabled: bool,
565        );
566
567        /// Indicates whether the receiver will use the application's AVAudioSession for recording.
568        ///
569        ///
570        /// 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.
571        #[unsafe(method(usesApplicationAudioSession))]
572        #[unsafe(method_family = none)]
573        pub unsafe fn usesApplicationAudioSession(&self) -> bool;
574
575        /// Setter for [`usesApplicationAudioSession`][Self::usesApplicationAudioSession].
576        #[unsafe(method(setUsesApplicationAudioSession:))]
577        #[unsafe(method_family = none)]
578        pub unsafe fn setUsesApplicationAudioSession(&self, uses_application_audio_session: bool);
579
580        /// Indicates whether the receiver should configure the application's audio session for recording.
581        ///
582        ///
583        /// 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.
584        #[unsafe(method(automaticallyConfiguresApplicationAudioSession))]
585        #[unsafe(method_family = none)]
586        pub unsafe fn automaticallyConfiguresApplicationAudioSession(&self) -> bool;
587
588        /// Setter for [`automaticallyConfiguresApplicationAudioSession`][Self::automaticallyConfiguresApplicationAudioSession].
589        #[unsafe(method(setAutomaticallyConfiguresApplicationAudioSession:))]
590        #[unsafe(method_family = none)]
591        pub unsafe fn setAutomaticallyConfiguresApplicationAudioSession(
592            &self,
593            automatically_configures_application_audio_session: bool,
594        );
595
596        /// Indicates whether the receiver should configure the application's audio session to mix with others.
597        ///
598        ///
599        /// 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.
600        #[unsafe(method(configuresApplicationAudioSessionToMixWithOthers))]
601        #[unsafe(method_family = none)]
602        pub unsafe fn configuresApplicationAudioSessionToMixWithOthers(&self) -> bool;
603
604        /// Setter for [`configuresApplicationAudioSessionToMixWithOthers`][Self::configuresApplicationAudioSessionToMixWithOthers].
605        #[unsafe(method(setConfiguresApplicationAudioSessionToMixWithOthers:))]
606        #[unsafe(method_family = none)]
607        pub unsafe fn setConfiguresApplicationAudioSessionToMixWithOthers(
608            &self,
609            configures_application_audio_session_to_mix_with_others: bool,
610        );
611
612        /// Indicates whether the receiver automatically configures its video device's activeFormat and activeColorSpace properties, preferring wide color for photos.
613        ///
614        ///
615        /// 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.
616        #[unsafe(method(automaticallyConfiguresCaptureDeviceForWideColor))]
617        #[unsafe(method_family = none)]
618        pub unsafe fn automaticallyConfiguresCaptureDeviceForWideColor(&self) -> bool;
619
620        /// Setter for [`automaticallyConfiguresCaptureDeviceForWideColor`][Self::automaticallyConfiguresCaptureDeviceForWideColor].
621        #[unsafe(method(setAutomaticallyConfiguresCaptureDeviceForWideColor:))]
622        #[unsafe(method_family = none)]
623        pub unsafe fn setAutomaticallyConfiguresCaptureDeviceForWideColor(
624            &self,
625            automatically_configures_capture_device_for_wide_color: bool,
626        );
627
628        /// Starts an AVCaptureSession instance running.
629        ///
630        ///
631        /// 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.
632        #[unsafe(method(startRunning))]
633        #[unsafe(method_family = none)]
634        pub unsafe fn startRunning(&self);
635
636        /// Stops an AVCaptureSession instance that is currently running.
637        ///
638        ///
639        /// 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.
640        #[unsafe(method(stopRunning))]
641        #[unsafe(method_family = none)]
642        pub unsafe fn stopRunning(&self);
643
644        #[cfg(feature = "objc2-core-media")]
645        /// Provides the clock being used for synchronization.
646        ///
647        /// 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.
648        ///
649        /// For example, if you want to reverse synchronize the output timestamps to the original timestamps, you can do the following: In captureOutput:didOutputSampleBuffer:fromConnection:
650        ///
651        /// AVCaptureInputPort *port = [[connection inputPorts] objectAtIndex:0];
652        /// CMClockRef originalClock = [port clock];
653        ///
654        /// CMTime syncedPTS = CMSampleBufferGetPresentationTime( sampleBuffer );
655        /// CMTime originalPTS = CMSyncConvertTime( syncedPTS, [session synchronizationClock], originalClock );
656        ///
657        /// This property is key-value observable.
658        #[unsafe(method(synchronizationClock))]
659        #[unsafe(method_family = none)]
660        pub unsafe fn synchronizationClock(&self) -> Option<Retained<CMClock>>;
661
662        #[cfg(feature = "objc2-core-media")]
663        /// Provides the clock being used for synchronization.
664        ///
665        /// Deprecated. Please use synchronizationClock instead.
666        #[deprecated]
667        #[unsafe(method(masterClock))]
668        #[unsafe(method_family = none)]
669        pub unsafe fn masterClock(&self) -> Option<Retained<CMClock>>;
670
671        /// Indicates the percentage of the session's available hardware budget currently in use.
672        ///
673        ///
674        /// 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.
675        ///
676        /// Contributors to hardwareCost include:
677        /// - 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.
678        /// - The max frame rate supported by the source device's active format. The higher the max frame rate, the higher the cost.
679        /// - 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.
680        /// - 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.
681        /// For AVCaptureMultiCamSessions, all of the source devices' active formats contribute to hardwareCost.
682        /// 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.
683        ///
684        /// 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.
685        #[unsafe(method(hardwareCost))]
686        #[unsafe(method_family = none)]
687        pub unsafe fn hardwareCost(&self) -> c_float;
688    );
689}
690
691/// Methods declared on superclass `NSObject`.
692impl AVCaptureSession {
693    extern_methods!(
694        #[unsafe(method(init))]
695        #[unsafe(method_family = init)]
696        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
697
698        #[unsafe(method(new))]
699        #[unsafe(method_family = new)]
700        pub unsafe fn new() -> Retained<Self>;
701    );
702}
703
704extern_protocol!(
705    /// Defines an interface for delegates of `AVCaptureSession` to receive events about the session's controls.
706    ///
707    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesessioncontrolsdelegate?language=objc)
708    pub unsafe trait AVCaptureSessionControlsDelegate: NSObjectProtocol {
709        /// Called when the controls of an `AVCaptureSession` instance become active and are available for interaction.
710        ///
711        ///
712        /// Parameter `session`: The `AVCaptureSession` instance whose controls are active.
713        ///
714        ///
715        /// Delegates receive this message when the controls of an `AVCaptureSession` instance become active and are available for interaction.
716        #[unsafe(method(sessionControlsDidBecomeActive:))]
717        #[unsafe(method_family = none)]
718        unsafe fn sessionControlsDidBecomeActive(&self, session: &AVCaptureSession);
719
720        /// Called when the controls of an `AVCaptureSession` instance will enter a fullscreen appearance.
721        ///
722        ///
723        /// Parameter `session`: The `AVCaptureSession` instance whose controls will enter a fullscreen appearance.
724        ///
725        ///
726        /// 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.
727        #[unsafe(method(sessionControlsWillEnterFullscreenAppearance:))]
728        #[unsafe(method_family = none)]
729        unsafe fn sessionControlsWillEnterFullscreenAppearance(&self, session: &AVCaptureSession);
730
731        /// Called when the controls of an `AVCaptureSession` instance will exit a fullscreen appearance.
732        ///
733        ///
734        /// Parameter `session`: The `AVCaptureSession` instance whose controls will exit a fullscreen appearance.
735        ///
736        ///
737        /// 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:`.
738        #[unsafe(method(sessionControlsWillExitFullscreenAppearance:))]
739        #[unsafe(method_family = none)]
740        unsafe fn sessionControlsWillExitFullscreenAppearance(&self, session: &AVCaptureSession);
741
742        /// Called when the controls of an `AVCaptureSession` instance become inactive and are no longer available for interaction.
743        ///
744        ///
745        /// Parameter `session`: The `AVCaptureSession` instance whose controls are inactive.
746        ///
747        ///
748        /// Delegates receive this message when the controls of an `AVCaptureSession` instance become inactive and are no longer available for interaction.
749        #[unsafe(method(sessionControlsDidBecomeInactive:))]
750        #[unsafe(method_family = none)]
751        unsafe fn sessionControlsDidBecomeInactive(&self, session: &AVCaptureSession);
752    }
753);
754
755extern_class!(
756    /// A subclass of AVCaptureSession which supports simultaneous capture from multiple inputs of the same media type.
757    ///
758    ///
759    /// 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.
760    ///
761    /// 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.
762    ///
763    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemulticamsession?language=objc)
764    #[unsafe(super(AVCaptureSession, NSObject))]
765    #[derive(Debug, PartialEq, Eq, Hash)]
766    pub struct AVCaptureMultiCamSession;
767);
768
769extern_conformance!(
770    unsafe impl NSObjectProtocol for AVCaptureMultiCamSession {}
771);
772
773impl AVCaptureMultiCamSession {
774    extern_methods!(
775        /// Indicates whether multicam session is supported on this platform.
776        ///
777        ///
778        /// 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.
779        #[unsafe(method(isMultiCamSupported))]
780        #[unsafe(method_family = none)]
781        pub unsafe fn isMultiCamSupported() -> bool;
782
783        /// Indicates the percentage of the session's available hardware budget currently in use.
784        ///
785        ///
786        /// 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.
787        ///
788        /// Contributors to hardwareCost include:
789        /// - 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.
790        /// - The max frame rate supported by the source devices' active formats. The higher the max frame rate, the higher the cost.
791        /// - Whether the source devices' active formats are binned or not. Binned formats require substantially less hardware bandwidth, and therefore result in a lower cost.
792        /// - 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.
793        /// 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.
794        #[unsafe(method(hardwareCost))]
795        #[unsafe(method_family = none)]
796        pub unsafe fn hardwareCost(&self) -> c_float;
797
798        /// Indicates the system pressure cost of your current configuration.
799        ///
800        ///
801        /// 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.
802        #[unsafe(method(systemPressureCost))]
803        #[unsafe(method_family = none)]
804        pub unsafe fn systemPressureCost(&self) -> c_float;
805    );
806}
807
808/// Methods declared on superclass `NSObject`.
809impl AVCaptureMultiCamSession {
810    extern_methods!(
811        #[unsafe(method(init))]
812        #[unsafe(method_family = init)]
813        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
814
815        #[unsafe(method(new))]
816        #[unsafe(method_family = new)]
817        pub unsafe fn new() -> Retained<Self>;
818    );
819}
820
821/// Constants indicating video field mode, for use with AVCaptureConnection's videoFieldMode property (see below).
822///
823///
824/// Indicates that both top and bottom video fields in interlaced content should be passed thru.
825///
826/// Indicates that only the top video field in interlaced content should be passed thru.
827///
828/// Indicates that the bottom video field only in interlaced content should be passed thru.
829///
830/// Indicates that top and bottom video fields in interlaced content should be deinterlaced.
831///
832/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avvideofieldmode?language=objc)
833// NS_ENUM
834#[repr(transparent)]
835#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
836pub struct AVVideoFieldMode(pub NSInteger);
837impl AVVideoFieldMode {
838    #[doc(alias = "AVVideoFieldModeBoth")]
839    pub const Both: Self = Self(0);
840    #[doc(alias = "AVVideoFieldModeTopOnly")]
841    pub const TopOnly: Self = Self(1);
842    #[doc(alias = "AVVideoFieldModeBottomOnly")]
843    pub const BottomOnly: Self = Self(2);
844    #[doc(alias = "AVVideoFieldModeDeinterlace")]
845    pub const Deinterlace: Self = Self(3);
846}
847
848unsafe impl Encode for AVVideoFieldMode {
849    const ENCODING: Encoding = NSInteger::ENCODING;
850}
851
852unsafe impl RefEncode for AVVideoFieldMode {
853    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
854}
855
856extern_class!(
857    /// AVCaptureConnection represents a connection between an AVCaptureInputPort or ports, and an AVCaptureOutput or AVCaptureVideoPreviewLayer present in an AVCaptureSession.
858    ///
859    ///
860    /// 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.
861    ///
862    /// Connections involving audio expose an array of AVCaptureAudioChannel objects, which can be used for monitoring levels.
863    ///
864    /// Connections involving video expose video specific properties, such as videoMirrored and videoRotationAngle.
865    ///
866    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureconnection?language=objc)
867    #[unsafe(super(NSObject))]
868    #[derive(Debug, PartialEq, Eq, Hash)]
869    pub struct AVCaptureConnection;
870);
871
872extern_conformance!(
873    unsafe impl NSObjectProtocol for AVCaptureConnection {}
874);
875
876impl AVCaptureConnection {
877    extern_methods!(
878        #[unsafe(method(init))]
879        #[unsafe(method_family = init)]
880        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
881
882        #[unsafe(method(new))]
883        #[unsafe(method_family = new)]
884        pub unsafe fn new() -> Retained<Self>;
885
886        #[cfg(all(feature = "AVCaptureInput", feature = "AVCaptureOutputBase"))]
887        /// Returns an AVCaptureConnection instance describing a connection between the specified inputPorts and the specified output.
888        ///
889        ///
890        /// Parameter `ports`: An array of AVCaptureInputPort objects associated with AVCaptureInput objects.
891        ///
892        /// Parameter `output`: An AVCaptureOutput object.
893        ///
894        /// Returns: An AVCaptureConnection instance joining the specified inputPorts to the specified output port.
895        ///
896        ///
897        /// 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.
898        #[unsafe(method(connectionWithInputPorts:output:))]
899        #[unsafe(method_family = none)]
900        pub unsafe fn connectionWithInputPorts_output(
901            ports: &NSArray<AVCaptureInputPort>,
902            output: &AVCaptureOutput,
903        ) -> Retained<Self>;
904
905        #[cfg(all(
906            feature = "AVCaptureInput",
907            feature = "AVCaptureVideoPreviewLayer",
908            feature = "objc2-quartz-core"
909        ))]
910        #[cfg(not(target_os = "watchos"))]
911        /// Returns an AVCaptureConnection instance describing a connection between the specified inputPort and the specified AVCaptureVideoPreviewLayer instance.
912        ///
913        ///
914        /// Parameter `port`: An AVCaptureInputPort object associated with an AVCaptureInput object.
915        ///
916        /// Parameter `layer`: An AVCaptureVideoPreviewLayer object.
917        ///
918        /// Returns: An AVCaptureConnection instance joining the specified inputPort to the specified video preview layer.
919        ///
920        ///
921        /// 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.
922        #[unsafe(method(connectionWithInputPort:videoPreviewLayer:))]
923        #[unsafe(method_family = none)]
924        pub unsafe fn connectionWithInputPort_videoPreviewLayer(
925            port: &AVCaptureInputPort,
926            layer: &AVCaptureVideoPreviewLayer,
927        ) -> Retained<Self>;
928
929        #[cfg(all(feature = "AVCaptureInput", feature = "AVCaptureOutputBase"))]
930        /// Returns an AVCaptureConnection instance describing a connection between the specified inputPorts and the specified output.
931        ///
932        ///
933        /// Parameter `ports`: An array of AVCaptureInputPort objects associated with AVCaptureInput objects.
934        ///
935        /// Parameter `output`: An AVCaptureOutput object.
936        ///
937        /// Returns: An AVCaptureConnection instance joining the specified inputPorts to the specified output port.
938        ///
939        ///
940        /// 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.
941        #[unsafe(method(initWithInputPorts:output:))]
942        #[unsafe(method_family = init)]
943        pub unsafe fn initWithInputPorts_output(
944            this: Allocated<Self>,
945            ports: &NSArray<AVCaptureInputPort>,
946            output: &AVCaptureOutput,
947        ) -> Retained<Self>;
948
949        #[cfg(all(
950            feature = "AVCaptureInput",
951            feature = "AVCaptureVideoPreviewLayer",
952            feature = "objc2-quartz-core"
953        ))]
954        #[cfg(not(target_os = "watchos"))]
955        /// Returns an AVCaptureConnection instance describing a connection between the specified inputPort
956        /// and the specified AVCaptureVideoPreviewLayer instance.
957        ///
958        ///
959        /// Parameter `port`: An AVCaptureInputPort object associated with an AVCaptureInput object.
960        ///
961        /// Parameter `layer`: An AVCaptureVideoPreviewLayer object.
962        ///
963        /// Returns: An AVCaptureConnection instance joining the specified inputPort to the specified video preview layer.
964        ///
965        ///
966        /// 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.
967        #[unsafe(method(initWithInputPort:videoPreviewLayer:))]
968        #[unsafe(method_family = init)]
969        pub unsafe fn initWithInputPort_videoPreviewLayer(
970            this: Allocated<Self>,
971            port: &AVCaptureInputPort,
972            layer: &AVCaptureVideoPreviewLayer,
973        ) -> Retained<Self>;
974
975        #[cfg(feature = "AVCaptureInput")]
976        /// An array of AVCaptureInputPort instances providing data through this connection.
977        ///
978        ///
979        /// 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.
980        #[unsafe(method(inputPorts))]
981        #[unsafe(method_family = none)]
982        pub unsafe fn inputPorts(&self) -> Retained<NSArray<AVCaptureInputPort>>;
983
984        #[cfg(feature = "AVCaptureOutputBase")]
985        /// The AVCaptureOutput instance consuming data from this connection's inputPorts.
986        ///
987        ///
988        /// 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.
989        #[unsafe(method(output))]
990        #[unsafe(method_family = none)]
991        pub unsafe fn output(&self) -> Option<Retained<AVCaptureOutput>>;
992
993        #[cfg(all(feature = "AVCaptureVideoPreviewLayer", feature = "objc2-quartz-core"))]
994        #[cfg(not(target_os = "watchos"))]
995        /// The AVCaptureVideoPreviewLayer instance consuming data from this connection's inputPort.
996        ///
997        ///
998        /// 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.
999        #[unsafe(method(videoPreviewLayer))]
1000        #[unsafe(method_family = none)]
1001        pub unsafe fn videoPreviewLayer(&self) -> Option<Retained<AVCaptureVideoPreviewLayer>>;
1002
1003        /// Indicates whether the connection's output should consume data.
1004        ///
1005        ///
1006        /// 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.
1007        #[unsafe(method(isEnabled))]
1008        #[unsafe(method_family = none)]
1009        pub unsafe fn isEnabled(&self) -> bool;
1010
1011        /// Setter for [`isEnabled`][Self::isEnabled].
1012        #[unsafe(method(setEnabled:))]
1013        #[unsafe(method_family = none)]
1014        pub unsafe fn setEnabled(&self, enabled: bool);
1015
1016        /// Indicates whether the receiver's output is currently capable of consuming data through this connection.
1017        ///
1018        ///
1019        /// 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.
1020        ///
1021        /// 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.
1022        #[unsafe(method(isActive))]
1023        #[unsafe(method_family = none)]
1024        pub unsafe fn isActive(&self) -> bool;
1025
1026        /// An array of AVCaptureAudioChannel objects representing individual channels of audio data flowing through the connection.
1027        ///
1028        ///
1029        /// 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.
1030        #[unsafe(method(audioChannels))]
1031        #[unsafe(method_family = none)]
1032        pub unsafe fn audioChannels(&self) -> Retained<NSArray<AVCaptureAudioChannel>>;
1033
1034        /// Indicates whether the connection supports setting the videoMirrored property.
1035        ///
1036        ///
1037        /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMirrored property may only be set if
1038        /// -isVideoMirroringSupported returns YES.
1039        #[unsafe(method(isVideoMirroringSupported))]
1040        #[unsafe(method_family = none)]
1041        pub unsafe fn isVideoMirroringSupported(&self) -> bool;
1042
1043        /// Indicates whether the video flowing through the connection should be mirrored about its vertical axis.
1044        ///
1045        ///
1046        /// 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.
1047        #[unsafe(method(isVideoMirrored))]
1048        #[unsafe(method_family = none)]
1049        pub unsafe fn isVideoMirrored(&self) -> bool;
1050
1051        /// Setter for [`isVideoMirrored`][Self::isVideoMirrored].
1052        #[unsafe(method(setVideoMirrored:))]
1053        #[unsafe(method_family = none)]
1054        pub unsafe fn setVideoMirrored(&self, video_mirrored: bool);
1055
1056        /// Specifies whether or not the value of
1057        /// "
1058        /// videoMirrored" can change based on configuration of the session.
1059        ///
1060        ///
1061        /// 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
1062        /// "
1063        /// videoMirrored" may change depending on the configuration of the session, for example after switching to a different AVCaptureDeviceInput. The default value is YES.
1064        #[unsafe(method(automaticallyAdjustsVideoMirroring))]
1065        #[unsafe(method_family = none)]
1066        pub unsafe fn automaticallyAdjustsVideoMirroring(&self) -> bool;
1067
1068        /// Setter for [`automaticallyAdjustsVideoMirroring`][Self::automaticallyAdjustsVideoMirroring].
1069        #[unsafe(method(setAutomaticallyAdjustsVideoMirroring:))]
1070        #[unsafe(method_family = none)]
1071        pub unsafe fn setAutomaticallyAdjustsVideoMirroring(
1072            &self,
1073            automatically_adjusts_video_mirroring: bool,
1074        );
1075
1076        #[cfg(feature = "objc2-core-foundation")]
1077        /// Returns whether the connection supports the given rotation angle in degrees.
1078        ///
1079        ///
1080        /// Parameter `videoRotationAngle`: A video rotation angle to be checked.
1081        ///
1082        /// Returns: YES if the connection supports the given video rotation angle, NO otherwise.
1083        ///
1084        ///
1085        /// 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.
1086        #[unsafe(method(isVideoRotationAngleSupported:))]
1087        #[unsafe(method_family = none)]
1088        pub unsafe fn isVideoRotationAngleSupported(&self, video_rotation_angle: CGFloat) -> bool;
1089
1090        #[cfg(feature = "objc2-core-foundation")]
1091        /// Indicates whether the video flowing through the connection should be rotated with a given angle in degrees.
1092        ///
1093        ///
1094        /// 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].
1095        ///
1096        /// 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.
1097        #[unsafe(method(videoRotationAngle))]
1098        #[unsafe(method_family = none)]
1099        pub unsafe fn videoRotationAngle(&self) -> CGFloat;
1100
1101        #[cfg(feature = "objc2-core-foundation")]
1102        /// Setter for [`videoRotationAngle`][Self::videoRotationAngle].
1103        #[unsafe(method(setVideoRotationAngle:))]
1104        #[unsafe(method_family = none)]
1105        pub unsafe fn setVideoRotationAngle(&self, video_rotation_angle: CGFloat);
1106
1107        /// Indicates whether the connection supports setting the videoOrientation property.
1108        ///
1109        ///
1110        /// This property is deprecated. Use -isVideoRotationAngleSupported: instead.
1111        #[deprecated = "Use -isVideoRotationAngleSupported: instead"]
1112        #[unsafe(method(isVideoOrientationSupported))]
1113        #[unsafe(method_family = none)]
1114        pub unsafe fn isVideoOrientationSupported(&self) -> bool;
1115
1116        /// Indicates whether the video flowing through the connection should be rotated to a given orientation.
1117        ///
1118        ///
1119        /// This property is deprecated. Use -videoRotationAngle instead. This property may only be set if -isVideoOrientationSupported returns YES, otherwise an NSInvalidArgumentException is thrown.
1120        #[deprecated = "Use -videoRotationAngle instead"]
1121        #[unsafe(method(videoOrientation))]
1122        #[unsafe(method_family = none)]
1123        pub unsafe fn videoOrientation(&self) -> AVCaptureVideoOrientation;
1124
1125        /// Setter for [`videoOrientation`][Self::videoOrientation].
1126        #[deprecated = "Use -videoRotationAngle instead"]
1127        #[unsafe(method(setVideoOrientation:))]
1128        #[unsafe(method_family = none)]
1129        pub unsafe fn setVideoOrientation(&self, video_orientation: AVCaptureVideoOrientation);
1130
1131        /// Indicates whether the connection supports setting the videoFieldMode property.
1132        ///
1133        ///
1134        /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoFieldMode property may only be set if -isVideoFieldModeSupported returns YES.
1135        #[unsafe(method(isVideoFieldModeSupported))]
1136        #[unsafe(method_family = none)]
1137        pub unsafe fn isVideoFieldModeSupported(&self) -> bool;
1138
1139        /// Indicates how interlaced video flowing through the connection should be treated.
1140        ///
1141        ///
1142        /// 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.
1143        #[unsafe(method(videoFieldMode))]
1144        #[unsafe(method_family = none)]
1145        pub unsafe fn videoFieldMode(&self) -> AVVideoFieldMode;
1146
1147        /// Setter for [`videoFieldMode`][Self::videoFieldMode].
1148        #[unsafe(method(setVideoFieldMode:))]
1149        #[unsafe(method_family = none)]
1150        pub unsafe fn setVideoFieldMode(&self, video_field_mode: AVVideoFieldMode);
1151
1152        /// Indicates whether the connection supports setting the videoMinFrameDuration property.
1153        ///
1154        ///
1155        /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMinFrameDuration property may only be set if -isVideoMinFrameDurationSupported returns YES.
1156        ///
1157        /// 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.
1158        #[deprecated = "Use AVCaptureDevice's activeFormat.videoSupportedFrameRateRanges instead."]
1159        #[unsafe(method(isVideoMinFrameDurationSupported))]
1160        #[unsafe(method_family = none)]
1161        pub unsafe fn isVideoMinFrameDurationSupported(&self) -> bool;
1162
1163        #[cfg(feature = "objc2-core-media")]
1164        /// Indicates the minimum time interval at which the receiver should output consecutive video frames.
1165        ///
1166        ///
1167        /// 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.
1168        ///
1169        /// 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.
1170        #[deprecated = "Use AVCaptureDevice's activeVideoMinFrameDuration instead."]
1171        #[unsafe(method(videoMinFrameDuration))]
1172        #[unsafe(method_family = none)]
1173        pub unsafe fn videoMinFrameDuration(&self) -> CMTime;
1174
1175        #[cfg(feature = "objc2-core-media")]
1176        /// Setter for [`videoMinFrameDuration`][Self::videoMinFrameDuration].
1177        #[deprecated = "Use AVCaptureDevice's activeVideoMinFrameDuration instead."]
1178        #[unsafe(method(setVideoMinFrameDuration:))]
1179        #[unsafe(method_family = none)]
1180        pub unsafe fn setVideoMinFrameDuration(&self, video_min_frame_duration: CMTime);
1181
1182        /// Indicates whether the connection supports setting the videoMaxFrameDuration property.
1183        ///
1184        ///
1185        /// This property is only applicable to AVCaptureConnection instances involving video. In such connections, the videoMaxFrameDuration property may only be set if -isVideoMaxFrameDurationSupported returns YES.
1186        ///
1187        /// 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.
1188        #[deprecated = "Use AVCaptureDevice's activeFormat.videoSupportedFrameRateRanges instead."]
1189        #[unsafe(method(isVideoMaxFrameDurationSupported))]
1190        #[unsafe(method_family = none)]
1191        pub unsafe fn isVideoMaxFrameDurationSupported(&self) -> bool;
1192
1193        #[cfg(feature = "objc2-core-media")]
1194        /// Indicates the maximum time interval at which the receiver should output consecutive video frames.
1195        ///
1196        ///
1197        /// 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.
1198        ///
1199        /// 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.
1200        #[deprecated = "Use AVCaptureDevice's activeVideoMaxFrameDuration instead."]
1201        #[unsafe(method(videoMaxFrameDuration))]
1202        #[unsafe(method_family = none)]
1203        pub unsafe fn videoMaxFrameDuration(&self) -> CMTime;
1204
1205        #[cfg(feature = "objc2-core-media")]
1206        /// Setter for [`videoMaxFrameDuration`][Self::videoMaxFrameDuration].
1207        #[deprecated = "Use AVCaptureDevice's activeVideoMaxFrameDuration instead."]
1208        #[unsafe(method(setVideoMaxFrameDuration:))]
1209        #[unsafe(method_family = none)]
1210        pub unsafe fn setVideoMaxFrameDuration(&self, video_max_frame_duration: CMTime);
1211
1212        #[cfg(feature = "objc2-core-foundation")]
1213        /// Indicates the maximum video scale and crop factor supported by the receiver.
1214        ///
1215        ///
1216        /// 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.
1217        #[unsafe(method(videoMaxScaleAndCropFactor))]
1218        #[unsafe(method_family = none)]
1219        pub unsafe fn videoMaxScaleAndCropFactor(&self) -> CGFloat;
1220
1221        #[cfg(feature = "objc2-core-foundation")]
1222        /// Indicates the current video scale and crop factor in use by the receiver.
1223        ///
1224        ///
1225        /// 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.
1226        ///
1227        ///
1228        /// See: -[AVCaptureDevice videoZoomFactor]
1229        #[unsafe(method(videoScaleAndCropFactor))]
1230        #[unsafe(method_family = none)]
1231        pub unsafe fn videoScaleAndCropFactor(&self) -> CGFloat;
1232
1233        #[cfg(feature = "objc2-core-foundation")]
1234        /// Setter for [`videoScaleAndCropFactor`][Self::videoScaleAndCropFactor].
1235        #[unsafe(method(setVideoScaleAndCropFactor:))]
1236        #[unsafe(method_family = none)]
1237        pub unsafe fn setVideoScaleAndCropFactor(&self, video_scale_and_crop_factor: CGFloat);
1238
1239        #[cfg(feature = "AVCaptureDevice")]
1240        /// Indicates the stabilization mode to apply to video flowing through the receiver when it is supported.
1241        ///
1242        ///
1243        /// 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.
1244        #[unsafe(method(preferredVideoStabilizationMode))]
1245        #[unsafe(method_family = none)]
1246        pub unsafe fn preferredVideoStabilizationMode(&self) -> AVCaptureVideoStabilizationMode;
1247
1248        #[cfg(feature = "AVCaptureDevice")]
1249        /// Setter for [`preferredVideoStabilizationMode`][Self::preferredVideoStabilizationMode].
1250        #[unsafe(method(setPreferredVideoStabilizationMode:))]
1251        #[unsafe(method_family = none)]
1252        pub unsafe fn setPreferredVideoStabilizationMode(
1253            &self,
1254            preferred_video_stabilization_mode: AVCaptureVideoStabilizationMode,
1255        );
1256
1257        #[cfg(feature = "AVCaptureDevice")]
1258        /// Indicates the stabilization mode currently being applied to video flowing through the receiver.
1259        ///
1260        ///
1261        /// 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.
1262        #[unsafe(method(activeVideoStabilizationMode))]
1263        #[unsafe(method_family = none)]
1264        pub unsafe fn activeVideoStabilizationMode(&self) -> AVCaptureVideoStabilizationMode;
1265
1266        /// Indicates whether the connection supports video stabilization.
1267        ///
1268        ///
1269        /// 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.
1270        #[unsafe(method(isVideoStabilizationSupported))]
1271        #[unsafe(method_family = none)]
1272        pub unsafe fn isVideoStabilizationSupported(&self) -> bool;
1273
1274        /// Indicates whether stabilization is currently being applied to video flowing through the receiver.
1275        ///
1276        ///
1277        /// 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.
1278        #[deprecated = "Use activeVideoStabilizationMode instead."]
1279        #[unsafe(method(isVideoStabilizationEnabled))]
1280        #[unsafe(method_family = none)]
1281        pub unsafe fn isVideoStabilizationEnabled(&self) -> bool;
1282
1283        /// Indicates whether stabilization should be applied to video flowing through the receiver when the feature is available.
1284        ///
1285        ///
1286        /// 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.
1287        #[deprecated = "Use preferredVideoStabilizationMode instead."]
1288        #[unsafe(method(enablesVideoStabilizationWhenAvailable))]
1289        #[unsafe(method_family = none)]
1290        pub unsafe fn enablesVideoStabilizationWhenAvailable(&self) -> bool;
1291
1292        /// Setter for [`enablesVideoStabilizationWhenAvailable`][Self::enablesVideoStabilizationWhenAvailable].
1293        #[deprecated = "Use preferredVideoStabilizationMode instead."]
1294        #[unsafe(method(setEnablesVideoStabilizationWhenAvailable:))]
1295        #[unsafe(method_family = none)]
1296        pub unsafe fn setEnablesVideoStabilizationWhenAvailable(
1297            &self,
1298            enables_video_stabilization_when_available: bool,
1299        );
1300
1301        /// Indicates whether the connection supports camera intrinsic matrix delivery.
1302        ///
1303        ///
1304        /// 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.
1305        #[unsafe(method(isCameraIntrinsicMatrixDeliverySupported))]
1306        #[unsafe(method_family = none)]
1307        pub unsafe fn isCameraIntrinsicMatrixDeliverySupported(&self) -> bool;
1308
1309        /// Indicates whether camera intrinsic matrix delivery should be enabled.
1310        ///
1311        ///
1312        /// 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.
1313        #[unsafe(method(isCameraIntrinsicMatrixDeliveryEnabled))]
1314        #[unsafe(method_family = none)]
1315        pub unsafe fn isCameraIntrinsicMatrixDeliveryEnabled(&self) -> bool;
1316
1317        /// Setter for [`isCameraIntrinsicMatrixDeliveryEnabled`][Self::isCameraIntrinsicMatrixDeliveryEnabled].
1318        #[unsafe(method(setCameraIntrinsicMatrixDeliveryEnabled:))]
1319        #[unsafe(method_family = none)]
1320        pub unsafe fn setCameraIntrinsicMatrixDeliveryEnabled(
1321            &self,
1322            camera_intrinsic_matrix_delivery_enabled: bool,
1323        );
1324    );
1325}
1326
1327extern_class!(
1328    /// AVCaptureAudioChannel represents a single channel of audio flowing through an AVCaptureSession.
1329    ///
1330    ///
1331    /// 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.
1332    ///
1333    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureaudiochannel?language=objc)
1334    #[unsafe(super(NSObject))]
1335    #[derive(Debug, PartialEq, Eq, Hash)]
1336    pub struct AVCaptureAudioChannel;
1337);
1338
1339extern_conformance!(
1340    unsafe impl NSObjectProtocol for AVCaptureAudioChannel {}
1341);
1342
1343impl AVCaptureAudioChannel {
1344    extern_methods!(
1345        #[unsafe(method(init))]
1346        #[unsafe(method_family = init)]
1347        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1348
1349        #[unsafe(method(new))]
1350        #[unsafe(method_family = new)]
1351        pub unsafe fn new() -> Retained<Self>;
1352
1353        /// A measurement of the instantaneous average power level of the audio flowing through the receiver.
1354        ///
1355        ///
1356        /// 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.
1357        #[unsafe(method(averagePowerLevel))]
1358        #[unsafe(method_family = none)]
1359        pub unsafe fn averagePowerLevel(&self) -> c_float;
1360
1361        /// A measurement of the peak/hold level of the audio flowing through the receiver.
1362        ///
1363        ///
1364        /// 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.
1365        #[unsafe(method(peakHoldLevel))]
1366        #[unsafe(method_family = none)]
1367        pub unsafe fn peakHoldLevel(&self) -> c_float;
1368
1369        /// A property indicating the current volume (gain) of the receiver.
1370        ///
1371        ///
1372        /// 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.
1373        #[unsafe(method(volume))]
1374        #[unsafe(method_family = none)]
1375        pub unsafe fn volume(&self) -> c_float;
1376
1377        /// Setter for [`volume`][Self::volume].
1378        #[unsafe(method(setVolume:))]
1379        #[unsafe(method_family = none)]
1380        pub unsafe fn setVolume(&self, volume: c_float);
1381
1382        /// A property indicating whether the receiver is currently enabled for data capture.
1383        ///
1384        ///
1385        /// 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.
1386        #[unsafe(method(isEnabled))]
1387        #[unsafe(method_family = none)]
1388        pub unsafe fn isEnabled(&self) -> bool;
1389
1390        /// Setter for [`isEnabled`][Self::isEnabled].
1391        #[unsafe(method(setEnabled:))]
1392        #[unsafe(method_family = none)]
1393        pub unsafe fn setEnabled(&self, enabled: bool);
1394    );
1395}