objc2_av_foundation/generated/
AVCaptureDevice.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#[cfg(feature = "objc2-quartz-core")]
12#[cfg(not(target_os = "watchos"))]
13use objc2_quartz_core::*;
14
15use crate::*;
16
17extern "C" {
18    /// Posted when a device becomes available on the system.
19    ///
20    ///
21    /// The notification object is an AVCaptureDevice instance representing the device that became available.
22    ///
23    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicewasconnectednotification?language=objc)
24    pub static AVCaptureDeviceWasConnectedNotification: &'static NSNotificationName;
25}
26
27extern "C" {
28    /// Posted when a device becomes unavailable on the system.
29    ///
30    ///
31    /// The notification object is an AVCaptureDevice instance representing the device that became unavailable.
32    ///
33    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicewasdisconnectednotification?language=objc)
34    pub static AVCaptureDeviceWasDisconnectedNotification: &'static NSNotificationName;
35}
36
37extern "C" {
38    /// Posted when the instance of AVCaptureDevice has detected a substantial change to the video subject area.
39    ///
40    ///
41    /// Clients may observe the AVCaptureDeviceSubjectAreaDidChangeNotification to know when an instance of AVCaptureDevice has detected a substantial change to the video subject area. This notification is only sent if you first set subjectAreaChangeMonitoringEnabled to YES.
42    ///
43    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicesubjectareadidchangenotification?language=objc)
44    pub static AVCaptureDeviceSubjectAreaDidChangeNotification: &'static NSNotificationName;
45}
46
47extern_class!(
48    /// An AVCaptureDevice represents a physical device that provides realtime input media data, such as video and audio.
49    ///
50    ///
51    /// Each instance of AVCaptureDevice corresponds to a device, such as a camera or microphone. Instances of AVCaptureDevice cannot be created directly. An array of all currently available devices can also be obtained using the AVCaptureDeviceDiscoverySession. Devices can provide one or more streams of a given media type. Applications can search for devices matching desired criteria by using AVCaptureDeviceDiscoverySession, or may obtain a reference to the default device matching desired criteria by using +[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
52    ///
53    /// Instances of AVCaptureDevice can be used to provide media data to an AVCaptureSession by creating an AVCaptureDeviceInput with the device and adding that to the capture session.
54    ///
55    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevice?language=objc)
56    #[unsafe(super(NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct AVCaptureDevice;
59);
60
61unsafe impl NSObjectProtocol for AVCaptureDevice {}
62
63impl AVCaptureDevice {
64    extern_methods!(
65        #[unsafe(method(init))]
66        #[unsafe(method_family = init)]
67        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
68
69        #[unsafe(method(new))]
70        #[unsafe(method_family = new)]
71        pub unsafe fn new() -> Retained<Self>;
72
73        /// Returns an array of devices currently available for use as media input sources.
74        ///
75        ///
76        /// Returns: An NSArray of AVCaptureDevice instances for each available device.
77        ///
78        ///
79        /// This method returns an array of AVCaptureDevice instances for input devices currently connected and available for capture. The returned array contains all devices that are available at the time the method is called. Applications should observe AVCaptureDeviceWasConnectedNotification and AVCaptureDeviceWasDisconnectedNotification to be notified when the list of available devices has changed.
80        #[deprecated = "Use AVCaptureDeviceDiscoverySession instead."]
81        #[unsafe(method(devices))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn devices() -> Retained<NSArray<AVCaptureDevice>>;
84
85        #[cfg(feature = "AVMediaFormat")]
86        /// Returns an array of devices currently available for use as sources of media with the given media type.
87        ///
88        ///
89        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by each returned device.
90        ///
91        /// Returns: An NSArray of AVCaptureDevice instances for each available device.
92        ///
93        ///
94        /// This method returns an array of AVCaptureDevice instances for input devices currently connected and available for capture that provide media of the given type. Media type constants are defined in AVMediaFormat.h. The returned array contains all devices that are available at the time the method is called. Applications should observe AVCaptureDeviceWasConnectedNotification and AVCaptureDeviceWasDisconnectedNotification to be notified when the list of available devices has changed.
95        #[deprecated = "Use AVCaptureDeviceDiscoverySession instead."]
96        #[unsafe(method(devicesWithMediaType:))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn devicesWithMediaType(
99            media_type: &AVMediaType,
100        ) -> Retained<NSArray<AVCaptureDevice>>;
101
102        #[cfg(feature = "AVMediaFormat")]
103        /// Returns an AVCaptureDevice instance for the default device of the given media type.
104        ///
105        ///
106        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by the returned device.
107        ///
108        /// Returns: The default device with the given media type, or nil if no device with that media type exists.
109        ///
110        ///
111        /// This method returns the default device of the given media type currently available on the system. For example, for AVMediaTypeVideo, this method will return the built in camera that is primarily used for capture and recording. Media type constants are defined in AVMediaFormat.h.
112        #[unsafe(method(defaultDeviceWithMediaType:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn defaultDeviceWithMediaType(
115            media_type: &AVMediaType,
116        ) -> Option<Retained<AVCaptureDevice>>;
117
118        /// Returns an AVCaptureDevice instance with the given unique ID.
119        ///
120        ///
121        /// Parameter `deviceUniqueID`: The unique ID of the device instance to be returned.
122        ///
123        /// Returns: An AVCaptureDevice instance with the given unique ID, or nil if no device with that unique ID is available.
124        ///
125        ///
126        /// Every available capture device has a unique ID that persists on one system across device connections and disconnections, application restarts, and reboots of the system itself. This method can be used to recall or track the status of a specific device whose unique ID has previously been saved.
127        #[unsafe(method(deviceWithUniqueID:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn deviceWithUniqueID(
130            device_unique_id: &NSString,
131        ) -> Option<Retained<AVCaptureDevice>>;
132
133        /// An ID unique to the model of device corresponding to the receiver.
134        ///
135        ///
136        /// Every available capture device has a unique ID that persists on one system across device connections and disconnections, application restarts, and reboots of the system itself. Applications can store the value returned by this property to recall or track the status of a specific device in the future.
137        #[unsafe(method(uniqueID))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn uniqueID(&self) -> Retained<NSString>;
140
141        /// The model ID of the receiver.
142        ///
143        ///
144        /// The value of this property is an identifier unique to all devices of the same model. The value is persistent across device connections and disconnections, and across different systems. For example, the model ID of the camera built in to two identical iPhone models will be the same even though they are different physical devices.
145        #[unsafe(method(modelID))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn modelID(&self) -> Retained<NSString>;
148
149        /// A localized human-readable name for the receiver.
150        ///
151        ///
152        /// This property can be used for displaying the name of a capture device in a user interface.
153        #[unsafe(method(localizedName))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn localizedName(&self) -> Retained<NSString>;
156
157        /// The human-readable manufacturer name for the receiver.
158        ///
159        ///
160        /// This property can be used to identify capture devices from a particular manufacturer. All Apple devices return "Apple Inc.". Devices from third party manufacturers may return an empty string.
161        #[unsafe(method(manufacturer))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn manufacturer(&self) -> Retained<NSString>;
164
165        /// The transport type of the receiver (e.g. USB, PCI, etc).
166        ///
167        ///
168        /// This property can be used to discover the transport type of a capture device. Transport types are defined in
169        /// <IOKit
170        /// /audio/IOAudioTypes.h> as kIOAudioDeviceTransportType*.
171        #[unsafe(method(transportType))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn transportType(&self) -> i32;
174
175        #[cfg(feature = "AVMediaFormat")]
176        /// Returns whether the receiver provides media with the given media type.
177        ///
178        ///
179        /// Parameter `mediaType`: A media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed.
180        ///
181        /// Returns: YES if the device outputs the given media type, NO otherwise.
182        ///
183        ///
184        /// Media type constants are defined in AVMediaFormat.h.
185        #[unsafe(method(hasMediaType:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn hasMediaType(&self, media_type: &AVMediaType) -> bool;
188
189        /// Requests exclusive access to configure device hardware properties.
190        ///
191        ///
192        /// Parameter `outError`: On return, if the device could not be locked, points to an NSError describing why the failure occurred.
193        ///
194        /// Returns: A BOOL indicating whether the device was successfully locked for configuration.
195        ///
196        ///
197        /// In order to set hardware properties on an AVCaptureDevice, such as focusMode and exposureMode, clients must first acquire a lock on the device. Clients should only hold the device lock if they require settable device properties to remain unchanged. Holding the device lock unnecessarily may degrade capture quality in other applications sharing the device.
198        #[unsafe(method(lockForConfiguration:_))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn lockForConfiguration(&self) -> Result<(), Retained<NSError>>;
201
202        /// Release exclusive control over device hardware properties.
203        ///
204        ///
205        /// This method should be called to match an invocation of lockForConfiguration: when an application no longer needs to keep device hardware properties from changing automatically.
206        #[unsafe(method(unlockForConfiguration))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn unlockForConfiguration(&self);
209
210        #[cfg(feature = "AVCaptureSessionPreset")]
211        /// Returns whether the receiver can be used in an AVCaptureSession configured with the given preset.
212        ///
213        ///
214        /// Parameter `preset`: An AVCaptureSession preset.
215        ///
216        /// Returns: YES if the receiver can be used with the given preset, NO otherwise.
217        ///
218        ///
219        /// 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 can be used in a capture session with the given preset. Presets are defined in AVCaptureSession.h.
220        #[unsafe(method(supportsAVCaptureSessionPreset:))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn supportsAVCaptureSessionPreset(
223            &self,
224            preset: &AVCaptureSessionPreset,
225        ) -> bool;
226
227        /// Indicates whether the device is connected and available to the system.
228        ///
229        ///
230        /// The value of this property is a BOOL indicating whether the device represented by the receiver is connected and available for use as a capture device. Clients can key value observe the value of this property to be notified when a device is no longer available. When the value of this property becomes NO for a given instance, it will not become YES again. If the same physical device again becomes available to the system, it will be represented using a new instance of AVCaptureDevice.
231        #[unsafe(method(isConnected))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn isConnected(&self) -> bool;
234
235        /// Indicates whether the device is in use by another application.
236        ///
237        ///
238        /// The value of this property is a BOOL indicating whether the device represented by the receiver is in use by another application. Clients can key value observe the value of this property to be notified when another app starts or stops using this device.
239        #[unsafe(method(isInUseByAnotherApplication))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn isInUseByAnotherApplication(&self) -> bool;
242
243        /// Indicates whether the device is suspended.
244        ///
245        ///
246        /// The value of this property is a BOOL indicating whether the device represented by the receiver is currently suspended. Some devices disallow data capture due to a feature on the device. For example, isSuspended returns YES for the external iSight when its privacy iris is closed, or for the internal iSight on a notebook when the notebook's display is closed. Clients can key value observe the value of this property to be notified when the device becomes suspended or unsuspended.
247        #[unsafe(method(isSuspended))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn isSuspended(&self) -> bool;
250
251        /// An array of AVCaptureDevice objects physically linked to the receiver.
252        ///
253        ///
254        /// The value of this property is an array of AVCaptureDevice objects that are a part of the same physical device as the receiver. For example, for the external iSight camera, linkedDevices returns an array containing an AVCaptureDevice for the external iSight microphone.
255        #[unsafe(method(linkedDevices))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn linkedDevices(&self) -> Retained<NSArray<AVCaptureDevice>>;
258
259        /// An array of AVCaptureDeviceFormat objects supported by the receiver.
260        ///
261        ///
262        /// This property can be used to enumerate the formats natively supported by the receiver. The capture device's activeFormat property may be set to one of the formats in this array. Clients can observe automatic changes to the receiver's formats by key value observing this property.
263        #[unsafe(method(formats))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn formats(&self) -> Retained<NSArray<AVCaptureDeviceFormat>>;
266
267        /// The currently active format of the receiver.
268        ///
269        ///
270        /// This property can be used to get or set the currently active device format.
271        ///
272        /// -setActiveFormat: throws an NSInvalidArgumentException if set to a format not present in the formats array.
273        ///
274        /// -setActiveFormat: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
275        ///
276        /// Clients can observe automatic changes to the receiver's activeFormat by key value observing this property.
277        ///
278        /// On iOS, use of AVCaptureDevice's setActiveFormat: and AVCaptureSession's setSessionPreset: are mutually exclusive. If you set a capture device's active format, the session to which it is attached changes its preset to AVCaptureSessionPresetInputPriority. Likewise if you set the AVCaptureSession's sessionPreset property, the session assumes control of its input devices, and configures their activeFormat appropriately. Note that audio devices do not expose any user-configurable formats on iOS. To configure audio input on iOS, you should use the AVAudioSession APIs instead (see AVAudioSession.h).
279        ///
280        /// The activeFormat, activeVideoMinFrameDuration, and activeVideoMaxFrameDuration properties may be set simultaneously by using AVCaptureSession's begin/commitConfiguration methods:
281        ///
282        /// [session beginConfiguration]; // the session to which the receiver's AVCaptureDeviceInput is added.
283        /// if ( [device lockForConfiguration:
284        /// &error
285        /// ] ) {
286        /// [device setActiveFormat:newFormat];
287        /// [device setActiveVideoMinFrameDuration:newMinDuration];
288        /// [device setActiveVideoMaxFrameDuration:newMaxDuration];
289        /// [device unlockForConfiguration];
290        /// }
291        /// [session commitConfiguration]; // The new format and frame rates are applied together in commitConfiguration
292        ///
293        /// Note that when configuring a session to use an active format intended for high resolution still photography and applying one or more of the following operations to an AVCaptureVideoDataOutput, the system may not meet the target framerate: zoom, orientation changes, format conversion.
294        #[unsafe(method(activeFormat))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn activeFormat(&self) -> Retained<AVCaptureDeviceFormat>;
297
298        /// Setter for [`activeFormat`][Self::activeFormat].
299        #[unsafe(method(setActiveFormat:))]
300        #[unsafe(method_family = none)]
301        pub unsafe fn setActiveFormat(&self, active_format: &AVCaptureDeviceFormat);
302
303        #[cfg(feature = "objc2-core-media")]
304        /// A property indicating the receiver's current active minimum frame duration (the reciprocal of its max frame rate).
305        ///
306        ///
307        /// An AVCaptureDevice's activeVideoMinFrameDuration property is the reciprocal of its active maximum frame rate. To limit the max frame rate of the capture device, clients may set this property to a value supported by the receiver's activeFormat (see AVCaptureDeviceFormat's videoSupportedFrameRateRanges property). Clients may set this property's value to kCMTimeInvalid to return activeVideoMinFrameDuration to its default value for the given activeFormat.
308        ///
309        /// -setActiveVideoMinFrameDuration: throws an NSInvalidArgumentException if set to an unsupported value.
310        ///
311        /// -setActiveVideoMinFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
312        ///
313        /// Clients can observe automatic changes to the receiver's activeVideoMinFrameDuration by key value observing this property.
314        ///
315        /// On iOS, the receiver's activeVideoMinFrameDuration resets to its default value under the following conditions:
316        /// - The receiver's activeFormat changes
317        /// - The receiver's AVCaptureDeviceInput's session's sessionPreset changes
318        /// - The receiver's AVCaptureDeviceInput is added to a session
319        ///
320        /// When exposureMode is AVCaptureExposureModeCustom, setting the activeVideoMinFrameDuration affects max frame rate, but not exposureDuration. You may use setExposureModeCustomWithDuration:ISO:completionHandler: to set a shorter exposureDuration than your activeVideoMinFrameDuration, if desired.
321        ///
322        /// When autoVideoFrameRateEnabled is true, setting activeVideoMinFrameDuration throws an NSInvalidArgumentException.
323        #[unsafe(method(activeVideoMinFrameDuration))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn activeVideoMinFrameDuration(&self) -> CMTime;
326
327        #[cfg(feature = "objc2-core-media")]
328        /// Setter for [`activeVideoMinFrameDuration`][Self::activeVideoMinFrameDuration].
329        #[unsafe(method(setActiveVideoMinFrameDuration:))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn setActiveVideoMinFrameDuration(
332            &self,
333            active_video_min_frame_duration: CMTime,
334        );
335
336        #[cfg(feature = "objc2-core-media")]
337        /// A property indicating the receiver's current active maximum frame duration (the reciprocal of its min frame rate).
338        ///
339        ///
340        /// An AVCaptureDevice's activeVideoMaxFrameDuration property is the reciprocal of its active minimum frame rate. To limit the min frame rate of the capture device, clients may set this property to a value supported by the receiver's activeFormat (see AVCaptureDeviceFormat's videoSupportedFrameRateRanges property). Clients may set this property's value to kCMTimeInvalid to return activeVideoMaxFrameDuration to its default value for the given activeFormat.
341        ///
342        /// -setActiveVideoMaxFrameDuration: throws an NSInvalidArgumentException if set to an unsupported value.
343        ///
344        /// -setActiveVideoMaxFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
345        ///
346        /// Clients can observe automatic changes to the receiver's activeVideoMaxFrameDuration by key value observing this property.
347        ///
348        /// On iOS, the receiver's activeVideoMaxFrameDuration resets to its default value under the following conditions:
349        /// - The receiver's activeFormat changes
350        /// - The receiver's AVCaptureDeviceInput's session's sessionPreset changes
351        /// - The receiver's AVCaptureDeviceInput is added to a session
352        ///
353        /// When exposureMode is AVCaptureExposureModeCustom, frame rate and exposure duration are interrelated. If you call setExposureModeCustomWithDuration:ISO:completionHandler: with an exposureDuration longer than the current activeVideoMaxFrameDuration, the activeVideoMaxFrameDuration will be lengthened to accommodate the longer exposure time. Setting a shorter exposure duration does not automatically change the activeVideoMinFrameDuration or activeVideoMaxFrameDuration. To explicitly increase the frame rate in custom exposure mode, you must set the activeVideoMaxFrameDuration to a shorter value. If your new max frame duration is shorter than the current exposureDuration, the exposureDuration will shorten as well to accommodate the new frame rate.
354        ///
355        /// When autoVideoFrameRateEnabled is true, setting activeVideoMaxFrameDuration throws an NSInvalidArgumentException.
356        #[unsafe(method(activeVideoMaxFrameDuration))]
357        #[unsafe(method_family = none)]
358        pub unsafe fn activeVideoMaxFrameDuration(&self) -> CMTime;
359
360        #[cfg(feature = "objc2-core-media")]
361        /// Setter for [`activeVideoMaxFrameDuration`][Self::activeVideoMaxFrameDuration].
362        #[unsafe(method(setActiveVideoMaxFrameDuration:))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn setActiveVideoMaxFrameDuration(
365            &self,
366            active_video_max_frame_duration: CMTime,
367        );
368
369        /// Indicates whether the receiver should enable auto video frame rate.
370        ///
371        /// When enabled the receiver automatically adjusts the active frame rate, depending on light level. Under low light conditions, frame rate is decreased to properly expose the scene. For formats with a maximum frame rate of 30 fps, the frame rate switches between 30 - 24. For formats with a maximum frame rate of 60 fps, the frame rate switches between 60 - 30 - 24.
372        ///
373        /// Setting this property throws an NSInvalidArgumentException if the active format's -isAutoVideoFrameRateSupported returns NO. Changing the device's active format resets isAutoVideoFrameRateEnabled to its default value of NO.
374        ///
375        /// When autoVideoFrameRateEnabled is true, setting activeVideoMinFrameDuration or activeVideoMaxFrameDuration throws an NSInvalidArgumentException.
376        #[unsafe(method(isAutoVideoFrameRateEnabled))]
377        #[unsafe(method_family = none)]
378        pub unsafe fn isAutoVideoFrameRateEnabled(&self) -> bool;
379
380        /// Setter for [`isAutoVideoFrameRateEnabled`][Self::isAutoVideoFrameRateEnabled].
381        #[unsafe(method(setAutoVideoFrameRateEnabled:))]
382        #[unsafe(method_family = none)]
383        pub unsafe fn setAutoVideoFrameRateEnabled(&self, auto_video_frame_rate_enabled: bool);
384
385        /// An array of AVCaptureDeviceInputSource objects supported by the receiver.
386        ///
387        ///
388        /// Some devices can capture data from one of multiple data sources (different input jacks on the same audio device, for example). For devices with multiple possible data sources, inputSources can be used to enumerate the possible choices. Clients can observe automatic changes to the receiver's inputSources by key value observing this property.
389        #[unsafe(method(inputSources))]
390        #[unsafe(method_family = none)]
391        pub unsafe fn inputSources(&self) -> Retained<NSArray<AVCaptureDeviceInputSource>>;
392
393        /// The currently active input source of the receiver.
394        ///
395        ///
396        /// This property can be used to get or set the currently active device input source. -setActiveInputSource: throws an NSInvalidArgumentException if set to a value not present in the inputSources array. -setActiveInputSource: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's activeInputSource by key value observing this property.
397        #[unsafe(method(activeInputSource))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn activeInputSource(&self) -> Option<Retained<AVCaptureDeviceInputSource>>;
400
401        /// Setter for [`activeInputSource`][Self::activeInputSource].
402        #[unsafe(method(setActiveInputSource:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn setActiveInputSource(
405            &self,
406            active_input_source: Option<&AVCaptureDeviceInputSource>,
407        );
408    );
409}
410
411/// Constants indicating the physical position of an AVCaptureDevice's hardware on the system.
412///
413///
414/// Indicates that the device's position relative to the system hardware is unspecified.
415///
416/// Indicates that the device is physically located on the back of the system hardware.
417///
418/// Indicates that the device is physically located on the front of the system hardware.
419///
420/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceposition?language=objc)
421// NS_ENUM
422#[repr(transparent)]
423#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
424pub struct AVCaptureDevicePosition(pub NSInteger);
425impl AVCaptureDevicePosition {
426    #[doc(alias = "AVCaptureDevicePositionUnspecified")]
427    pub const Unspecified: Self = Self(0);
428    #[doc(alias = "AVCaptureDevicePositionBack")]
429    pub const Back: Self = Self(1);
430    #[doc(alias = "AVCaptureDevicePositionFront")]
431    pub const Front: Self = Self(2);
432}
433
434unsafe impl Encode for AVCaptureDevicePosition {
435    const ENCODING: Encoding = NSInteger::ENCODING;
436}
437
438unsafe impl RefEncode for AVCaptureDevicePosition {
439    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
440}
441
442/// AVCaptureDevicePosition.
443impl AVCaptureDevice {
444    extern_methods!(
445        /// Indicates the physical position of an AVCaptureDevice's hardware on the system.
446        ///
447        ///
448        /// The value of this property is an AVCaptureDevicePosition indicating where the receiver's device is physically located on the system hardware.
449        #[unsafe(method(position))]
450        #[unsafe(method_family = none)]
451        pub unsafe fn position(&self) -> AVCaptureDevicePosition;
452    );
453}
454
455/// AVCaptureDeviceType string constants
456///
457///
458/// The AVCaptureDeviceType string constants are intended to be used in combination with the AVCaptureDeviceDiscoverySession class to obtain a list of devices matching certain search criteria.
459///
460/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetype?language=objc)
461// NS_TYPED_ENUM
462pub type AVCaptureDeviceType = NSString;
463
464extern "C" {
465    /// An external device type. On iPad, external devices are those that conform to the UVC (USB Video Class) specification.
466    ///
467    ///
468    /// Starting in Mac Catalyst 17.0, apps may opt in for using AVCaptureDeviceTypeExternal by adding the following key to their Info.plist:
469    /// <key
470    /// >NSCameraUseExternalDeviceType
471    /// </key
472    /// >
473    /// <true
474    /// />
475    /// Otherwise, external cameras on Mac Catalyst report that their device type is AVCaptureDeviceTypeBuiltInWideAngleCamera.
476    ///
477    /// On visionOS, your app must have the `com.apple.developer.avfoundation.uvc-device-access` entitlement in order to discover and use devices of type `AVCaptureDeviceTypeExternal`.
478    ///
479    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypeexternal?language=objc)
480    pub static AVCaptureDeviceTypeExternal: &'static AVCaptureDeviceType;
481}
482
483extern "C" {
484    /// A microphone. On iOS and tvOS, only one AVCaptureDevice of type AVCaptureDeviceTypeMicrophone is exposed to the system. The audio routing subsystem decides which physical microphone to use, be it a built in microphone, a wired headset, an external microphone, etc. The microphone device's `localizedName` will change as the audio subsystem switches to a different physical device.
485    ///
486    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypemicrophone?language=objc)
487    pub static AVCaptureDeviceTypeMicrophone: &'static AVCaptureDeviceType;
488}
489
490extern "C" {
491    /// A built-in wide angle camera device. These devices are suitable for general purpose use.
492    ///
493    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinwideanglecamera?language=objc)
494    pub static AVCaptureDeviceTypeBuiltInWideAngleCamera: &'static AVCaptureDeviceType;
495}
496
497extern "C" {
498    /// A built-in camera device with a longer focal length than a wide angle camera. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession.
499    ///
500    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintelephotocamera?language=objc)
501    pub static AVCaptureDeviceTypeBuiltInTelephotoCamera: &'static AVCaptureDeviceType;
502}
503
504extern "C" {
505    /// A built-in camera device with a shorter focal length than a wide angle camera. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession.
506    ///
507    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinultrawidecamera?language=objc)
508    pub static AVCaptureDeviceTypeBuiltInUltraWideCamera: &'static AVCaptureDeviceType;
509}
510
511extern "C" {
512    /// A device that consists of two fixed focal length cameras, one wide and one telephoto. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
513    ///
514    /// A device of this device type supports the following features:
515    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
516    /// - Higher quality zoom for still captures by fusing images from both cameras.
517    /// - Depth data delivery by measuring the disparity of matched features between the wide and telephoto cameras.
518    /// - Delivery of photos from constituent devices (wide and telephoto cameras) via a single photo capture request.
519    ///
520    /// A device of this device type does not support the following features:
521    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
522    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
523    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
524    ///
525    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
526    ///
527    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltindualcamera?language=objc)
528    pub static AVCaptureDeviceTypeBuiltInDualCamera: &'static AVCaptureDeviceType;
529}
530
531extern "C" {
532    /// A device that consists of two fixed focal length cameras, one ultra wide and one wide angle. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
533    ///
534    /// A device of this device type supports the following features:
535    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
536    /// - Depth data delivery by measuring the disparity of matched features between the ultra wide and wide cameras.
537    /// - Delivery of photos from constituent devices (ultra wide and wide) via a single photo capture request.
538    ///
539    /// A device of this device type does not support the following features:
540    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
541    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
542    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
543    ///
544    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
545    ///
546    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltindualwidecamera?language=objc)
547    pub static AVCaptureDeviceTypeBuiltInDualWideCamera: &'static AVCaptureDeviceType;
548}
549
550extern "C" {
551    /// A device that consists of three fixed focal length cameras, one ultra wide, one wide angle, and one telephoto. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
552    ///
553    /// A device of this device type supports the following features:
554    /// - Auto switching from one camera to the other when zoom factor, light level, and focus position allow this.
555    /// - Delivery of photos from constituent devices (ultra wide, wide and telephoto cameras) via a single photo capture request.
556    ///
557    /// A device of this device type does not support the following features:
558    /// - AVCaptureExposureModeCustom and manual exposure bracketing.
559    /// - Locking focus with a lens position other than AVCaptureLensPositionCurrent.
560    /// - Locking auto white balance with device white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
561    ///
562    /// Even when locked, exposure duration, ISO, aperture, white balance gains, or lens position may change when the device switches from one camera to the other. The overall exposure, white balance, and focus position however should be consistent.
563    ///
564    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintriplecamera?language=objc)
565    pub static AVCaptureDeviceTypeBuiltInTripleCamera: &'static AVCaptureDeviceType;
566}
567
568extern "C" {
569    /// A device that consists of two cameras, one YUV and one Infrared. The infrared camera provides high quality depth information that is synchronized and perspective corrected to frames produced by the YUV camera. While the resolution of the depth data and YUV frames may differ, their field of view and aspect ratio always match. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
570    ///
571    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltintruedepthcamera?language=objc)
572    pub static AVCaptureDeviceTypeBuiltInTrueDepthCamera: &'static AVCaptureDeviceType;
573}
574
575extern "C" {
576    /// A device that consists of two cameras, one YUV and one LiDAR. The LiDAR camera provides high quality, high accuracy depth information by measuring the round trip of an artificial light signal emitted by a laser. The depth is synchronized and perspective corrected to frames produced by the paired YUV camera. While the resolution of the depth data and YUV frames may differ, their field of view and aspect ratio always match. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
577    ///
578    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinlidardepthcamera?language=objc)
579    pub static AVCaptureDeviceTypeBuiltInLiDARDepthCamera: &'static AVCaptureDeviceType;
580}
581
582extern "C" {
583    /// A continuity camera device. These devices are suitable for general purpose use. Note that devices of this type may only be discovered using an AVCaptureDeviceDiscoverySession or -[AVCaptureDevice defaultDeviceWithDeviceType:mediaType:position:].
584    ///
585    ///
586    /// Starting in macOS 14.0 and Mac Catalyst 17.0, apps may opt in for using AVCaptureDeviceTypeContinuityCamera by adding the following key to their Info.plist:
587    /// <key
588    /// >NSCameraUseContinuityCameraDeviceType
589    /// </key
590    /// >
591    /// <true
592    /// />
593    ///
594    /// Otherwise, continuity cameras on macOS and Mac Catalyst report that their device type is AVCaptureDeviceTypeBuiltInWideAngleCamera.
595    ///
596    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypecontinuitycamera?language=objc)
597    pub static AVCaptureDeviceTypeContinuityCamera: &'static AVCaptureDeviceType;
598}
599
600extern "C" {
601    /// A distortion corrected cut out from an ultra wide camera, made to approximate an overhead camera pointing at a desk. Supports multicam operation.
602    ///
603    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypedeskviewcamera?language=objc)
604    pub static AVCaptureDeviceTypeDeskViewCamera: &'static AVCaptureDeviceType;
605}
606
607extern "C" {
608    /// A deprecated synonym for AVCaptureDeviceTypeExternal. Please use AVCaptureDeviceTypeExternal instead.
609    ///
610    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypeexternalunknown?language=objc)
611    pub static AVCaptureDeviceTypeExternalUnknown: &'static AVCaptureDeviceType;
612}
613
614extern "C" {
615    /// A deprecated synonym for AVCaptureDeviceTypeBuiltInDualCamera. Please use AVCaptureDeviceTypeBuiltInDualCamera instead.
616    ///
617    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinduocamera?language=objc)
618    pub static AVCaptureDeviceTypeBuiltInDuoCamera: &'static AVCaptureDeviceType;
619}
620
621extern "C" {
622    /// A deprecated synonym for AVCaptureDeviceTypeMicrophone. Please use AVCaptureDeviceTypeMicrophone instead.
623    ///
624    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetypebuiltinmicrophone?language=objc)
625    pub static AVCaptureDeviceTypeBuiltInMicrophone: &'static AVCaptureDeviceType;
626}
627
628/// AVCaptureDeviceType.
629impl AVCaptureDevice {
630    extern_methods!(
631        /// The type of the capture device.
632        ///
633        ///
634        /// A capture device's type never changes.
635        #[unsafe(method(deviceType))]
636        #[unsafe(method_family = none)]
637        pub unsafe fn deviceType(&self) -> Retained<AVCaptureDeviceType>;
638    );
639}
640
641/// AVCaptureDefaultDevice.
642impl AVCaptureDevice {
643    extern_methods!(
644        #[cfg(feature = "AVMediaFormat")]
645        /// Returns an AVCaptureDevice instance for the default device of the given device type, media type, and position.
646        ///
647        ///
648        /// Parameter `deviceType`: The device type supported by the returned device. It must be a valid AVCaptureDeviceType.
649        ///
650        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, supported by the returned device. Pass nil to consider devices with any media type.
651        ///
652        /// Parameter `position`: The position supported by the returned device. Pass AVCaptureDevicePositionUnspecified to consider devices with any position.
653        ///
654        /// Returns: The default device with the given device type, media type and position or nil if no device with that media type exists and nil otherwise.
655        ///
656        ///
657        /// This method returns the default device of the given combination of device type, media type, and position currently available on the system.
658        #[unsafe(method(defaultDeviceWithDeviceType:mediaType:position:))]
659        #[unsafe(method_family = none)]
660        pub unsafe fn defaultDeviceWithDeviceType_mediaType_position(
661            device_type: &AVCaptureDeviceType,
662            media_type: Option<&AVMediaType>,
663            position: AVCaptureDevicePosition,
664        ) -> Option<Retained<AVCaptureDevice>>;
665    );
666}
667
668/// AVCaptureDevicePreferredCamera.
669impl AVCaptureDevice {
670    extern_methods!(
671        /// Settable property that specifies a user preferred camera.
672        ///
673        ///
674        /// Setting this property allows an application to persist its user’s preferred camera across app launches and reboots. The property internally maintains a short history, so if your user’s most recent preferred camera is not currently connected, it still reports the next best choice. This property always returns a device that is present. If no camera is available nil is returned. Setting the property to nil has no effect.
675        #[unsafe(method(userPreferredCamera))]
676        #[unsafe(method_family = none)]
677        pub unsafe fn userPreferredCamera() -> Option<Retained<AVCaptureDevice>>;
678
679        /// Setter for [`userPreferredCamera`][Self::userPreferredCamera].
680        #[unsafe(method(setUserPreferredCamera:))]
681        #[unsafe(method_family = none)]
682        pub unsafe fn setUserPreferredCamera(user_preferred_camera: Option<&AVCaptureDevice>);
683
684        /// Specifies the best camera to use as determined by the system.
685        ///
686        ///
687        /// Apple chooses the default value. This property incorporates userPreferredCamera as well as other factors, such as camera suspension and Apple cameras appearing that should be automatically chosen. The property may change spontaneously, such as when the preferred camera goes away. This property always returns a device that is present. If no camera is available nil is returned.
688        ///
689        /// Applications that adopt this API should always key-value observe this property and update their AVCaptureSession’s input device to reflect changes to the systemPreferredCamera. The application can still offer users the ability to pick a camera by setting userPreferredCamera, which will cause the systemPreferredCamera API to put the user’s choice first until either another Apple-preferred device becomes available or the machine is rebooted (after which it reverts to its original behavior of returning the internally determined best camera to use).
690        ///
691        /// If the application wishes to offer users a fully manual camera selection mode in addition to automatic camera selection, it is recommended to call setUserPreferredCamera: each time the user makes a camera selection, but ignore key-value observer updates to systemPreferredCamera while in manual selection mode.
692        #[unsafe(method(systemPreferredCamera))]
693        #[unsafe(method_family = none)]
694        pub unsafe fn systemPreferredCamera() -> Option<Retained<AVCaptureDevice>>;
695    );
696}
697
698/// AVCaptureDeviceSystemPressure.
699impl AVCaptureDevice {
700    extern_methods!(
701        #[cfg(feature = "AVCaptureSystemPressure")]
702        /// A key-value observable property indicating the capture device's current system pressure state.
703        ///
704        ///
705        /// This property indicates whether the capture device is currently subject to an elevated system pressure condition. When system pressure reaches AVCaptureSystemPressureLevelShutdown, the capture device cannot continue to provide input, so the AVCaptureSession becomes interrupted until the pressured state abates. System pressure can be effectively mitigated by lowering the device's activeVideoMinFrameDuration in response to changes in the systemPressureState. Clients are encouraged to implement frame rate throttling to bring system pressure down if their capture use case can tolerate a reduced frame rate.
706        #[unsafe(method(systemPressureState))]
707        #[unsafe(method_family = none)]
708        pub unsafe fn systemPressureState(&self) -> Retained<AVCaptureSystemPressureState>;
709    );
710}
711
712/// These constants can be used to control when the virtual device is allowed to switch the active primary constituent device.
713///
714///
715/// Indicates that the device does not support constituent device switching. This is reported for cameras that do not have more than one constituent device.
716///
717/// Automatically select the best camera for the current scene. In this mode there are no restrictions on when a camera switch can occur.
718///
719/// Restrict fallback camera selection to certain conditions (see AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions). Camera switches necessary to satisfy the requested video zoom factor are still allowed without restriction.
720///
721/// Lock camera switching to the active primary constituent device. Note that this restricts the minAvailableVideoZoomFactor to the switch-over zoom factor of the activePrimaryConstituentDevice (as reported in AVCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors).
722///
723///
724/// Virtual devices with multiple constituent video devices (such as the Dual Camera, Dual Wide Camera, or Triple Camera), consist of cameras that each have different properties such as focal length, maximum light sensitivity, and minimum focus distance. One of the constituent video devices is selected as the primary constituent device. For an AVCaptureSession, the primary constituent device produces for all outputs. For an AVCaptureMultiCamSession, the primary constituent device produces for all outputs connected to the virtual device's native AVCaptureDeviceInputPort (where its sourceDeviceType is equal to the virtual device's deviceType).
725///
726/// When the requested zoom factor can be achieved by multiple constituent cameras (see -virtualDeviceSwitchOverVideoZoomFactors), the virtual device chooses the best camera for the scene. The primary condition for this is the focal length; the camera with the longest focal length requires the least amount of digital upscaling and therefore normally provides the highest image quality. Secondary conditions are focus and exposure; when the scene requires focus or exposure to go beyond the limits of the active primary constituent device, a camera with a shorter focal length may be able to deliver a better quality image. Such a device is called a fallback primary constituent device. For example, a telephoto camera with a minimum focus distance of 40cm is not able to deliver a sharp image when the subject in the scene is closer than 40cm. For such a scene, the virtual device will switch to the wide-angle camera which typically has a smaller minimum focus distance and is able to achieve accurate focus on the subject. In this case the wide-angle camera is the fallback primary constitute device.
727///
728/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureprimaryconstituentdeviceswitchingbehavior?language=objc)
729// NS_ENUM
730#[repr(transparent)]
731#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
732pub struct AVCapturePrimaryConstituentDeviceSwitchingBehavior(pub NSInteger);
733impl AVCapturePrimaryConstituentDeviceSwitchingBehavior {
734    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorUnsupported")]
735    pub const Unsupported: Self = Self(0);
736    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorAuto")]
737    pub const Auto: Self = Self(1);
738    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted")]
739    pub const Restricted: Self = Self(2);
740    #[doc(alias = "AVCapturePrimaryConstituentDeviceSwitchingBehaviorLocked")]
741    pub const Locked: Self = Self(3);
742}
743
744unsafe impl Encode for AVCapturePrimaryConstituentDeviceSwitchingBehavior {
745    const ENCODING: Encoding = NSInteger::ENCODING;
746}
747
748unsafe impl RefEncode for AVCapturePrimaryConstituentDeviceSwitchingBehavior {
749    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
750}
751
752/// These constants can be used and combined to control the conditions that allow fallback camera selection when the primaryConstituentDeviceSelectionBehavior is set to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted. Note that camera switching necessary to satisfy the requested zoom factor is still allowed.
753///
754///
755/// Disallow fallback switching.
756///
757/// Restrict fallback camera switching to when the video zoom factor changes, either through AVCaptureDevice.videoZoomFactor or -[AVCaptureDevice rampToVideoZoomFactor:withRate:]. Note that any change in video zoom factor will allow a switch to a fallback camera, not just changes across switch-over zoom factors.
758///
759/// Restrict fallback camera switches to when AVCaptureDevice.focusMode is set.
760///
761/// Restrict fallback camera switches to when AVCaptureDevice.exposureMode is set.
762///
763///
764/// Whenever triggered by one or more of the enabled conditions, the fallback camera switching waits for exposure and focus to stabilize before deciding which camera to use as the primary constituent device.
765///
766/// Whenever AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged is not included in the restricted switching behavior conditions, AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted still allows camera selection when a change in video zoom factor makes a camera eligible or ineligible to be selected as the activePrimaryConstituentDevice. When the video zoom factor decreases to below the switch-over zoom factor of the activePrimaryConstituentDevice, a different camera will be selected to satisfy the requested zoom factor. When the video zoom factor increases and crosses a camera's switch-over zoom factor, this camera becomes eligible to be selected as the activePrimaryConstituentDevice. If exposure and focus allow, this camera then becomes the new activePrimaryConstituentDevice. Similar to the AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged this also waits for exposure and focus to stabilize. Otherwise the activePrimaryConstituentDevice remains unchanged.
767///
768/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureprimaryconstituentdevicerestrictedswitchingbehaviorconditions?language=objc)
769// NS_OPTIONS
770#[repr(transparent)]
771#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
772pub struct AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions(pub NSUInteger);
773bitflags::bitflags! {
774    impl AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions: NSUInteger {
775        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone")]
776        const None = 0;
777        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionVideoZoomChanged")]
778        const VideoZoomChanged = 1<<0;
779        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionFocusModeChanged")]
780        const FocusModeChanged = 1<<1;
781        #[doc(alias = "AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionExposureModeChanged")]
782        const ExposureModeChanged = 1<<2;
783    }
784}
785
786unsafe impl Encode for AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions {
787    const ENCODING: Encoding = NSUInteger::ENCODING;
788}
789
790unsafe impl RefEncode for AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions {
791    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
792}
793
794/// AVCaptureDeviceVirtual.
795impl AVCaptureDevice {
796    extern_methods!(
797        /// A property indicating whether the receiver is a virtual device consisting of constituent physical devices.
798        ///
799        ///
800        /// Two examples of virtual devices are:
801        /// The Dual Camera, which supports seamlessly switching between a wide and telephoto camera while zooming and generating depth data from the disparities between the different points of view of the physical cameras.
802        /// The TrueDepth Camera, which generates depth data from disparities between a YUV camera and an Infrared camera pointed in the same direction.
803        #[unsafe(method(isVirtualDevice))]
804        #[unsafe(method_family = none)]
805        pub unsafe fn isVirtualDevice(&self) -> bool;
806
807        /// An array of constituent physical devices comprising a virtual device.
808        ///
809        ///
810        /// When called on a device for which virtualDevice == NO, an empty array is returned.
811        #[unsafe(method(constituentDevices))]
812        #[unsafe(method_family = none)]
813        pub unsafe fn constituentDevices(&self) -> Retained<NSArray<AVCaptureDevice>>;
814
815        /// An array of video zoom factors at or above which a virtual device (such as the Dual Camera) may switch to its next constituent device.
816        ///
817        ///
818        /// This array contains zoom factors at which one of the constituent device's field of view matches the next constituent device's full field of view. The number of switch over video zoom factors is always one less than the count of the constituentDevices property, and the factors progress in the same order as the devices listed in that property. On non-virtual devices this property returns an empty array.
819        #[unsafe(method(virtualDeviceSwitchOverVideoZoomFactors))]
820        #[unsafe(method_family = none)]
821        pub unsafe fn virtualDeviceSwitchOverVideoZoomFactors(&self)
822            -> Retained<NSArray<NSNumber>>;
823
824        /// The switching behavior and conditions, unless overwritten via -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions].
825        ///
826        /// Parameter `switchingBehavior`: The desired switching behavior.
827        ///
828        /// Parameter `restrictedSwitchingBehaviorConditions`: The desired conditions for restricting camera switching. This must be set to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone whenever switchingBehavior is not equal to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted.
829        ///
830        ///
831        /// The switching behavior may be overridden on the AVCaptureMovieFileOutput while recording (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions]). This method throws an NSInvalidArgumentException if constituent device switching is not supported by the receiver or if restrictedSwitchingBehaviorConditions is not equal to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone and switchingBehavior is not equal to AVCapturePrimaryConstituentDeviceSwitchingBehaviorRestricted.
832        #[unsafe(method(setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:))]
833        #[unsafe(method_family = none)]
834        pub unsafe fn setPrimaryConstituentDeviceSwitchingBehavior_restrictedSwitchingBehaviorConditions(
835            &self,
836            switching_behavior: AVCapturePrimaryConstituentDeviceSwitchingBehavior,
837            restricted_switching_behavior_conditions: AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions,
838        );
839
840        /// The primaryConstituentDeviceSwitchingBehavior as set by -[AVCaptureDevice setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:].
841        ///
842        ///
843        /// By default, this property is set to AVCapturePrimaryConstituentDeviceSwitchingBehaviorAuto for AVCaptureDevices that support it.  This property is key-value observable.
844        #[unsafe(method(primaryConstituentDeviceSwitchingBehavior))]
845        #[unsafe(method_family = none)]
846        pub unsafe fn primaryConstituentDeviceSwitchingBehavior(
847            &self,
848        ) -> AVCapturePrimaryConstituentDeviceSwitchingBehavior;
849
850        /// The primaryConstituentDeviceRestrictedSwitchingBehaviorConditions as set by -[AVCaptureDevice setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions:].
851        ///
852        ///
853        /// By default, this propety is set to AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone. This property is key-value observable.
854        #[unsafe(method(primaryConstituentDeviceRestrictedSwitchingBehaviorConditions))]
855        #[unsafe(method_family = none)]
856        pub unsafe fn primaryConstituentDeviceRestrictedSwitchingBehaviorConditions(
857            &self,
858        ) -> AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions;
859
860        /// The active constituent device switching behavior.
861        ///
862        ///
863        /// For virtual devices with multiple constituent devices, this property returns the active switching behavior. This is equal to primaryConstituentDeviceSwitchingBehavior except while recording using an AVCaptureMovieFileOutput configured with a different switching behavior (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehavior:restrictedSwitchingBehaviorConditions]). Devices that do not support constituent device switching return AVCapturePrimaryConstituentDeviceSwitchingBehaviorUnsupported. This property is key-value observable.
864        #[unsafe(method(activePrimaryConstituentDeviceSwitchingBehavior))]
865        #[unsafe(method_family = none)]
866        pub unsafe fn activePrimaryConstituentDeviceSwitchingBehavior(
867            &self,
868        ) -> AVCapturePrimaryConstituentDeviceSwitchingBehavior;
869
870        /// The active constituent device restricted  switching behavior.
871        ///
872        ///
873        /// For virtual devices with multiple constituent devices, this property returns the active restricted switching behavior conditions. This is equal to primaryConstituentDeviceRestrictedSwitchingBehaviorConditions except while recording using an AVCaptureMovieFileOutput configured with different retricted switching behavior conditions (see -[AVCaptureMovieFileOutput setPrimaryConstituentDeviceSwitchingBehaviorForRecording:restrictedSwitchingBehaviorConditions]). Devices that do not support constituent device switching return AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditionNone. This property is key-value observable.
874        #[unsafe(method(activePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions))]
875        #[unsafe(method_family = none)]
876        pub unsafe fn activePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions(
877            &self,
878        ) -> AVCapturePrimaryConstituentDeviceRestrictedSwitchingBehaviorConditions;
879
880        /// For virtual devices, this property indicates which constituent device is currently the primary constituent device. The primary constituent device may change when zoom, exposure, or focus changes.
881        ///
882        ///
883        /// This property returns nil for non-virtual devices. On virtual devices this property returns nil until the device is used in a running AVCaptureSession. This property is key-value observable.
884        #[unsafe(method(activePrimaryConstituentDevice))]
885        #[unsafe(method_family = none)]
886        pub unsafe fn activePrimaryConstituentDevice(&self) -> Option<Retained<AVCaptureDevice>>;
887
888        /// The constituent devices that may be selected as a fallback for a longer focal length primary constituent device.
889        ///
890        ///
891        /// This property returns an empty array for non-virtual devices. This property never changes for a given virtual device.
892        #[unsafe(method(supportedFallbackPrimaryConstituentDevices))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn supportedFallbackPrimaryConstituentDevices(
895            &self,
896        ) -> Retained<NSArray<AVCaptureDevice>>;
897
898        /// The constituent devices that may be used as a fallback device when a constituent device with a longer focal length becomes limited by its light sensitivity or minimum focus distance.
899        ///
900        ///
901        /// This may only be set to the supportedFallbackPrimaryConstituentDevices or a subset thereof. By default this is set to all supportedFallbackPrimaryConstituentDevices. This property will throw an NSInvalidArgumentException if the array includes any device not reported in supportedFallbackPrimaryConstituentDevices. This property is key-value observable.
902        #[unsafe(method(fallbackPrimaryConstituentDevices))]
903        #[unsafe(method_family = none)]
904        pub unsafe fn fallbackPrimaryConstituentDevices(
905            &self,
906        ) -> Retained<NSArray<AVCaptureDevice>>;
907
908        /// Setter for [`fallbackPrimaryConstituentDevices`][Self::fallbackPrimaryConstituentDevices].
909        #[unsafe(method(setFallbackPrimaryConstituentDevices:))]
910        #[unsafe(method_family = none)]
911        pub unsafe fn setFallbackPrimaryConstituentDevices(
912            &self,
913            fallback_primary_constituent_devices: &NSArray<AVCaptureDevice>,
914        );
915    );
916}
917
918/// Constants indicating the mode of the flash on the receiver's device, if it has one.
919///
920///
921/// Indicates that the flash should always be off.
922///
923/// Indicates that the flash should always be on.
924///
925/// Indicates that the flash should be used automatically depending on ambient light conditions.
926///
927/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureflashmode?language=objc)
928// NS_ENUM
929#[repr(transparent)]
930#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
931pub struct AVCaptureFlashMode(pub NSInteger);
932impl AVCaptureFlashMode {
933    #[doc(alias = "AVCaptureFlashModeOff")]
934    pub const Off: Self = Self(0);
935    #[doc(alias = "AVCaptureFlashModeOn")]
936    pub const On: Self = Self(1);
937    #[doc(alias = "AVCaptureFlashModeAuto")]
938    pub const Auto: Self = Self(2);
939}
940
941unsafe impl Encode for AVCaptureFlashMode {
942    const ENCODING: Encoding = NSInteger::ENCODING;
943}
944
945unsafe impl RefEncode for AVCaptureFlashMode {
946    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
947}
948
949/// AVCaptureDeviceFlash.
950impl AVCaptureDevice {
951    extern_methods!(
952        /// Indicates whether the receiver has a flash.
953        ///
954        ///
955        /// The value of this property is a BOOL indicating whether the receiver has a flash. The receiver's flashMode property can only be set when this property returns YES.
956        #[unsafe(method(hasFlash))]
957        #[unsafe(method_family = none)]
958        pub unsafe fn hasFlash(&self) -> bool;
959
960        /// Indicates whether the receiver's flash is currently available for use.
961        ///
962        ///
963        /// The value of this property is a BOOL indicating whether the receiver's flash is currently available. The flash may become unavailable if, for example, the device overheats and needs to cool off. This property is key-value observable.
964        #[unsafe(method(isFlashAvailable))]
965        #[unsafe(method_family = none)]
966        pub unsafe fn isFlashAvailable(&self) -> bool;
967
968        /// Indicates whether the receiver's flash is currently active.
969        ///
970        ///
971        /// The value of this property is a BOOL indicating whether the receiver's flash is currently active. When the flash is active, it will flash if a still image is captured. When a still image is captured with the flash active, exposure and white balance settings are overridden for the still. This is true even when using AVCaptureExposureModeCustom and/or AVCaptureWhiteBalanceModeLocked. This property is key-value observable.
972        #[deprecated = "Use AVCapturePhotoOutput's -isFlashScene instead."]
973        #[unsafe(method(isFlashActive))]
974        #[unsafe(method_family = none)]
975        pub unsafe fn isFlashActive(&self) -> bool;
976
977        /// Returns whether the receiver supports the given flash mode.
978        ///
979        ///
980        /// Parameter `flashMode`: An AVCaptureFlashMode to be checked.
981        ///
982        /// Returns: YES if the receiver supports the given flash mode, NO otherwise.
983        ///
984        ///
985        /// The receiver's flashMode property can only be set to a certain mode if this method returns YES for that mode.
986        #[deprecated = "Use AVCapturePhotoOutput's -supportedFlashModes instead."]
987        #[unsafe(method(isFlashModeSupported:))]
988        #[unsafe(method_family = none)]
989        pub unsafe fn isFlashModeSupported(&self, flash_mode: AVCaptureFlashMode) -> bool;
990
991        /// Indicates current mode of the receiver's flash, if it has one.
992        ///
993        ///
994        /// The value of this property is an AVCaptureFlashMode that determines the mode of the receiver's flash, if it has one. -setFlashMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isFlashModeSupported:). -setFlashMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's flashMode by key value observing this property.
995        ///
996        /// When using AVCapturePhotoOutput, AVCaptureDevice's flashMode property is ignored. You specify flashMode on a per photo basis by setting the AVCapturePhotoSettings.flashMode property.
997        #[deprecated = "Use AVCapturePhotoSettings.flashMode instead."]
998        #[unsafe(method(flashMode))]
999        #[unsafe(method_family = none)]
1000        pub unsafe fn flashMode(&self) -> AVCaptureFlashMode;
1001
1002        /// Setter for [`flashMode`][Self::flashMode].
1003        #[deprecated = "Use AVCapturePhotoSettings.flashMode instead."]
1004        #[unsafe(method(setFlashMode:))]
1005        #[unsafe(method_family = none)]
1006        pub unsafe fn setFlashMode(&self, flash_mode: AVCaptureFlashMode);
1007    );
1008}
1009
1010/// Constants indicating the mode of the torch on the receiver's device, if it has one.
1011///
1012///
1013/// Indicates that the torch should always be off.
1014///
1015/// Indicates that the torch should always be on.
1016///
1017/// Indicates that the torch should be used automatically depending on ambient light conditions.
1018///
1019/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturetorchmode?language=objc)
1020// NS_ENUM
1021#[repr(transparent)]
1022#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1023pub struct AVCaptureTorchMode(pub NSInteger);
1024impl AVCaptureTorchMode {
1025    #[doc(alias = "AVCaptureTorchModeOff")]
1026    pub const Off: Self = Self(0);
1027    #[doc(alias = "AVCaptureTorchModeOn")]
1028    pub const On: Self = Self(1);
1029    #[doc(alias = "AVCaptureTorchModeAuto")]
1030    pub const Auto: Self = Self(2);
1031}
1032
1033unsafe impl Encode for AVCaptureTorchMode {
1034    const ENCODING: Encoding = NSInteger::ENCODING;
1035}
1036
1037unsafe impl RefEncode for AVCaptureTorchMode {
1038    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1039}
1040
1041extern "C" {
1042    /// A special value that may be passed to -setTorchModeWithLevel:error: to set the torch to the maximum level currently available. Under thermal duress, the maximum available torch level may be less than 1.0.
1043    ///
1044    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemaxavailabletorchlevel?language=objc)
1045    pub static AVCaptureMaxAvailableTorchLevel: c_float;
1046}
1047
1048/// AVCaptureDeviceTorch.
1049impl AVCaptureDevice {
1050    extern_methods!(
1051        /// Indicates whether the receiver has a torch.
1052        ///
1053        ///
1054        /// The value of this property is a BOOL indicating whether the receiver has a torch. The receiver's torchMode property can only be set when this property returns YES.
1055        #[unsafe(method(hasTorch))]
1056        #[unsafe(method_family = none)]
1057        pub unsafe fn hasTorch(&self) -> bool;
1058
1059        /// Indicates whether the receiver's torch is currently available for use.
1060        ///
1061        ///
1062        /// The value of this property is a BOOL indicating whether the receiver's torch is currently available. The torch may become unavailable if, for example, the device overheats and needs to cool off. This property is key-value observable.
1063        #[unsafe(method(isTorchAvailable))]
1064        #[unsafe(method_family = none)]
1065        pub unsafe fn isTorchAvailable(&self) -> bool;
1066
1067        /// Indicates whether the receiver's torch is currently active.
1068        ///
1069        ///
1070        /// The value of this property is a BOOL indicating whether the receiver's torch is currently active. If the current torchMode is AVCaptureTorchModeAuto and isTorchActive is YES, the torch will illuminate once a recording starts (see AVCaptureOutput.h -startRecordingToOutputFileURL:recordingDelegate:). This property is key-value observable.
1071        #[unsafe(method(isTorchActive))]
1072        #[unsafe(method_family = none)]
1073        pub unsafe fn isTorchActive(&self) -> bool;
1074
1075        /// Indicates the receiver's current torch brightness level as a floating point value.
1076        ///
1077        ///
1078        /// The value of this property is a float indicating the receiver's torch level from 0.0 (off) -> 1.0 (full). This property is key-value observable.
1079        #[unsafe(method(torchLevel))]
1080        #[unsafe(method_family = none)]
1081        pub unsafe fn torchLevel(&self) -> c_float;
1082
1083        /// Returns whether the receiver supports the given torch mode.
1084        ///
1085        ///
1086        /// Parameter `torchMode`: An AVCaptureTorchMode to be checked.
1087        ///
1088        /// Returns: YES if the receiver supports the given torch mode, NO otherwise.
1089        ///
1090        ///
1091        /// The receiver's torchMode property can only be set to a certain mode if this method returns YES for that mode.
1092        #[unsafe(method(isTorchModeSupported:))]
1093        #[unsafe(method_family = none)]
1094        pub unsafe fn isTorchModeSupported(&self, torch_mode: AVCaptureTorchMode) -> bool;
1095
1096        /// Indicates current mode of the receiver's torch, if it has one.
1097        ///
1098        ///
1099        /// The value of this property is an AVCaptureTorchMode that determines the mode of the receiver's torch, if it has one. -setTorchMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isTorchModeSupported:). -setTorchMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's torchMode by key value observing this property.
1100        #[unsafe(method(torchMode))]
1101        #[unsafe(method_family = none)]
1102        pub unsafe fn torchMode(&self) -> AVCaptureTorchMode;
1103
1104        /// Setter for [`torchMode`][Self::torchMode].
1105        #[unsafe(method(setTorchMode:))]
1106        #[unsafe(method_family = none)]
1107        pub unsafe fn setTorchMode(&self, torch_mode: AVCaptureTorchMode);
1108
1109        /// Sets the current mode of the receiver's torch to AVCaptureTorchModeOn at the specified level.
1110        ///
1111        ///
1112        /// This method sets the torch mode to AVCaptureTorchModeOn at a specified level. torchLevel must be a value between 0 and 1, or the special value AVCaptureMaxAvailableTorchLevel. The specified value may not be available if the iOS device is too hot. This method throws an NSInvalidArgumentException if set to an unsupported level. If the specified level is valid, but unavailable, the method returns NO with AVErrorTorchLevelUnavailable. -setTorchModeOnWithLevel:error: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's torchMode by key value observing the torchMode property.
1113        #[unsafe(method(setTorchModeOnWithLevel:error:_))]
1114        #[unsafe(method_family = none)]
1115        pub unsafe fn setTorchModeOnWithLevel_error(
1116            &self,
1117            torch_level: c_float,
1118        ) -> Result<(), Retained<NSError>>;
1119    );
1120}
1121
1122/// Constants indicating the mode of the focus on the receiver's device, if it has one.
1123///
1124///
1125/// Indicates that the focus should be locked at the lens' current position.
1126///
1127/// Indicates that the device should autofocus once and then change the focus mode to AVCaptureFocusModeLocked.
1128///
1129/// Indicates that the device should automatically focus when needed.
1130///
1131/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturefocusmode?language=objc)
1132// NS_ENUM
1133#[repr(transparent)]
1134#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1135pub struct AVCaptureFocusMode(pub NSInteger);
1136impl AVCaptureFocusMode {
1137    #[doc(alias = "AVCaptureFocusModeLocked")]
1138    pub const Locked: Self = Self(0);
1139    #[doc(alias = "AVCaptureFocusModeAutoFocus")]
1140    pub const AutoFocus: Self = Self(1);
1141    #[doc(alias = "AVCaptureFocusModeContinuousAutoFocus")]
1142    pub const ContinuousAutoFocus: Self = Self(2);
1143}
1144
1145unsafe impl Encode for AVCaptureFocusMode {
1146    const ENCODING: Encoding = NSInteger::ENCODING;
1147}
1148
1149unsafe impl RefEncode for AVCaptureFocusMode {
1150    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1151}
1152
1153/// Constants indicating the restriction of the receiver's autofocus system to a particular range of focus scan, if it supports range restrictions.
1154///
1155///
1156/// Indicates that the autofocus system should not restrict the focus range.
1157///
1158/// Indicates that the autofocus system should restrict the focus range for subject matter that is near to the camera.
1159///
1160/// Indicates that the autofocus system should restrict the focus range for subject matter that is far from the camera.
1161///
1162/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureautofocusrangerestriction?language=objc)
1163// NS_ENUM
1164#[repr(transparent)]
1165#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1166pub struct AVCaptureAutoFocusRangeRestriction(pub NSInteger);
1167impl AVCaptureAutoFocusRangeRestriction {
1168    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionNone")]
1169    pub const None: Self = Self(0);
1170    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionNear")]
1171    pub const Near: Self = Self(1);
1172    #[doc(alias = "AVCaptureAutoFocusRangeRestrictionFar")]
1173    pub const Far: Self = Self(2);
1174}
1175
1176unsafe impl Encode for AVCaptureAutoFocusRangeRestriction {
1177    const ENCODING: Encoding = NSInteger::ENCODING;
1178}
1179
1180unsafe impl RefEncode for AVCaptureAutoFocusRangeRestriction {
1181    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1182}
1183
1184extern "C" {
1185    /// A special value that may be passed as the lensPosition parameter of setFocusModeLockedWithLensPosition:completionHandler: to indicate that the caller does not wish to specify a value for the lensPosition property, and that it should instead be set to its current value. Note that the device may be adjusting lensPosition at the time of the call, in which case the value at which lensPosition is locked may differ from the value obtained by querying the lensPosition property.
1186    ///
1187    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturelenspositioncurrent?language=objc)
1188    pub static AVCaptureLensPositionCurrent: c_float;
1189}
1190
1191/// AVCaptureDeviceFocus.
1192impl AVCaptureDevice {
1193    extern_methods!(
1194        /// Returns whether the receiver supports the given focus mode.
1195        ///
1196        ///
1197        /// Parameter `focusMode`: An AVCaptureFocusMode to be checked.
1198        ///
1199        /// Returns: YES if the receiver supports the given focus mode, NO otherwise.
1200        ///
1201        ///
1202        /// The receiver's focusMode property can only be set to a certain mode if this method returns YES for that mode.
1203        #[unsafe(method(isFocusModeSupported:))]
1204        #[unsafe(method_family = none)]
1205        pub unsafe fn isFocusModeSupported(&self, focus_mode: AVCaptureFocusMode) -> bool;
1206
1207        /// Indicates whether the receiver supports a lens position other than AVCaptureLensPositionCurrent.
1208        ///
1209        ///
1210        /// If lockingFocusWithCustomLensPositionSupported returns NO, setFocusModeLockedWithLensPosition: may only be called with AVCaptureLensPositionCurrent. Passing any other lens position will result in an exception.
1211        #[unsafe(method(isLockingFocusWithCustomLensPositionSupported))]
1212        #[unsafe(method_family = none)]
1213        pub unsafe fn isLockingFocusWithCustomLensPositionSupported(&self) -> bool;
1214
1215        /// Indicates current focus mode of the receiver, if it has one.
1216        ///
1217        ///
1218        /// The value of this property is an AVCaptureFocusMode that determines the receiver's focus mode, if it has one. -setFocusMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isFocusModeSupported:). -setFocusMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's focusMode by key value observing this property.
1219        #[unsafe(method(focusMode))]
1220        #[unsafe(method_family = none)]
1221        pub unsafe fn focusMode(&self) -> AVCaptureFocusMode;
1222
1223        /// Setter for [`focusMode`][Self::focusMode].
1224        #[unsafe(method(setFocusMode:))]
1225        #[unsafe(method_family = none)]
1226        pub unsafe fn setFocusMode(&self, focus_mode: AVCaptureFocusMode);
1227
1228        /// Indicates whether the receiver supports focus points of interest.
1229        ///
1230        ///
1231        /// The receiver's focusPointOfInterest property can only be set if this property returns YES.
1232        #[unsafe(method(isFocusPointOfInterestSupported))]
1233        #[unsafe(method_family = none)]
1234        pub unsafe fn isFocusPointOfInterestSupported(&self) -> bool;
1235
1236        #[cfg(feature = "objc2-core-foundation")]
1237        /// Indicates current focus point of interest of the receiver, if it has one.
1238        ///
1239        ///
1240        /// The value of this property is a CGPoint that determines the receiver's focus point of interest, if it has one. A value of (0,0) indicates that the camera should focus on the top left corner of the image, while a value of (1,1) indicates that it should focus on the bottom right. The default value is (0.5,0.5). -setFocusPointOfInterest: throws an NSInvalidArgumentException if isFocusPointOfInterestSupported returns NO. -setFocusPointOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's focusPointOfInterest by key value observing this property. Note that setting focusPointOfInterest alone does not initiate a focus operation. After setting focusPointOfInterest, call -setFocusMode: to apply the new point of interest.
1241        #[unsafe(method(focusPointOfInterest))]
1242        #[unsafe(method_family = none)]
1243        pub unsafe fn focusPointOfInterest(&self) -> CGPoint;
1244
1245        #[cfg(feature = "objc2-core-foundation")]
1246        /// Setter for [`focusPointOfInterest`][Self::focusPointOfInterest].
1247        #[unsafe(method(setFocusPointOfInterest:))]
1248        #[unsafe(method_family = none)]
1249        pub unsafe fn setFocusPointOfInterest(&self, focus_point_of_interest: CGPoint);
1250
1251        /// Indicates whether the receiver is currently performing a focus scan to adjust focus.
1252        ///
1253        ///
1254        /// The value of this property is a BOOL indicating whether the receiver's camera focus is being automatically adjusted by means of a focus scan, because its focus mode is AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Clients can observe the value of this property to determine whether the camera's focus is stable.
1255        ///
1256        /// See also: lensPosition
1257        ///
1258        /// See also: AVCaptureAutoFocusSystem
1259        #[unsafe(method(isAdjustingFocus))]
1260        #[unsafe(method_family = none)]
1261        pub unsafe fn isAdjustingFocus(&self) -> bool;
1262
1263        /// Indicates whether the receiver supports autofocus range restrictions.
1264        ///
1265        ///
1266        /// The receiver's autoFocusRangeRestriction property can only be set if this property returns YES.
1267        #[unsafe(method(isAutoFocusRangeRestrictionSupported))]
1268        #[unsafe(method_family = none)]
1269        pub unsafe fn isAutoFocusRangeRestrictionSupported(&self) -> bool;
1270
1271        /// Indicates current restriction of the receiver's autofocus system to a particular range of focus scan, if it supports range restrictions.
1272        ///
1273        ///
1274        /// The value of this property is an AVCaptureAutoFocusRangeRestriction indicating how the autofocus system should limit its focus scan. The default value is AVCaptureAutoFocusRangeRestrictionNone. -setAutoFocusRangeRestriction: throws an NSInvalidArgumentException if isAutoFocusRangeRestrictionSupported returns NO. -setAutoFocusRangeRestriction: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. This property only has an effect when the focusMode property is set to AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Note that setting autoFocusRangeRestriction alone does not initiate a focus operation. After setting autoFocusRangeRestriction, call -setFocusMode: to apply the new restriction.
1275        #[unsafe(method(autoFocusRangeRestriction))]
1276        #[unsafe(method_family = none)]
1277        pub unsafe fn autoFocusRangeRestriction(&self) -> AVCaptureAutoFocusRangeRestriction;
1278
1279        /// Setter for [`autoFocusRangeRestriction`][Self::autoFocusRangeRestriction].
1280        #[unsafe(method(setAutoFocusRangeRestriction:))]
1281        #[unsafe(method_family = none)]
1282        pub unsafe fn setAutoFocusRangeRestriction(
1283            &self,
1284            auto_focus_range_restriction: AVCaptureAutoFocusRangeRestriction,
1285        );
1286
1287        /// Indicates whether the receiver supports smooth autofocus.
1288        ///
1289        ///
1290        /// The receiver's smoothAutoFocusEnabled property can only be set if this property returns YES.
1291        #[unsafe(method(isSmoothAutoFocusSupported))]
1292        #[unsafe(method_family = none)]
1293        pub unsafe fn isSmoothAutoFocusSupported(&self) -> bool;
1294
1295        /// Indicates whether the receiver should use smooth autofocus.
1296        ///
1297        ///
1298        /// On a receiver where -isSmoothAutoFocusSupported returns YES and smoothAutoFocusEnabled is set to YES, a smooth autofocus will be engaged when the focus mode is set to AVCaptureFocusModeAutoFocus or AVCaptureFocusModeContinuousAutoFocus. Enabling smooth autofocus is appropriate for movie recording. Smooth autofocus is slower and less visually invasive. Disabling smooth autofocus is more appropriate for video processing where a fast autofocus is necessary. The default value is NO. Setting this property throws an NSInvalidArgumentException if -isSmoothAutoFocusSupported returns NO. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown. Note that setting smoothAutoFocusEnabled alone does not initiate a focus operation. After setting smoothAutoFocusEnabled, call -setFocusMode: to apply the new smooth autofocus mode.
1299        #[unsafe(method(isSmoothAutoFocusEnabled))]
1300        #[unsafe(method_family = none)]
1301        pub unsafe fn isSmoothAutoFocusEnabled(&self) -> bool;
1302
1303        /// Setter for [`isSmoothAutoFocusEnabled`][Self::isSmoothAutoFocusEnabled].
1304        #[unsafe(method(setSmoothAutoFocusEnabled:))]
1305        #[unsafe(method_family = none)]
1306        pub unsafe fn setSmoothAutoFocusEnabled(&self, smooth_auto_focus_enabled: bool);
1307
1308        /// Indicates whether the receiver should automatically adjust face-driven autofocus.
1309        ///
1310        ///
1311        /// The value of this property is a BOOL that determines the receiver's automatic adjustment of face-driven autofocus. Default is YES on all platforms, if the receiver supports autofocus. This property must be set to NO before manually setting faceDrivenAutoFocusEnabled to YES/NO. -setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if the receiver doesn't support autofocus. -setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. After setting automaticallyAdjustsFaceDrivenAutoFocusEnabled, call -setFocusMode: to apply the change.
1312        #[unsafe(method(automaticallyAdjustsFaceDrivenAutoFocusEnabled))]
1313        #[unsafe(method_family = none)]
1314        pub unsafe fn automaticallyAdjustsFaceDrivenAutoFocusEnabled(&self) -> bool;
1315
1316        /// Setter for [`automaticallyAdjustsFaceDrivenAutoFocusEnabled`][Self::automaticallyAdjustsFaceDrivenAutoFocusEnabled].
1317        #[unsafe(method(setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled:))]
1318        #[unsafe(method_family = none)]
1319        pub unsafe fn setAutomaticallyAdjustsFaceDrivenAutoFocusEnabled(
1320            &self,
1321            automatically_adjusts_face_driven_auto_focus_enabled: bool,
1322        );
1323
1324        /// Indicates whether face-driven autofocus is enabled on the receiver.
1325        ///
1326        ///
1327        /// Default is YES for all apps linked on or after iOS 15.4 when the receiver supports autofocus. -setFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if automaticallyAdjustsFaceDrivenAutoFocusEnabled returns YES.  -setFaceDrivenAutoFocusEnabled: throws an NSInvalidArgumentException if the receiver doesn't support autofocus. -setFaceDrivenAutoFocusEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Note that setting faceDrivenAutoFocusEnabled alone does not initiate this focus change operation. After setting faceDrivenAutoFocusEnabled, call -setFocusMode: to apply the change.
1328        #[unsafe(method(isFaceDrivenAutoFocusEnabled))]
1329        #[unsafe(method_family = none)]
1330        pub unsafe fn isFaceDrivenAutoFocusEnabled(&self) -> bool;
1331
1332        /// Setter for [`isFaceDrivenAutoFocusEnabled`][Self::isFaceDrivenAutoFocusEnabled].
1333        #[unsafe(method(setFaceDrivenAutoFocusEnabled:))]
1334        #[unsafe(method_family = none)]
1335        pub unsafe fn setFaceDrivenAutoFocusEnabled(&self, face_driven_auto_focus_enabled: bool);
1336
1337        /// Indicates the focus position of the lens.
1338        ///
1339        ///
1340        /// The range of possible positions is 0.0 to 1.0, with 0.0 being the shortest distance at which the lens can focus and 1.0 the furthest. Note that 1.0 does not represent focus at infinity. The default value is 1.0. Note that a given lens position value does not correspond to an exact physical distance, nor does it represent a consistent focus distance from device to device. This property is key-value observable. It can be read at any time, regardless of focus mode, but can only be set via setFocusModeLockedWithLensPosition:completionHandler:.
1341        #[unsafe(method(lensPosition))]
1342        #[unsafe(method_family = none)]
1343        pub unsafe fn lensPosition(&self) -> c_float;
1344
1345        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
1346        /// Sets focusMode to AVCaptureFocusModeLocked and locks lensPosition at an explicit value.
1347        ///
1348        ///
1349        /// Parameter `lensPosition`: The lens position, as described in the documentation for the lensPosition property. A value of AVCaptureLensPositionCurrent can be used to indicate that the caller does not wish to specify a value for lensPosition.
1350        ///
1351        /// Parameter `handler`: A block to be called when lensPosition has been set to the value specified and focusMode is set to AVCaptureFocusModeLocked. If setFocusModeLockedWithLensPosition:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the master clock prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
1352        ///
1353        ///
1354        /// This is the only way of setting lensPosition. This method throws an NSRangeException if lensPosition is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
1355        #[unsafe(method(setFocusModeLockedWithLensPosition:completionHandler:))]
1356        #[unsafe(method_family = none)]
1357        pub unsafe fn setFocusModeLockedWithLensPosition_completionHandler(
1358            &self,
1359            lens_position: c_float,
1360            handler: Option<&block2::Block<dyn Fn(CMTime)>>,
1361        );
1362
1363        /// A property indicating the minimum focus distance.
1364        ///
1365        ///
1366        /// The minimum focus distance is given in millimeters, -1 if unknown. For virtual cameras (AVCaptureDeviceTypeBuiltInDualCamera, AVCaptureDeviceTypeBuiltInTripleCamera, etc.), the value reported is the smallest minimum focus distance of the auto-focus-capable cameras that it sources.
1367        #[unsafe(method(minimumFocusDistance))]
1368        #[unsafe(method_family = none)]
1369        pub unsafe fn minimumFocusDistance(&self) -> NSInteger;
1370    );
1371}
1372
1373/// Constants indicating the mode of the exposure on the receiver's device, if it has adjustable exposure.
1374///
1375///
1376/// Indicates that the exposure should be locked at its current value.
1377///
1378/// Indicates that the device should automatically adjust exposure once and then change the exposure mode to AVCaptureExposureModeLocked.
1379///
1380/// Indicates that the device should automatically adjust exposure when needed.
1381///
1382/// Indicates that the device should only adjust exposure according to user provided ISO, exposureDuration values.
1383///
1384/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuremode?language=objc)
1385// NS_ENUM
1386#[repr(transparent)]
1387#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1388pub struct AVCaptureExposureMode(pub NSInteger);
1389impl AVCaptureExposureMode {
1390    #[doc(alias = "AVCaptureExposureModeLocked")]
1391    pub const Locked: Self = Self(0);
1392    #[doc(alias = "AVCaptureExposureModeAutoExpose")]
1393    pub const AutoExpose: Self = Self(1);
1394    #[doc(alias = "AVCaptureExposureModeContinuousAutoExposure")]
1395    pub const ContinuousAutoExposure: Self = Self(2);
1396    #[doc(alias = "AVCaptureExposureModeCustom")]
1397    pub const Custom: Self = Self(3);
1398}
1399
1400unsafe impl Encode for AVCaptureExposureMode {
1401    const ENCODING: Encoding = NSInteger::ENCODING;
1402}
1403
1404unsafe impl RefEncode for AVCaptureExposureMode {
1405    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1406}
1407
1408extern "C" {
1409    /// A special value that may be passed as the duration parameter of setExposureModeCustomWithDuration:ISO:completionHandler: to indicate that the caller does not wish to specify a value for the exposureDuration property, and that it should instead be set to its current value. Note that the device may be adjusting exposureDuration at the time of the call, in which case the value to which exposureDuration is set may differ from the value obtained by querying the exposureDuration property.
1410    ///
1411    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuredurationcurrent?language=objc)
1412    #[cfg(feature = "objc2-core-media")]
1413    pub static AVCaptureExposureDurationCurrent: CMTime;
1414}
1415
1416extern "C" {
1417    /// A special value that may be passed as the ISO parameter of setExposureModeCustomWithDuration:ISO:completionHandler: to indicate that the caller does not wish to specify a value for the ISO property, and that it should instead be set to its current value. Note that the device may be adjusting ISO at the time of the call, in which case the value to which ISO is set may differ from the value obtained by querying the ISO property.
1418    ///
1419    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureisocurrent?language=objc)
1420    pub static AVCaptureISOCurrent: c_float;
1421}
1422
1423extern "C" {
1424    /// A special value that may be passed as the bias parameter of setExposureTargetBias:completionHandler: to indicate that the caller does not wish to specify a value for the exposureTargetBias property, and that it should instead be set to its current value.
1425    ///
1426    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureexposuretargetbiascurrent?language=objc)
1427    pub static AVCaptureExposureTargetBiasCurrent: c_float;
1428}
1429
1430/// AVCaptureDeviceExposure.
1431impl AVCaptureDevice {
1432    extern_methods!(
1433        /// Returns whether the receiver supports the given exposure mode.
1434        ///
1435        ///
1436        /// Parameter `exposureMode`: An AVCaptureExposureMode to be checked.
1437        ///
1438        /// Returns: YES if the receiver supports the given exposure mode, NO otherwise.
1439        ///
1440        ///
1441        /// The receiver's exposureMode property can only be set to a certain mode if this method returns YES for that mode.
1442        #[unsafe(method(isExposureModeSupported:))]
1443        #[unsafe(method_family = none)]
1444        pub unsafe fn isExposureModeSupported(&self, exposure_mode: AVCaptureExposureMode) -> bool;
1445
1446        /// Indicates current exposure mode of the receiver, if it has adjustable exposure.
1447        ///
1448        ///
1449        /// The value of this property is an AVCaptureExposureMode that determines the receiver's exposure mode, if it has adjustable exposure. -setExposureMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isExposureModeSupported:). -setExposureMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. When using AVCapturePhotoOutput and capturing photos with AVCapturePhotoSettings' photoQualityPrioritization property set to AVCapturePhotoQualityPrioritizationBalanced or higher, the receiver's ISO and exposureDuration values may be overridden when exposing the photo if the scene is dark enough to warrant some form of multi-image fusion to improve quality. To ensure that the receiver's ISO and exposureDuration values are honored while in AVCaptureExposureModeCustom or AVCaptureExposureModeLocked, you must set your AVCapturePhotoSettings.photoQualityPrioritization property to AVCapturePhotoQualityPrioritizationSpeed. The same rule applies if you are using the deprecated AVCapturePhotoSettings.autoStillImageStabilizationEnabled property; you must set it to NO to preserve your custom exposure values in the photo capture. Likewise if you're using AVCaptureStillImageOutput, automaticallyEnablesStillImageStabilizationWhenAvailable must be set to NO to preserve your custom exposure values in a still image capture. Clients can observe automatic changes to the receiver's exposureMode by key value observing this property.
1450        #[unsafe(method(exposureMode))]
1451        #[unsafe(method_family = none)]
1452        pub unsafe fn exposureMode(&self) -> AVCaptureExposureMode;
1453
1454        /// Setter for [`exposureMode`][Self::exposureMode].
1455        #[unsafe(method(setExposureMode:))]
1456        #[unsafe(method_family = none)]
1457        pub unsafe fn setExposureMode(&self, exposure_mode: AVCaptureExposureMode);
1458
1459        /// Indicates whether the receiver supports exposure points of interest.
1460        ///
1461        ///
1462        /// The receiver's exposurePointOfInterest property can only be set if this property returns YES.
1463        #[unsafe(method(isExposurePointOfInterestSupported))]
1464        #[unsafe(method_family = none)]
1465        pub unsafe fn isExposurePointOfInterestSupported(&self) -> bool;
1466
1467        #[cfg(feature = "objc2-core-foundation")]
1468        /// Indicates current exposure point of interest of the receiver, if it has one.
1469        ///
1470        ///
1471        /// The value of this property is a CGPoint that determines the receiver's exposure point of interest, if it has adjustable exposure. A value of (0,0) indicates that the camera should adjust exposure based on the top left corner of the image, while a value of (1,1) indicates that it should adjust exposure based on the bottom right corner. The default value is (0.5,0.5). -setExposurePointOfInterest: throws an NSInvalidArgumentException if isExposurePointOfInterestSupported returns NO. -setExposurePointOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Note that setting exposurePointOfInterest alone does not initiate an exposure operation. After setting exposurePointOfInterest, call -setExposureMode: to apply the new point of interest.
1472        #[unsafe(method(exposurePointOfInterest))]
1473        #[unsafe(method_family = none)]
1474        pub unsafe fn exposurePointOfInterest(&self) -> CGPoint;
1475
1476        #[cfg(feature = "objc2-core-foundation")]
1477        /// Setter for [`exposurePointOfInterest`][Self::exposurePointOfInterest].
1478        #[unsafe(method(setExposurePointOfInterest:))]
1479        #[unsafe(method_family = none)]
1480        pub unsafe fn setExposurePointOfInterest(&self, exposure_point_of_interest: CGPoint);
1481
1482        /// Indicates whether the receiver should automatically adjust face-driven auto exposure.
1483        ///
1484        ///
1485        /// The value of this property is a BOOL that determines the receiver's automatic adjustment of face-driven auto exposure. Default is YES on all platforms, if the receiver supports auto exposure. This property must be set to NO before manually setting faceDrivenAutoExposureEnabled to YES/NO. -setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if the receiver doesn't support auto exposure. -setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. After setting automaticallyAdjustsFaceDrivenAutoExposureEnabled, call -setExposureMode: to apply the change.
1486        #[unsafe(method(automaticallyAdjustsFaceDrivenAutoExposureEnabled))]
1487        #[unsafe(method_family = none)]
1488        pub unsafe fn automaticallyAdjustsFaceDrivenAutoExposureEnabled(&self) -> bool;
1489
1490        /// Setter for [`automaticallyAdjustsFaceDrivenAutoExposureEnabled`][Self::automaticallyAdjustsFaceDrivenAutoExposureEnabled].
1491        #[unsafe(method(setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled:))]
1492        #[unsafe(method_family = none)]
1493        pub unsafe fn setAutomaticallyAdjustsFaceDrivenAutoExposureEnabled(
1494            &self,
1495            automatically_adjusts_face_driven_auto_exposure_enabled: bool,
1496        );
1497
1498        /// Indicates whether face-driven auto exposure is enabled on the receiver.
1499        ///
1500        ///
1501        /// Default is YES for all apps linked on or after iOS 15.4 when the receiver supports auto exposure. -setFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if automaticallyAdjustsFaceDrivenAutoExposureEnabled returns YES. -setFaceDrivenAutoExposureEnabled: throws an NSInvalidArgumentException if the receiver doesn't support auto exposure. -setFaceDrivenAutoExposureEnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Note that setting faceDrivenAutoExposureEnabled alone does not initiate this exposure change operation. After setting faceDrivenAutoExposureEnabled, call -setExposureMode: to apply the change.
1502        #[unsafe(method(isFaceDrivenAutoExposureEnabled))]
1503        #[unsafe(method_family = none)]
1504        pub unsafe fn isFaceDrivenAutoExposureEnabled(&self) -> bool;
1505
1506        /// Setter for [`isFaceDrivenAutoExposureEnabled`][Self::isFaceDrivenAutoExposureEnabled].
1507        #[unsafe(method(setFaceDrivenAutoExposureEnabled:))]
1508        #[unsafe(method_family = none)]
1509        pub unsafe fn setFaceDrivenAutoExposureEnabled(
1510            &self,
1511            face_driven_auto_exposure_enabled: bool,
1512        );
1513
1514        #[cfg(feature = "objc2-core-media")]
1515        /// The maximum exposure (integration) time that may be used by the auto exposure algorithm.
1516        ///
1517        ///
1518        /// When an AVCaptureDevice's exposureMode is set to AVCaptureExposureModeAutoExpose or AVCaptureExposureModeContinuousAutoExposure, the auto exposure algorithm picks a default max exposure duration that is tuned for the current configuration, balancing low light image quality with motion preservation. By querying or key-value observing this property, you may find out the current max exposure duration in use. You may also override the default value by setting this property to a value between activeFormat.maxExposureDuration and activeFormat.minExposureDuration. An NSRangeException is thrown if you pass an out-of-bounds exposure duration. Setting the property to the special value of kCMTimeInvalid resets the auto exposure max duration to the device's default for your current configuration. When the device's activeFormat or the AVCaptureSession's sessionPreset changes, this property resets to the default max exposure duration for the new format or session preset.
1519        ///
1520        /// On some devices, the auto exposure algorithm picks a different max exposure duration for a given format depending whether you used the -[AVCaptureSession setSessionPreset:] API or the -[AVCaptureDevice setActiveFormat:] API to set the format. To ensure uniform default handling of max exposure duration, you can set your AVCaptureDeviceInput's unifiedAutoExposureDefaultsEnabled property to YES.
1521        #[unsafe(method(activeMaxExposureDuration))]
1522        #[unsafe(method_family = none)]
1523        pub unsafe fn activeMaxExposureDuration(&self) -> CMTime;
1524
1525        #[cfg(feature = "objc2-core-media")]
1526        /// Setter for [`activeMaxExposureDuration`][Self::activeMaxExposureDuration].
1527        #[unsafe(method(setActiveMaxExposureDuration:))]
1528        #[unsafe(method_family = none)]
1529        pub unsafe fn setActiveMaxExposureDuration(&self, active_max_exposure_duration: CMTime);
1530
1531        /// Indicates whether the receiver is currently adjusting camera exposure.
1532        ///
1533        ///
1534        /// The value of this property is a BOOL indicating whether the receiver's camera exposure is being automatically adjusted because its exposure mode is AVCaptureExposureModeAutoExpose or AVCaptureExposureModeContinuousAutoExposure. Clients can observe the value of this property to determine whether the camera exposure is stable or is being automatically adjusted.
1535        #[unsafe(method(isAdjustingExposure))]
1536        #[unsafe(method_family = none)]
1537        pub unsafe fn isAdjustingExposure(&self) -> bool;
1538
1539        /// The size of the lens diaphragm.
1540        ///
1541        ///
1542        /// The value of this property is a float indicating the size (f number) of the lens diaphragm. This property does not change.
1543        #[unsafe(method(lensAperture))]
1544        #[unsafe(method_family = none)]
1545        pub unsafe fn lensAperture(&self) -> c_float;
1546
1547        #[cfg(feature = "objc2-core-media")]
1548        /// The length of time over which exposure takes place.
1549        ///
1550        ///
1551        /// Only exposure duration values between activeFormat.minExposureDuration and activeFormat.maxExposureDuration are supported. This property is key-value observable. It can be read at any time, regardless of exposure mode, but can only be set via setExposureModeCustomWithDuration:ISO:completionHandler:.
1552        #[unsafe(method(exposureDuration))]
1553        #[unsafe(method_family = none)]
1554        pub unsafe fn exposureDuration(&self) -> CMTime;
1555
1556        /// The current exposure ISO value.
1557        ///
1558        ///
1559        /// This property controls the sensor's sensitivity to light by means of a gain value applied to the signal. Only ISO values between activeFormat.minISO and activeFormat.maxISO are supported. Higher values will result in noisier images. This property is key-value observable. It can be read at any time, regardless of exposure mode, but can only be set via setExposureModeCustomWithDuration:ISO:completionHandler:.
1560        #[unsafe(method(ISO))]
1561        #[unsafe(method_family = none)]
1562        pub unsafe fn ISO(&self) -> c_float;
1563
1564        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
1565        /// Sets exposureMode to AVCaptureExposureModeCustom and locks exposureDuration and ISO at explicit values.
1566        ///
1567        ///
1568        /// Parameter `duration`: The exposure duration, as described in the documentation for the exposureDuration property. A value of AVCaptureExposureDurationCurrent can be used to indicate that the caller does not wish to specify a value for exposureDuration. Note that changes to this property may result in changes to activeVideoMinFrameDuration and/or activeVideoMaxFrameDuration.
1569        ///
1570        /// Parameter `ISO`: The exposure ISO value, as described in the documentation for the ISO property. A value of AVCaptureISOCurrent can be used to indicate that the caller does not wish to specify a value for ISO.
1571        ///
1572        /// Parameter `handler`: A block to be called when both exposureDuration and ISO have been set to the values specified and exposureMode is set to AVCaptureExposureModeCustom. If setExposureModeCustomWithDuration:ISO:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the master clock prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
1573        ///
1574        ///
1575        /// This is the only way of setting exposureDuration and ISO. This method throws an NSRangeException if either exposureDuration or ISO is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. When using AVCapturePhotoOutput to capture photos, note that the photoQualityPrioritization property of AVCapturePhotoSettings defaults to AVCapturePhotoQualityPrioritizationBalanced, which allows photo capture to temporarily override the capture device's ISO and exposureDuration values if the scene is dark enough to warrant some form of multi-image fusion to improve quality. To ensure that the receiver's ISO and exposureDuration values are honored while in AVCaptureExposureModeCustom or AVCaptureExposureModeLocked, you must set your AVCapturePhotoSettings.photoQualityPrioritization property to AVCapturePhotoQualityPrioritizationSpeed. The same rule applies if you use the deprecated AVCapturePhotoSettings.autoStillImageStabilizationEnabled property or AVCaptureStillImageOutput.automaticallyEnablesStillImageStabilizationWhenAvailable property. You must set them to NO to preserve your custom or locked exposure settings.
1576        #[unsafe(method(setExposureModeCustomWithDuration:ISO:completionHandler:))]
1577        #[unsafe(method_family = none)]
1578        pub unsafe fn setExposureModeCustomWithDuration_ISO_completionHandler(
1579            &self,
1580            duration: CMTime,
1581            iso: c_float,
1582            handler: Option<&block2::Block<dyn Fn(CMTime)>>,
1583        );
1584
1585        /// Indicates the metered exposure level's offset from the target exposure value, in EV units.
1586        ///
1587        ///
1588        /// The value of this read-only property indicates the difference between the metered exposure level of the current scene and the target exposure value. This property is key-value observable.
1589        #[unsafe(method(exposureTargetOffset))]
1590        #[unsafe(method_family = none)]
1591        pub unsafe fn exposureTargetOffset(&self) -> c_float;
1592
1593        /// Bias applied to the target exposure value, in EV units.
1594        ///
1595        ///
1596        /// When exposureMode is AVCaptureExposureModeContinuousAutoExposure or AVCaptureExposureModeLocked, the bias will affect both metering (exposureTargetOffset), and the actual exposure level (exposureDuration and ISO). When the exposure mode is AVCaptureExposureModeCustom, it will only affect metering. This property is key-value observable. It can be read at any time, but can only be set via setExposureTargetBias:completionHandler:.
1597        #[unsafe(method(exposureTargetBias))]
1598        #[unsafe(method_family = none)]
1599        pub unsafe fn exposureTargetBias(&self) -> c_float;
1600
1601        /// A float indicating the minimum supported exposure bias, in EV units.
1602        ///
1603        ///
1604        /// This read-only property indicates the minimum supported exposure bias.
1605        #[unsafe(method(minExposureTargetBias))]
1606        #[unsafe(method_family = none)]
1607        pub unsafe fn minExposureTargetBias(&self) -> c_float;
1608
1609        /// A float indicating the maximum supported exposure bias, in EV units.
1610        ///
1611        ///
1612        /// This read-only property indicates the maximum supported exposure bias.
1613        #[unsafe(method(maxExposureTargetBias))]
1614        #[unsafe(method_family = none)]
1615        pub unsafe fn maxExposureTargetBias(&self) -> c_float;
1616
1617        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
1618        /// Sets the bias to be applied to the target exposure value.
1619        ///
1620        ///
1621        /// Parameter `bias`: The bias to be applied to the exposure target value, as described in the documentation for the exposureTargetBias property.
1622        ///
1623        /// Parameter `handler`: A block to be called when exposureTargetBias has been set to the value specified. If setExposureTargetBias:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which the setting has been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the master clock prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. The client may pass nil for the handler parameter if knowledge of the operation's completion is not required.
1624        ///
1625        ///
1626        /// This is the only way of setting exposureTargetBias. This method throws an NSRangeException if exposureTargetBias is set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
1627        #[unsafe(method(setExposureTargetBias:completionHandler:))]
1628        #[unsafe(method_family = none)]
1629        pub unsafe fn setExposureTargetBias_completionHandler(
1630            &self,
1631            bias: c_float,
1632            handler: Option<&block2::Block<dyn Fn(CMTime)>>,
1633        );
1634    );
1635}
1636
1637/// AVCaptureDeviceToneMapping.
1638impl AVCaptureDevice {
1639    extern_methods!(
1640        /// Indicates whether the receiver should use global tone mapping.
1641        ///
1642        ///
1643        /// Tone mapping is a technique used by the device to map the pixel levels in high dynamic range images to a more limited dynamic range (such as 16 bit to 8 bit), while still retaining as close an appearance as possible. Normally the device employs adaptive, local tone curves to preserve highest image quality and adapt quickly to changing lighting conditions.
1644        ///
1645        /// This property indicates to the receiver to use a global tone map. If set to YES, the tone map is adjusted dynamically depending on the current scene and the same tone map is applied to all pixels in an image. If set to its default value of NO, different tone maps may be applied to different pixels in an image.
1646        ///
1647        /// globalToneMappingEnabled may only be set to YES if the receiver's activeFormat.isGlobalToneMappingSupported property returns YES, otherwise an NSGenericException is thrown. Setting globalToneMappingEnabled throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
1648        ///
1649        /// When global tone mapping is enabled, an AVCapturePhotoOutput connected to the AVCaptureDeviceInput’s session disables all forms of still image fusion, resulting in still images with no automatic stabilization applied.
1650        ///
1651        /// The receiver’s globalToneMappingEnabled resets to its default value of NO under the following conditions:
1652        /// - The receiver’s activeFormat changes
1653        /// - The receiver’s AVCaptureDeviceInput’s session’s sessionPreset changes
1654        /// - The receiver’s AVCaptureDeviceInput is added to a session
1655        ///
1656        /// Clients can observe automatic changes to the receiver's globalToneMappingEnabled by key value observing this property.
1657        #[unsafe(method(isGlobalToneMappingEnabled))]
1658        #[unsafe(method_family = none)]
1659        pub unsafe fn isGlobalToneMappingEnabled(&self) -> bool;
1660
1661        /// Setter for [`isGlobalToneMappingEnabled`][Self::isGlobalToneMappingEnabled].
1662        #[unsafe(method(setGlobalToneMappingEnabled:))]
1663        #[unsafe(method_family = none)]
1664        pub unsafe fn setGlobalToneMappingEnabled(&self, global_tone_mapping_enabled: bool);
1665    );
1666}
1667
1668/// Constants indicating the mode of the white balance on the receiver's device, if it has adjustable white balance.
1669///
1670///
1671/// Indicates that the white balance should be locked at its current value.
1672///
1673/// Indicates that the device should automatically adjust white balance once and then change the white balance mode to AVCaptureWhiteBalanceModeLocked.
1674///
1675/// Indicates that the device should automatically adjust white balance when needed.
1676///
1677/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancemode?language=objc)
1678// NS_ENUM
1679#[repr(transparent)]
1680#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1681pub struct AVCaptureWhiteBalanceMode(pub NSInteger);
1682impl AVCaptureWhiteBalanceMode {
1683    #[doc(alias = "AVCaptureWhiteBalanceModeLocked")]
1684    pub const Locked: Self = Self(0);
1685    #[doc(alias = "AVCaptureWhiteBalanceModeAutoWhiteBalance")]
1686    pub const AutoWhiteBalance: Self = Self(1);
1687    #[doc(alias = "AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance")]
1688    pub const ContinuousAutoWhiteBalance: Self = Self(2);
1689}
1690
1691unsafe impl Encode for AVCaptureWhiteBalanceMode {
1692    const ENCODING: Encoding = NSInteger::ENCODING;
1693}
1694
1695unsafe impl RefEncode for AVCaptureWhiteBalanceMode {
1696    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1697}
1698
1699/// Structure containing RGB white balance gain values.
1700///
1701/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancegains?language=objc)
1702#[repr(C)]
1703#[derive(Clone, Copy, Debug, PartialEq)]
1704pub struct AVCaptureWhiteBalanceGains {
1705    pub redGain: c_float,
1706    pub greenGain: c_float,
1707    pub blueGain: c_float,
1708}
1709
1710unsafe impl Encode for AVCaptureWhiteBalanceGains {
1711    const ENCODING: Encoding = Encoding::Struct(
1712        "?",
1713        &[
1714            <c_float>::ENCODING,
1715            <c_float>::ENCODING,
1716            <c_float>::ENCODING,
1717        ],
1718    );
1719}
1720
1721unsafe impl RefEncode for AVCaptureWhiteBalanceGains {
1722    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1723}
1724
1725/// Structure containing CIE 1931 xy chromaticity values.
1726///
1727/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancechromaticityvalues?language=objc)
1728#[repr(C)]
1729#[derive(Clone, Copy, Debug, PartialEq)]
1730pub struct AVCaptureWhiteBalanceChromaticityValues {
1731    pub x: c_float,
1732    pub y: c_float,
1733}
1734
1735unsafe impl Encode for AVCaptureWhiteBalanceChromaticityValues {
1736    const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
1737}
1738
1739unsafe impl RefEncode for AVCaptureWhiteBalanceChromaticityValues {
1740    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1741}
1742
1743/// Structure containing a white balance color correlated temperature in kelvin, plus a tint value in the range of [-150 - +150].
1744///
1745/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancetemperatureandtintvalues?language=objc)
1746#[repr(C)]
1747#[derive(Clone, Copy, Debug, PartialEq)]
1748pub struct AVCaptureWhiteBalanceTemperatureAndTintValues {
1749    pub temperature: c_float,
1750    pub tint: c_float,
1751}
1752
1753unsafe impl Encode for AVCaptureWhiteBalanceTemperatureAndTintValues {
1754    const ENCODING: Encoding = Encoding::Struct("?", &[<c_float>::ENCODING, <c_float>::ENCODING]);
1755}
1756
1757unsafe impl RefEncode for AVCaptureWhiteBalanceTemperatureAndTintValues {
1758    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1759}
1760
1761extern "C" {
1762    /// A special value that may be passed as a parameter of setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler: to indicate that the caller does not wish to specify a value for deviceWhiteBalanceGains, and that gains should instead be locked at their value at the moment that white balance is locked.
1763    ///
1764    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturewhitebalancegainscurrent?language=objc)
1765    pub static AVCaptureWhiteBalanceGainsCurrent: AVCaptureWhiteBalanceGains;
1766}
1767
1768/// AVCaptureDeviceWhiteBalance.
1769impl AVCaptureDevice {
1770    extern_methods!(
1771        /// Returns whether the receiver supports the given white balance mode.
1772        ///
1773        ///
1774        /// Parameter `whiteBalanceMode`: An AVCaptureWhiteBalanceMode to be checked.
1775        ///
1776        /// Returns: YES if the receiver supports the given white balance mode, NO otherwise.
1777        ///
1778        ///
1779        /// The receiver's whiteBalanceMode property can only be set to a certain mode if this method returns YES for that mode.
1780        #[unsafe(method(isWhiteBalanceModeSupported:))]
1781        #[unsafe(method_family = none)]
1782        pub unsafe fn isWhiteBalanceModeSupported(
1783            &self,
1784            white_balance_mode: AVCaptureWhiteBalanceMode,
1785        ) -> bool;
1786
1787        /// Indicates whether the receiver supports white balance gains other than AVCaptureWhiteBalanceGainsCurrent.
1788        ///
1789        ///
1790        /// If lockingWhiteBalanceWithCustomDeviceGainsSupported returns NO, setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains: may only be called with AVCaptureWhiteBalanceGainsCurrent. Passing any other white balance gains will result in an exception.
1791        #[unsafe(method(isLockingWhiteBalanceWithCustomDeviceGainsSupported))]
1792        #[unsafe(method_family = none)]
1793        pub unsafe fn isLockingWhiteBalanceWithCustomDeviceGainsSupported(&self) -> bool;
1794
1795        /// Indicates current white balance mode of the receiver, if it has adjustable white balance.
1796        ///
1797        ///
1798        /// The value of this property is an AVCaptureWhiteBalanceMode that determines the receiver's white balance mode, if it has adjustable white balance. -setWhiteBalanceMode: throws an NSInvalidArgumentException if set to an unsupported value (see -isWhiteBalanceModeSupported:). -setWhiteBalanceMode: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's whiteBalanceMode by key value observing this property.
1799        #[unsafe(method(whiteBalanceMode))]
1800        #[unsafe(method_family = none)]
1801        pub unsafe fn whiteBalanceMode(&self) -> AVCaptureWhiteBalanceMode;
1802
1803        /// Setter for [`whiteBalanceMode`][Self::whiteBalanceMode].
1804        #[unsafe(method(setWhiteBalanceMode:))]
1805        #[unsafe(method_family = none)]
1806        pub unsafe fn setWhiteBalanceMode(&self, white_balance_mode: AVCaptureWhiteBalanceMode);
1807
1808        /// Indicates whether the receiver is currently adjusting camera white balance.
1809        ///
1810        ///
1811        /// The value of this property is a BOOL indicating whether the receiver's camera white balance is being automatically adjusted because its white balance mode is AVCaptureWhiteBalanceModeAutoWhiteBalance or AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance. Clients can observe the value of this property to determine whether the camera white balance is stable or is being automatically adjusted.
1812        #[unsafe(method(isAdjustingWhiteBalance))]
1813        #[unsafe(method_family = none)]
1814        pub unsafe fn isAdjustingWhiteBalance(&self) -> bool;
1815
1816        /// Indicates the current device-specific RGB white balance gain values in use.
1817        ///
1818        ///
1819        /// This property specifies the current red, green, and blue gain values used for white balance. The values can be used to adjust color casts for a given scene. For each channel, only values between 1.0 and -maxWhiteBalanceGain are supported. This property is key-value observable. It can be read at any time, regardless of white balance mode, but can only be set via setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:.
1820        #[unsafe(method(deviceWhiteBalanceGains))]
1821        #[unsafe(method_family = none)]
1822        pub unsafe fn deviceWhiteBalanceGains(&self) -> AVCaptureWhiteBalanceGains;
1823
1824        /// Indicates the current device-specific Gray World RGB white balance gain values in use.
1825        ///
1826        ///
1827        /// This property specifies the current red, green, and blue gain values derived from the current scene to deliver a neutral (or "Gray World") white point for white balance. Gray World values assume a neutral subject (e.g. a gray card) has been placed in the middle of the subject area and fills the center 50% of the frame. Clients can read these values and apply them to the device using setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. For each channel, only values between 1.0 and -maxWhiteBalanceGain are supported. This property is key-value observable. It can be read at any time, regardless of white balance mode.
1828        #[unsafe(method(grayWorldDeviceWhiteBalanceGains))]
1829        #[unsafe(method_family = none)]
1830        pub unsafe fn grayWorldDeviceWhiteBalanceGains(&self) -> AVCaptureWhiteBalanceGains;
1831
1832        /// Indicates the maximum supported value to which a channel in the AVCaptureWhiteBalanceGains may be set.
1833        ///
1834        ///
1835        /// This property does not change for the life of the receiver.
1836        #[unsafe(method(maxWhiteBalanceGain))]
1837        #[unsafe(method_family = none)]
1838        pub unsafe fn maxWhiteBalanceGain(&self) -> c_float;
1839
1840        #[cfg(all(feature = "block2", feature = "objc2-core-media"))]
1841        /// Sets white balance to locked mode with explicit deviceWhiteBalanceGains values.
1842        ///
1843        ///
1844        /// Parameter `whiteBalanceGains`: The white balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent can be used to indicate that the caller does not wish to specify a value for deviceWhiteBalanceGains.
1845        ///
1846        /// Parameter `handler`: A block to be called when white balance gains have been set to the values specified and whiteBalanceMode is set to AVCaptureWhiteBalanceModeLocked. If setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler: is called multiple times, the completion handlers will be called in FIFO order. The block receives a timestamp which matches that of the first buffer to which all settings have been applied. Note that the timestamp is synchronized to the device clock, and thus must be converted to the master clock prior to comparison with the timestamps of buffers delivered via an AVCaptureVideoDataOutput. This parameter may be nil if synchronization is not required.
1847        ///
1848        ///
1849        /// For each channel in the whiteBalanceGains struct, only values between 1.0 and -maxWhiteBalanceGain are supported. Gain values are normalized to the minimum channel value to avoid brightness changes (e.g. R:2 G:2 B:4 will be normalized to R:1 G:1 B:2). This method throws an NSRangeException if any of the whiteBalanceGains are set to an unsupported level. This method throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
1850        #[unsafe(method(setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:))]
1851        #[unsafe(method_family = none)]
1852        pub unsafe fn setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains_completionHandler(
1853            &self,
1854            white_balance_gains: AVCaptureWhiteBalanceGains,
1855            handler: Option<&block2::Block<dyn Fn(CMTime)>>,
1856        );
1857
1858        /// Converts device-specific white balance RGB gain values to device-independent chromaticity values.
1859        ///
1860        ///
1861        /// Parameter `whiteBalanceGains`: White balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent may not be used in this function.
1862        ///
1863        /// Returns: A fully populated AVCaptureWhiteBalanceChromaticityValues structure containing device-independent values.
1864        ///
1865        ///
1866        /// This method may be called on the receiver to convert device-specific white balance RGB gain values to device-independent chromaticity (little x, little y) values. For each channel in the whiteBalanceGains struct, only values between 1.0 and -maxWhiteBalanceGain are supported. This method throws an NSRangeException if any of the whiteBalanceGains are set to unsupported values.
1867        #[unsafe(method(chromaticityValuesForDeviceWhiteBalanceGains:))]
1868        #[unsafe(method_family = none)]
1869        pub unsafe fn chromaticityValuesForDeviceWhiteBalanceGains(
1870            &self,
1871            white_balance_gains: AVCaptureWhiteBalanceGains,
1872        ) -> AVCaptureWhiteBalanceChromaticityValues;
1873
1874        /// Converts device-independent chromaticity values to device-specific white balance RGB gain values.
1875        ///
1876        ///
1877        /// Parameter `chromaticityValues`: Little x, little y chromaticity values as described in the documentation for AVCaptureWhiteBalanceChromaticityValues.
1878        ///
1879        /// Returns: A fully populated AVCaptureWhiteBalanceGains structure containing device-specific RGB gain values.
1880        ///
1881        ///
1882        /// This method may be called on the receiver to convert device-independent chromaticity values to device-specific RGB white balance gain values. This method throws an NSRangeException if any of the chromaticityValues are set outside the range [0,1]. Note that some x,y combinations yield out-of-range device RGB values that will cause an exception to be thrown if passed directly to -setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. Be sure to check that red, green, and blue gain values are within the range of [1.0 - maxWhiteBalanceGain].
1883        #[unsafe(method(deviceWhiteBalanceGainsForChromaticityValues:))]
1884        #[unsafe(method_family = none)]
1885        pub unsafe fn deviceWhiteBalanceGainsForChromaticityValues(
1886            &self,
1887            chromaticity_values: AVCaptureWhiteBalanceChromaticityValues,
1888        ) -> AVCaptureWhiteBalanceGains;
1889
1890        /// Converts device-specific white balance RGB gain values to device-independent temperature and tint values.
1891        ///
1892        ///
1893        /// Parameter `whiteBalanceGains`: White balance gain values, as described in the documentation for the deviceWhiteBalanceGains property. A value of AVCaptureWhiteBalanceGainsCurrent may not be used in this function.
1894        ///
1895        /// Returns: A fully populated AVCaptureWhiteBalanceTemperatureAndTintValues structure containing device-independent values.
1896        ///
1897        ///
1898        /// This method may be called on the receiver to convert device-specific white balance RGB gain values to device-independent temperature (in kelvin) and tint values. For each channel in the whiteBalanceGains struct, only values between 1.0 and -maxWhiteBalanceGain are supported. This method throws an NSRangeException if any of the whiteBalanceGains are set to unsupported values.
1899        #[unsafe(method(temperatureAndTintValuesForDeviceWhiteBalanceGains:))]
1900        #[unsafe(method_family = none)]
1901        pub unsafe fn temperatureAndTintValuesForDeviceWhiteBalanceGains(
1902            &self,
1903            white_balance_gains: AVCaptureWhiteBalanceGains,
1904        ) -> AVCaptureWhiteBalanceTemperatureAndTintValues;
1905
1906        /// Converts device-independent temperature and tint values to device-specific white balance RGB gain values.
1907        ///
1908        ///
1909        /// Parameter `tempAndTintValues`: Temperature and tint values as described in the documentation for AVCaptureWhiteBalanceTemperatureAndTintValues.
1910        ///
1911        /// Returns: A fully populated AVCaptureWhiteBalanceGains structure containing device-specific RGB gain values.
1912        ///
1913        ///
1914        /// This method may be called on the receiver to convert device-independent temperature and tint values to device-specific RGB white balance gain values. You may pass any temperature and tint values and corresponding white balance gains will be produced. Note though that some temperature and tint combinations yield out-of-range device RGB values that will cause an exception to be thrown if passed directly to -setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:. Be sure to check that red, green, and blue gain values are within the range of [1.0 - maxWhiteBalanceGain].
1915        #[unsafe(method(deviceWhiteBalanceGainsForTemperatureAndTintValues:))]
1916        #[unsafe(method_family = none)]
1917        pub unsafe fn deviceWhiteBalanceGainsForTemperatureAndTintValues(
1918            &self,
1919            temp_and_tint_values: AVCaptureWhiteBalanceTemperatureAndTintValues,
1920        ) -> AVCaptureWhiteBalanceGains;
1921    );
1922}
1923
1924/// AVCaptureDeviceSubjectAreaChangeMonitoring.
1925impl AVCaptureDevice {
1926    extern_methods!(
1927        /// Indicates whether the receiver should monitor the subject area for changes.
1928        ///
1929        ///
1930        /// The value of this property is a BOOL indicating whether the receiver should monitor the video subject area for changes, such as lighting changes, substantial movement, etc. If subject area change monitoring is enabled, the receiver sends an AVCaptureDeviceSubjectAreaDidChangeNotification whenever it detects a change to the subject area, at which time an interested client may wish to re-focus, adjust exposure, white balance, etc. The receiver must be locked for configuration using lockForConfiguration: before clients can set the value of this property.
1931        #[unsafe(method(isSubjectAreaChangeMonitoringEnabled))]
1932        #[unsafe(method_family = none)]
1933        pub unsafe fn isSubjectAreaChangeMonitoringEnabled(&self) -> bool;
1934
1935        /// Setter for [`isSubjectAreaChangeMonitoringEnabled`][Self::isSubjectAreaChangeMonitoringEnabled].
1936        #[unsafe(method(setSubjectAreaChangeMonitoringEnabled:))]
1937        #[unsafe(method_family = none)]
1938        pub unsafe fn setSubjectAreaChangeMonitoringEnabled(
1939            &self,
1940            subject_area_change_monitoring_enabled: bool,
1941        );
1942    );
1943}
1944
1945/// AVCaptureDeviceLowLightBoost.
1946impl AVCaptureDevice {
1947    extern_methods!(
1948        /// Indicates whether the receiver supports boosting images in low light conditions.
1949        ///
1950        ///
1951        /// The receiver's automaticallyEnablesLowLightBoostWhenAvailable property can only be set if this property returns YES.
1952        #[unsafe(method(isLowLightBoostSupported))]
1953        #[unsafe(method_family = none)]
1954        pub unsafe fn isLowLightBoostSupported(&self) -> bool;
1955
1956        /// Indicates whether the receiver's low light boost feature is enabled.
1957        ///
1958        ///
1959        /// The value of this property is a BOOL indicating whether the receiver is currently enhancing images to improve quality due to low light conditions. When -isLowLightBoostEnabled returns YES, the receiver has switched into a special mode in which more light can be perceived in images. This property is key-value observable.
1960        #[unsafe(method(isLowLightBoostEnabled))]
1961        #[unsafe(method_family = none)]
1962        pub unsafe fn isLowLightBoostEnabled(&self) -> bool;
1963
1964        /// Indicates whether the receiver should automatically switch to low light boost mode when necessary.
1965        ///
1966        ///
1967        /// On a receiver where -isLowLightBoostSupported returns YES, a special low light boost mode may be engaged to improve image quality. When the automaticallyEnablesLowLightBoostWhenAvailable property is set to YES, the receiver switches at its discretion to a special boost mode under low light, and back to normal operation when the scene becomes sufficiently lit. An AVCaptureDevice that supports this feature may only engage boost mode for certain source formats or resolutions. Clients may observe changes to the lowLightBoostEnabled property to know when the mode has engaged. The switch between normal operation and low light boost mode may drop one or more video frames. The default value is NO. Setting this property throws an NSInvalidArgumentException if -isLowLightBoostSupported returns NO. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
1968        #[unsafe(method(automaticallyEnablesLowLightBoostWhenAvailable))]
1969        #[unsafe(method_family = none)]
1970        pub unsafe fn automaticallyEnablesLowLightBoostWhenAvailable(&self) -> bool;
1971
1972        /// Setter for [`automaticallyEnablesLowLightBoostWhenAvailable`][Self::automaticallyEnablesLowLightBoostWhenAvailable].
1973        #[unsafe(method(setAutomaticallyEnablesLowLightBoostWhenAvailable:))]
1974        #[unsafe(method_family = none)]
1975        pub unsafe fn setAutomaticallyEnablesLowLightBoostWhenAvailable(
1976            &self,
1977            automatically_enables_low_light_boost_when_available: bool,
1978        );
1979    );
1980}
1981
1982/// AVCaptureDeviceVideoZoom.
1983impl AVCaptureDevice {
1984    extern_methods!(
1985        #[cfg(feature = "objc2-core-foundation")]
1986        /// Controls zoom level of image outputs
1987        ///
1988        ///
1989        /// Applies a centered crop for all image outputs, scaling as necessary to maintain output dimensions. Minimum value of 1.0 yields full field of view, increasing values will increase magnification, up to a maximum value specified in the activeFormat's videoMaxZoomFactor property. Modifying the zoom factor will cancel any active rampToVideoZoomFactor:withRate:, and snap directly to the assigned value. Assigning values outside the acceptable range will generate an NSRangeException. Clients can key value observe the value of this property. When depth data delivery is enabled, changing the zoom factor sets the videoZoomFactor to the nearest supportedVideoZoomFactor from -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] with a disruptive reconfiguration of the capture render pipeline.
1990        ///
1991        /// -setVideoZoomFactor: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
1992        ///
1993        ///
1994        /// See also: -[AVCaptureDeviceFormat videoMaxZoomFactor], -[AVCaptureDeviceFormat videoZoomFactorUpscaleThreshold], -[AVCaptureDevice minAvailableVideoZoomFactor], -[AVCaptureDevice maxAvailableVideoZoomFactor],  -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery], -[AVCaptureDeviceFormat videoMinZoomFactorForCenterStage] and -[AVCaptureDeviceFormat videoMaxZoomFactorForCenterStage]
1995        #[unsafe(method(videoZoomFactor))]
1996        #[unsafe(method_family = none)]
1997        pub unsafe fn videoZoomFactor(&self) -> CGFloat;
1998
1999        #[cfg(feature = "objc2-core-foundation")]
2000        /// Setter for [`videoZoomFactor`][Self::videoZoomFactor].
2001        #[unsafe(method(setVideoZoomFactor:))]
2002        #[unsafe(method_family = none)]
2003        pub unsafe fn setVideoZoomFactor(&self, video_zoom_factor: CGFloat);
2004
2005        #[cfg(feature = "objc2-core-foundation")]
2006        /// Provides smooth changes in zoom factor.
2007        ///
2008        ///
2009        /// This method provides a change in zoom by compounding magnification at the specified rate over time. Although the zoom factor will grow exponentially, this yields a visually linear zoom in the image over time.
2010        ///
2011        /// The zoom transition will stop at the specified factor, which must be in the valid range for videoZoomFactor. Assignments to videoZoomFactor while a ramp is in progress will cancel the ramp and snap to the assigned value.
2012        ///
2013        /// The zoom factor is continuously scaled by pow(2,rate * time). A rate of 0 causes no change in zoom factor, equivalent to calling cancelVideoZoomRamp. A rate of 1 will cause the magnification to double every second (or halve every second if zooming out), and similarly larger or smaller values will zoom faster or slower respectively. Only the absolute value of the rate is significant--sign is corrected for the direction of the target. Changes in rate will be smoothed by an internal acceleration limit.
2014        ///
2015        /// When depth data delivery is enabled, -rampToVideoZoomFactor:withRate: sets the videoZoomFactor to the nearest supportedVideoZoomFactor from -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] with a disruptive reconfiguration of the capture render pipeline.
2016        ///
2017        /// -rampToVideoZoomFactor:withRate: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
2018        #[unsafe(method(rampToVideoZoomFactor:withRate:))]
2019        #[unsafe(method_family = none)]
2020        pub unsafe fn rampToVideoZoomFactor_withRate(&self, factor: CGFloat, rate: c_float);
2021
2022        /// Indicates if the zoom factor is transitioning to a value set by rampToVideoZoomFactor:withRate:
2023        ///
2024        ///
2025        /// Clients can observe this value to determine when a ramp begins or completes.
2026        #[unsafe(method(isRampingVideoZoom))]
2027        #[unsafe(method_family = none)]
2028        pub unsafe fn isRampingVideoZoom(&self) -> bool;
2029
2030        /// Eases out of any video zoom transitions initiated by rampToVideoZoomFactor:withRate:
2031        ///
2032        ///
2033        /// This method is equivalent to calling rampToVideoZoomFactor:withRate: using the current zoom factor target and a rate of 0. This allows a smooth stop to any changes in zoom which were in progress.
2034        ///
2035        /// -cancelVideoZoomRamp: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
2036        #[unsafe(method(cancelVideoZoomRamp))]
2037        #[unsafe(method_family = none)]
2038        pub unsafe fn cancelVideoZoomRamp(&self);
2039
2040        #[cfg(feature = "objc2-core-foundation")]
2041        /// The video zoom factor at or above which a DualCamera can select between its wide angle camera and its telephoto camera.
2042        ///
2043        ///
2044        /// This is the zoom factor at which the wide angle camera's field of view matches telephoto camera's full field of view. On non-DualCamera devices this will return 1.0. As of iOS 13.0, this API has been deprecated in favor of virtualDeviceSwitchOverVideoZoomFactors.
2045        #[deprecated]
2046        #[unsafe(method(dualCameraSwitchOverVideoZoomFactor))]
2047        #[unsafe(method_family = none)]
2048        pub unsafe fn dualCameraSwitchOverVideoZoomFactor(&self) -> CGFloat;
2049
2050        #[cfg(feature = "objc2-core-foundation")]
2051        /// A multiplier that can be used with the receiver's videoZoomFactor property for displaying a video zoom factor in a user interface.
2052        ///
2053        ///
2054        /// In some system user interfaces, like the macOS Video Effects Menu, the video zoom factor value is displayed in a way most appropriate for visual representation and might differ from the videoZoomFactor property value on the receiver by a fixed ratio. For example, if the videoZoomFactor property value is 1.0 and the displayVideoZoomFactorMultiplier property value is 0.5, then multiplying 1.0 and 0.5 produces 0.5 which can be displayed in the UI. Client applications can key value observe this property to update the display video zoom factor values in their UI to stay consistent with Apple's system UIs.
2055        #[unsafe(method(displayVideoZoomFactorMultiplier))]
2056        #[unsafe(method_family = none)]
2057        pub unsafe fn displayVideoZoomFactorMultiplier(&self) -> CGFloat;
2058    );
2059}
2060
2061/// Constants indicating the client's authorization to the underlying hardware supporting a media type.
2062///
2063///
2064/// Indicates that the user has not yet made a choice regarding whether the client can access the hardware.
2065///
2066/// The client is not authorized to access the hardware for the media type. The user cannot change the client's status, possibly due to active restrictions such as parental controls being in place.
2067///
2068/// The user explicitly denied access to the hardware supporting a media type for the client.
2069///
2070/// The client is authorized to access the hardware supporting a media type.
2071///
2072/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avauthorizationstatus?language=objc)
2073// NS_ENUM
2074#[repr(transparent)]
2075#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2076pub struct AVAuthorizationStatus(pub NSInteger);
2077impl AVAuthorizationStatus {
2078    #[doc(alias = "AVAuthorizationStatusNotDetermined")]
2079    pub const NotDetermined: Self = Self(0);
2080    #[doc(alias = "AVAuthorizationStatusRestricted")]
2081    pub const Restricted: Self = Self(1);
2082    #[doc(alias = "AVAuthorizationStatusDenied")]
2083    pub const Denied: Self = Self(2);
2084    #[doc(alias = "AVAuthorizationStatusAuthorized")]
2085    pub const Authorized: Self = Self(3);
2086}
2087
2088unsafe impl Encode for AVAuthorizationStatus {
2089    const ENCODING: Encoding = NSInteger::ENCODING;
2090}
2091
2092unsafe impl RefEncode for AVAuthorizationStatus {
2093    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2094}
2095
2096/// AVCaptureDeviceAuthorization.
2097impl AVCaptureDevice {
2098    extern_methods!(
2099        #[cfg(feature = "AVMediaFormat")]
2100        /// Returns the client's authorization status for accessing the underlying hardware that supports a given media type.
2101        ///
2102        ///
2103        /// Parameter `mediaType`: The media type, either AVMediaTypeVideo or AVMediaTypeAudio
2104        ///
2105        /// Returns: The authorization status of the client
2106        ///
2107        ///
2108        /// This method returns the AVAuthorizationStatus of the client for accessing the underlying hardware supporting the media type. Media type constants are defined in AVMediaFormat.h. If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown. If the status is AVAuthorizationStatusNotDetermined, you may use the +requestAccessForMediaType:completionHandler: method to request access by prompting the user.
2109        #[unsafe(method(authorizationStatusForMediaType:))]
2110        #[unsafe(method_family = none)]
2111        pub unsafe fn authorizationStatusForMediaType(
2112            media_type: &AVMediaType,
2113        ) -> AVAuthorizationStatus;
2114
2115        #[cfg(all(feature = "AVMediaFormat", feature = "block2"))]
2116        /// Requests access to the underlying hardware for the media type, showing a dialog to the user if necessary.
2117        ///
2118        ///
2119        /// Parameter `mediaType`: The media type, either AVMediaTypeVideo or AVMediaTypeAudio
2120        ///
2121        /// Parameter `handler`: A block called with the result of requesting access
2122        ///
2123        ///
2124        /// Use this function to request access to the hardware for a given media type. Media type constants are defined in AVMediaFormat.h. If any media type other than AVMediaTypeVideo or AVMediaTypeAudio is supplied, an NSInvalidArgumentException will be thrown.
2125        ///
2126        /// This call will not block while the user is being asked for access, allowing the client to continue running. Until access has been granted, any AVCaptureDevices for the media type will vend silent audio samples or black video frames. The user is only asked for permission the first time the client requests access. Later calls use the permission granted by the user.
2127        ///
2128        /// Note that the authorization dialog will automatically be shown if the status is AVAuthorizationStatusNotDetermined when creating an AVCaptureDeviceInput.
2129        ///
2130        /// Invoking this method with AVMediaTypeAudio is equivalent to calling -[AVAudioSession requestRecordPermission:].
2131        ///
2132        /// The completion handler is called on an arbitrary dispatch queue. It is the client's responsibility to ensure that any UIKit-related updates are called on the main queue or main thread as a result.
2133        #[unsafe(method(requestAccessForMediaType:completionHandler:))]
2134        #[unsafe(method_family = none)]
2135        pub unsafe fn requestAccessForMediaType_completionHandler(
2136            media_type: &AVMediaType,
2137            handler: &block2::Block<dyn Fn(Bool)>,
2138        );
2139    );
2140}
2141
2142/// A constant that is used to specify the transport controls' speed.
2143///
2144/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetransportcontrolsspeed?language=objc)
2145pub type AVCaptureDeviceTransportControlsSpeed = c_float;
2146
2147/// Constants indicating the transport controls' current mode of play back, if it has one.
2148///
2149///
2150/// Indicates that the tape transport is not threaded through the play head.
2151///
2152/// Indicates that the tape transport is threaded through the play head.
2153///
2154/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicetransportcontrolsplaybackmode?language=objc)
2155// NS_ENUM
2156#[repr(transparent)]
2157#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2158pub struct AVCaptureDeviceTransportControlsPlaybackMode(pub NSInteger);
2159impl AVCaptureDeviceTransportControlsPlaybackMode {
2160    #[doc(alias = "AVCaptureDeviceTransportControlsNotPlayingMode")]
2161    pub const NotPlayingMode: Self = Self(0);
2162    #[doc(alias = "AVCaptureDeviceTransportControlsPlayingMode")]
2163    pub const PlayingMode: Self = Self(1);
2164}
2165
2166unsafe impl Encode for AVCaptureDeviceTransportControlsPlaybackMode {
2167    const ENCODING: Encoding = NSInteger::ENCODING;
2168}
2169
2170unsafe impl RefEncode for AVCaptureDeviceTransportControlsPlaybackMode {
2171    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2172}
2173
2174/// AVCaptureDeviceTransportControls.
2175impl AVCaptureDevice {
2176    extern_methods!(
2177        /// Returns whether the receiver supports transport control commands.
2178        ///
2179        ///
2180        /// For devices with transport controls, such as AVC tape-based camcorders or pro capture devices with RS422 deck control, the value of this property is YES. If transport controls are not supported, none of the associated transport control methods and properties are available on the receiver.
2181        #[unsafe(method(transportControlsSupported))]
2182        #[unsafe(method_family = none)]
2183        pub unsafe fn transportControlsSupported(&self) -> bool;
2184
2185        /// Returns the receiver's current playback mode.
2186        ///
2187        ///
2188        /// For devices that support transport control, this property may be queried to discover the current playback mode.
2189        #[unsafe(method(transportControlsPlaybackMode))]
2190        #[unsafe(method_family = none)]
2191        pub unsafe fn transportControlsPlaybackMode(
2192            &self,
2193        ) -> AVCaptureDeviceTransportControlsPlaybackMode;
2194
2195        /// Returns the receiver's current playback speed as a floating point value.
2196        ///
2197        ///
2198        /// For devices that support transport control, this property may be queried to discover the current playback speed of the deck.
2199        /// 0.0 -> stopped.
2200        /// 1.0 -> forward at normal speed.
2201        /// -1.0-> reverse at normal speed.
2202        /// 2.0 -> forward at 2x normal speed.
2203        /// etc.
2204        #[unsafe(method(transportControlsSpeed))]
2205        #[unsafe(method_family = none)]
2206        pub unsafe fn transportControlsSpeed(&self) -> AVCaptureDeviceTransportControlsSpeed;
2207
2208        /// Sets both the transport controls playback mode and speed in a single method.
2209        ///
2210        ///
2211        /// Parameter `mode`: A AVCaptureDeviceTransportControlsPlaybackMode indicating whether the deck should be put into play mode.
2212        ///
2213        /// Parameter `speed`: A AVCaptureDeviceTransportControlsSpeed indicating the speed at which to wind or play the tape.
2214        ///
2215        ///
2216        /// A method for setting the receiver's transport controls playback mode and speed. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
2217        #[unsafe(method(setTransportControlsPlaybackMode:speed:))]
2218        #[unsafe(method_family = none)]
2219        pub unsafe fn setTransportControlsPlaybackMode_speed(
2220            &self,
2221            mode: AVCaptureDeviceTransportControlsPlaybackMode,
2222            speed: AVCaptureDeviceTransportControlsSpeed,
2223        );
2224    );
2225}
2226
2227/// AVCaptureDeviceHighDynamicRangeSupport.
2228impl AVCaptureDevice {
2229    extern_methods!(
2230        /// Indicates whether the receiver is allowed to turn high dynamic range streaming on or off.
2231        ///
2232        ///
2233        /// The value of this property is a BOOL indicating whether the receiver is free to turn high dynamic range streaming on or off. This property defaults to YES. When automaticallyAdjustsVideoHDREnabled, the AVCaptureDevice turns videoHDR on automatically if it's a good fit for the activeFormat. -setAutomaticallyAdjustsVideoHDREnabled: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. Clients can key-value observe videoHDREnabled to know when the receiver has automatically changed the value.
2234        #[unsafe(method(automaticallyAdjustsVideoHDREnabled))]
2235        #[unsafe(method_family = none)]
2236        pub unsafe fn automaticallyAdjustsVideoHDREnabled(&self) -> bool;
2237
2238        /// Setter for [`automaticallyAdjustsVideoHDREnabled`][Self::automaticallyAdjustsVideoHDREnabled].
2239        #[unsafe(method(setAutomaticallyAdjustsVideoHDREnabled:))]
2240        #[unsafe(method_family = none)]
2241        pub unsafe fn setAutomaticallyAdjustsVideoHDREnabled(
2242            &self,
2243            automatically_adjusts_video_hdr_enabled: bool,
2244        );
2245
2246        /// Indicates whether the receiver's streaming high dynamic range feature is enabled. See AVCaptureDeviceFormat.isVideoHDRSupported.
2247        ///
2248        ///
2249        /// The value of this property is a BOOL indicating whether the receiver is currently streaming high dynamic range video buffers, also known as Extended Dynamic Range (EDR). The value of this property is ignored when device.activeColorSpace is HLG BT2020 color space since HDR is effectively always on and can't be disabled. The property may only be set if you first set automaticallyAdjustsVideoHDREnabled to NO, otherwise an NSGenericException is thrown. videoHDREnabled may only be set to YES if the receiver's activeFormat.isVideoHDRSupported property returns YES, otherwise an NSGenericException is thrown. This property may be key-value observed.
2250        ///
2251        /// Note that setting this property may cause a lengthy reconfiguration of the receiver, similar to setting a new active format or AVCaptureSession sessionPreset. If you are setting either the active format or the AVCaptureSession's sessionPreset AND this property, you should bracket these operations with [session beginConfiguration] and [session commitConfiguration] to minimize reconfiguration time.
2252        #[unsafe(method(isVideoHDREnabled))]
2253        #[unsafe(method_family = none)]
2254        pub unsafe fn isVideoHDREnabled(&self) -> bool;
2255
2256        /// Setter for [`isVideoHDREnabled`][Self::isVideoHDREnabled].
2257        #[unsafe(method(setVideoHDREnabled:))]
2258        #[unsafe(method_family = none)]
2259        pub unsafe fn setVideoHDREnabled(&self, video_hdr_enabled: bool);
2260    );
2261}
2262
2263/// Constants indicating active or supported video color space.
2264///
2265///
2266/// The sRGB color space ( https://www.w3.org/Graphics/Color/srgb )
2267///
2268/// The P3 D65 wide color space which uses Illuminant D65 as the white point.
2269///
2270/// The BT2020 wide color space which uses Illuminant D65 as the white point and Hybrid Log-Gamma as the transfer function.
2271///
2272/// The Apple Log Color space, which uses BT2020 as the color primaries, and an Apple defined Log curve as a transfer function. When this is set as the active color space on an AVCaptureDevice, any AVCapturePhotoOutput or AVCaptureStillImageOutput connected to the same AVCaptureDevice will have its video connection disabled.
2273///
2274/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecolorspace?language=objc)
2275// NS_ENUM
2276#[repr(transparent)]
2277#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2278pub struct AVCaptureColorSpace(pub NSInteger);
2279impl AVCaptureColorSpace {
2280    #[doc(alias = "AVCaptureColorSpace_sRGB")]
2281    pub const sRGB: Self = Self(0);
2282    #[doc(alias = "AVCaptureColorSpace_P3_D65")]
2283    pub const P3_D65: Self = Self(1);
2284    #[doc(alias = "AVCaptureColorSpace_HLG_BT2020")]
2285    pub const HLG_BT2020: Self = Self(2);
2286    #[doc(alias = "AVCaptureColorSpace_AppleLog")]
2287    pub const AppleLog: Self = Self(3);
2288}
2289
2290unsafe impl Encode for AVCaptureColorSpace {
2291    const ENCODING: Encoding = NSInteger::ENCODING;
2292}
2293
2294unsafe impl RefEncode for AVCaptureColorSpace {
2295    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2296}
2297
2298/// AVCaptureDeviceColorSpaceSupport.
2299impl AVCaptureDevice {
2300    extern_methods!(
2301        /// Indicates the receiver's current active color space.
2302        ///
2303        ///
2304        /// By default, an AVCaptureDevice attached to an AVCaptureSession is automatically configured for wide color by the AVCaptureSession (see AVCaptureSession automaticallyConfiguresCaptureDeviceForWideColor). You may also set the activeColorSpace manually. To prevent the AVCaptureSession from undoing your work, remember to set AVCaptureSession's automaticallyConfiguresCaptureDeviceForWideColor property to NO. Changing the receiver's activeColorSpace while the session is running requires a disruptive reconfiguration of the capture render pipeline. Movie captures in progress will be ended immediately; unfulfilled photo requests will be aborted; video preview will temporarily freeze. -setActiveColorSpace: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:.
2305        #[unsafe(method(activeColorSpace))]
2306        #[unsafe(method_family = none)]
2307        pub unsafe fn activeColorSpace(&self) -> AVCaptureColorSpace;
2308
2309        /// Setter for [`activeColorSpace`][Self::activeColorSpace].
2310        #[unsafe(method(setActiveColorSpace:))]
2311        #[unsafe(method_family = none)]
2312        pub unsafe fn setActiveColorSpace(&self, active_color_space: AVCaptureColorSpace);
2313    );
2314}
2315
2316/// AVCaptureDeviceDepthSupport.
2317impl AVCaptureDevice {
2318    extern_methods!(
2319        /// The currently active depth data format of the receiver.
2320        ///
2321        ///
2322        /// This property can be used to get or set the device's currently active depth data format. -setActiveDepthDataFormat: throws an NSInvalidArgumentException if set to a format not present in the activeFormat's -supportedDepthDataFormats array. -setActiveDepthDataFormat: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:. Clients can observe automatic changes to the receiver's activeDepthDataFormat by key value observing this property. On devices where depth data is not supported, this property returns nil.
2323        ///
2324        /// The frame rate of depth data may not be set directly. Depth data frame rate is synchronized to the device's activeMin/MaxFrameDurations. It may match the device's current frame rate, or lower, if depth data cannot be produced fast enough for the active video frame rate.
2325        ///
2326        /// Delivery of depth data to a AVCaptureDepthDataOutput may increase the system load, resulting in a reduced video frame rate for thermal sustainability.
2327        #[unsafe(method(activeDepthDataFormat))]
2328        #[unsafe(method_family = none)]
2329        pub unsafe fn activeDepthDataFormat(&self) -> Option<Retained<AVCaptureDeviceFormat>>;
2330
2331        /// Setter for [`activeDepthDataFormat`][Self::activeDepthDataFormat].
2332        #[unsafe(method(setActiveDepthDataFormat:))]
2333        #[unsafe(method_family = none)]
2334        pub unsafe fn setActiveDepthDataFormat(
2335            &self,
2336            active_depth_data_format: Option<&AVCaptureDeviceFormat>,
2337        );
2338
2339        #[cfg(feature = "objc2-core-media")]
2340        /// A property indicating the receiver's current active minimum depth data frame duration (the reciprocal of its maximum depth data frame rate).
2341        ///
2342        ///
2343        /// This property may be used to set an upper limit to the frame rate at which depth data is produced. Lowering the depth data frame rate typically lowers power consumption which will increase the time the camera can run before an elevated system pressure state is reached.
2344        ///
2345        /// Setting this property to kCMTimeInvalid resets it to the active depth data format's default min frame duration. Setting this property to kCMTimePositiveInfinity results in a depth data frame rate of 0.
2346        ///
2347        /// The activeDepthDataMinFrameDuration gets reset whenever either the active video format or the active depth data format changes.
2348        ///
2349        /// -setActiveDepthDataMinFrameDuration: throws an NSRangeException if set to a value that is outside of the active depth data format's supported frame rate range.
2350        /// -setActiveDepthDataMinFrameDuration: throws an NSGenericException if called without first obtaining exclusive access to the receiver using lockForConfiguration:.
2351        #[unsafe(method(activeDepthDataMinFrameDuration))]
2352        #[unsafe(method_family = none)]
2353        pub unsafe fn activeDepthDataMinFrameDuration(&self) -> CMTime;
2354
2355        #[cfg(feature = "objc2-core-media")]
2356        /// Setter for [`activeDepthDataMinFrameDuration`][Self::activeDepthDataMinFrameDuration].
2357        #[unsafe(method(setActiveDepthDataMinFrameDuration:))]
2358        #[unsafe(method_family = none)]
2359        pub unsafe fn setActiveDepthDataMinFrameDuration(
2360            &self,
2361            active_depth_data_min_frame_duration: CMTime,
2362        );
2363
2364        #[cfg(feature = "objc2-core-foundation")]
2365        /// Indicates the minimum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
2366        ///
2367        ///
2368        /// On non-virtual devices the minAvailableVideoZoomFactor is always 1.0. If the device's videoZoomFactor property is assigned a value smaller than 1.0, an NSRangeException is thrown.
2369        /// On a virtual device the minAvailableVideoZoomFactor can change when the device is delivering depth data to one or more outputs (see -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery]). When depth data delivery is enabled, allowed zoom factor values are governed by -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] and this contains the absolute minimum zoom of all allowed zoom factors.
2370        /// Setting the videoZoomFactor to a value greater than or equal to 1.0, but lower than minAvailableVideoZoomFactor results in the value being clamped to the minAvailableVideoZoomFactor. Clients can key value observe the value of this property.
2371        #[unsafe(method(minAvailableVideoZoomFactor))]
2372        #[unsafe(method_family = none)]
2373        pub unsafe fn minAvailableVideoZoomFactor(&self) -> CGFloat;
2374
2375        #[cfg(feature = "objc2-core-foundation")]
2376        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
2377        ///
2378        ///
2379        /// On non-virtual devices the maxAvailableVideoZoomFactor is always equal to the activeFormat.videoMaxZoomFactor. If the device's videoZoomFactor property is assigned a value greater than activeFormat.videoMaxZoomFactor, an NSRangeException is thrown.
2380        /// On a virtual device the maxAvailableVideoZoomFactor can change when the device is delivering depth data to one or more outputs (see -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery]). When depth data delivery is enabled, allowed zoom factor values are governed by -[AVCaptureDeviceFormat supportedVideoZoomFactorsForDepthDataDelivery] and this contains the absolute maximum zoom of all allowed zoom factors.
2381        /// Setting the videoZoomFactor to a value less than or equal to activeFormat.videoMaxZoomFactor, but greater than maxAvailableVideoZoomFactor results in the value being clamped to the maxAvailableVideoZoomFactor. Clients can key value observe the value of this property.
2382        #[unsafe(method(maxAvailableVideoZoomFactor))]
2383        #[unsafe(method_family = none)]
2384        pub unsafe fn maxAvailableVideoZoomFactor(&self) -> CGFloat;
2385    );
2386}
2387
2388/// AVCaptureDeviceGeometricDistortionCorrection.
2389impl AVCaptureDevice {
2390    extern_methods!(
2391        /// Indicates that geometric distortion correction is supported by the receiver.
2392        ///
2393        ///
2394        /// Some AVCaptureDevices benefit from geometric distortion correction (GDC), such as devices with a very wide field of view. GDC lessens the fisheye effect at the outer edge of the frame at the cost of losing a small amount of vertical and horizontal field of view. When GDC is enabled on the AVCaptureDevice (see geometricDistortionEnabled), the corrected image is upscaled to the original image size when needed.  With respect to the AVCaptureDevice.videoZoomFactor API, the full viewable field of view is always represented with a videoZoomFactor of 1.0. Thus, when GDC is enabled, the AVCaptureDevice.activeFormat's field of view at videoZoomFactor = 1.0 will be different than when GDC is disabled. The smaller field of view is reported through the activeFormat's geometricDistortionCorrectedVideoFieldOfView property. Beware though that RAW photo captures never have GDC applied, regardless of the value of AVCaptureDevice.geometricDistortionCorrectionEnabled.
2395        #[unsafe(method(isGeometricDistortionCorrectionSupported))]
2396        #[unsafe(method_family = none)]
2397        pub unsafe fn isGeometricDistortionCorrectionSupported(&self) -> bool;
2398
2399        /// Indicates whether geometric distortion correction is enabled by the receiver.
2400        ///
2401        ///
2402        /// Where supported, the default value is YES. The receiver must be locked for configuration using lockForConfiguration: before clients can set this method, otherwise an NSGenericException is thrown.
2403        #[unsafe(method(isGeometricDistortionCorrectionEnabled))]
2404        #[unsafe(method_family = none)]
2405        pub unsafe fn isGeometricDistortionCorrectionEnabled(&self) -> bool;
2406
2407        /// Setter for [`isGeometricDistortionCorrectionEnabled`][Self::isGeometricDistortionCorrectionEnabled].
2408        #[unsafe(method(setGeometricDistortionCorrectionEnabled:))]
2409        #[unsafe(method_family = none)]
2410        pub unsafe fn setGeometricDistortionCorrectionEnabled(
2411            &self,
2412            geometric_distortion_correction_enabled: bool,
2413        );
2414    );
2415}
2416
2417/// AVCaptureDeviceCalibration.
2418impl AVCaptureDevice {
2419    extern_methods!(
2420        /// An NSData containing the relative extrinsic matrix from one AVCaptureDevice to another.
2421        ///
2422        /// Parameter `fromDevice`: The AVCaptureDevice to use as the source. Must be non nil or an NSInvalidArgumentException is thrown.
2423        ///
2424        /// Parameter `toDevice`: The AVCaptureDevice to use as the destination. Must be non nil or an NSInvalidArgumentException is thrown.
2425        ///
2426        ///
2427        /// The extrinsic matrix consists of a unitless 3x3 rotation matrix (R) on the left and a translation (t) 3x1 column vector on the right. The translation vector's units are millimeters. The extrinsics of the "toDevice" camera are expressed with respect to a reference camera "fromDevice". If X_from is a 3D point in "fromCamera"'s coordinate system, then it can be projected into "toCamera"'s coordinate system with X_to = [R | t] * X_from. Note that a matrix_float4x3 matrix is column major with 3 rows and 4 columns. The extrinsicMatrix is only provided for physical cameras for which factory calibrations exist. Virtual device cameras return nil.
2428        /// /
2429        /// \
2430        /// /
2431        /// \
2432        /// | r1,1  r1,2  r1,3 | t1 |
2433        /// |R|t| = | r2,1  r2,2  r2,3 | t2 |
2434        /// \
2435        /// /   | r3,1  r3,2  r3,3 | t3 |
2436        /// \
2437        /// /
2438        ///
2439        /// Note that if you enable video stabilization (see AVCaptureConnection.preferredVideoStabilizationMode), the pixels in stabilized video frames no longer match the relative extrinsicMatrix from one device to another due to warping. The extrinsicMatrix and camera intrinsics should only be used when video stabilization is disabled.
2440        #[unsafe(method(extrinsicMatrixFromDevice:toDevice:))]
2441        #[unsafe(method_family = none)]
2442        pub unsafe fn extrinsicMatrixFromDevice_toDevice(
2443            from_device: &AVCaptureDevice,
2444            to_device: &AVCaptureDevice,
2445        ) -> Option<Retained<NSData>>;
2446    );
2447}
2448
2449/// Constants indicating the current Center Stage control mode.
2450///
2451///
2452/// Indicates that the application is unaware of the Center Stage feature. Its enablement is entirely under user control in Control Center.
2453///
2454/// Indicates that the application controls the Center Stage feature, disallowing input from the user in Control Center.
2455///
2456/// Indicates that both the user and application cooperatively share control of the Center Stage feature.
2457///
2458/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturecenterstagecontrolmode?language=objc)
2459// NS_ENUM
2460#[repr(transparent)]
2461#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2462pub struct AVCaptureCenterStageControlMode(pub NSInteger);
2463impl AVCaptureCenterStageControlMode {
2464    #[doc(alias = "AVCaptureCenterStageControlModeUser")]
2465    pub const User: Self = Self(0);
2466    #[doc(alias = "AVCaptureCenterStageControlModeApp")]
2467    pub const App: Self = Self(1);
2468    #[doc(alias = "AVCaptureCenterStageControlModeCooperative")]
2469    pub const Cooperative: Self = Self(2);
2470}
2471
2472unsafe impl Encode for AVCaptureCenterStageControlMode {
2473    const ENCODING: Encoding = NSInteger::ENCODING;
2474}
2475
2476unsafe impl RefEncode for AVCaptureCenterStageControlMode {
2477    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2478}
2479
2480/// AVCaptureDeviceCenterStage.
2481impl AVCaptureDevice {
2482    extern_methods!(
2483        /// A class property indicating the current mode of Center Stage control (user, app, or cooperative).
2484        ///
2485        ///
2486        /// This class property determines how the Center Stage feature is controlled. When set to the default value of AVCaptureCenterStageControlModeUser, centerStageEnabled may not be set programmatically and throws an NSInvalidArgumentException. In User mode, the feature may only be set by the user in Control Center. If you wish to take Center Stage control away from the user and exclusively enable / disable it programmatically, set this property to AVCaptureCenterStageControlModeApp. When under exclusive app control, Center Stage user control is disallowed (for instance, the toggle is grayed out in Control Center). If you wish to take control of Center Stage, but also cooperate with the user by listening for and appropriately reacting to their changes to the centerStageEnabled property, set this property to AVCaptureCenterStageControlModeCooperative. Note that in this mode, the onus is on you, the app developer, to honor user intent and conform your AVCaptureSession configuration to make Center Stage active (see the AVCaptureDevice instance property centerStageActive). In cooperative mode, the centerStageEnabled property may change at any time (such as when the user enables / disables the feature in Control Center).
2487        #[unsafe(method(centerStageControlMode))]
2488        #[unsafe(method_family = none)]
2489        pub unsafe fn centerStageControlMode() -> AVCaptureCenterStageControlMode;
2490
2491        /// Setter for [`centerStageControlMode`][Self::centerStageControlMode].
2492        #[unsafe(method(setCenterStageControlMode:))]
2493        #[unsafe(method_family = none)]
2494        pub unsafe fn setCenterStageControlMode(
2495            center_stage_control_mode: AVCaptureCenterStageControlMode,
2496        );
2497
2498        /// A class property indicating whether the Center Stage feature is currently enabled or disabled (such as in Control Center or programmatically via your app).
2499        ///
2500        ///
2501        /// This property may only be set if centerStageControlMode is AVCaptureCenterStageControlModeApp or AVCaptureCenterStageControlModeCooperative, and otherwise throws an NSInvalidArgumentException. When centerStageControlMode is AVCaptureCenterStageControlModeUser or AVCaptureCenterStageControlModeCooperative, this property may change according to user desire (such as enabling / disabling the feature in Control Center), so you should key-value observe it.
2502        #[unsafe(method(isCenterStageEnabled))]
2503        #[unsafe(method_family = none)]
2504        pub unsafe fn isCenterStageEnabled() -> bool;
2505
2506        /// Setter for [`isCenterStageEnabled`][Self::isCenterStageEnabled].
2507        #[unsafe(method(setCenterStageEnabled:))]
2508        #[unsafe(method_family = none)]
2509        pub unsafe fn setCenterStageEnabled(center_stage_enabled: bool);
2510
2511        /// Indicates whether Center Stage is currently active on a particular AVCaptureDevice.
2512        ///
2513        ///
2514        /// This readonly property returns YES when Center Stage is currently active on the receiver. When active, the camera automatically adjusts to keep people optimally framed within the field of view. The field of view may pan, tighten or widen as needed. Certain restrictions come into play when Center Stage is active:
2515        /// - The device's minAvailableVideoZoomFactor and maxAvailableVideoZoomFactor become restricted (see AVCaptureDeviceFormat's videoMinZoomFactorForCenterStage and videoMaxZoomFactorForCenterStage).
2516        /// - The device's activeVideoMinFrameDuration and activeVideoMaxFrameDuration are limited (see AVCaptureDeviceFormat's videoFrameRateRangeForCenterStage).
2517        /// Center Stage may be enabled via user control or application control, depending on the current +AVCaptureDevice.centerStageControlMode. When +AVCaptureDevice.centerStageEnabled is YES, a particular AVCaptureDevice instance may return YES for this property, depending whether it supports the feature in its current configuration. Some device features are mutually exclusive to Center Stage:
2518        /// - If depth data delivery is enabled on any output, such as AVCaptureDepthDataOutput, or -AVCapturePhotoOutput.depthDataDeliveryEnabled, Center Stage is deactivated.
2519        /// - If geometricDistortionCorrectionSupported is YES, geometricDistortionCorrectionEnabled must also be YES, or Center Stage is deactivated.
2520        /// This property is key-value observable.
2521        #[unsafe(method(isCenterStageActive))]
2522        #[unsafe(method_family = none)]
2523        pub unsafe fn isCenterStageActive(&self) -> bool;
2524
2525        /// Indicates whether the device supports the Center Stage Rect of Interest feature.
2526        ///
2527        ///
2528        /// This property returns YES if the device supports Center Stage Rect of Interest.
2529        #[unsafe(method(isCenterStageRectOfInterestSupported))]
2530        #[unsafe(method_family = none)]
2531        pub unsafe fn isCenterStageRectOfInterestSupported(&self) -> bool;
2532
2533        #[cfg(feature = "objc2-core-foundation")]
2534        /// Specifies the effective region within the output pixel buffer that will be used to perform Center Stage framing.
2535        ///
2536        ///
2537        /// Applications that wish to apply additional processing (such as cropping) on top of Center Stage's output can use this property to guide Center Stage's framing.
2538        ///
2539        /// The rectangle's origin is top left and is relative to the coordinate space of the output pixel buffer. The default value of this property is the value CGRectMake(0, 0, 1, 1), where {0,0} represents the top left of the picture area, and {1,1} represents the bottom right on an unrotated picture. This rectangle of interest is applied prior to rotation, mirroring or scaling.
2540        ///
2541        /// Pixels outside of this rectangle of interest will be blackened out.
2542        ///
2543        /// Setting this property has no impact on objects specified in the metadata output.
2544        ///
2545        /// -setCenterStageRectOfInterest: throws an NSGenericException if called without first obtaining exclusive access to the receiver using -lockForConfiguration:. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if none of the AVCaptureDeviceFormats supported by the receiver support CenterStage. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if +centerStageEnabled is NO on the AVCaptureDevice class. -setCenterStageRectOfInterest: throws an NSInvalidArgumentException if the provided rectOfInterest goes outside the normalized (0-1) coordinate space.
2546        #[unsafe(method(centerStageRectOfInterest))]
2547        #[unsafe(method_family = none)]
2548        pub unsafe fn centerStageRectOfInterest(&self) -> CGRect;
2549
2550        #[cfg(feature = "objc2-core-foundation")]
2551        /// Setter for [`centerStageRectOfInterest`][Self::centerStageRectOfInterest].
2552        #[unsafe(method(setCenterStageRectOfInterest:))]
2553        #[unsafe(method_family = none)]
2554        pub unsafe fn setCenterStageRectOfInterest(&self, center_stage_rect_of_interest: CGRect);
2555    );
2556}
2557
2558/// AVCaptureDevicePortraitEffect.
2559impl AVCaptureDevice {
2560    extern_methods!(
2561        /// A class property indicating whether the Portrait Effect feature is currently enabled in Control Center.
2562        ///
2563        ///
2564        /// This property changes to reflect the Portrait Effect state in Control Center. It is key-value observable. On iOS, Portrait Effect only applies to video conferencing apps by default (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing apps may opt in for the Portrait Effect by adding the following key to their Info.plist:
2565        /// <key
2566        /// >NSCameraPortraitEffectEnabled
2567        /// </key
2568        /// >
2569        /// <true
2570        /// />
2571        #[unsafe(method(isPortraitEffectEnabled))]
2572        #[unsafe(method_family = none)]
2573        pub unsafe fn isPortraitEffectEnabled() -> bool;
2574
2575        /// Indicates whether Portrait Effect is currently active for a particular AVCaptureDevice.
2576        ///
2577        ///
2578        /// This readonly property returns YES when Portrait Effect is currently active on the receiver. When active, the device blurs the background, simulating a shallow depth of field effect. Certain restrictions come into play when Portrait Effect is active:
2579        /// - The device's activeVideoMinFrameDuration and activeVideoMaxFrameDuration are limited (see AVCaptureDeviceFormat's videoFrameRateRangeForPortraitEffect).
2580        /// Note that when +AVCaptureDevice.portraitEffectEnabled is YES, a particular AVCaptureDevice instance may return YES for this property, depending whether it supports the feature in its current configuration.
2581        /// This property is key-value observable.
2582        #[unsafe(method(isPortraitEffectActive))]
2583        #[unsafe(method_family = none)]
2584        pub unsafe fn isPortraitEffectActive(&self) -> bool;
2585    );
2586}
2587
2588/// AVCaptureDeviceReactionEffects.
2589impl AVCaptureDevice {
2590    extern_methods!(
2591        /// A class property indicating whether the application is suitable for reaction effects, either by automatic gesture detection, or by calls to -[AVCaptureDevice performEffectForReaction:]. Reactions are only rendered when the device's activeFormat.reactionEffectsSupported is also YES, which will be reflected by canPerformReactionEffects when the feature is both enabled and supported.
2592        ///
2593        ///
2594        /// On macOS, Reaction Effects are enabled by default for all applications. On iOS, Reaction Effects are enabled by default for video conferencing applications (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing applications may opt in for Reaction Effects by adding the following key to their Info.plist:
2595        /// <key
2596        /// >NSCameraReactionEffectsEnabled
2597        /// </key
2598        /// >
2599        /// <true
2600        /// />
2601        #[unsafe(method(reactionEffectsEnabled))]
2602        #[unsafe(method_family = none)]
2603        pub unsafe fn reactionEffectsEnabled() -> bool;
2604
2605        /// A class property indicating whether gesture detection will trigger reaction effects on the video stream. Gesture detection will only run when the device's activeFormat.reactionEffectsSupported is also YES, which will be reflected by canPerformReactionEffects.
2606        ///
2607        ///
2608        /// This property changes to reflect the Gestures state in Control Center. It is key-value observable. Clients can call performEffectForReaction: independently of whether gesture detection is enabled, reaction effects from either source will be intermixed.
2609        /// By default, gesture detection is enabled.  As of iOS 17.4 and macOS 14.4, applications can control the default value of this property by adding the following key to their Info.plist:
2610        /// <key
2611        /// >NSCameraReactionEffectGesturesEnabledDefault
2612        /// </key
2613        /// >
2614        /// A value of true enables gesture detection and a value of false disables it, until such time that the user makes their own selection in Control Center.
2615        #[unsafe(method(reactionEffectGesturesEnabled))]
2616        #[unsafe(method_family = none)]
2617        pub unsafe fn reactionEffectGesturesEnabled() -> bool;
2618
2619        /// Indicates whether reactions can be performed on a particular AVCaptureDevice. This requires reactionEffectsEnabled to be YES, as well as using a AVCaptureDeviceFormat with reactionEffectsSupported.
2620        ///
2621        ///
2622        /// This readonly property returns YES when resources for reactions are available on the device instance. When YES, calls to performEffectForReaction: will render on the video feed, otherwise those calls are ignored. It is key-value observable.
2623        #[unsafe(method(canPerformReactionEffects))]
2624        #[unsafe(method_family = none)]
2625        pub unsafe fn canPerformReactionEffects(&self) -> bool;
2626
2627        #[cfg(feature = "AVCaptureReactions")]
2628        /// Returns a list of reaction types which can be passed to performEffectForReaction.
2629        ///
2630        ///
2631        /// The list may differ between devices, or be affected by changes to active format, and can be key-value observed.
2632        #[unsafe(method(availableReactionTypes))]
2633        #[unsafe(method_family = none)]
2634        pub unsafe fn availableReactionTypes(&self) -> Retained<NSSet<AVCaptureReactionType>>;
2635
2636        #[cfg(feature = "AVCaptureReactions")]
2637        /// Triggers a specified reaction on the video stream.
2638        ///
2639        ///
2640        /// Parameter `reactionType`: Indicates which reaction to perform.
2641        ///
2642        ///
2643        /// The entries in reactionEffectsInProgress may not reflect one-to-one against calls to this method. Depending on reaction style or resource limits, triggering multiple overlapping reactions of the same type may be coalesced into extending an existing reaction rather than overlaying a new one.
2644        ///
2645        /// The reactionType requested must be one of those listed in availableReactionTypes or an exception will be thrown. Performing a reaction when canPerformReactionEffects is NO is ignored, and VoIP applications are encouraged to transmit and display such reactions outside of the video feed.
2646        #[unsafe(method(performEffectForReaction:))]
2647        #[unsafe(method_family = none)]
2648        pub unsafe fn performEffectForReaction(&self, reaction_type: &AVCaptureReactionType);
2649
2650        #[cfg(feature = "AVCaptureReactions")]
2651        /// Contains an array of reaction effects that are currently being performed by the device, sorted by timestamp. If observing old and new values in the KVO callback, the reaction effects which are still running in the new array will have kCMTimeInvalid as their endTime property. Reaction effects which have ended will only be in the old array, and will have their endTime property set to the presentation time of the first frame where the reaction effect was no longer present.
2652        ///
2653        ///
2654        /// Reaction effects which are triggered by either a call to performEffectForReaction: or by the automatic gesture detection will be reflected in this array. It is key-value observable to be notified when reaction effects begin or end.
2655        #[unsafe(method(reactionEffectsInProgress))]
2656        #[unsafe(method_family = none)]
2657        pub unsafe fn reactionEffectsInProgress(
2658            &self,
2659        ) -> Retained<NSArray<AVCaptureReactionEffectState>>;
2660    );
2661}
2662
2663/// AVCaptureDeviceBackgroundReplacement.
2664impl AVCaptureDevice {
2665    extern_methods!(
2666        /// A class property indicating whether the user has enabled the Background Replacement feature for this application.
2667        #[unsafe(method(isBackgroundReplacementEnabled))]
2668        #[unsafe(method_family = none)]
2669        pub unsafe fn isBackgroundReplacementEnabled() -> bool;
2670
2671        /// Indicates whether Background Replacement is currently active on a particular AVCaptureDevice.
2672        ///
2673        ///
2674        /// This property is key-value observable.
2675        #[unsafe(method(isBackgroundReplacementActive))]
2676        #[unsafe(method_family = none)]
2677        pub unsafe fn isBackgroundReplacementActive(&self) -> bool;
2678    );
2679}
2680
2681/// AVCaptureDeviceContinuityCamera.
2682impl AVCaptureDevice {
2683    extern_methods!(
2684        /// A property that reports YES if the receiver is a Continuity Camera.
2685        ///
2686        ///
2687        /// Access this property to discover if the receiver is a Continuity Camera (external iPhone webcam).
2688        #[unsafe(method(isContinuityCamera))]
2689        #[unsafe(method_family = none)]
2690        pub unsafe fn isContinuityCamera(&self) -> bool;
2691    );
2692}
2693
2694/// AVCaptureDeviceDeskViewCamera.
2695impl AVCaptureDevice {
2696    extern_methods!(
2697        /// A reference to the Desk View Camera that is associated with and derived from this camera.
2698        ///
2699        ///
2700        /// The companionDeskViewCamera property allows you to discover if the receiver has a paired Desk View Camera which derives its desk framing from the receiver's ultra wide frame. In the presence of multiple Continuity Cameras, this property allows you to pair a particular Continuity Camera with its associated Desk View Camera.
2701        #[unsafe(method(companionDeskViewCamera))]
2702        #[unsafe(method_family = none)]
2703        pub unsafe fn companionDeskViewCamera(&self) -> Option<Retained<AVCaptureDevice>>;
2704    );
2705}
2706
2707/// Constants describing microphone filtering modes.
2708///
2709///
2710/// Indicates that microphone audio is being processed with standard voice DSP.
2711///
2712/// Indicates that microphone audio processing is minimized to capture all sounds in the room.
2713///
2714/// Indicates that microphone audio is being processed to isolate the voice and attenuate other signals.
2715///
2716/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturemicrophonemode?language=objc)
2717// NS_ENUM
2718#[repr(transparent)]
2719#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2720pub struct AVCaptureMicrophoneMode(pub NSInteger);
2721impl AVCaptureMicrophoneMode {
2722    #[doc(alias = "AVCaptureMicrophoneModeStandard")]
2723    pub const Standard: Self = Self(0);
2724    #[doc(alias = "AVCaptureMicrophoneModeWideSpectrum")]
2725    pub const WideSpectrum: Self = Self(1);
2726    #[doc(alias = "AVCaptureMicrophoneModeVoiceIsolation")]
2727    pub const VoiceIsolation: Self = Self(2);
2728}
2729
2730unsafe impl Encode for AVCaptureMicrophoneMode {
2731    const ENCODING: Encoding = NSInteger::ENCODING;
2732}
2733
2734unsafe impl RefEncode for AVCaptureMicrophoneMode {
2735    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2736}
2737
2738/// AVCaptureMicrophoneMode.
2739impl AVCaptureDevice {
2740    extern_methods!(
2741        /// Indicates the microphone mode that has been selected by the user in Control Center.
2742        ///
2743        ///
2744        /// This readonly property returns the microphone mode selected by the user in Control Center. It is key-value observable.
2745        #[unsafe(method(preferredMicrophoneMode))]
2746        #[unsafe(method_family = none)]
2747        pub unsafe fn preferredMicrophoneMode() -> AVCaptureMicrophoneMode;
2748
2749        /// Indicates the currently active microphone mode.
2750        ///
2751        ///
2752        /// This readonly property returns the currently active microphone mode, which may differ from the preferredMicrophoneMode if the application's active audio route does not support the preferred microphone mode. This property is key-value observable.
2753        #[unsafe(method(activeMicrophoneMode))]
2754        #[unsafe(method_family = none)]
2755        pub unsafe fn activeMicrophoneMode() -> AVCaptureMicrophoneMode;
2756    );
2757}
2758
2759/// Constants describing the system user interfaces available to +showSystemUserInterface:.
2760///
2761///
2762/// Indicates the system UI for enabling / disabling video effects.
2763///
2764/// Indicates the system UI for selecting microphone modes.
2765///
2766/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturesystemuserinterface?language=objc)
2767// NS_ENUM
2768#[repr(transparent)]
2769#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2770pub struct AVCaptureSystemUserInterface(pub NSInteger);
2771impl AVCaptureSystemUserInterface {
2772    #[doc(alias = "AVCaptureSystemUserInterfaceVideoEffects")]
2773    pub const VideoEffects: Self = Self(1);
2774    #[doc(alias = "AVCaptureSystemUserInterfaceMicrophoneModes")]
2775    pub const MicrophoneModes: Self = Self(2);
2776}
2777
2778unsafe impl Encode for AVCaptureSystemUserInterface {
2779    const ENCODING: Encoding = NSInteger::ENCODING;
2780}
2781
2782unsafe impl RefEncode for AVCaptureSystemUserInterface {
2783    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2784}
2785
2786/// AVCaptureSystemUserInterface.
2787impl AVCaptureDevice {
2788    extern_methods!(
2789        /// Displays the system's user interface for video effects or microphone modes.
2790        ///
2791        ///
2792        /// Parameter `systemUserInterface`: The system UI to show.
2793        ///
2794        ///
2795        /// This method allows the calling application to prompt the user to make changes to Video Effects (such as Center Stage or the Portrait Effect) or Microphone Modes. It brings up the system user interface and deep links to the appropriate module. This method is non-blocking. After presenting the desired system user interface, control returns immediately to the application.
2796        #[unsafe(method(showSystemUserInterface:))]
2797        #[unsafe(method_family = none)]
2798        pub unsafe fn showSystemUserInterface(system_user_interface: AVCaptureSystemUserInterface);
2799    );
2800}
2801
2802/// AVSpatialCaptureDiscomfortReason string constants
2803///
2804///
2805/// The AVSpatialCaptureDiscomfortReason string constants are used to report the applicability of the current scene to create a comfortable viewing experience.
2806///
2807/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreason?language=objc)
2808// NS_TYPED_ENUM
2809pub type AVSpatialCaptureDiscomfortReason = NSString;
2810
2811extern "C" {
2812    /// The lighting of the current scene is not bright enough; the playback experience will likely be uncomfortable due to noise differences between the two cameras.
2813    ///
2814    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreasonnotenoughlight?language=objc)
2815    pub static AVSpatialCaptureDiscomfortReasonNotEnoughLight:
2816        &'static AVSpatialCaptureDiscomfortReason;
2817}
2818
2819extern "C" {
2820    /// The focus point of the current scene is too close; the playback experience will likely be uncomfortable due to the subject being closer than the minimum focus distance of one or both of the lenses.
2821    ///
2822    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avspatialcapturediscomfortreasonsubjecttooclose?language=objc)
2823    pub static AVSpatialCaptureDiscomfortReasonSubjectTooClose:
2824        &'static AVSpatialCaptureDiscomfortReason;
2825}
2826
2827/// AVCaptureDeviceSpatialCapture.
2828impl AVCaptureDevice {
2829    extern_methods!(
2830        /// Indicates whether or not the current environmental conditions are amenable to a spatial capture that is comfortable to view.
2831        ///
2832        ///
2833        /// This property can be monitored in order to determine the presentation of U/I elements to inform the user that they should reframe their scene for a more pleasing spatial capture ("subject is too close", "scene is too dark").
2834        #[unsafe(method(spatialCaptureDiscomfortReasons))]
2835        #[unsafe(method_family = none)]
2836        pub unsafe fn spatialCaptureDiscomfortReasons(
2837            &self,
2838        ) -> Retained<NSSet<AVSpatialCaptureDiscomfortReason>>;
2839    );
2840}
2841
2842extern_class!(
2843    /// The AVCaptureDeviceDiscoverySession allows clients to search for devices by certain criteria.
2844    ///
2845    ///
2846    /// This class allows clients to discover devices by providing certain search criteria. The objective of this class is to help find devices by device type and optionally by media type or position and allow you to key-value observe changes to the returned devices list.
2847    ///
2848    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicediscoverysession?language=objc)
2849    #[unsafe(super(NSObject))]
2850    #[derive(Debug, PartialEq, Eq, Hash)]
2851    pub struct AVCaptureDeviceDiscoverySession;
2852);
2853
2854unsafe impl NSObjectProtocol for AVCaptureDeviceDiscoverySession {}
2855
2856impl AVCaptureDeviceDiscoverySession {
2857    extern_methods!(
2858        #[unsafe(method(init))]
2859        #[unsafe(method_family = init)]
2860        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2861
2862        #[unsafe(method(new))]
2863        #[unsafe(method_family = new)]
2864        pub unsafe fn new() -> Retained<Self>;
2865
2866        #[cfg(feature = "AVMediaFormat")]
2867        /// Returns an AVCaptureDeviceDiscoverySession instance for the given device types, media type, and position.
2868        ///
2869        ///
2870        /// Parameter `deviceTypes`: An array specifying the device types to include in the list of discovered devices.
2871        ///
2872        /// Parameter `mediaType`: The media type, such as AVMediaTypeVideo, AVMediaTypeAudio, or AVMediaTypeMuxed, to include in the list of discovered devices. Pass nil to search for devices with any media type.
2873        ///
2874        /// Parameter `position`: The position to include in the list of discovered devices. Pass AVCaptureDevicePositionUnspecified to search for devices with any position.
2875        ///
2876        /// Returns: The AVCaptureDeviceDiscoverySession from which the list of devices can be obtained.
2877        ///
2878        ///
2879        /// The list of device types is mandatory. This is used to make sure that clients only get access to devices of types they expect. This prevents new device types from automatically being included in the list of devices.
2880        #[unsafe(method(discoverySessionWithDeviceTypes:mediaType:position:))]
2881        #[unsafe(method_family = none)]
2882        pub unsafe fn discoverySessionWithDeviceTypes_mediaType_position(
2883            device_types: &NSArray<AVCaptureDeviceType>,
2884            media_type: Option<&AVMediaType>,
2885            position: AVCaptureDevicePosition,
2886        ) -> Retained<Self>;
2887
2888        /// The list of devices that comply to the search criteria specified on the discovery session.
2889        ///
2890        ///
2891        /// The returned array contains only devices that are available at the time the method is called. Applications can key-value observe this property to be notified when the list of available devices has changed. For apps linked against iOS 10, the devices returned are unsorted. For apps linked against iOS 11 or later, the devices are sorted by AVCaptureDeviceType, matching the order specified in the deviceTypes parameter of +[AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:mediaType:position:]. If a position of AVCaptureDevicePositionUnspecified is specified, the results are further ordered by position in the AVCaptureDevicePosition enum. Starting in Mac Catalyst 14.0, clients can key value observe the value of this property to be notified when the devices change.
2892        #[unsafe(method(devices))]
2893        #[unsafe(method_family = none)]
2894        pub unsafe fn devices(&self) -> Retained<NSArray<AVCaptureDevice>>;
2895
2896        /// An array of sets of AVCaptureDevices that are allowed to be used simultaneously in an AVCaptureMultiCamSession.
2897        ///
2898        ///
2899        /// When using an AVCaptureMultiCamSession, multiple cameras may be used as device inputs to the session, so long as they are included in one of the supportedMultiCamDeviceSets. Starting in Mac Catalyst 14.0, clients can key value observe the value of this property to be notified when the device sets change.
2900        #[unsafe(method(supportedMultiCamDeviceSets))]
2901        #[unsafe(method_family = none)]
2902        pub unsafe fn supportedMultiCamDeviceSets(
2903            &self,
2904        ) -> Retained<NSArray<NSSet<AVCaptureDevice>>>;
2905    );
2906}
2907
2908extern_class!(
2909    /// The AVCaptureDeviceRotationCoordinator allows clients to monitor rotations of a given AVCaptureDevice instance and be provided the video rotation angle that should be applied for horizon-level preview and capture relative to gravity.
2910    ///
2911    ///
2912    /// Each instance of AVCaptureDeviceRotationCoordinator allows a client to coordinate with changes to the rotation of an AVCaptureDevice to ensure the camera's video preview and captured output are horizon-level. The coordinator delivers key-value updates on the main queue.
2913    ///
2914    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedevicerotationcoordinator?language=objc)
2915    #[unsafe(super(NSObject))]
2916    #[derive(Debug, PartialEq, Eq, Hash)]
2917    pub struct AVCaptureDeviceRotationCoordinator;
2918);
2919
2920unsafe impl NSObjectProtocol for AVCaptureDeviceRotationCoordinator {}
2921
2922impl AVCaptureDeviceRotationCoordinator {
2923    extern_methods!(
2924        #[unsafe(method(init))]
2925        #[unsafe(method_family = init)]
2926        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2927
2928        #[unsafe(method(new))]
2929        #[unsafe(method_family = new)]
2930        pub unsafe fn new() -> Retained<Self>;
2931
2932        #[cfg(feature = "objc2-quartz-core")]
2933        #[cfg(not(target_os = "watchos"))]
2934        /// Returns an AVCaptureDeviceRotationCoordinator instance that provides updates to the amount of rotation that should be applied for horizon-level preview and capture relative to gravity.
2935        ///
2936        ///
2937        /// Parameter `device`: The device for which to monitor rotation.
2938        ///
2939        /// Parameter `previewLayer`: A layer displaying the camera's video preview. If nil, the coordinator will return 0 degrees of rotation for horizon-level preview.
2940        ///
2941        /// Returns: An AVCaptureDeviceRotationCoordinator from which rotation angles for preview and capture can be obtained.
2942        ///
2943        ///
2944        /// An AVCaptureDeviceRotationCoordinator is only applicable to video devices. The given device and layer determine the amount of rotation that should be applied for horizon-level preview and capture.
2945        #[unsafe(method(initWithDevice:previewLayer:))]
2946        #[unsafe(method_family = init)]
2947        pub unsafe fn initWithDevice_previewLayer(
2948            this: Allocated<Self>,
2949            device: &AVCaptureDevice,
2950            preview_layer: Option<&CALayer>,
2951        ) -> Retained<Self>;
2952
2953        /// The the device for which the coordinator provides video rotation angles.
2954        ///
2955        ///
2956        /// The value of this property is the AVCaptureDevice instance that was used to create the coordinator. The coordinator holds a weak reference to the device.
2957        #[unsafe(method(device))]
2958        #[unsafe(method_family = none)]
2959        pub unsafe fn device(&self) -> Option<Retained<AVCaptureDevice>>;
2960
2961        #[cfg(feature = "objc2-quartz-core")]
2962        #[cfg(not(target_os = "watchos"))]
2963        /// The CALayer for which the coordinator calculates video rotation angles for horizon-level preview.
2964        ///
2965        ///
2966        /// The value of this property is the CALayer instance that was used to create the coordinator. Clients may specify an AVCaptureVideoPreviewLayer or other CALayer instance that displays a camera's video preview. The coordinator holds a weak reference to the layer. The coordinator will return 0 degrees of rotation from -videoRotationAngleForHorizonLevelPreview if a layer was not specified at initialization, the layer is not in a view hierarchy, or the layer has been deallocated.
2967        #[unsafe(method(previewLayer))]
2968        #[unsafe(method_family = none)]
2969        pub unsafe fn previewLayer(&self) -> Option<Retained<CALayer>>;
2970
2971        #[cfg(feature = "objc2-core-foundation")]
2972        /// Returns a video rotation angle in degrees for displaying the camera's video preview in the given CALayer.
2973        ///
2974        ///
2975        /// The video rotation angle represents by how much the camera's video preview should be rotated for display in the CALayer to be horizon-level relative to gravity. An angle of 0 degrees means that video will be output in the camera's unrotated, native sensor orientation. The video rotation angle for preview may differ between cameras at different positions. For example when an iOS device is held in portrait orientation, the video preview for built-in cameras may need to be rotated by 90 degrees while the video preview for an external camera should not be rotated. External cameras return 0 degrees of rotation even if they physically rotate when their position in physical space is unknown. This property is key-value observable and delivers updates on the main queue.
2976        #[unsafe(method(videoRotationAngleForHorizonLevelPreview))]
2977        #[unsafe(method_family = none)]
2978        pub unsafe fn videoRotationAngleForHorizonLevelPreview(&self) -> CGFloat;
2979
2980        #[cfg(feature = "objc2-core-foundation")]
2981        /// Returns a video rotation angle in degrees for horizon-level capture from this camera.
2982        ///
2983        ///
2984        /// The video rotation angle represents by how much the photos or movies captured from the camera should be rotated to be horizon-level relative to gravity. A video rotation angle of 0 degrees means that the output will be in the camera's unrotated, native sensor orientation. The video rotation angle for capture may differ between cameras. For example when an iOS device is held in portrait orientation, photos and movies captured from built-in cameras may need to be rotated by 90 degrees while the photos and movies from an external camera should not be rotated. External cameras return 0 degrees of rotation even if they physically rotate when their position in physical space is unknown. The video rotation angle returned from this property is distinct from the angle returned by -videoRotationAngleForHorizonLevelPreview because in certain combinations of device and interface orientations, the video rotation angle needed for horizon-level preview may not match the amount of rotation needed for horizon-level capture. This property is key-value observable and delivers updates on the main queue.
2985        #[unsafe(method(videoRotationAngleForHorizonLevelCapture))]
2986        #[unsafe(method_family = none)]
2987        pub unsafe fn videoRotationAngleForHorizonLevelCapture(&self) -> CGFloat;
2988    );
2989}
2990
2991extern_class!(
2992    /// An AVExposureBiasRange expresses an inclusive range of supported exposure bias values, in EV units.
2993    ///
2994    ///
2995    /// This is used by AVCaptureSystemExposureBiasSlider for the range the slider uses.
2996    ///
2997    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avexposurebiasrange?language=objc)
2998    #[unsafe(super(NSObject))]
2999    #[derive(Debug, PartialEq, Eq, Hash)]
3000    pub struct AVExposureBiasRange;
3001);
3002
3003unsafe impl NSObjectProtocol for AVExposureBiasRange {}
3004
3005impl AVExposureBiasRange {
3006    extern_methods!(
3007        #[unsafe(method(init))]
3008        #[unsafe(method_family = init)]
3009        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3010
3011        #[unsafe(method(new))]
3012        #[unsafe(method_family = new)]
3013        pub unsafe fn new() -> Retained<Self>;
3014
3015        /// A float indicating the minimum exposure bias in EV units supported by this range.
3016        #[unsafe(method(minExposureBias))]
3017        #[unsafe(method_family = none)]
3018        pub unsafe fn minExposureBias(&self) -> c_float;
3019
3020        /// A float indicating the maximum exposure bias in EV units supported by this range.
3021        #[unsafe(method(maxExposureBias))]
3022        #[unsafe(method_family = none)]
3023        pub unsafe fn maxExposureBias(&self) -> c_float;
3024
3025        /// Tests if a given exposure bias in EV units is within the exposure bias range.
3026        ///
3027        ///
3028        /// Parameter `exposureBias`: The exposure bias to test.
3029        ///
3030        /// Returns: Returns YES if the given exposure bias is within the exposure bias, NO otherwise.
3031        ///
3032        ///
3033        /// Note that the exposure bias ranges are inclusive.
3034        #[unsafe(method(containsExposureBias:))]
3035        #[unsafe(method_family = none)]
3036        pub unsafe fn containsExposureBias(&self, exposure_bias: c_float) -> bool;
3037    );
3038}
3039
3040extern_class!(
3041    /// An AVFrameRateRange expresses a range of valid frame rates as min and max rate and min and max duration.
3042    ///
3043    ///
3044    /// An AVCaptureDevice exposes an array of formats, and its current activeFormat may be queried. The payload for the formats property is an array of AVCaptureDeviceFormat objects and the activeFormat property payload is an AVCaptureDeviceFormat. AVCaptureDeviceFormat wraps a CMFormatDescription and expresses a range of valid video frame rates as an NSArray of AVFrameRateRange objects. AVFrameRateRange expresses min and max frame rate as a rate in frames per second and duration (CMTime). An AVFrameRateRange object is immutable. Its values do not change for the life of the object.
3045    ///
3046    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avframeraterange?language=objc)
3047    #[unsafe(super(NSObject))]
3048    #[derive(Debug, PartialEq, Eq, Hash)]
3049    pub struct AVFrameRateRange;
3050);
3051
3052unsafe impl NSObjectProtocol for AVFrameRateRange {}
3053
3054impl AVFrameRateRange {
3055    extern_methods!(
3056        #[unsafe(method(init))]
3057        #[unsafe(method_family = init)]
3058        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3059
3060        #[unsafe(method(new))]
3061        #[unsafe(method_family = new)]
3062        pub unsafe fn new() -> Retained<Self>;
3063
3064        /// A Float64 indicating the minimum frame rate supported by this range.
3065        ///
3066        ///
3067        /// This read-only property indicates the minimum frame rate supported by this range in frames per second.
3068        #[unsafe(method(minFrameRate))]
3069        #[unsafe(method_family = none)]
3070        pub unsafe fn minFrameRate(&self) -> f64;
3071
3072        /// A Float64 indicating the maximum frame rate supported by this range.
3073        ///
3074        ///
3075        /// This read-only property indicates the maximum frame rate supported by this range in frames per second.
3076        #[unsafe(method(maxFrameRate))]
3077        #[unsafe(method_family = none)]
3078        pub unsafe fn maxFrameRate(&self) -> f64;
3079
3080        #[cfg(feature = "objc2-core-media")]
3081        /// A CMTime indicating the maximum frame duration supported by this range.
3082        ///
3083        ///
3084        /// This read-only property indicates the maximum frame duration supported by this range. It is the reciprocal of minFrameRate, and expresses minFrameRate as a duration.
3085        #[unsafe(method(maxFrameDuration))]
3086        #[unsafe(method_family = none)]
3087        pub unsafe fn maxFrameDuration(&self) -> CMTime;
3088
3089        #[cfg(feature = "objc2-core-media")]
3090        /// A CMTime indicating the minimum frame duration supported by this range.
3091        ///
3092        ///
3093        /// This read-only property indicates the minimum frame duration supported by this range. It is the reciprocal of maxFrameRate, and expresses maxFrameRate as a duration.
3094        #[unsafe(method(minFrameDuration))]
3095        #[unsafe(method_family = none)]
3096        pub unsafe fn minFrameDuration(&self) -> CMTime;
3097    );
3098}
3099
3100extern_class!(
3101    /// An AVZoomRange expresses an inclusive range of supported zoom factors.
3102    ///
3103    ///
3104    /// This is used by features that have requirements on zoom factors falling within certain ranges.
3105    ///
3106    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avzoomrange?language=objc)
3107    #[unsafe(super(NSObject))]
3108    #[derive(Debug, PartialEq, Eq, Hash)]
3109    pub struct AVZoomRange;
3110);
3111
3112unsafe impl NSObjectProtocol for AVZoomRange {}
3113
3114impl AVZoomRange {
3115    extern_methods!(
3116        #[unsafe(method(init))]
3117        #[unsafe(method_family = init)]
3118        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3119
3120        #[unsafe(method(new))]
3121        #[unsafe(method_family = new)]
3122        pub unsafe fn new() -> Retained<Self>;
3123
3124        #[cfg(feature = "objc2-core-foundation")]
3125        /// A CGFloat indicating the minimum zoom factor supported by this range.
3126        #[unsafe(method(minZoomFactor))]
3127        #[unsafe(method_family = none)]
3128        pub unsafe fn minZoomFactor(&self) -> CGFloat;
3129
3130        #[cfg(feature = "objc2-core-foundation")]
3131        /// A CGFloat indicating the maximum zoom factor supported by this range.
3132        #[unsafe(method(maxZoomFactor))]
3133        #[unsafe(method_family = none)]
3134        pub unsafe fn maxZoomFactor(&self) -> CGFloat;
3135
3136        #[cfg(feature = "objc2-core-foundation")]
3137        /// Tests if a given zoom factor is within the zoom range.
3138        ///
3139        /// Parameter `zoomFactor`: The zoom factor to test.
3140        ///
3141        /// Returns: Returns YES if the given zoom factor is within the zoom range, NO otherwise.
3142        ///
3143        /// Note that the zoom ranges are inclusive.
3144        #[unsafe(method(containsZoomFactor:))]
3145        #[unsafe(method_family = none)]
3146        pub unsafe fn containsZoomFactor(&self, zoom_factor: CGFloat) -> bool;
3147    );
3148}
3149
3150/// Constants indicating the modes of video stabilization supported by the device's format.
3151///
3152///
3153/// Indicates that video should not be stabilized.
3154///
3155/// Indicates that video should be stabilized using the standard video stabilization algorithm introduced with iOS 5.0. Standard video stabilization has a reduced field of view. Enabling video stabilization may introduce additional latency into the video capture pipeline.
3156///
3157/// Indicates that video should be stabilized using the cinematic stabilization algorithm for more dramatic results. Cinematic video stabilization has a reduced field of view compared to standard video stabilization. Enabling cinematic video stabilization introduces much more latency into the video capture pipeline than standard video stabilization and consumes significantly more system memory. Use narrow or identical min and max frame durations in conjunction with this mode.
3158///
3159/// Indicates that the video should be stabilized using the extended cinematic stabilization algorithm. Enabling extended cinematic stabilization introduces longer latency into the video capture pipeline compared to the AVCaptureVideoStabilizationModeCinematic and consumes more memory, but yields improved stability. It is recommended to use identical or similar min and max frame durations in conjunction with this mode.
3160///
3161/// Indicates that video should be stabilized using the preview optimized stabilization algorithm. Preview stabilization is a low latency and low power algorithm which is supported only on connections which either have an associated preview layer or have a preview-sized VideoDataOutput.
3162///
3163/// Indicates that the video should be stabilized using the enhanced extended cinematic stabilization algorithm. Enhanced extended cinematic has a reduced field of view compared to extended cinematic, without any noticeable increase in latency, and it yields improved stability. It is recommended to use identical or similar min and max frame durations in conjunction with this mode.
3164///
3165/// Indicates that the most appropriate video stabilization mode for the device and format should be chosen.
3166///
3167/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideostabilizationmode?language=objc)
3168// NS_ENUM
3169#[repr(transparent)]
3170#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3171pub struct AVCaptureVideoStabilizationMode(pub NSInteger);
3172impl AVCaptureVideoStabilizationMode {
3173    #[doc(alias = "AVCaptureVideoStabilizationModeOff")]
3174    pub const Off: Self = Self(0);
3175    #[doc(alias = "AVCaptureVideoStabilizationModeStandard")]
3176    pub const Standard: Self = Self(1);
3177    #[doc(alias = "AVCaptureVideoStabilizationModeCinematic")]
3178    pub const Cinematic: Self = Self(2);
3179    #[doc(alias = "AVCaptureVideoStabilizationModeCinematicExtended")]
3180    pub const CinematicExtended: Self = Self(3);
3181    #[doc(alias = "AVCaptureVideoStabilizationModePreviewOptimized")]
3182    pub const PreviewOptimized: Self = Self(4);
3183    #[doc(alias = "AVCaptureVideoStabilizationModeCinematicExtendedEnhanced")]
3184    pub const CinematicExtendedEnhanced: Self = Self(5);
3185    #[doc(alias = "AVCaptureVideoStabilizationModeAuto")]
3186    pub const Auto: Self = Self(-1);
3187}
3188
3189unsafe impl Encode for AVCaptureVideoStabilizationMode {
3190    const ENCODING: Encoding = NSInteger::ENCODING;
3191}
3192
3193unsafe impl RefEncode for AVCaptureVideoStabilizationMode {
3194    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3195}
3196
3197/// Constants indicating the autofocus system.
3198///
3199///
3200/// Indicates that autofocus is not available.
3201///
3202/// Indicates that autofocus is achieved by contrast detection. Contrast detection performs a focus scan to find the optimal position.
3203///
3204/// Indicates that autofocus is achieved by phase detection. Phase detection has the ability to achieve focus in many cases without a focus scan. Phase detection autofocus is typically less visually intrusive than contrast detection autofocus.
3205///
3206/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureautofocussystem?language=objc)
3207// NS_ENUM
3208#[repr(transparent)]
3209#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
3210pub struct AVCaptureAutoFocusSystem(pub NSInteger);
3211impl AVCaptureAutoFocusSystem {
3212    #[doc(alias = "AVCaptureAutoFocusSystemNone")]
3213    pub const None: Self = Self(0);
3214    #[doc(alias = "AVCaptureAutoFocusSystemContrastDetection")]
3215    pub const ContrastDetection: Self = Self(1);
3216    #[doc(alias = "AVCaptureAutoFocusSystemPhaseDetection")]
3217    pub const PhaseDetection: Self = Self(2);
3218}
3219
3220unsafe impl Encode for AVCaptureAutoFocusSystem {
3221    const ENCODING: Encoding = NSInteger::ENCODING;
3222}
3223
3224unsafe impl RefEncode for AVCaptureAutoFocusSystem {
3225    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
3226}
3227
3228extern_class!(
3229    /// An AVCaptureDeviceFormat wraps a CMFormatDescription and other format-related information, such as min and max framerate.
3230    ///
3231    ///
3232    /// An AVCaptureDevice exposes an array of formats, and its current activeFormat may be queried. The payload for the formats property is an array of AVCaptureDeviceFormat objects and the activeFormat property payload is an AVCaptureDeviceFormat. AVCaptureDeviceFormat is a thin wrapper around a CMFormatDescription, and can carry associated device format information that doesn't go in a CMFormatDescription, such as min and max frame rate. An AVCaptureDeviceFormat object is immutable. Its values do not change for the life of the object.
3233    ///
3234    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceformat?language=objc)
3235    #[unsafe(super(NSObject))]
3236    #[derive(Debug, PartialEq, Eq, Hash)]
3237    pub struct AVCaptureDeviceFormat;
3238);
3239
3240unsafe impl NSObjectProtocol for AVCaptureDeviceFormat {}
3241
3242impl AVCaptureDeviceFormat {
3243    extern_methods!(
3244        #[unsafe(method(init))]
3245        #[unsafe(method_family = init)]
3246        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3247
3248        #[unsafe(method(new))]
3249        #[unsafe(method_family = new)]
3250        pub unsafe fn new() -> Retained<Self>;
3251
3252        #[cfg(feature = "AVMediaFormat")]
3253        /// An NSString describing the media type of an AVCaptureDevice active or supported format.
3254        ///
3255        ///
3256        /// Supported mediaTypes are listed in AVMediaFormat.h. This is a read-only property. The caller assumes no ownership of the returned value and should not CFRelease it.
3257        #[unsafe(method(mediaType))]
3258        #[unsafe(method_family = none)]
3259        pub unsafe fn mediaType(&self) -> Retained<AVMediaType>;
3260
3261        #[cfg(feature = "objc2-core-media")]
3262        /// A CMFormatDescription describing an AVCaptureDevice active or supported format.
3263        ///
3264        ///
3265        /// A CMFormatDescription describing an AVCaptureDevice active or supported format. This is a read-only property. The caller assumes no ownership of the returned value and should not CFRelease it.
3266        #[unsafe(method(formatDescription))]
3267        #[unsafe(method_family = none)]
3268        pub unsafe fn formatDescription(&self) -> Retained<CMFormatDescription>;
3269
3270        /// A property indicating the format's supported frame rate ranges.
3271        ///
3272        ///
3273        /// videoSupportedFrameRateRanges is an array of AVFrameRateRange objects, one for each of the format's supported video frame rate ranges.
3274        #[unsafe(method(videoSupportedFrameRateRanges))]
3275        #[unsafe(method_family = none)]
3276        pub unsafe fn videoSupportedFrameRateRanges(&self) -> Retained<NSArray<AVFrameRateRange>>;
3277
3278        /// A property indicating the format's horizontal field of view.
3279        ///
3280        ///
3281        /// videoFieldOfView is a float value indicating the receiver's field of view in degrees. If field of view is unknown, a value of 0 is returned.
3282        #[unsafe(method(videoFieldOfView))]
3283        #[unsafe(method_family = none)]
3284        pub unsafe fn videoFieldOfView(&self) -> c_float;
3285
3286        /// A property indicating whether the format is binned.
3287        ///
3288        ///
3289        /// videoBinned is a BOOL indicating whether the format is a binned format. Binning is a pixel-combining process which can result in greater low light sensitivity at the cost of reduced resolution.
3290        #[unsafe(method(isVideoBinned))]
3291        #[unsafe(method_family = none)]
3292        pub unsafe fn isVideoBinned(&self) -> bool;
3293
3294        /// Returns whether the format supports the given video stabilization mode.
3295        ///
3296        ///
3297        /// Parameter `videoStabilizationMode`: An AVCaptureVideoStabilizationMode to be checked.
3298        ///
3299        ///
3300        /// isVideoStabilizationModeSupported: returns a boolean value indicating whether the format can be stabilized using the given mode with -[AVCaptureConnection setPreferredVideoStabilizationMode:].
3301        #[unsafe(method(isVideoStabilizationModeSupported:))]
3302        #[unsafe(method_family = none)]
3303        pub unsafe fn isVideoStabilizationModeSupported(
3304            &self,
3305            video_stabilization_mode: AVCaptureVideoStabilizationMode,
3306        ) -> bool;
3307
3308        /// A property indicating whether the format supports video stabilization.
3309        ///
3310        ///
3311        /// videoStabilizationSupported is a BOOL indicating whether the format can be stabilized using AVCaptureConnection -setEnablesVideoStabilizationWhenAvailable. This property is deprecated. Use isVideoStabilizationModeSupported: instead.
3312        #[deprecated = "Use isVideoStabilizationModeSupported: instead."]
3313        #[unsafe(method(isVideoStabilizationSupported))]
3314        #[unsafe(method_family = none)]
3315        pub unsafe fn isVideoStabilizationSupported(&self) -> bool;
3316
3317        #[cfg(feature = "objc2-core-foundation")]
3318        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property.
3319        ///
3320        ///
3321        /// If the device's videoZoomFactor property is assigned a larger value, an NSRangeException will be thrown. A maximum zoom factor of 1 indicates no zoom is available.
3322        #[unsafe(method(videoMaxZoomFactor))]
3323        #[unsafe(method_family = none)]
3324        pub unsafe fn videoMaxZoomFactor(&self) -> CGFloat;
3325
3326        #[cfg(feature = "objc2-core-foundation")]
3327        /// Indicates the value of AVCaptureDevice's videoZoomFactor property at which the image output begins to require upscaling.
3328        ///
3329        ///
3330        /// In some cases the image sensor's dimensions are larger than the dimensions reported by the video AVCaptureDeviceFormat. As long as the sensor crop is larger than the reported dimensions of the AVCaptureDeviceFormat, the image will be downscaled. Setting videoZoomFactor to the value of videoZoomFactorUpscalingThreshold will provide a center crop of the sensor image data without any scaling. If a greater zoom factor is used, then the sensor data will be upscaled to the device format's dimensions.
3331        #[unsafe(method(videoZoomFactorUpscaleThreshold))]
3332        #[unsafe(method_family = none)]
3333        pub unsafe fn videoZoomFactorUpscaleThreshold(&self) -> CGFloat;
3334
3335        /// Indicates the system's recommended zoom range for this device format.
3336        ///
3337        ///
3338        /// This property can be used to create a slider in your app's user interface to control the device's zoom with a system-recommended video zoom range. When a recommendation is not available, this property returns nil. Clients can key value observe AVCaptureDevice's minAvailableVideoZoomFactor and maxAvailableVideoZoomFactor properties to know when a device's supported zoom is restricted within the recommended zoom range.
3339        ///
3340        /// The value of this property is also used for the AVCaptureSystemZoomSlider's range.
3341        #[unsafe(method(systemRecommendedVideoZoomRange))]
3342        #[unsafe(method_family = none)]
3343        pub unsafe fn systemRecommendedVideoZoomRange(&self) -> Option<Retained<AVZoomRange>>;
3344
3345        #[cfg(feature = "objc2-core-media")]
3346        /// A CMTime indicating the minimum supported exposure duration.
3347        ///
3348        ///
3349        /// This read-only property indicates the minimum supported exposure duration.
3350        #[unsafe(method(minExposureDuration))]
3351        #[unsafe(method_family = none)]
3352        pub unsafe fn minExposureDuration(&self) -> CMTime;
3353
3354        #[cfg(feature = "objc2-core-media")]
3355        /// A CMTime indicating the maximum supported exposure duration.
3356        ///
3357        ///
3358        /// This read-only property indicates the maximum supported exposure duration.
3359        #[unsafe(method(maxExposureDuration))]
3360        #[unsafe(method_family = none)]
3361        pub unsafe fn maxExposureDuration(&self) -> CMTime;
3362
3363        /// Indicates the system's recommended exposure bias range for this device format.
3364        ///
3365        ///
3366        /// This property can be used to create a slider in your app's user interface to control the device's exposure bias with a system-recommended exposure bias range. When a recommendation is not available, this property returns nil.
3367        ///
3368        /// The value of this property is also used for the AVCaptureSystemExposureBiasSlider's range.
3369        #[unsafe(method(systemRecommendedExposureBiasRange))]
3370        #[unsafe(method_family = none)]
3371        pub unsafe fn systemRecommendedExposureBiasRange(
3372            &self,
3373        ) -> Option<Retained<AVExposureBiasRange>>;
3374
3375        /// A float indicating the minimum supported exposure ISO value.
3376        ///
3377        ///
3378        /// This read-only property indicates the minimum supported exposure ISO value.
3379        #[unsafe(method(minISO))]
3380        #[unsafe(method_family = none)]
3381        pub unsafe fn minISO(&self) -> c_float;
3382
3383        /// An float indicating the maximum supported exposure ISO value.
3384        ///
3385        ///
3386        /// This read-only property indicates the maximum supported exposure ISO value.
3387        #[unsafe(method(maxISO))]
3388        #[unsafe(method_family = none)]
3389        pub unsafe fn maxISO(&self) -> c_float;
3390
3391        /// A property indicating whether the format supports global tone mapping.
3392        ///
3393        ///
3394        /// globalToneMappingSupported is a BOOL indicating whether the format supports global tone mapping. See AVCaptureDevice's globalToneMappingEnabled property.
3395        #[unsafe(method(isGlobalToneMappingSupported))]
3396        #[unsafe(method_family = none)]
3397        pub unsafe fn isGlobalToneMappingSupported(&self) -> bool;
3398
3399        /// A property indicating whether the format supports high dynamic range streaming.
3400        ///
3401        ///
3402        /// videoHDRSupported is a BOOL indicating whether the format supports high dynamic range streaming, also known as Extended Dynamic Range (EDR). When enabled, the device streams at twice the published frame rate, capturing an under-exposed frame and correctly exposed frame for each frame time at the published rate. Portions of the under-exposed frame are combined with the correctly exposed frame to recover detail in darker areas of the scene. EDR is a separate and distinct feature from 10-bit HDR video (first seen in 2020 iPhones). 10-bit formats with HLG BT2020 color space have greater dynamic range by virtue of their expanded bit depth and HLG transfer function, and when captured in movies, contain Dolby Vision metadata. They are, in effect, "always on" HDR. And thus the videoHDRSupported property is always NO for 10-bit formats only supporting HLG BT2020 colorspace, since HDR cannot be enabled or disabled. To enable videoHDR (EDR), set the AVCaptureDevice.videoHDREnabled property.
3403        #[unsafe(method(isVideoHDRSupported))]
3404        #[unsafe(method_family = none)]
3405        pub unsafe fn isVideoHDRSupported(&self) -> bool;
3406
3407        #[cfg(feature = "objc2-core-media")]
3408        /// CMVideoDimensions indicating the highest resolution still image that can be produced by this format.
3409        ///
3410        ///
3411        /// By default, AVCapturePhotoOutput and AVCaptureStillImageOutput emit images with the same dimensions as their source AVCaptureDevice's activeFormat.formatDescription property. Some device formats support high resolution photo output. That is, they can stream video to an AVCaptureVideoDataOutput or AVCaptureMovieFileOutput at one resolution while outputting photos to AVCapturePhotoOutput at a higher resolution. You may query this property to discover a video format's supported high resolution still image dimensions. See -[AVCapturePhotoOutput highResolutionPhotoEnabled], -[AVCapturePhotoSettings highResolutionPhotoEnabled], and -[AVCaptureStillImageOutput highResolutionStillImageOutputEnabled].
3412        ///
3413        /// AVCaptureDeviceFormats of type AVMediaTypeDepthData may also support the delivery of a higher resolution depth data map to an AVCapturePhotoOutput. Chief differences are:
3414        /// - Depth data accompanying still images is not supported by AVCaptureStillImageOutput. You must use AVCapturePhotoOutput.
3415        /// - By opting in for depth data ( -[AVCapturePhotoSettings setDepthDataDeliveryEnabled:YES] ), you implicitly opt in for high resolution depth data if it's available. You may query the -[AVCaptureDevice activeDepthDataFormat]'s highResolutionStillImageDimensions to discover the depth data resolution that will be delivered with captured photos.
3416        #[deprecated = "Use supportedMaxPhotoDimensions instead."]
3417        #[unsafe(method(highResolutionStillImageDimensions))]
3418        #[unsafe(method_family = none)]
3419        pub unsafe fn highResolutionStillImageDimensions(&self) -> CMVideoDimensions;
3420
3421        /// A boolean value specifying whether this format supports high photo quality when selecting an AVCapturePhotoQualityPrioritization of .balanced or .quality.
3422        ///
3423        ///
3424        /// If an AVCaptureDeviceFormat's highPhotoQualitySupported property is YES, the format produces higher image quality when selecting .balanced or .quality AVCapturePhotoQualityPrioritization compared to .speed. Such formats adhere to the following rules:
3425        /// - Photo requests with a prioritization of .speed produce the fastest image result (suitable for burst captures).
3426        /// - Photo requests with a prioritization of .balanced produce higher image quality without dropping frames if a video recording is underway.
3427        /// - Photo requests with a prioritization of .quality produce high image quality and may cause frame drops if a video recording is underway. For maximum backward compatibility, photo requests on high photo quality formats set to .quality only cause video frame drops if your app is linked on or after iOS 15.
3428        /// Formats that don't support high photo quality produce the same image quality whether you select .speed, .balanced, or .quality. Note that high photo quality is only attainable when using the AVCapturePhotoOutput with these supported formats.
3429        #[unsafe(method(isHighPhotoQualitySupported))]
3430        #[unsafe(method_family = none)]
3431        pub unsafe fn isHighPhotoQualitySupported(&self) -> bool;
3432
3433        /// A boolean value specifying whether this format supports the highest possible photo quality that can be delivered on the current platform.
3434        ///
3435        ///
3436        /// Of the many formats supported by an AVCaptureDevice, only a few of them are designated as "photo" formats which can produce the highest possible quality, such as still image stabilization and Live Photos. If you intend to connect an AVCaptureDeviceInput to an AVCapturePhotoOutput and receive the best possible images, you should ensure that you are either using the AVCaptureSessionPresetPhoto as your preset, or if using the parallel AVCaptureDevice activeFormat API, select as your activeFormat one for which this property is YES.
3437        #[unsafe(method(isHighestPhotoQualitySupported))]
3438        #[unsafe(method_family = none)]
3439        pub unsafe fn isHighestPhotoQualitySupported(&self) -> bool;
3440
3441        /// A property indicating the autofocus system.
3442        ///
3443        ///
3444        /// This read-only property indicates the autofocus system.
3445        #[unsafe(method(autoFocusSystem))]
3446        #[unsafe(method_family = none)]
3447        pub unsafe fn autoFocusSystem(&self) -> AVCaptureAutoFocusSystem;
3448
3449        /// A property indicating the receiver's supported color spaces.
3450        ///
3451        ///
3452        /// This read-only property indicates the receiver's supported color spaces as an array of AVCaptureColorSpace constants sorted from narrow to wide color.
3453        #[unsafe(method(supportedColorSpaces))]
3454        #[unsafe(method_family = none)]
3455        pub unsafe fn supportedColorSpaces(&self) -> Retained<NSArray<NSNumber>>;
3456
3457        #[cfg(feature = "objc2-core-foundation")]
3458        /// A deprecated property. Please use supportedVideoZoomFactorsForDepthDataDelivery instead
3459        #[deprecated]
3460        #[unsafe(method(videoMinZoomFactorForDepthDataDelivery))]
3461        #[unsafe(method_family = none)]
3462        pub unsafe fn videoMinZoomFactorForDepthDataDelivery(&self) -> CGFloat;
3463
3464        #[cfg(feature = "objc2-core-foundation")]
3465        /// A deprecated property. Please use supportedVideoZoomFactorsForDepthDataDelivery instead
3466        #[deprecated]
3467        #[unsafe(method(videoMaxZoomFactorForDepthDataDelivery))]
3468        #[unsafe(method_family = none)]
3469        pub unsafe fn videoMaxZoomFactorForDepthDataDelivery(&self) -> CGFloat;
3470
3471        /// A deprecated property. Please use supportedVideoZoomRangesForDepthDataDelivery
3472        #[deprecated]
3473        #[unsafe(method(supportedVideoZoomFactorsForDepthDataDelivery))]
3474        #[unsafe(method_family = none)]
3475        pub unsafe fn supportedVideoZoomFactorsForDepthDataDelivery(
3476            &self,
3477        ) -> Retained<NSArray<NSNumber>>;
3478
3479        /// This property returns the zoom ranges within which depth data can be delivered.
3480        ///
3481        /// Virtual devices support limited zoom ranges when delivering depth data to any output. If this device format has no -supportedDepthDataFormats, this property returns an empty array.
3482        /// The presence of one or more ranges where the min and max zoom factors are not equal means that "continuous zoom" with depth is supported.
3483        /// For example:
3484        /// a) ranges:
3485        /// @
3486        /// [ [2..2], [4..4] ]
3487        /// only zoom factors 2 and 4 are allowed to be set when depthDataDelivery is enabled. Any other zoom factor results in an exception.
3488        /// b) ranges:
3489        /// @
3490        /// [ [2..5] ]
3491        /// depthDataDelivery is supported with zoom factors [2..5]. Zoom factors outside of this range may be set, but will result in loss of depthDataDeliery. Whenever zoom is set back to a value within the range of [2..5], depthDataDelivery will resume.
3492        ///
3493        /// When depth data delivery is enabled, the effective videoZoomFactorUpscaleThreshold will be 1.0, meaning that all zoom factors that are not native zoom factors (see AVCaptureDevice.virtualDeviceSwitchOverVideoZoomFactors and AVCaptureDevice.secondaryNativeResolutionZoomFactors) result in digital upscaling.
3494        #[unsafe(method(supportedVideoZoomRangesForDepthDataDelivery))]
3495        #[unsafe(method_family = none)]
3496        pub unsafe fn supportedVideoZoomRangesForDepthDataDelivery(
3497            &self,
3498        ) -> Retained<NSArray<AVZoomRange>>;
3499
3500        /// This property returns whether the format supports zoom factors outside of the supportedVideoZoomFactorRangesForDepthDataDelivery.
3501        ///
3502        /// When a zoom factor outside of the supportedVideoZoomFactorRangesForDepthDataDelivery is set, depth data delivery will be suspended until a zoom factor within the supportedVideoZoomFactorRangesForDepthDataDelivery is set.
3503        #[unsafe(method(zoomFactorsOutsideOfVideoZoomRangesForDepthDeliverySupported))]
3504        #[unsafe(method_family = none)]
3505        pub unsafe fn zoomFactorsOutsideOfVideoZoomRangesForDepthDeliverySupported(&self) -> bool;
3506
3507        /// Indicates this format's companion depth data formats.
3508        ///
3509        ///
3510        /// If no depth data formats are supported by the receiver, an empty array is returned. On virtual devices, the supportedDepthDataFormats list items always match the aspect ratio of their paired video format. When the receiver is set as the device's activeFormat, you may set the device's activeDepthDataFormat to one of these supported depth data formats.
3511        #[unsafe(method(supportedDepthDataFormats))]
3512        #[unsafe(method_family = none)]
3513        pub unsafe fn supportedDepthDataFormats(&self) -> Retained<NSArray<AVCaptureDeviceFormat>>;
3514
3515        /// A property indicating AVCaptureOutput subclasses the receiver does not support.
3516        ///
3517        ///
3518        /// As a rule, AVCaptureDeviceFormats of a given mediaType are available for use with all AVCaptureOutputs that accept that media type, but there are exceptions. For instance, on apps linked against iOS versions earlier than 12.0, the photo resolution video formats may not be used as sources for AVCaptureMovieFileOutput due to bandwidth limitations. On DualCamera devices, AVCaptureDepthDataOutput is not supported when outputting full resolution (i.e. 12 MP) video due to bandwidth limitations. In order to stream depth data plus video data from a photo format, ensure that your AVCaptureVideoDataOutput's deliversPreviewSizedOutputBuffers property is set to YES. Likewise, to stream depth data while capturing video to a movie file using AVCaptureMovieFileOutput, call -[AVCaptureSession setSessionPreset:AVCaptureSessionPresetPhoto]. When using the photo preset, video is captured at preview resolution rather than the full sensor resolution.
3519        #[unsafe(method(unsupportedCaptureOutputClasses))]
3520        #[unsafe(method_family = none)]
3521        pub unsafe fn unsupportedCaptureOutputClasses(&self) -> Retained<NSArray<AnyClass>>;
3522
3523        /// This property lists all of the supported maximum photo dimensions for this format. The array contains CMVideoDimensions structs encoded as NSValues.
3524        ///
3525        /// Enumerate all supported resolution settings for which this format may be configured to capture photos. Use these values to set AVCapturePhotoOutput.maxPhotoDimensions and AVCapturePhotoSettings.maxPhotoDimensions.
3526        #[unsafe(method(supportedMaxPhotoDimensions))]
3527        #[unsafe(method_family = none)]
3528        pub unsafe fn supportedMaxPhotoDimensions(&self) -> Retained<NSArray<NSValue>>;
3529
3530        /// Indicates zoom factors at which this device transitions to secondary native resolution modes.
3531        ///
3532        /// Devices with this property have the means to switch their pixel sampling mode on the fly to produce a high-fidelity, non-upsampled images at a fixed zoom factor beyond 1.0x.
3533        #[unsafe(method(secondaryNativeResolutionZoomFactors))]
3534        #[unsafe(method_family = none)]
3535        pub unsafe fn secondaryNativeResolutionZoomFactors(&self) -> Retained<NSArray<NSNumber>>;
3536
3537        /// Indicates whether the device format supports auto video frame rate.
3538        ///
3539        ///
3540        /// See -[AVCaptureDevice autoVideoFrameRateEnabled] (above) for a detailed description of the feature.
3541        #[unsafe(method(isAutoVideoFrameRateSupported))]
3542        #[unsafe(method_family = none)]
3543        pub unsafe fn isAutoVideoFrameRateSupported(&self) -> bool;
3544    );
3545}
3546
3547/// AVCaptureDeviceFormatDepthDataAdditions.
3548impl AVCaptureDeviceFormat {
3549    extern_methods!(
3550        #[unsafe(method(isPortraitEffectsMatteStillImageDeliverySupported))]
3551        #[unsafe(method_family = none)]
3552        pub unsafe fn isPortraitEffectsMatteStillImageDeliverySupported(&self) -> bool;
3553    );
3554}
3555
3556/// AVCaptureDeviceFormatMultiCamAdditions.
3557impl AVCaptureDeviceFormat {
3558    extern_methods!(
3559        /// A property indicating whether this format is supported in an AVCaptureMultiCamSession.
3560        ///
3561        ///
3562        /// When using an AVCaptureSession (single camera capture), any of the formats in the device's -formats array may be set as the -activeFormat. However, when used with an AVCaptureMultiCamSession, the device's -activeFormat may only be set to one of the formats for which multiCamSupported answers YES. This limited subset of capture formats are known to run sustainably in a multi camera capture scenario.
3563        #[unsafe(method(isMultiCamSupported))]
3564        #[unsafe(method_family = none)]
3565        pub unsafe fn isMultiCamSupported(&self) -> bool;
3566    );
3567}
3568
3569/// AVCaptureDeviceFormatSpatialVideoCapture.
3570impl AVCaptureDeviceFormat {
3571    extern_methods!(
3572        /// Returns whether or not the format supports capturing spatial video to a file.
3573        #[unsafe(method(isSpatialVideoCaptureSupported))]
3574        #[unsafe(method_family = none)]
3575        pub unsafe fn isSpatialVideoCaptureSupported(&self) -> bool;
3576    );
3577}
3578
3579/// AVCaptureDeviceFormatGeometricDistortionCorrection.
3580impl AVCaptureDeviceFormat {
3581    extern_methods!(
3582        /// A property indicating the format's horizontal field of view post geometric distortion correction.
3583        ///
3584        ///
3585        /// If the receiver's AVCaptureDevice does not support GDC, geometricDistortionCorrectedVideoFieldOfView matches the videoFieldOfView property.
3586        #[unsafe(method(geometricDistortionCorrectedVideoFieldOfView))]
3587        #[unsafe(method_family = none)]
3588        pub unsafe fn geometricDistortionCorrectedVideoFieldOfView(&self) -> c_float;
3589    );
3590}
3591
3592/// AVCaptureDeviceFormatCenterStage.
3593impl AVCaptureDeviceFormat {
3594    extern_methods!(
3595        /// Indicates whether the format supports the Center Stage feature.
3596        ///
3597        ///
3598        /// This property returns YES if the format supports "Center Stage", which automatically adjusts the camera to keep people optimally framed within the field of view. See +AVCaptureDevice.centerStageEnabled for a detailed discussion.
3599        #[unsafe(method(isCenterStageSupported))]
3600        #[unsafe(method_family = none)]
3601        pub unsafe fn isCenterStageSupported(&self) -> bool;
3602
3603        #[cfg(feature = "objc2-core-foundation")]
3604        #[unsafe(method(videoMinZoomFactorForCenterStage))]
3605        #[unsafe(method_family = none)]
3606        pub unsafe fn videoMinZoomFactorForCenterStage(&self) -> CGFloat;
3607
3608        #[cfg(feature = "objc2-core-foundation")]
3609        /// Indicates the maximum zoom factor available for the AVCaptureDevice's videoZoomFactor property when centerStageActive is YES.
3610        ///
3611        ///
3612        /// Devices support a limited zoom range when Center Stage is active. If this device format does not support Center Stage, this property returns videoMaxZoomFactor.
3613        #[unsafe(method(videoMaxZoomFactorForCenterStage))]
3614        #[unsafe(method_family = none)]
3615        pub unsafe fn videoMaxZoomFactorForCenterStage(&self) -> CGFloat;
3616
3617        /// Indicates the minimum / maximum frame rates available when centerStageActive is YES.
3618        ///
3619        ///
3620        /// Devices may support a limited frame rate range when Center Stage is active. If this device format does not support Center Stage, this property returns nil.
3621        #[unsafe(method(videoFrameRateRangeForCenterStage))]
3622        #[unsafe(method_family = none)]
3623        pub unsafe fn videoFrameRateRangeForCenterStage(
3624            &self,
3625        ) -> Option<Retained<AVFrameRateRange>>;
3626    );
3627}
3628
3629/// AVCaptureDeviceFormatPortraitEffect.
3630impl AVCaptureDeviceFormat {
3631    extern_methods!(
3632        /// Indicates whether the format supports the Portrait Effect feature.
3633        ///
3634        ///
3635        /// This property returns YES if the format supports Portrait Effect, the application of a shallow depth of field effect to objects in the background. See +AVCaptureDevice.portraitEffectEnabled for a detailed discussion.
3636        #[unsafe(method(isPortraitEffectSupported))]
3637        #[unsafe(method_family = none)]
3638        pub unsafe fn isPortraitEffectSupported(&self) -> bool;
3639
3640        /// Indicates the minimum / maximum frame rates available when portraitEffectActive is YES.
3641        ///
3642        ///
3643        /// Devices may support a limited frame rate range when Portrait Effect is active. If this device format does not support Portrait Effect, this property returns nil.
3644        #[unsafe(method(videoFrameRateRangeForPortraitEffect))]
3645        #[unsafe(method_family = none)]
3646        pub unsafe fn videoFrameRateRangeForPortraitEffect(
3647            &self,
3648        ) -> Option<Retained<AVFrameRateRange>>;
3649    );
3650}
3651
3652/// AVCaptureDeviceStudioLight.
3653impl AVCaptureDevice {
3654    extern_methods!(
3655        /// A class property indicating whether the Studio Light feature is currently enabled in Control Center.
3656        ///
3657        ///
3658        /// This property changes to reflect the Studio Light state in Control Center. It is key-value observable.  On iOS, Studio Light only applies to video conferencing apps by default (apps that use "voip" as one of their UIBackgroundModes). Non video conferencing apps may opt in for Studio Light by adding the following key to their Info.plist:
3659        /// <key
3660        /// >NSCameraStudioLightEnabled
3661        /// </key
3662        /// >
3663        /// <true
3664        /// />
3665        #[unsafe(method(isStudioLightEnabled))]
3666        #[unsafe(method_family = none)]
3667        pub unsafe fn isStudioLightEnabled() -> bool;
3668
3669        /// Indicates whether Studio Light is currently active on a particular AVCaptureDevice.
3670        ///
3671        ///
3672        /// This readonly property returns YES when Studio Light is currently active on the receiver. When active, the subject's face is artificially lit to simulate the presence of a studio light near the camera.
3673        #[unsafe(method(isStudioLightActive))]
3674        #[unsafe(method_family = none)]
3675        pub unsafe fn isStudioLightActive(&self) -> bool;
3676    );
3677}
3678
3679/// AVCaptureDeviceFormatStudioLight.
3680impl AVCaptureDeviceFormat {
3681    extern_methods!(
3682        /// Indicates whether the format supports the Studio Light feature.
3683        ///
3684        ///
3685        /// This property returns YES if the format supports Studio Light (artificial re-lighting of the subject's face). See +AVCaptureDevice.studioLightEnabled.
3686        #[unsafe(method(isStudioLightSupported))]
3687        #[unsafe(method_family = none)]
3688        pub unsafe fn isStudioLightSupported(&self) -> bool;
3689
3690        /// Indicates the minimum / maximum frame rates available when studioLight is YES.
3691        ///
3692        ///
3693        /// Devices may support a limited frame rate range when Studio Light is active. If this device format does not support Studio Light, this property returns nil.
3694        #[unsafe(method(videoFrameRateRangeForStudioLight))]
3695        #[unsafe(method_family = none)]
3696        pub unsafe fn videoFrameRateRangeForStudioLight(
3697            &self,
3698        ) -> Option<Retained<AVFrameRateRange>>;
3699    );
3700}
3701
3702/// AVCaptureDeviceFormatReactionEffects.
3703impl AVCaptureDeviceFormat {
3704    extern_methods!(
3705        /// Indicates whether the format supports the Reaction Effects feature.
3706        ///
3707        ///
3708        /// This property returns YES if the format supports Reaction Effects. See +AVCaptureDevice.reactionEffectsEnabled.
3709        #[unsafe(method(reactionEffectsSupported))]
3710        #[unsafe(method_family = none)]
3711        pub unsafe fn reactionEffectsSupported(&self) -> bool;
3712
3713        /// Indicates the minimum / maximum frame rates available when a reaction effect is running.
3714        ///
3715        ///
3716        /// Unlike the other video effects, enabling reaction effects does not limit the stream's frame rate because most of the time no rendering is being performed. The frame rate will only ramp down when a reaction is actually being rendered on the stream (see AVCaptureDevice.reactionEffectsInProgress)
3717        #[unsafe(method(videoFrameRateRangeForReactionEffectsInProgress))]
3718        #[unsafe(method_family = none)]
3719        pub unsafe fn videoFrameRateRangeForReactionEffectsInProgress(
3720            &self,
3721        ) -> Option<Retained<AVFrameRateRange>>;
3722    );
3723}
3724
3725/// AVCaptureDeviceFormatBackgroundReplacement.
3726impl AVCaptureDeviceFormat {
3727    extern_methods!(
3728        /// Indicates whether the format supports the Background Replacement feature.
3729        ///
3730        ///
3731        /// This property returns YES if the format supports Background Replacement background replacement. See +AVCaptureDevice.backgroundReplacementEnabled.
3732        #[unsafe(method(isBackgroundReplacementSupported))]
3733        #[unsafe(method_family = none)]
3734        pub unsafe fn isBackgroundReplacementSupported(&self) -> bool;
3735
3736        /// Indicates the minimum / maximum frame rates available when background replacement is active.
3737        ///
3738        ///
3739        /// Devices may support a limited frame rate range when Background Replacement is active. If this device format does not support Background Replacement, this property returns nil.
3740        #[unsafe(method(videoFrameRateRangeForBackgroundReplacement))]
3741        #[unsafe(method_family = none)]
3742        pub unsafe fn videoFrameRateRangeForBackgroundReplacement(
3743            &self,
3744        ) -> Option<Retained<AVFrameRateRange>>;
3745    );
3746}
3747
3748extern_class!(
3749    /// An AVCaptureDeviceInputSource represents a distinct input source on an AVCaptureDevice object.
3750    ///
3751    ///
3752    /// An AVCaptureDevice may optionally present an array of inputSources, representing distinct mutually exclusive inputs to the device, for example, an audio AVCaptureDevice might have ADAT optical and analog input sources. A video AVCaptureDevice might have an HDMI input source, or a component input source.
3753    ///
3754    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeviceinputsource?language=objc)
3755    #[unsafe(super(NSObject))]
3756    #[derive(Debug, PartialEq, Eq, Hash)]
3757    pub struct AVCaptureDeviceInputSource;
3758);
3759
3760unsafe impl NSObjectProtocol for AVCaptureDeviceInputSource {}
3761
3762impl AVCaptureDeviceInputSource {
3763    extern_methods!(
3764        #[unsafe(method(init))]
3765        #[unsafe(method_family = init)]
3766        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3767
3768        #[unsafe(method(new))]
3769        #[unsafe(method_family = new)]
3770        pub unsafe fn new() -> Retained<Self>;
3771
3772        /// An ID unique among the inputSources exposed by a given AVCaptureDevice.
3773        ///
3774        ///
3775        /// An AVCaptureDevice's inputSources array must contain AVCaptureInputSource objects with unique inputSourceIDs.
3776        #[unsafe(method(inputSourceID))]
3777        #[unsafe(method_family = none)]
3778        pub unsafe fn inputSourceID(&self) -> Retained<NSString>;
3779
3780        /// A localized human-readable name for the receiver.
3781        ///
3782        ///
3783        /// This property can be used for displaying the name of the capture device input source in a user interface.
3784        #[unsafe(method(localizedName))]
3785        #[unsafe(method_family = none)]
3786        pub unsafe fn localizedName(&self) -> Retained<NSString>;
3787    );
3788}