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