objc2_av_foundation/generated/AVCapturePhotoOutput.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-graphics")]
7use objc2_core_graphics::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10#[cfg(feature = "objc2-core-video")]
11use objc2_core_video::*;
12use objc2_foundation::*;
13
14use crate::*;
15
16/// Constants indicating how photo quality should be prioritized against speed.
17///
18///
19/// Indicates that speed of photo delivery is most important, even at the expense of quality.
20///
21/// Indicates that photo quality and speed of delivery are balanced in priority.
22///
23/// Indicates that photo quality is paramount, even at the expense of shot-to-shot time.
24///
25/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotoqualityprioritization?language=objc)
26// NS_ENUM
27#[repr(transparent)]
28#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
29pub struct AVCapturePhotoQualityPrioritization(pub NSInteger);
30impl AVCapturePhotoQualityPrioritization {
31 #[doc(alias = "AVCapturePhotoQualityPrioritizationSpeed")]
32 pub const Speed: Self = Self(1);
33 #[doc(alias = "AVCapturePhotoQualityPrioritizationBalanced")]
34 pub const Balanced: Self = Self(2);
35 #[doc(alias = "AVCapturePhotoQualityPrioritizationQuality")]
36 pub const Quality: Self = Self(3);
37}
38
39unsafe impl Encode for AVCapturePhotoQualityPrioritization {
40 const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for AVCapturePhotoQualityPrioritization {
44 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47/// Constants indicating whether the output is ready to receive capture requests.
48///
49///
50/// Indicates that the session is not running and the output is not ready to receive requests.
51///
52/// Indicates that the output is ready to receive new requests.
53///
54/// Indicates that the output is not ready to receive requests and may be ready shortly.
55///
56/// Indicates that the output is not ready to receive requests for a longer duration because it is busy capturing.
57///
58/// Indicates that the output is not ready to receive requests for a longer duration because it is busy processing.
59///
60/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotooutputcapturereadiness?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct AVCapturePhotoOutputCaptureReadiness(pub NSInteger);
65impl AVCapturePhotoOutputCaptureReadiness {
66 #[doc(alias = "AVCapturePhotoOutputCaptureReadinessSessionNotRunning")]
67 pub const SessionNotRunning: Self = Self(0);
68 #[doc(alias = "AVCapturePhotoOutputCaptureReadinessReady")]
69 pub const Ready: Self = Self(1);
70 #[doc(alias = "AVCapturePhotoOutputCaptureReadinessNotReadyMomentarily")]
71 pub const NotReadyMomentarily: Self = Self(2);
72 #[doc(alias = "AVCapturePhotoOutputCaptureReadinessNotReadyWaitingForCapture")]
73 pub const NotReadyWaitingForCapture: Self = Self(3);
74 #[doc(alias = "AVCapturePhotoOutputCaptureReadinessNotReadyWaitingForProcessing")]
75 pub const NotReadyWaitingForProcessing: Self = Self(4);
76}
77
78unsafe impl Encode for AVCapturePhotoOutputCaptureReadiness {
79 const ENCODING: Encoding = NSInteger::ENCODING;
80}
81
82unsafe impl RefEncode for AVCapturePhotoOutputCaptureReadiness {
83 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86extern_class!(
87 /// AVCapturePhotoOutput is a concrete subclass of AVCaptureOutput that supersedes AVCaptureStillImageOutput as the preferred interface for capturing photos. In addition to capturing all flavors of still image supported by AVCaptureStillImageOutput, it supports Live Photo capture, preview-sized image delivery, wide color, RAW, RAW+JPG and RAW+DNG formats.
88 ///
89 ///
90 /// Taking a photo is multi-step process. Clients wishing to build a responsive UI need to know about the progress of a photo capture request as it advances from capture to processing to finished delivery. AVCapturePhotoOutput informs clients of photo capture progress through a delegate protocol. To take a picture, a client instantiates and configures an AVCapturePhotoSettings object, then calls AVCapturePhotoOutput's -capturePhotoWithSettings:delegate:, passing a delegate to be informed when events relating to the photo capture occur (e.g., the photo is about to be captured, the photo has been captured but not processed yet, the Live Photo movie is ready, etc.).
91 ///
92 /// Some AVCapturePhotoSettings properties can be set to "Auto", such as flashMode. When set to AVCaptureFlashModeAuto, the photo output decides at capture time whether the current scene and lighting conditions require use of the flash. Thus the client doesn't know with certainty which features will be enabled when making the capture request. With the first and each subsequent delegate callback, the client is provided an AVCaptureResolvedPhotoSettings instance that indicates the settings that were applied to the capture. All "Auto" features have now been resolved to on or off. The AVCaptureResolvedPhotoSettings object passed in the client's delegate callbacks has a uniqueID identical to the AVCapturePhotoSettings request. This uniqueID allows clients to pair unresolved and resolved settings objects. See AVCapturePhotoCaptureDelegate below for a detailed discussion of the delegate callbacks.
93 ///
94 /// Enabling certain photo features (Live Photo capture and high resolution capture) requires a reconfiguration of the capture render pipeline. Clients wishing to opt in for these features should call -setLivePhotoCaptureEnabled: and/or -setHighResolutionCaptureEnabled: before calling -startRunning on the AVCaptureSession. Changing any of these properties while the session is running requires a disruptive reconfiguration of the capture render pipeline. Live Photo captures in progress will be ended immediately; unfulfilled photo requests will be aborted; video preview will temporarily freeze. If you wish to capture Live Photos containing sound, you must add an audio AVCaptureDeviceInput to your AVCaptureSession.
95 ///
96 /// Simultaneous Live Photo capture and MovieFileOutput capture is not supported. If an AVCaptureMovieFileOutput is added to your session, AVCapturePhotoOutput's livePhotoCaptureSupported property returns NO. Note that simultaneous Live Photo capture and AVCaptureVideoDataOutput is supported.
97 ///
98 /// AVCaptureStillImageOutput and AVCapturePhotoOutput may not both be added to a capture session. You must use one or the other. If you add both to a session, a NSInvalidArgumentException is thrown.
99 ///
100 /// AVCapturePhotoOutput implicitly supports wide color photo capture, following the activeColorSpace of the source AVCaptureDevice. If the source device's activeColorSpace is AVCaptureColorSpace_P3_D65, photos are encoded with wide color information, unless you've specified an output format of '420v', which does not support wide color.
101 ///
102 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotooutput?language=objc)
103 #[unsafe(super(AVCaptureOutput, NSObject))]
104 #[derive(Debug, PartialEq, Eq, Hash)]
105 #[cfg(feature = "AVCaptureOutputBase")]
106 pub struct AVCapturePhotoOutput;
107);
108
109#[cfg(feature = "AVCaptureOutputBase")]
110extern_conformance!(
111 unsafe impl NSObjectProtocol for AVCapturePhotoOutput {}
112);
113
114#[cfg(feature = "AVCaptureOutputBase")]
115impl AVCapturePhotoOutput {
116 extern_methods!(
117 #[unsafe(method(init))]
118 #[unsafe(method_family = init)]
119 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
120
121 #[unsafe(method(new))]
122 #[unsafe(method_family = new)]
123 pub unsafe fn new() -> Retained<Self>;
124
125 /// Method for initiating a photo capture request with progress monitoring through the supplied delegate.
126 ///
127 ///
128 /// Parameter `settings`: An AVCapturePhotoSettings object you have configured. May not be nil.
129 ///
130 /// Parameter `delegate`: An object conforming to the AVCapturePhotoCaptureDelegate protocol. This object's delegate methods are called back as the photo advances from capture to processing to finished delivery. May not be nil.
131 ///
132 ///
133 /// This method initiates a photo capture. The receiver copies your provided settings to prevent unintentional mutation. It is illegal to re-use settings. The receiver throws a NSInvalidArgumentException if your settings.uniqueID matches that of any previously used settings. This method is used to initiate all flavors of photo capture: single photo, RAW capture with or without a processed image (such as a JPEG), bracketed capture, and Live Photo.
134 ///
135 /// Clients need not wait for a capture photo request to complete before issuing another request. This is true for single photo captures as well as Live Photos, where movie complements of adjacent photo captures are allowed to overlap.
136 ///
137 /// This method validates your settings and enforces the following rules in order to ensure deterministic behavior. If any of these rules are violated, a NSInvalidArgumentException is thrown.
138 /// RAW rules:
139 /// See +isBayerRAWPixelFormat: and +isAppleProRAWPixelFormat: on the difference between Bayer RAW and Apple ProRAW pixel formats.
140 /// Common RAW rules:
141 /// - If rawPhotoPixelFormatType is non-zero, it must be present in the receiver's -availableRawPhotoPixelFormatTypes array.
142 /// - If rawPhotoPixelFormatType is non-zero, your delegate must respond to -captureOutput:didFinishProcessingRawPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:.
143 /// - If rawPhotoPixelFormatType is non-zero, highResolutionPhotoEnabled may be YES or NO, but the setting only applies to the processed image, if you've specified one.
144 /// - If rawPhotoPixelFormatType is non-zero, constantColorEnabled must be set to NO.
145 /// - If rawFileType is specified, it must be present in -availableRawPhotoFileTypes and must support the rawPhotoPixelFormatType specified using -supportedRawPhotoPixelFormatTypesForFileType:.
146 /// Bayer RAW rules (isBayerRAWPixelFormat: returns yes for rawPhotoPixelFormatType):
147 /// - photoQualityPrioritization must be set to AVCapturePhotoQualityPrioritizationSpeed (deprecated autoStillImageStabilizationEnabled must be set to NO).
148 /// - the videoZoomFactor of the source device and the videoScaleAndCropFactor of the photo output's video connection must both be 1.0. Ensure no zoom is applied before requesting a RAW capture, and don't change the zoom during RAW capture.
149 /// Apple ProRAW rules (isAppleProRAWPixelFormat: returns yes for rawPhotoPixelFormatType):
150 /// - livePhotoMovieFileURL must be nil in AVCapturePhotoSettings settings
151 /// - autoContentAwareDistortionCorrectionEnabled will automatically be disabled in AVCapturePhotoSettings
152 /// - autoRedEyeReductionEnabled will automatically be disabled in AVCapturePhotoSettings
153 /// - portraitEffectsMatteDeliveryEnabled will automatically be disabled in AVCapturePhotoSettings
154 /// - enabledSemanticSegmentationMatteTypes will automatically be cleared in AVCapturePhotoSettings
155 /// Processed Format rules:
156 /// - If format is non-nil, a kCVPixelBufferPixelFormatTypeKey or AVVideoCodecKey must be present, and both may not be present.
157 /// - If format has a kCVPixelBufferPixelFormatTypeKey, its value must be present in the receiver's -availablePhotoPixelFormatTypes array.
158 /// - If format has a AVVideoCodecKey, its value must be present in the receiver's -availablePhotoCodecTypes array.
159 /// - If format is non-nil, your delegate must respond to -captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:.
160 /// - If processedFileType is specified, it must be present in -availablePhotoFileTypes and must support the format's specified kCVPixelBufferPixelFormatTypeKey (using -supportedPhotoPixelFormatTypesForFileType:) or AVVideoCodecKey (using -supportedPhotoCodecTypesForFileType:).
161 /// - The photoQualityPrioritization you specify may not be a greater number than the photo output's maxPhotoQualityPrioritization. You must set your AVCapturePhotoOutput maxPhotoQualityPrioritization up front.
162 /// Flash rules:
163 /// - The specified flashMode must be present in the receiver's -supportedFlashModes array.
164 /// Live Photo rules:
165 /// - The receiver's livePhotoCaptureEnabled must be YES if settings.livePhotoMovieURL is non-nil.
166 /// - If settings.livePhotoMovieURL is non-nil, the receiver's livePhotoCaptureSuspended property must be set to NO.
167 /// - If settings.livePhotoMovieURL is non-nil, it must be a file URL that's accessible to your app's sandbox.
168 /// - If settings.livePhotoMovieURL is non-nil, your delegate must respond to -captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error:.
169 /// Bracketed capture rules:
170 /// - bracketedSettings.count must be
171 /// <
172 /// = the receiver's maxBracketedCapturePhotoCount property.
173 /// - For manual exposure brackets, ISO value must be within the source device activeFormat's minISO and maxISO values.
174 /// - For manual exposure brackets, exposureDuration value must be within the source device activeFormat's minExposureDuration and maxExposureDuration values.
175 /// - For auto exposure brackets, exposureTargetBias value must be within the source device's minExposureTargetBias and maxExposureTargetBias values.
176 /// Deferred Photo Delivery rules:
177 /// - If the receiver's autoDeferredPhotoDeliveryEnabled is YES, your delegate must respond to -captureOutput:didFinishCapturingDeferredPhotoProxy:error:.
178 /// - The maxPhotoDimensions setting for 24MP (5712, 4284), when supported, is only serviced as 24MP via deferred photo delivery.
179 /// Color space rules:
180 /// - Photo capture is not supported when AVCaptureDevice has selected AVCaptureColorSpace_AppleLog as color space.
181 #[unsafe(method(capturePhotoWithSettings:delegate:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn capturePhotoWithSettings_delegate(
184 &self,
185 settings: &AVCapturePhotoSettings,
186 delegate: &ProtocolObject<dyn AVCapturePhotoCaptureDelegate>,
187 );
188
189 /// An array of AVCapturePhotoSettings instances for which the receiver is prepared to capture.
190 ///
191 ///
192 /// See also setPreparedPhotoSettingsArray:completionHandler:
193 /// Some types of photo capture, such as bracketed captures and RAW captures, require the receiver to allocate additional buffers or prepare other resources. To prevent photo capture requests from executing slowly due to lazy resource allocation, you may call -setPreparedPhotoSettingsArray:completionHandler: with an array of settings objects representative of the types of capture you will be performing (e.g., settings for a bracketed capture, RAW capture, and/or still image stabilization capture). By default, the receiver prepares sufficient resources to capture photos with default settings, +[AVCapturePhotoSettings photoSettings].
194 #[unsafe(method(preparedPhotoSettingsArray))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn preparedPhotoSettingsArray(
197 &self,
198 ) -> Retained<NSArray<AVCapturePhotoSettings>>;
199
200 #[cfg(feature = "block2")]
201 /// Method allowing the receiver to prepare resources in advance for future -capturePhotoWithSettings:delegate: requests.
202 ///
203 ///
204 /// Parameter `preparedPhotoSettingsArray`: An array of AVCapturePhotoSettings instances indicating the types of capture for which the receiver should prepare resources.
205 ///
206 /// Parameter `completionHandler`: A completion block to be fired on a serial dispatch queue once the receiver has finished preparing. You may pass nil to indicate you do not wish to be called back when preparation is complete.
207 ///
208 ///
209 /// Some types of photo capture, such as bracketed captures and RAW captures, require the receiver to allocate additional buffers or prepare other resources. To prevent photo capture requests from executing slowly due to lazy resource allocation, you may call this method with an array of settings objects representative of the types of capture you will be performing (e.g., settings for a bracketed capture, RAW capture, and/or still image stabilization capture). You may call this method even before calling -[AVCaptureSession startRunning] in order to hint the receiver up front which features you'll be utilizing. Each time you call this method with an array of settings, the receiver evaluates what additional resources it needs to allocate, as well as existing resources that can be reclaimed, and calls back your completionHandler when it has finished preparing (and possibly reclaiming) needed resources. By default, the receiver prepares sufficient resources to capture photos with default settings, +[AVCapturePhotoSettings photoSettings]. If you wish to reclaim all possible resources, you may call this method with an empty array.
210 ///
211 /// Preparation for photo capture is always optional. You may call -capturePhotoWithSettings:delegate: without first calling -setPreparedPhotoSettingsArray:completionHandler:, but be advised that some of your photo captures may execute slowly as additional resources are allocated just-in-time.
212 ///
213 /// If you call this method while your AVCaptureSession is not running, your completionHandler does not fire immediately. It only fires once you've called -[AVCaptureSession startRunning], and the needed resources have actually been prepared. If you call -setPreparedPhotoSettingsArray:completionHandler: with an array of settings, and then call it a second time, your first prepare call's completionHandler fires immediately with prepared == NO.
214 ///
215 /// Prepared settings persist across session starts/stops and committed configuration changes. This property participates in -[AVCaptureSession beginConfiguration] / -[AVCaptureSession commitConfiguration] deferred work behavior. That is, if you call -[AVCaptureSession beginConfiguration], change your session's input/output topology, and call this method, preparation is deferred until you call -[AVCaptureSession commitConfiguration], enabling you to atomically commit a new configuration as well as prepare to take photos in that new configuration.
216 #[unsafe(method(setPreparedPhotoSettingsArray:completionHandler:))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn setPreparedPhotoSettingsArray_completionHandler(
219 &self,
220 prepared_photo_settings_array: &NSArray<AVCapturePhotoSettings>,
221 completion_handler: Option<&block2::DynBlock<dyn Fn(Bool, *mut NSError)>>,
222 );
223
224 /// An array of kCVPixelBufferPixelFormatTypeKey values that are currently supported by the receiver.
225 ///
226 ///
227 /// If you wish to capture a photo in an uncompressed format, such as 420f, 420v, or BGRA, you must ensure that the format you want is present in the receiver's availablePhotoPixelFormatTypes array. If you've not yet added your receiver to an AVCaptureSession with a video source, no pixel format types are available. This property is key-value observable.
228 #[unsafe(method(availablePhotoPixelFormatTypes))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn availablePhotoPixelFormatTypes(&self) -> Retained<NSArray<NSNumber>>;
231
232 #[cfg(feature = "AVVideoSettings")]
233 /// An array of AVVideoCodecKey values that are currently supported by the receiver.
234 ///
235 ///
236 /// If you wish to capture a photo in a compressed format, such as JPEG, you must ensure that the format you want is present in the receiver's availablePhotoCodecTypes array. If you've not yet added your receiver to an AVCaptureSession with a video source, no codec types are available. This property is key-value observable.
237 #[unsafe(method(availablePhotoCodecTypes))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn availablePhotoCodecTypes(&self) -> Retained<NSArray<AVVideoCodecType>>;
240
241 #[cfg(feature = "AVVideoSettings")]
242 /// An array of available AVVideoCodecType values that may be used for the raw photo.
243 ///
244 ///
245 /// Not all codecs can be used for all rawPixelFormatType values and this call will show all of the possible codecs available. To check if a codec is available for a specific rawPixelFormatType and rawFileType, one should use supportedRawPhotoCodecTypesForRawPhotoPixelFormatType:fileType:.
246 #[unsafe(method(availableRawPhotoCodecTypes))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn availableRawPhotoCodecTypes(&self) -> Retained<NSArray<AVVideoCodecType>>;
249
250 /// Indicates whether the current configuration supports Apple ProRAW pixel formats.
251 ///
252 ///
253 /// The AVCapturePhotoSettings appleProRAWEnabled property may only be set to YES if this property returns YES. This property is key-value observable.
254 #[unsafe(method(isAppleProRAWSupported))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn isAppleProRAWSupported(&self) -> bool;
257
258 /// Indicates whether the photo output is configured for delivery of Apple ProRAW pixel formats as well as Bayer RAW formats.
259 ///
260 ///
261 /// Setting this property to YES will enable support for taking photos in Apple ProRAW pixel formats. These formats will be added to -availableRawPhotoPixelFormatTypes after any existing Bayer RAW formats. Compared to photos taken with a Bayer RAW format, these photos will be demosaiced and partially processed. They are still scene-referred, and allow capturing RAW photos in modes where there is no traditional sensor/Bayer RAW available. Examples are any modes that rely on fusion of multiple captures. Use +isBayerRAWPixelFormat: to determine if a pixel format in -availableRawPhotoPixelFormatTypes is a Bayer RAW format, and +isAppleProRAWPixelFormat: to determine if it is an Apple ProRAW format. When writing an Apple ProRAW buffer to a DNG file, the resulting file is known as "Linear DNG". Apple ProRAW formats are not supported on all platforms and devices. This property may only be set to YES if appleProRAWSupported returns YES. This property is key-value observable.
262 ///
263 /// Enabling this property requires a lengthy reconfiguration of the capture render pipeline, so you should set this property to YES before calling -[AVCaptureSession startRunning].
264 #[unsafe(method(isAppleProRAWEnabled))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn isAppleProRAWEnabled(&self) -> bool;
267
268 /// Setter for [`isAppleProRAWEnabled`][Self::isAppleProRAWEnabled].
269 #[unsafe(method(setAppleProRAWEnabled:))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn setAppleProRAWEnabled(&self, apple_pro_raw_enabled: bool);
272
273 /// Returns YES if the given pixel format is a Bayer RAW format.
274 ///
275 ///
276 /// May be used to distinguish Bayer RAW from Apple ProRAW pixel formats in -availableRawPhotoPixelFormatTypes once appleProRAWEnabled has been set to YES.
277 #[unsafe(method(isBayerRAWPixelFormat:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn isBayerRAWPixelFormat(pixel_format: OSType) -> bool;
280
281 /// Returns YES if the given pixel format is an Apple ProRAW format.
282 ///
283 ///
284 /// May be used to distinguish Bayer RAW from Apple ProRAW pixel formats in -availableRawPhotoPixelFormatTypes once appleProRAWEnabled has been set to YES.
285 ///
286 /// See appleProRAWEnabled for more information on Apple ProRAW.
287 #[unsafe(method(isAppleProRAWPixelFormat:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn isAppleProRAWPixelFormat(pixel_format: OSType) -> bool;
290
291 /// An array of RAW CVPixelBufferPixelFormatTypeKey values that are currently supported by the receiver.
292 ///
293 ///
294 /// If you wish to capture a RAW photo, you must ensure that the RAW format you want is present in the receiver's availableRawPhotoPixelFormatTypes array. If you've not yet added your receiver to an AVCaptureSession with a video source, no RAW formats are available. See AVCapturePhotoOutput.appleProRAWEnabled on how to enable support for partially processed RAW formats. This property is key-value observable. RAW capture is not supported on all platforms.
295 #[unsafe(method(availableRawPhotoPixelFormatTypes))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn availableRawPhotoPixelFormatTypes(&self) -> Retained<NSArray<NSNumber>>;
298
299 #[cfg(feature = "AVMediaFormat")]
300 /// An array of AVFileType values that are currently supported by the receiver.
301 ///
302 ///
303 /// If you wish to capture a photo that is formatted for a particular file container, such as HEIF, you must ensure that the fileType you desire is present in the receiver's availablePhotoFileTypes array. If you've not yet added your receiver to an AVCaptureSession with a video source, no file types are available. This property is key-value observable.
304 #[unsafe(method(availablePhotoFileTypes))]
305 #[unsafe(method_family = none)]
306 pub unsafe fn availablePhotoFileTypes(&self) -> Retained<NSArray<AVFileType>>;
307
308 #[cfg(feature = "AVMediaFormat")]
309 /// An array of AVFileType values that are currently supported by the receiver for RAW capture.
310 ///
311 ///
312 /// If you wish to capture a RAW photo that is formatted for a particular file container, such as DNG, you must ensure that the fileType you desire is present in the receiver's availableRawPhotoFileTypes array. If you've not yet added your receiver to an AVCaptureSession with a video source, no file types are available. This property is key-value observable.
313 #[unsafe(method(availableRawPhotoFileTypes))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn availableRawPhotoFileTypes(&self) -> Retained<NSArray<AVFileType>>;
316
317 #[cfg(feature = "AVMediaFormat")]
318 /// An array of pixel format type values that are currently supported by the receiver for a particular file container.
319 ///
320 ///
321 /// Parameter `fileType`: The AVFileType container type intended for storage of a photo.
322 ///
323 /// Returns: An array of CVPixelBufferPixelFormatTypeKey values supported by the receiver for the file type in question.
324 ///
325 ///
326 /// If you wish to capture a photo for storage in a particular file container, such as TIFF, you must ensure that the photo pixel format type you request is valid for that file type. If no pixel format types are supported for a given fileType, an empty array is returned. If you've not yet added your receiver to an AVCaptureSession with a video source, no pixel format types are supported.
327 #[unsafe(method(supportedPhotoPixelFormatTypesForFileType:))]
328 #[unsafe(method_family = none)]
329 pub unsafe fn supportedPhotoPixelFormatTypesForFileType(
330 &self,
331 file_type: &AVFileType,
332 ) -> Retained<NSArray<NSNumber>>;
333
334 #[cfg(all(feature = "AVMediaFormat", feature = "AVVideoSettings"))]
335 /// An array of AVVideoCodecKey values that are currently supported by the receiver for a particular file container.
336 ///
337 ///
338 /// Parameter `fileType`: The AVFileType container type intended for storage of a photo.
339 ///
340 /// Returns: An array of AVVideoCodecKey values supported by the receiver for the file type in question.
341 ///
342 ///
343 /// If you wish to capture a photo for storage in a particular file container, such as HEIF, you must ensure that the photo codec type you request is valid for that file type. If no codec types are supported for a given fileType, an empty array is returned. If you've not yet added your receiver to an AVCaptureSession with a video source, no codec types are supported.
344 #[unsafe(method(supportedPhotoCodecTypesForFileType:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn supportedPhotoCodecTypesForFileType(
347 &self,
348 file_type: &AVFileType,
349 ) -> Retained<NSArray<AVVideoCodecType>>;
350
351 #[cfg(all(feature = "AVMediaFormat", feature = "AVVideoSettings"))]
352 /// An array of AVVideoCodecType values that are currently supported by the receiver for a particular file container and raw pixel format.
353 ///
354 ///
355 /// Parameter `pixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
356 ///
357 /// Parameter `fileType`: The AVFileType container type intended for storage of a photo which can be retrieved from -availableRawPhotoFileTypes.
358 ///
359 /// Returns: An array of AVVideoCodecType values supported by the receiver for the file type and and raw pixel format in question.
360 ///
361 ///
362 /// If you wish to capture a raw photo for storage using a Bayer RAW or Apple ProRAW pixel format and to be stored in a file container, such as DNG, you must ensure that the codec type you request is valid for that file and pixel format type. If no RAW codec types are supported for a given file type and/or pixel format type, an empty array is returned. If you have not yet added your receiver to an AVCaptureSession with a video source, an empty array is returned.
363 #[unsafe(method(supportedRawPhotoCodecTypesForRawPhotoPixelFormatType:fileType:))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn supportedRawPhotoCodecTypesForRawPhotoPixelFormatType_fileType(
366 &self,
367 pixel_format_type: OSType,
368 file_type: &AVFileType,
369 ) -> Retained<NSArray<AVVideoCodecType>>;
370
371 #[cfg(feature = "AVMediaFormat")]
372 /// An array of CVPixelBufferPixelFormatType values that are currently supported by the receiver for a particular file container.
373 ///
374 ///
375 /// Parameter `fileType`: The AVFileType container type intended for storage of a photo.
376 ///
377 /// Returns: An array of CVPixelBufferPixelFormatType values supported by the receiver for the file type in question.
378 ///
379 ///
380 /// If you wish to capture a photo for storage in a particular file container, such as DNG, you must ensure that the RAW pixel format type you request is valid for that file type. If no RAW pixel format types are supported for a given fileType, an empty array is returned. If you've not yet added your receiver to an AVCaptureSession with a video source, no pixel format types are supported.
381 #[unsafe(method(supportedRawPhotoPixelFormatTypesForFileType:))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn supportedRawPhotoPixelFormatTypesForFileType(
384 &self,
385 file_type: &AVFileType,
386 ) -> Retained<NSArray<NSNumber>>;
387
388 /// Indicates the highest quality the receiver should be prepared to output on a capture-by-capture basis.
389 ///
390 ///
391 /// Default value is AVCapturePhotoQualityPrioritizationBalanced when attached to an AVCaptureSession, and AVCapturePhotoQualityPrioritizationSpeed when attached to an AVCaptureMultiCamSession. The AVCapturePhotoOutput is capable of applying a variety of techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc). Some techniques improve image quality at the expense of speed (shot-to-shot time). Before starting your session, you may set this property to indicate the highest quality prioritization you intend to request when calling -capturePhotoWithSettings:delegate:. When configuring an AVCapturePhotoSettings object, you may not exceed this quality prioritization level, but you may select a lower (speedier) prioritization level.
392 ///
393 /// Changing the maxPhotoQualityPrioritization while the session is running can result in a lengthy rebuild of the session in which video preview is disrupted.
394 ///
395 /// Setting the maxPhotoQualityPrioritization to .quality will turn on optical image stabilization if the -isHighPhotoQualitySupported of the source device's -activeFormat is true.
396 #[unsafe(method(maxPhotoQualityPrioritization))]
397 #[unsafe(method_family = none)]
398 pub unsafe fn maxPhotoQualityPrioritization(&self) -> AVCapturePhotoQualityPrioritization;
399
400 /// Setter for [`maxPhotoQualityPrioritization`][Self::maxPhotoQualityPrioritization].
401 #[unsafe(method(setMaxPhotoQualityPrioritization:))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn setMaxPhotoQualityPrioritization(
404 &self,
405 max_photo_quality_prioritization: AVCapturePhotoQualityPrioritization,
406 );
407
408 /// Specifies whether fast capture prioritization is supported.
409 ///
410 ///
411 /// Fast capture prioritization allows capture quality to be automatically reduced from the selected AVCapturePhotoQualityPrioritization to ensure the photo output can keep up when captures are requested in rapid succession. Fast capture prioritization is only supported for certain AVCaptureSession sessionPresets and AVCaptureDevice activeFormats and only when responsiveCaptureEnabled is YES. When switching cameras or formats this property may change. When this property changes from YES to NO, fastCapturePrioritizationEnabled also reverts to NO. If you've previously opted in for fast capture prioritization and then change configurations, you may need to set fastCapturePrioritizationEnabled = YES again.
412 #[unsafe(method(isFastCapturePrioritizationSupported))]
413 #[unsafe(method_family = none)]
414 pub unsafe fn isFastCapturePrioritizationSupported(&self) -> bool;
415
416 /// Setter for [`isFastCapturePrioritizationSupported`][Self::isFastCapturePrioritizationSupported].
417 #[unsafe(method(setFastCapturePrioritizationSupported:))]
418 #[unsafe(method_family = none)]
419 pub unsafe fn setFastCapturePrioritizationSupported(
420 &self,
421 fast_capture_prioritization_supported: bool,
422 );
423
424 /// Specifies whether fast capture prioritization is enabled.
425 ///
426 ///
427 /// This property defaults to NO. This property may only be set to YES if fastCapturePrioritizationSupported is YES, otherwise an NSInvalidArgumentException is thrown. By setting this property to YES, the photo output prepares itself to automatically reduce capture quality from the selected AVCapturePhotoQualityPrioritization when needed to keep up with rapid capture requests. In many cases the slightly reduced quality is preferable to missing the moment entirely. If you intend to use fast capture prioritization, you should set this property to YES before calling -[AVCaptureSession startRunning] or within -[AVCaptureSession beginConfiguration] and -[AVCaptureSession commitConfiguration] while running.
428 #[unsafe(method(isFastCapturePrioritizationEnabled))]
429 #[unsafe(method_family = none)]
430 pub unsafe fn isFastCapturePrioritizationEnabled(&self) -> bool;
431
432 /// Setter for [`isFastCapturePrioritizationEnabled`][Self::isFastCapturePrioritizationEnabled].
433 #[unsafe(method(setFastCapturePrioritizationEnabled:))]
434 #[unsafe(method_family = none)]
435 pub unsafe fn setFastCapturePrioritizationEnabled(
436 &self,
437 fast_capture_prioritization_enabled: bool,
438 );
439
440 /// Indicates whether the deferred photo delivery feature is supported by the receiver.
441 ///
442 ///
443 /// This property may change as the session's -sessionPreset or source device's -activeFormat change. When deferred photo delivery is not supported, your capture requests always resolve their AVCaptureResolvedPhotoSettings.deferredPhotoProxyDimensions to { 0, 0 }. This property is key-value observable.
444 ///
445 /// Automatic deferred photo delivery can produce a lightweight photo representation, called a "proxy", at the time of capture that can later be processed to completion while improving camera responsiveness. When it's appropriate for the receiver to deliver a photo proxy for deferred processing, the delegate callback -captureOutput:didFinishCapturingDeferredPhotoProxy:error: will be invoked instead of -captureOutput:didFinishProcessingPhoto:error:. See the documentation for AVCaptureDeferredPhotoProxy for more details.
446 #[unsafe(method(isAutoDeferredPhotoDeliverySupported))]
447 #[unsafe(method_family = none)]
448 pub unsafe fn isAutoDeferredPhotoDeliverySupported(&self) -> bool;
449
450 /// Specifies whether automatic deferred photo delivery is enabled.
451 ///
452 ///
453 /// Setting this value to either YES or NO requires a lengthy reconfiguration of the capture pipeline, so you should set this property before calling -[AVCaptureSession startRunning]. Setting this property to YES throws an NSInvalidArgumentException if autoDeferredPhotoDeliverySupported is NO.
454 #[unsafe(method(isAutoDeferredPhotoDeliveryEnabled))]
455 #[unsafe(method_family = none)]
456 pub unsafe fn isAutoDeferredPhotoDeliveryEnabled(&self) -> bool;
457
458 /// Setter for [`isAutoDeferredPhotoDeliveryEnabled`][Self::isAutoDeferredPhotoDeliveryEnabled].
459 #[unsafe(method(setAutoDeferredPhotoDeliveryEnabled:))]
460 #[unsafe(method_family = none)]
461 pub unsafe fn setAutoDeferredPhotoDeliveryEnabled(
462 &self,
463 auto_deferred_photo_delivery_enabled: bool,
464 );
465
466 /// Indicates whether the still image stabilization feature is supported by the receiver.
467 ///
468 ///
469 /// This property may change as the session's -sessionPreset or source device's -activeFormat change. When still image stabilization is not supported, your capture requests always resolve stillImageStabilizationEnabled to NO. This property is key-value observable.
470 ///
471 /// As of iOS 13 hardware, the AVCapturePhotoOutput is capable of applying a variety of multi-image fusion techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc), all of which have been previously lumped under the stillImageStabilization moniker. This property should no longer be used as it no longer provides meaningful information about the techniques used to improve quality in a photo capture. Instead, you should use -maxPhotoQualityPrioritization to indicate the highest quality prioritization level you might request in a photo capture, understanding that the higher the quality, the longer the potential wait. You may also use AVCapturePhotoSettings' photoQualityPrioritization property to specify a prioritization level for a particular photo capture, and then query the AVCaptureResolvedPhotoSettings photoProcessingTimeRange property to find out how long it might take to receive the resulting photo in your delegate callback.
472 #[deprecated]
473 #[unsafe(method(isStillImageStabilizationSupported))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn isStillImageStabilizationSupported(&self) -> bool;
476
477 /// Indicates whether the current scene is dark enough to warrant use of still image stabilization.
478 ///
479 ///
480 /// This property reports whether the current scene being previewed by the camera is dark enough to benefit from still image stabilization. You can influence this property's answers by setting the photoSettingsForSceneMonitoring property, indicating whether autoStillImageStabilization monitoring should be on or off. If you set autoStillImageStabilization to NO, isStillImageStabilizationScene always reports NO. If you set it to YES, this property returns YES or NO depending on the current scene's lighting conditions. Note that some very dark scenes do not benefit from still image stabilization, but do benefit from flash. By default, this property always returns NO unless you set photoSettingsForSceneMonitoring to a non-nil value. This property may be key-value observed.
481 ///
482 /// As of iOS 13 hardware, the AVCapturePhotoOutput is capable of applying a variety of multi-image fusion techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc), all of which have been previously lumped under the stillImageStabilization moniker. This property should no longer be used as it no longer provides meaningful information about the techniques used to improve quality in a photo capture. Instead, you should use -maxPhotoQualityPrioritization to indicate the highest quality prioritization level you might request in a photo capture, understanding that the higher the quality, the longer the potential wait. You may also use AVCapturePhotoSettings' photoQualityPrioritization property to specify a prioritization level for a particular photo capture, and then query the AVCaptureResolvedPhotoSettings photoProcessingTimeRange property to find out how long it might take to receive the resulting photo in your delegate callback.
483 #[deprecated]
484 #[unsafe(method(isStillImageStabilizationScene))]
485 #[unsafe(method_family = none)]
486 pub unsafe fn isStillImageStabilizationScene(&self) -> bool;
487
488 /// Indicates whether the virtual device image fusion feature is supported by the receiver.
489 ///
490 ///
491 /// This property may change as the session's -sessionPreset or source device's -activeFormat change. When using a virtual AVCaptureDevice, its constituent camera images can be fused together to improve image quality when this property answers YES. When virtual device fusion is not supported by the current configuration, your capture requests always resolve virtualDeviceFusionEnabled to NO. This property is key-value observable.
492 #[unsafe(method(isVirtualDeviceFusionSupported))]
493 #[unsafe(method_family = none)]
494 pub unsafe fn isVirtualDeviceFusionSupported(&self) -> bool;
495
496 /// Indicates whether the DualCamera image fusion feature is supported by the receiver.
497 ///
498 ///
499 /// This property may change as the session's -sessionPreset or source device's -activeFormat change. When using the AVCaptureDevice with deviceType AVCaptureDeviceTypeBuiltInDualCamera, the wide-angle and telephoto camera images can be fused together to improve image quality in some configurations. When DualCamera image fusion is not supported by the current configuration, your capture requests always resolve dualCameraFusionEnabled to NO. This property is key-value observable. As of iOS 13, this property is deprecated in favor of virtualDeviceFusionSupported.
500 #[deprecated]
501 #[unsafe(method(isDualCameraFusionSupported))]
502 #[unsafe(method_family = none)]
503 pub unsafe fn isDualCameraFusionSupported(&self) -> bool;
504
505 /// Specifies whether the photo output's current configuration supports delivery of photos from constituent cameras of a virtual device.
506 ///
507 ///
508 /// Virtual device constituent photo delivery is only supported for certain AVCaptureSession sessionPresets and AVCaptureDevice activeFormats. When switching cameras or formats this property may change. When this property changes from YES to NO, virtualDeviceConstituentPhotoDeliveryEnabled also reverts to NO. If you've previously opted in for virtual device constituent photo delivery and then change configurations, you may need to set virtualDeviceConstituentPhotoDeliveryEnabled = YES again. This property is key-value observable.
509 #[unsafe(method(isVirtualDeviceConstituentPhotoDeliverySupported))]
510 #[unsafe(method_family = none)]
511 pub unsafe fn isVirtualDeviceConstituentPhotoDeliverySupported(&self) -> bool;
512
513 /// Specifies whether the photo output's current configuration supports delivery of both telephoto and wide images from the DualCamera.
514 ///
515 ///
516 /// DualCamera dual photo delivery is only supported for certain AVCaptureSession sessionPresets and AVCaptureDevice activeFormats. When switching cameras or formats this property may change. When this property changes from YES to NO, dualCameraDualPhotoDeliveryEnabled also reverts to NO. If you've previously opted in for DualCamera dual photo delivery and then change configurations, you may need to set dualCameraDualPhotoDeliveryEnabled = YES again. This property is key-value observable. As of iOS 13, this property is deprecated in favor of virtualDeviceConstituentPhotoDeliverySupported.
517 #[deprecated]
518 #[unsafe(method(isDualCameraDualPhotoDeliverySupported))]
519 #[unsafe(method_family = none)]
520 pub unsafe fn isDualCameraDualPhotoDeliverySupported(&self) -> bool;
521
522 /// Indicates whether the photo output is configured for delivery of photos from constituent cameras of a virtual device.
523 ///
524 ///
525 /// Default value is NO. This property may only be set to YES if virtualDeviceConstituentPhotoDeliverySupported is YES. Virtual device constituent photo delivery requires a lengthy reconfiguration of the capture render pipeline, so if you intend to do any constituent photo delivery captures, you should set this property to YES before calling -[AVCaptureSession startRunning]. See also -[AVCapturePhotoSettings virtualDeviceConstituentPhotoDeliveryEnabledDevices].
526 #[unsafe(method(isVirtualDeviceConstituentPhotoDeliveryEnabled))]
527 #[unsafe(method_family = none)]
528 pub unsafe fn isVirtualDeviceConstituentPhotoDeliveryEnabled(&self) -> bool;
529
530 /// Setter for [`isVirtualDeviceConstituentPhotoDeliveryEnabled`][Self::isVirtualDeviceConstituentPhotoDeliveryEnabled].
531 #[unsafe(method(setVirtualDeviceConstituentPhotoDeliveryEnabled:))]
532 #[unsafe(method_family = none)]
533 pub unsafe fn setVirtualDeviceConstituentPhotoDeliveryEnabled(
534 &self,
535 virtual_device_constituent_photo_delivery_enabled: bool,
536 );
537
538 /// Indicates whether the photo output is configured for delivery of both the telephoto and wide images from the DualCamera.
539 ///
540 ///
541 /// Default value is NO. This property may only be set to YES if dualCameraDualPhotoDeliverySupported is YES. DualCamera dual photo delivery requires a lengthy reconfiguration of the capture render pipeline, so if you intend to do any dual photo delivery captures, you should set this property to YES before calling -[AVCaptureSession startRunning]. See also -[AVCapturePhotoSettings dualCameraDualPhotoDeliveryEnabled]. As of iOS 13, this property is deprecated in favor of virtualDeviceConstituentPhotoDeliveryEnabled.
542 #[deprecated]
543 #[unsafe(method(isDualCameraDualPhotoDeliveryEnabled))]
544 #[unsafe(method_family = none)]
545 pub unsafe fn isDualCameraDualPhotoDeliveryEnabled(&self) -> bool;
546
547 /// Setter for [`isDualCameraDualPhotoDeliveryEnabled`][Self::isDualCameraDualPhotoDeliveryEnabled].
548 #[deprecated]
549 #[unsafe(method(setDualCameraDualPhotoDeliveryEnabled:))]
550 #[unsafe(method_family = none)]
551 pub unsafe fn setDualCameraDualPhotoDeliveryEnabled(
552 &self,
553 dual_camera_dual_photo_delivery_enabled: bool,
554 );
555
556 /// Specifies whether the photo output's current configuration supports delivery of AVCameraCalibrationData in the resultant AVCapturePhoto.
557 ///
558 ///
559 /// Camera calibration data delivery (intrinsics, extrinsics, lens distortion characteristics, etc.) is only supported if virtualDeviceConstituentPhotoDeliveryEnabled is YES and contentAwareDistortionCorrectionEnabled is NO and the source device's geometricDistortionCorrectionEnabled property is set to NO. This property is key-value observable.
560 #[unsafe(method(isCameraCalibrationDataDeliverySupported))]
561 #[unsafe(method_family = none)]
562 pub unsafe fn isCameraCalibrationDataDeliverySupported(&self) -> bool;
563
564 /// An array of AVCaptureFlashMode constants for the current capture session configuration.
565 ///
566 ///
567 /// This property supersedes AVCaptureDevice's isFlashModeSupported: It returns an array of AVCaptureFlashMode constants. To test whether a particular flash mode is supported, use NSArray's containsObject API: [photoOutput.supportedFlashModes containsObject:
568 /// @
569 /// (AVCaptureFlashModeAuto)]. This property is key-value observable.
570 #[unsafe(method(supportedFlashModes))]
571 #[unsafe(method_family = none)]
572 pub unsafe fn supportedFlashModes(&self) -> Retained<NSArray<NSNumber>>;
573
574 /// Indicates whether the receiver supports automatic red-eye reduction for flash captures.
575 ///
576 ///
577 /// Flash images may cause subjects' eyes to appear red, golden, or white. Automatic red-eye reduction detects and corrects for reflected light in eyes, at the cost of additional processing time per image. This property may change as the session's -sessionPreset or source device's -activeFormat change. When red-eye reduction is not supported, your capture requests always resolve redEyeReductionEnabled to NO. This property is key-value observable.
578 #[unsafe(method(isAutoRedEyeReductionSupported))]
579 #[unsafe(method_family = none)]
580 pub unsafe fn isAutoRedEyeReductionSupported(&self) -> bool;
581
582 /// Indicates whether the current scene is dark enough to warrant use of the flash.
583 ///
584 ///
585 /// This property reports whether the current scene being previewed by the camera is dark enough to need the flash. If -supportedFlashModes only contains AVCaptureFlashModeOff, isFlashScene always reports NO. You can influence this property's answers by setting the photoSettingsForSceneMonitoring property, indicating the flashMode you wish to monitor. If you set flashMode to AVCaptureFlashModeOff, isFlashScene always reports NO. If you set it to AVCaptureFlashModeAuto or AVCaptureFlashModeOn, isFlashScene answers YES or NO based on the current scene's lighting conditions. By default, this property always returns NO unless you set photoSettingsForSceneMonitoring to a non-nil value. Note that there is some overlap in the light level ranges that benefit from still image stabilization and flash. If your photoSettingsForSceneMonitoring indicate that both still image stabilization and flash scenes should be monitored, still image stabilization takes precedence, and isFlashScene becomes YES at lower overall light levels. This property may be key-value observed.
586 #[unsafe(method(isFlashScene))]
587 #[unsafe(method_family = none)]
588 pub unsafe fn isFlashScene(&self) -> bool;
589
590 /// Settings that govern the behavior of isFlashScene and isStillImageStabilizationScene.
591 ///
592 ///
593 /// You can influence the return values of isFlashScene and isStillImageStabilizationScene by setting this property, indicating the flashMode and photoQualityPrioritization values that should be considered for scene monitoring. For instance, if you set flashMode to AVCaptureFlashModeOff, isFlashScene always reports NO. If you set it to AVCaptureFlashModeAuto or AVCaptureFlashModeOn, isFlashScene answers YES or NO based on the current scene's lighting conditions. Note that there is some overlap in the light level ranges that benefit from still image stabilization and flash. If your photoSettingsForSceneMonitoring indicate that both still image stabilization and flash scenes should be monitored, still image stabilization takes precedence, and isFlashScene becomes YES at lower overall light levels. The default value for this property is nil. See isStillImageStabilizationScene and isFlashScene for further discussion.
594 #[unsafe(method(photoSettingsForSceneMonitoring))]
595 #[unsafe(method_family = none)]
596 pub unsafe fn photoSettingsForSceneMonitoring(
597 &self,
598 ) -> Option<Retained<AVCapturePhotoSettings>>;
599
600 /// Setter for [`photoSettingsForSceneMonitoring`][Self::photoSettingsForSceneMonitoring].
601 #[unsafe(method(setPhotoSettingsForSceneMonitoring:))]
602 #[unsafe(method_family = none)]
603 pub unsafe fn setPhotoSettingsForSceneMonitoring(
604 &self,
605 photo_settings_for_scene_monitoring: Option<&AVCapturePhotoSettings>,
606 );
607
608 /// Indicates whether the photo render pipeline should be configured to deliver high resolution still images.
609 ///
610 ///
611 /// Some AVCaptureDeviceFormats support outputting higher resolution stills than their streaming resolution (See AVCaptureDeviceFormat.highResolutionStillImageDimensions). Under some conditions, AVCaptureSession needs to set up the photo render pipeline differently to support high resolution still image capture. If you intend to take high resolution still images at all, you should set this property to YES before calling -[AVCaptureSession startRunning]. Once you've opted in for high resolution capture, you are free to issue photo capture requests with or without highResolutionCaptureEnabled in the AVCapturePhotoSettings. If you have not set this property to YES and call capturePhotoWithSettings:delegate: with settings.highResolutionCaptureEnabled set to YES, an NSInvalidArgumentException will be thrown.
612 #[deprecated = "Use maxPhotoDimensions instead."]
613 #[unsafe(method(isHighResolutionCaptureEnabled))]
614 #[unsafe(method_family = none)]
615 pub unsafe fn isHighResolutionCaptureEnabled(&self) -> bool;
616
617 /// Setter for [`isHighResolutionCaptureEnabled`][Self::isHighResolutionCaptureEnabled].
618 #[deprecated = "Use maxPhotoDimensions instead."]
619 #[unsafe(method(setHighResolutionCaptureEnabled:))]
620 #[unsafe(method_family = none)]
621 pub unsafe fn setHighResolutionCaptureEnabled(&self, high_resolution_capture_enabled: bool);
622
623 #[cfg(feature = "objc2-core-media")]
624 /// Indicates the maximum resolution of the requested photo.
625 ///
626 ///
627 /// Set this property to enable requesting of images up to as large as the specified dimensions. Images returned by AVCapturePhotoOutput may be smaller than these dimensions but will never be larger. Once set, images can be requested with any valid maximum photo dimensions by setting AVCapturePhotoSettings.maxPhotoDimensions on a per photo basis. The dimensions set must match one of the dimensions returned by AVCaptureDeviceFormat.supportedMaxPhotoDimensions for the current active format. Changing this property may trigger a lengthy reconfiguration of the capture render pipeline so it is recommended that this is set before calling -[AVCaptureSession startRunning].
628 /// Note: When supported, the 24MP setting (5712, 4284) is only serviced as 24MP when opted-in to autoDeferredPhotoDeliveryEnabled.
629 #[unsafe(method(maxPhotoDimensions))]
630 #[unsafe(method_family = none)]
631 pub unsafe fn maxPhotoDimensions(&self) -> CMVideoDimensions;
632
633 #[cfg(feature = "objc2-core-media")]
634 /// Setter for [`maxPhotoDimensions`][Self::maxPhotoDimensions].
635 #[unsafe(method(setMaxPhotoDimensions:))]
636 #[unsafe(method_family = none)]
637 pub unsafe fn setMaxPhotoDimensions(&self, max_photo_dimensions: CMVideoDimensions);
638
639 /// Specifies the maximum number of photos that may be taken in a single bracket.
640 ///
641 ///
642 /// AVCapturePhotoOutput can only satisfy a limited number of image requests in a single bracket without exhausting system resources. The maximum number of photos that may be taken in a single bracket depends on the size and format of the images being captured, and consequently may vary with AVCaptureSession -sessionPreset and AVCaptureDevice -activeFormat. Some formats do not support bracketed capture at all, and thus this property may return a value of 0. This read-only property is key-value observable. If you call -capturePhotoWithSettings:delegate: with a bracketedSettings whose count exceeds -maxBracketedCapturePhotoCount, an NSInvalidArgumentException is thrown.
643 #[unsafe(method(maxBracketedCapturePhotoCount))]
644 #[unsafe(method_family = none)]
645 pub unsafe fn maxBracketedCapturePhotoCount(&self) -> NSUInteger;
646
647 /// Indicates whether the receiver supports lens stabilization during bracketed captures.
648 ///
649 ///
650 /// The AVCapturePhotoBracketSettings lensStabilizationEnabled property may only be set if this property returns YES. Its value may change as the session's -sessionPreset or input device's -activeFormat changes. This read-only property is key-value observable.
651 #[unsafe(method(isLensStabilizationDuringBracketedCaptureSupported))]
652 #[unsafe(method_family = none)]
653 pub unsafe fn isLensStabilizationDuringBracketedCaptureSupported(&self) -> bool;
654
655 /// Indicates whether the receiver supports Live Photo capture.
656 ///
657 ///
658 /// Live Photo capture is only supported for certain AVCaptureSession sessionPresets and AVCaptureDevice activeFormats. When switching cameras or formats this property may change. When this property changes from YES to NO, livePhotoCaptureEnabled also reverts to NO. If you've previously opted in for Live Photo capture and then change configurations, you may need to set livePhotoCaptureEnabled = YES again.
659 #[unsafe(method(isLivePhotoCaptureSupported))]
660 #[unsafe(method_family = none)]
661 pub unsafe fn isLivePhotoCaptureSupported(&self) -> bool;
662
663 /// Indicates whether the receiver is configured for Live Photo capture.
664 ///
665 ///
666 /// Default value is NO. This property may only be set to YES if livePhotoCaptureSupported is YES. Live Photo capture requires a lengthy reconfiguration of the capture render pipeline, so if you intend to do any Live Photo captures at all, you should set livePhotoCaptureEnabled to YES before calling -[AVCaptureSession startRunning].
667 #[unsafe(method(isLivePhotoCaptureEnabled))]
668 #[unsafe(method_family = none)]
669 pub unsafe fn isLivePhotoCaptureEnabled(&self) -> bool;
670
671 /// Setter for [`isLivePhotoCaptureEnabled`][Self::isLivePhotoCaptureEnabled].
672 #[unsafe(method(setLivePhotoCaptureEnabled:))]
673 #[unsafe(method_family = none)]
674 pub unsafe fn setLivePhotoCaptureEnabled(&self, live_photo_capture_enabled: bool);
675
676 /// Indicates whether Live Photo capture is enabled, but currently suspended.
677 ///
678 ///
679 /// This property allows you to cut current Live Photo movie captures short (for instance, if you suddenly need to do something that you don't want to show up in the Live Photo movie, such as take a non Live Photo capture that makes a shutter sound). By default, livePhotoCaptureSuspended is NO. When you set livePhotoCaptureSuspended = YES, any Live Photo movie captures in progress are trimmed to the current time. Likewise, when you toggle livePhotoCaptureSuspended from YES to NO, subsequent Live Photo movie captures will not contain any samples earlier than the time you un-suspended Live Photo capture. Setting this property to YES throws an NSInvalidArgumentException if livePhotoCaptureEnabled is NO. By default, this property resets to NO when the AVCaptureSession stops. This behavior can be prevented by setting preservesLivePhotoCaptureSuspendedOnSessionStop to YES before stopping the session.
680 #[unsafe(method(isLivePhotoCaptureSuspended))]
681 #[unsafe(method_family = none)]
682 pub unsafe fn isLivePhotoCaptureSuspended(&self) -> bool;
683
684 /// Setter for [`isLivePhotoCaptureSuspended`][Self::isLivePhotoCaptureSuspended].
685 #[unsafe(method(setLivePhotoCaptureSuspended:))]
686 #[unsafe(method_family = none)]
687 pub unsafe fn setLivePhotoCaptureSuspended(&self, live_photo_capture_suspended: bool);
688
689 /// By default, Live Photo capture is resumed when the session stops. This property allows clients to opt out of this and preserve the value of livePhotoCaptureSuspended.
690 ///
691 ///
692 /// Defaults to NO.
693 #[unsafe(method(preservesLivePhotoCaptureSuspendedOnSessionStop))]
694 #[unsafe(method_family = none)]
695 pub unsafe fn preservesLivePhotoCaptureSuspendedOnSessionStop(&self) -> bool;
696
697 /// Setter for [`preservesLivePhotoCaptureSuspendedOnSessionStop`][Self::preservesLivePhotoCaptureSuspendedOnSessionStop].
698 #[unsafe(method(setPreservesLivePhotoCaptureSuspendedOnSessionStop:))]
699 #[unsafe(method_family = none)]
700 pub unsafe fn setPreservesLivePhotoCaptureSuspendedOnSessionStop(
701 &self,
702 preserves_live_photo_capture_suspended_on_session_stop: bool,
703 );
704
705 /// Indicates whether Live Photo movies are trimmed in real time to avoid excessive movement.
706 ///
707 ///
708 /// This property defaults to YES when livePhotoCaptureSupported is YES. Changing this property's value while your session is running will cause a lengthy reconfiguration of the session. You should set livePhotoAutoTrimmingEnabled to YES or NO before calling -[AVCaptureSession startRunning]. When set to YES, Live Photo movies are analyzed in real time and trimmed if there's excessive movement before or after the photo is taken. Nominally, Live Photos are approximately 3 seconds long. With trimming enabled, they may be shorter, depending on movement. This feature prevents common problems such as Live Photo movies containing shoe or pocket shots.
709 #[unsafe(method(isLivePhotoAutoTrimmingEnabled))]
710 #[unsafe(method_family = none)]
711 pub unsafe fn isLivePhotoAutoTrimmingEnabled(&self) -> bool;
712
713 /// Setter for [`isLivePhotoAutoTrimmingEnabled`][Self::isLivePhotoAutoTrimmingEnabled].
714 #[unsafe(method(setLivePhotoAutoTrimmingEnabled:))]
715 #[unsafe(method_family = none)]
716 pub unsafe fn setLivePhotoAutoTrimmingEnabled(
717 &self,
718 live_photo_auto_trimming_enabled: bool,
719 );
720
721 #[cfg(feature = "AVVideoSettings")]
722 /// An array of AVVideoCodecKey values that are currently supported by the receiver for use in the movie complement of a Live Photo.
723 ///
724 ///
725 /// Prior to iOS 11, all Live Photo movie video tracks are compressed using H.264. Beginning in iOS 11, you can select the Live Photo movie video compression format using one of the AVVideoCodecKey strings presented in this property. The system's default (preferred) video codec is always presented first in the list. If you've not yet added your receiver to an AVCaptureSession with a video source, no codecs are available. This property is key-value observable.
726 #[unsafe(method(availableLivePhotoVideoCodecTypes))]
727 #[unsafe(method_family = none)]
728 pub unsafe fn availableLivePhotoVideoCodecTypes(
729 &self,
730 ) -> Retained<NSArray<AVVideoCodecType>>;
731
732 #[cfg(feature = "objc2-core-media")]
733 /// A class method that writes a JPEG sample buffer to an NSData in the JPEG file format.
734 ///
735 ///
736 /// Parameter `JPEGSampleBuffer`: A CMSampleBuffer containing JPEG compressed data.
737 ///
738 /// Parameter `previewPhotoSampleBuffer`: An optional CMSampleBuffer containing pixel buffer image data to be written as a thumbnail image.
739 ///
740 /// Returns: An NSData containing bits in the JPEG file format. May return nil if the re-packaging process fails.
741 ///
742 ///
743 /// AVCapturePhotoOutput's depecrated -captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error: callback delivers JPEG photos to clients as CMSampleBuffers. To re-package these buffers in a data format suitable for writing to a JPEG file, you may call this class method, optionally inserting your own metadata into the JPEG CMSampleBuffer first, and optionally passing a preview image to be written to the JPEG file format as a thumbnail image.
744 #[deprecated]
745 #[unsafe(method(JPEGPhotoDataRepresentationForJPEGSampleBuffer:previewPhotoSampleBuffer:))]
746 #[unsafe(method_family = none)]
747 pub unsafe fn JPEGPhotoDataRepresentationForJPEGSampleBuffer_previewPhotoSampleBuffer(
748 jpeg_sample_buffer: &CMSampleBuffer,
749 preview_photo_sample_buffer: Option<&CMSampleBuffer>,
750 ) -> Option<Retained<NSData>>;
751
752 #[cfg(feature = "objc2-core-media")]
753 /// A class method that writes a RAW sample buffer to an NSData containing bits in the DNG file format.
754 ///
755 ///
756 /// Parameter `rawSampleBuffer`: A CMSampleBuffer containing Bayer RAW data.
757 ///
758 /// Parameter `previewPhotoSampleBuffer`: An optional CMSampleBuffer containing pixel buffer image data to be written as a thumbnail image.
759 ///
760 /// Returns: An NSData containing bits in the DNG file format. May return nil if the re-packaging process fails.
761 ///
762 ///
763 /// AVCapturePhotoOutput's deprecated -captureOutput:didFinishProcessingRawPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error: callback delivers RAW photos to clients as CMSampleBuffers. To re-package these buffers in a data format suitable for writing to a DNG file, you may call this class method, optionally inserting your own metadata into the RAW CMSampleBuffer first, and optionally passing a preview image to be written to the DNG file format as a thumbnail image. Only RAW images from Apple built-in cameras are supported.
764 #[deprecated]
765 #[unsafe(method(DNGPhotoDataRepresentationForRawSampleBuffer:previewPhotoSampleBuffer:))]
766 #[unsafe(method_family = none)]
767 pub unsafe fn DNGPhotoDataRepresentationForRawSampleBuffer_previewPhotoSampleBuffer(
768 raw_sample_buffer: &CMSampleBuffer,
769 preview_photo_sample_buffer: Option<&CMSampleBuffer>,
770 ) -> Option<Retained<NSData>>;
771
772 /// A BOOL value specifying whether content aware distortion correction is supported.
773 ///
774 ///
775 /// The rectilinear model used in optical design and by geometric distortion correction only preserves lines but not area, angles, or distance. Thus the wider the field of view of a lens, the greater the areal distortion at the edges of images. Content aware distortion correction, when enabled, intelligently corrects distortions by taking content into consideration, such as faces near the edges of the image. This property returns YES if the session's current configuration allows photos to be captured with content aware distortion correction. When switching cameras or formats or enabling depth data delivery this property may change. When this property changes from YES to NO, contentAwareDistortionCorrectionEnabled also reverts to NO. This property is key-value observable.
776 #[unsafe(method(isContentAwareDistortionCorrectionSupported))]
777 #[unsafe(method_family = none)]
778 pub unsafe fn isContentAwareDistortionCorrectionSupported(&self) -> bool;
779
780 /// A BOOL value specifying whether the photo render pipeline is set up to perform content aware distortion correction.
781 ///
782 ///
783 /// Default is NO. Set to YES if you wish content aware distortion correction to be performed on your AVCapturePhotos. This property may only be set to YES if contentAwareDistortionCorrectionSupported is YES. Note that warping the photos to preserve more natural looking content may result in a small change in field of view compared to what you see in the AVCaptureVideoPreviewLayer. The amount of field of view lost or gained is content specific and may vary from photo to photo. Enabling this property requires a lengthy reconfiguration of the capture render pipeline, so you should set this property to YES before calling -[AVCaptureSession startRunning].
784 #[unsafe(method(isContentAwareDistortionCorrectionEnabled))]
785 #[unsafe(method_family = none)]
786 pub unsafe fn isContentAwareDistortionCorrectionEnabled(&self) -> bool;
787
788 /// Setter for [`isContentAwareDistortionCorrectionEnabled`][Self::isContentAwareDistortionCorrectionEnabled].
789 #[unsafe(method(setContentAwareDistortionCorrectionEnabled:))]
790 #[unsafe(method_family = none)]
791 pub unsafe fn setContentAwareDistortionCorrectionEnabled(
792 &self,
793 content_aware_distortion_correction_enabled: bool,
794 );
795
796 /// A BOOL value specifying whether zero shutter lag is supported.
797 ///
798 ///
799 /// This property returns YES if the session's current configuration allows zero shutter lag. When switching cameras or formats, setting depthDataDeliveryEnabled, or setting virtualDeviceConstituentPhotoDeliveryEnabled this property may change. When this property changes from YES to NO, zeroShutterLagEnabled also reverts to NO. This property is key-value observable.
800 #[unsafe(method(isZeroShutterLagSupported))]
801 #[unsafe(method_family = none)]
802 pub unsafe fn isZeroShutterLagSupported(&self) -> bool;
803
804 /// A BOOL value specifying whether the output is set up to support zero shutter lag.
805 ///
806 ///
807 /// This property may only be set to YES if zeroShutterLagSupported is YES, otherwise an NSInvalidArgumentException is thrown. For apps linked on or after iOS 17 zero shutter lag is automatically enabled when supported. Enabling zero shutter lag reduces or eliminates shutter lag when using AVCapturePhotoQualityPrioritizationBalanced or Quality at the cost of additional memory usage by the photo output. The timestamp of the AVCapturePhoto may be slightly earlier than when -capturePhotoWithSettings:delegate: was called. To minimize camera shake from the user's tapping gesture it is recommended that -capturePhotoWithSettings:delegate: be called as early as possible when handling the touch down event. Zero shutter lag isn't available when using manual exposure or bracketed capture. Changing this property requires a lengthy reconfiguration of the capture render pipeline, so you should set this property to YES before calling -[AVCaptureSession startRunning] or within -[AVCaptureSession beginConfiguration] and -[AVCaptureSession commitConfiguration] while running.
808 #[unsafe(method(isZeroShutterLagEnabled))]
809 #[unsafe(method_family = none)]
810 pub unsafe fn isZeroShutterLagEnabled(&self) -> bool;
811
812 /// Setter for [`isZeroShutterLagEnabled`][Self::isZeroShutterLagEnabled].
813 #[unsafe(method(setZeroShutterLagEnabled:))]
814 #[unsafe(method_family = none)]
815 pub unsafe fn setZeroShutterLagEnabled(&self, zero_shutter_lag_enabled: bool);
816
817 /// A BOOL value specifying whether responsive capture is supported.
818 ///
819 ///
820 /// Enabling responsive capture increases peak and sustained capture rates, and reduces shutter lag at the cost of additional memory usage by the photo output. This property returns YES if the session's current configuration allows responsive capture. When switching cameras or formats, enabling depth data delivery, or enabling zero shutter lag this property may change. Responsive capture is only supported when zero shutter lag is enabled. When this property changes from YES to NO, responsiveCaptureEnabled also reverts to NO. This property is key-value observable.
821 #[unsafe(method(isResponsiveCaptureSupported))]
822 #[unsafe(method_family = none)]
823 pub unsafe fn isResponsiveCaptureSupported(&self) -> bool;
824
825 /// A BOOL value specifying whether the photo output is set up to support responsive capture.
826 ///
827 ///
828 /// This property may only be set to YES if responsiveCaptureSupported is YES, otherwise an NSInvalidArgumentException is thrown. When responsiveCaptureEnabled is YES the captureReadiness property should be used to determine whether new capture requests can be serviced in a reasonable time and whether the shutter control should be available to the user. Responsive capture adds buffering between the capture and photo processing stages which allows a new capture to start before processing has completed for the previous capture, so be prepared to handle -captureOutput:willBeginCaptureForResolvedSettings: being called before the -captureOutput:didFinishProcessingPhoto: for the prior requests. Processed photos continue to be delivered in the order they were captured. To minimize camera shake from the user's tapping gesture it is recommended that -capturePhotoWithSettings:delegate: be called as early as possible when handling the touch down event. Enabling responsive capture allows the fast capture prioritization feature to be used, which further increases capture rates and reduces preview and recording disruptions. See the fastCapturePrioritizationEnabled property. When requesting uncompressed output using kCVPixelBufferPixelFormatTypeKey in AVCapturePhotoSetting.format the AVCapturePhoto's pixelBuffer is allocated from a pool with enough capacity for that request only, and overlap between capture and processing is disabled. The client must release the AVCapturePhoto and references to the pixelBuffer before capturing again and the pixelBuffer's IOSurface must also no longer be in use. Changing this property requires a lengthy reconfiguration of the capture render pipeline, so you should set this property to YES before calling -[AVCaptureSession startRunning] or within -[AVCaptureSession beginConfiguration] and -[AVCaptureSession commitConfiguration] while running.
829 #[unsafe(method(isResponsiveCaptureEnabled))]
830 #[unsafe(method_family = none)]
831 pub unsafe fn isResponsiveCaptureEnabled(&self) -> bool;
832
833 /// Setter for [`isResponsiveCaptureEnabled`][Self::isResponsiveCaptureEnabled].
834 #[unsafe(method(setResponsiveCaptureEnabled:))]
835 #[unsafe(method_family = none)]
836 pub unsafe fn setResponsiveCaptureEnabled(&self, responsive_capture_enabled: bool);
837
838 /// A value specifying whether the photo output is ready to respond to new capture requests in a timely manner.
839 ///
840 ///
841 /// This property can be key-value observed to enable and disable shutter button UI depending on whether the output is ready to capture, which is especially important when the responsiveCaptureEnabled property is YES. When interacting with AVCapturePhotoOutput on a background queue AVCapturePhotoOutputReadinessCoordinator should instead be used to observe readiness changes and perform UI updates. Capturing only when the output is ready limits the number of requests inflight to minimize shutter lag while maintaining the fastest shot to shot time. When the property returns a value other than Ready the output is not ready to capture and the shutter button should be disabled to prevent the user from initiating new requests. The output continues to accept requests when the captureReadiness property returns a value other than Ready, but the request may not be serviced for a longer period. The visual presentation of the shutter button can be customized based on the readiness value. When the user rapidly taps the shutter button the property may transition to NotReadyMomentarily for a brief period. Although the shutter button should be disabled during this period it is short lived enough that dimming or changing the appearance of the shutter is not recommended as it would be visually distracting to the user. Longer running capture types like flash or captures with AVCapturePhotoQualityPrioritizationQuality may prevent the output from capturing for an extended period, indicated by NotReadyWaitingForCapture or NotReadyWaitingForProcessing, which is appropriate to show by dimming or disabling the shutter button. For NotReadyWaitingForProcessing it is also appropriate to show a spinner or other indication that the shutter is busy.
842 #[unsafe(method(captureReadiness))]
843 #[unsafe(method_family = none)]
844 pub unsafe fn captureReadiness(&self) -> AVCapturePhotoOutputCaptureReadiness;
845
846 /// A BOOL value specifying whether constant color capture is supported.
847 ///
848 ///
849 /// An object's color in a photograph is affected by the light sources illuminating the scene, so the color of the same object photographed in warm light might look markedly different than in colder light. In some use cases, such ambient light induced color variation is undesirable, and the user may prefer an estimate of what these materials would look like under a standard light such as daylight (D65), regardless of the lighting conditions at the time the photograph was taken. Some devices are capable of producing such constant color photos.
850 ///
851 /// Constant color captures require the flash to be fired and may require pre-flash sequence to determine the correct focus and exposure, therefore it might take several seconds to acquire a constant color photo. Due to this flash requirement, a constant color capture can only be taken with AVCaptureFlashModeAuto or AVCaptureFlashModeOn as the flash mode, otherwise an exception is thrown.
852 ///
853 /// Constant color can only be achieved when the flash has a discernible effect on the scene so it may not perform well in bright conditions such as direct sunlight. Use the constantColorConfidenceMap property to examine the confidence level, and therefore the usefulness, of each region of a constant color photo.
854 ///
855 /// Constant color should not be used in conjunction with locked or manual white balance.
856 ///
857 /// This property returns YES if the session's current configuration allows photos to be captured with constant color. When switching cameras or formats this property may change. When this property changes from YES to NO, constantColorEnabled also reverts to NO. If you've previously opted in for constant color and then change configurations, you may need to set constantColorEnabled = YES again. This property is key-value observable.
858 #[unsafe(method(isConstantColorSupported))]
859 #[unsafe(method_family = none)]
860 pub unsafe fn isConstantColorSupported(&self) -> bool;
861
862 /// A BOOL value specifying whether the photo render pipeline is set up to perform constant color captures.
863 ///
864 ///
865 /// Default is NO. Set to YES to enable support for taking constant color photos. This property may only be set to YES if constantColorSupported is YES. Enabling constant color requires a lengthy reconfiguration of the capture render pipeline, so if you intend to capture constant color photos, you should set this property to YES before calling -[AVCaptureSession startRunning] or within -[AVCaptureSession beginConfiguration] and -[AVCaptureSession commitConfiguration] while running.
866 #[unsafe(method(isConstantColorEnabled))]
867 #[unsafe(method_family = none)]
868 pub unsafe fn isConstantColorEnabled(&self) -> bool;
869
870 /// Setter for [`isConstantColorEnabled`][Self::isConstantColorEnabled].
871 #[unsafe(method(setConstantColorEnabled:))]
872 #[unsafe(method_family = none)]
873 pub unsafe fn setConstantColorEnabled(&self, constant_color_enabled: bool);
874
875 /// Specifies whether suppressing the shutter sound is supported.
876 ///
877 ///
878 /// On iOS, this property returns NO in jurisdictions where shutter sound production cannot be disabled. On all other platforms, it always returns NO.
879 #[unsafe(method(isShutterSoundSuppressionSupported))]
880 #[unsafe(method_family = none)]
881 pub unsafe fn isShutterSoundSuppressionSupported(&self) -> bool;
882 );
883}
884
885extern_class!(
886 /// AVCapturePhotoOutputReadinessCoordinator notifies its delegate of changes in an AVCapturePhotoOutput's captureReadiness property and can be used to coordinate UI updates on the main queue with use of AVCapturePhotoOutput on a background queue.
887 ///
888 ///
889 /// AVCapturePhotoOutputReadinessCoordinator tracks its output's captureReadiness and incorporates additional requests registered via -startTrackingCaptureRequestUsingPhotoSettings:. This allows clients to synchronously update shutter button availability and appearance and on the main thread while calling -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] asynchronously on a background queue.
890 ///
891 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotooutputreadinesscoordinator?language=objc)
892 #[unsafe(super(NSObject))]
893 #[derive(Debug, PartialEq, Eq, Hash)]
894 pub struct AVCapturePhotoOutputReadinessCoordinator;
895);
896
897extern_conformance!(
898 unsafe impl NSObjectProtocol for AVCapturePhotoOutputReadinessCoordinator {}
899);
900
901impl AVCapturePhotoOutputReadinessCoordinator {
902 extern_methods!(
903 #[unsafe(method(init))]
904 #[unsafe(method_family = init)]
905 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
906
907 #[unsafe(method(new))]
908 #[unsafe(method_family = new)]
909 pub unsafe fn new() -> Retained<Self>;
910
911 #[cfg(feature = "AVCaptureOutputBase")]
912 #[unsafe(method(initWithPhotoOutput:))]
913 #[unsafe(method_family = init)]
914 pub unsafe fn initWithPhotoOutput(
915 this: Allocated<Self>,
916 photo_output: &AVCapturePhotoOutput,
917 ) -> Retained<Self>;
918
919 /// The receiver's delegate, called on the main queue.
920 ///
921 ///
922 /// The value of this property is an object conforming to the AVCapturePhotoOutputReadinessCoordinatorDelegate protocol that will receive a callback when the captureReadiness property changes. Callbacks are delivered on the main queue, allowing UI updates to be done directly in the callback. A callback with the initial value of captureReadiness is delivered when delegate is set.
923 #[unsafe(method(delegate))]
924 #[unsafe(method_family = none)]
925 pub unsafe fn delegate(
926 &self,
927 ) -> Option<Retained<ProtocolObject<dyn AVCapturePhotoOutputReadinessCoordinatorDelegate>>>;
928
929 /// This is a [weak property][objc2::topics::weak_property].
930 /// Setter for [`delegate`][Self::delegate].
931 #[unsafe(method(setDelegate:))]
932 #[unsafe(method_family = none)]
933 pub unsafe fn setDelegate(
934 &self,
935 delegate: Option<&ProtocolObject<dyn AVCapturePhotoOutputReadinessCoordinatorDelegate>>,
936 );
937
938 /// A value specifying whether the coordinator's photo output is ready to respond to new capture requests in a timely manner.
939 ///
940 ///
941 /// The value incorporates the photo output's captureReadiness and any requests registered using -startTrackingCaptureRequestUsingPhotoSettings:. The value is updated before calling the -readinessCoordinator:captureReadinessDidChange: callback. See AVCapturePhotoOutput's captureReadiness documentation for a discussion of how to update shutter availability and appearance based on the captureReadiness value. This property is key-value observable and all change notifications are delivered on the main queue, allowing UI updates to be done directly in the callback.
942 #[unsafe(method(captureReadiness))]
943 #[unsafe(method_family = none)]
944 pub unsafe fn captureReadiness(&self) -> AVCapturePhotoOutputCaptureReadiness;
945
946 /// Track the capture request represented by the specified photo settings until it is enqueued to the photo output and update captureReadiness to include this request.
947 ///
948 ///
949 /// Parameter `settings`: The AVCapturePhotoSettings which will be passed to -[AVCapturePhotoOutput capturePhotoWithSettings:delegate] for this capture request.
950 ///
951 ///
952 /// The captureReadiness property is updated to include the tracked request until the the photo output receives a settings object with the same or a newer uniqueID. It is recommended that the same photo settings be passed to -[AVCapturePhotoOutput capturePhotoWithSettings:delegate] to ensure the captureReadiness value is consistent once the capture begins. When called on the main queue the delegate callback is invoked synchronously before returning to ensure shutter availability is updated immediately and prevent queued touch events from initiating unwanted captures. The -startTrackingCaptureRequestUsingPhotoSettings: method can be called while in the SessionNotRunning state to allow the shutter button to be interactive while the session is being started on a background queue. An NSInvalidArgumentException is thrown if the photo settings are invalid.
953 #[unsafe(method(startTrackingCaptureRequestUsingPhotoSettings:))]
954 #[unsafe(method_family = none)]
955 pub unsafe fn startTrackingCaptureRequestUsingPhotoSettings(
956 &self,
957 settings: &AVCapturePhotoSettings,
958 );
959
960 /// Stop tracking the capture request represented by the specified photo settings uniqueID and update captureReadiness to no longer include this request.
961 ///
962 ///
963 /// Parameter `settingsUniqueID`: The AVCapturePhotoSettings.uniqueID of the settings passed to -startTrackingCaptureRequestUsingPhotoSettings:.
964 ///
965 ///
966 /// Tracking automatically stops when -[AVCapturePhotoOutput capturePhotoWithSettings:delegate] is called with a photo settings objects with the same or a newer uniqueID, but in cases where an error or other condition prevents calling -capturePhotoWithSettings:delegate tracking should be explictly stopped to ensure the captureReadiness value is up to date. When called on the main queue the delegate callback is invoked synchronously before returning to ensure shutter availability is updated immediately.
967 #[unsafe(method(stopTrackingCaptureRequestUsingPhotoSettingsUniqueID:))]
968 #[unsafe(method_family = none)]
969 pub unsafe fn stopTrackingCaptureRequestUsingPhotoSettingsUniqueID(
970 &self,
971 settings_unique_id: i64,
972 );
973 );
974}
975
976extern_protocol!(
977 /// [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotooutputreadinesscoordinatordelegate?language=objc)
978 pub unsafe trait AVCapturePhotoOutputReadinessCoordinatorDelegate:
979 NSObjectProtocol
980 {
981 /// A callback delivered on the main queue whenever the captureReadiness property changes.
982 ///
983 ///
984 /// Parameter `coordinator`: The calling instance of AVCapturePhotoOutputReadinessCoordinator.
985 ///
986 /// Parameter `captureReadiness`: The updated captureReadiness value which can be used to update shutter button availability and appearance.
987 ///
988 ///
989 /// This callback is always delivered on the main queue and is suitable for updating shutter button availability and appearance.
990 #[optional]
991 #[unsafe(method(readinessCoordinator:captureReadinessDidChange:))]
992 #[unsafe(method_family = none)]
993 unsafe fn readinessCoordinator_captureReadinessDidChange(
994 &self,
995 coordinator: &AVCapturePhotoOutputReadinessCoordinator,
996 capture_readiness: AVCapturePhotoOutputCaptureReadiness,
997 );
998 }
999);
1000
1001/// AVCapturePhotoOutputDepthDataDeliverySupport.
1002#[cfg(feature = "AVCaptureOutputBase")]
1003impl AVCapturePhotoOutput {
1004 extern_methods!(
1005 /// A BOOL value specifying whether depth data delivery is supported.
1006 ///
1007 ///
1008 /// Some cameras and configurations support the delivery of depth data (e.g. disparity maps) along with the photo. This property returns YES if the session's current configuration allows photos to be captured with depth data, from which depth-related filters may be applied. When switching cameras or formats this property may change. When this property changes from YES to NO, depthDataDeliveryEnabled also reverts to NO. If you've previously opted in for depth data delivery and then change configurations, you may need to set depthDataDeliveryEnabled = YES again. This property is key-value observable.
1009 #[unsafe(method(isDepthDataDeliverySupported))]
1010 #[unsafe(method_family = none)]
1011 pub unsafe fn isDepthDataDeliverySupported(&self) -> bool;
1012
1013 /// A BOOL specifying whether the photo render pipeline is prepared for depth data delivery.
1014 ///
1015 ///
1016 /// Default is NO. Set to YES if you wish depth data to be delivered with your AVCapturePhotos. This property may only be set to YES if depthDataDeliverySupported is YES. Enabling depth data delivery requires a lengthy reconfiguration of the capture render pipeline, so if you intend to capture depth data, you should set this property to YES before calling -[AVCaptureSession startRunning].
1017 #[unsafe(method(isDepthDataDeliveryEnabled))]
1018 #[unsafe(method_family = none)]
1019 pub unsafe fn isDepthDataDeliveryEnabled(&self) -> bool;
1020
1021 /// Setter for [`isDepthDataDeliveryEnabled`][Self::isDepthDataDeliveryEnabled].
1022 #[unsafe(method(setDepthDataDeliveryEnabled:))]
1023 #[unsafe(method_family = none)]
1024 pub unsafe fn setDepthDataDeliveryEnabled(&self, depth_data_delivery_enabled: bool);
1025
1026 /// A BOOL value specifying whether portrait effects matte delivery is supported.
1027 ///
1028 ///
1029 /// Some cameras and configurations support the delivery of a matting image to augment depth data and aid in high quality portrait effect rendering (see AVPortraitEffectsMatte.h). This property returns YES if the session's current configuration allows photos to be captured with a portrait effects matte. When switching cameras or formats this property may change. When this property changes from YES to NO, portraitEffectsMatteDeliveryEnabled also reverts to NO. If you've previously opted in for portrait effects matte delivery and then change configurations, you may need to set portraitEffectsMatteDeliveryEnabled = YES again. This property is key-value observable.
1030 #[unsafe(method(isPortraitEffectsMatteDeliverySupported))]
1031 #[unsafe(method_family = none)]
1032 pub unsafe fn isPortraitEffectsMatteDeliverySupported(&self) -> bool;
1033
1034 /// A BOOL specifying whether the photo render pipeline is prepared for portrait effects matte delivery.
1035 ///
1036 ///
1037 /// Default is NO. Set to YES if you wish portrait effects mattes to be delivered with your AVCapturePhotos. This property may only be set to YES if portraitEffectsMatteDeliverySupported is YES. Portrait effects matte generation requires depth to be present, so when enabling portrait effects matte delivery, you must also set depthDataDeliveryEnabled to YES. Enabling portrait effects matte delivery requires a lengthy reconfiguration of the capture render pipeline, so if you intend to capture portrait effects mattes, you should set this property to YES before calling -[AVCaptureSession startRunning].
1038 #[unsafe(method(isPortraitEffectsMatteDeliveryEnabled))]
1039 #[unsafe(method_family = none)]
1040 pub unsafe fn isPortraitEffectsMatteDeliveryEnabled(&self) -> bool;
1041
1042 /// Setter for [`isPortraitEffectsMatteDeliveryEnabled`][Self::isPortraitEffectsMatteDeliveryEnabled].
1043 #[unsafe(method(setPortraitEffectsMatteDeliveryEnabled:))]
1044 #[unsafe(method_family = none)]
1045 pub unsafe fn setPortraitEffectsMatteDeliveryEnabled(
1046 &self,
1047 portrait_effects_matte_delivery_enabled: bool,
1048 );
1049
1050 #[cfg(feature = "AVSemanticSegmentationMatte")]
1051 /// An array of supported semantic segmentation matte types that may be captured and delivered along with your AVCapturePhotos.
1052 ///
1053 ///
1054 /// Some cameras and configurations support the delivery of semantic segmentation matting images (e.g. segmentations of the hair, skin, or teeth in the photo). This property returns an array of AVSemanticSegmentationMatteTypes available given the session's current configuration. When switching cameras or formats this property may change. When this property changes, enabledSemanticSegmentationMatteTypes reverts to an empty array. If you've previously opted in for delivery of one or more semantic segmentation mattes and then change configurations, you need to set up your enabledSemanticSegmentationMatteTypes again. This property is key-value observable.
1055 #[unsafe(method(availableSemanticSegmentationMatteTypes))]
1056 #[unsafe(method_family = none)]
1057 pub unsafe fn availableSemanticSegmentationMatteTypes(
1058 &self,
1059 ) -> Retained<NSArray<AVSemanticSegmentationMatteType>>;
1060
1061 #[cfg(feature = "AVSemanticSegmentationMatte")]
1062 /// An array of semantic segmentation matte types which the photo render pipeline is prepared to deliver.
1063 ///
1064 ///
1065 /// Default is empty array. You may set this to the array of matte types you'd like to be delivered with your AVCapturePhotos. The array may only contain values present in availableSemanticSegmentationMatteTypes. Enabling semantic segmentation matte delivery requires a lengthy reconfiguration of the capture render pipeline, so if you intend to capture semantic segmentation mattes, you should set this property to YES before calling -[AVCaptureSession startRunning].
1066 #[unsafe(method(enabledSemanticSegmentationMatteTypes))]
1067 #[unsafe(method_family = none)]
1068 pub unsafe fn enabledSemanticSegmentationMatteTypes(
1069 &self,
1070 ) -> Retained<NSArray<AVSemanticSegmentationMatteType>>;
1071
1072 #[cfg(feature = "AVSemanticSegmentationMatte")]
1073 /// Setter for [`enabledSemanticSegmentationMatteTypes`][Self::enabledSemanticSegmentationMatteTypes].
1074 #[unsafe(method(setEnabledSemanticSegmentationMatteTypes:))]
1075 #[unsafe(method_family = none)]
1076 pub unsafe fn setEnabledSemanticSegmentationMatteTypes(
1077 &self,
1078 enabled_semantic_segmentation_matte_types: &NSArray<AVSemanticSegmentationMatteType>,
1079 );
1080 );
1081}
1082
1083extern_protocol!(
1084 /// A set of delegate callbacks to be implemented by a client who calls AVCapturePhotoOutput's -capturePhotoWithSettings:delegate.
1085 ///
1086 ///
1087 /// AVCapturePhotoOutput invokes the AVCapturePhotoCaptureDelegate callbacks on a common dispatch queue — not necessarily the main queue. While the -captureOutput:willBeginCaptureForResolvedSettings: callback always comes first and the -captureOutput:didFinishCaptureForResolvedSettings: callback always comes last, none of the other callbacks can be assumed to come in any particular order. The AVCaptureResolvedPhotoSettings instance passed to the client with each callback has the same uniqueID as the AVCapturePhotoSettings instance passed in -capturePhotoWithSettings:delegate:. All callbacks are marked optional, but depending on the features you've specified in your AVCapturePhotoSettings, some callbacks become mandatory and are validated in -capturePhotoWithSettings:delegate:. If your delegate does not implement the mandatory callbacks, an NSInvalidArgumentException is thrown.
1088 ///
1089 /// - If you initialize your photo settings with a format dictionary, or use one of the default constructors (that is, if you're not requesting a RAW-only capture), your delegate must respond to either - captureOutput:didFinishProcessingPhoto:error: or the deprecated -captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:. If your delegate responds to both of these callbacks, only the undeprecated variant will be called.
1090 /// - If you initialize your photo settings with a rawPhotoPixelFormatType, your delegate must respond to either -captureOutput:didFinishProcessingPhoto:error: or the deprecated -captureOutput:didFinishProcessingRawPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error:. If your delegate responds to both of these callbacks, only the undeprecated variant will be called.
1091 /// - If you set livePhotoMovieFileURL to non-nil, your delegate must respond to -captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error:.
1092 ///
1093 /// In the event of an error, all expected callbacks are fired with an appropriate error.
1094 ///
1095 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotocapturedelegate?language=objc)
1096 pub unsafe trait AVCapturePhotoCaptureDelegate: NSObjectProtocol {
1097 #[cfg(feature = "AVCaptureOutputBase")]
1098 /// A callback fired as soon as the capture settings have been resolved.
1099 ///
1100 ///
1101 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1102 ///
1103 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features have been selected.
1104 ///
1105 ///
1106 /// This callback is always delivered first for a particular capture request. It is delivered as soon as possible after you call -capturePhotoWithSettings:delegate:, so you can know what to expect in the remainder of your callbacks.
1107 #[optional]
1108 #[unsafe(method(captureOutput:willBeginCaptureForResolvedSettings:))]
1109 #[unsafe(method_family = none)]
1110 unsafe fn captureOutput_willBeginCaptureForResolvedSettings(
1111 &self,
1112 output: &AVCapturePhotoOutput,
1113 resolved_settings: &AVCaptureResolvedPhotoSettings,
1114 );
1115
1116 #[cfg(feature = "AVCaptureOutputBase")]
1117 /// A callback fired just as the photo is being taken.
1118 ///
1119 ///
1120 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1121 ///
1122 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features have been selected.
1123 ///
1124 ///
1125 /// The timing of this callback is analogous to AVCaptureStillImageOutput's capturingStillImage property changing from NO to YES. The callback is delivered right after the shutter sound is heard (note that shutter sounds are suppressed when Live Photos are being captured).
1126 #[optional]
1127 #[unsafe(method(captureOutput:willCapturePhotoForResolvedSettings:))]
1128 #[unsafe(method_family = none)]
1129 unsafe fn captureOutput_willCapturePhotoForResolvedSettings(
1130 &self,
1131 output: &AVCapturePhotoOutput,
1132 resolved_settings: &AVCaptureResolvedPhotoSettings,
1133 );
1134
1135 #[cfg(feature = "AVCaptureOutputBase")]
1136 /// A callback fired just after the photo is taken.
1137 ///
1138 ///
1139 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1140 ///
1141 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features have been selected.
1142 ///
1143 ///
1144 /// The timing of this callback is analogous to AVCaptureStillImageOutput's capturingStillImage property changing from YES to NO.
1145 #[optional]
1146 #[unsafe(method(captureOutput:didCapturePhotoForResolvedSettings:))]
1147 #[unsafe(method_family = none)]
1148 unsafe fn captureOutput_didCapturePhotoForResolvedSettings(
1149 &self,
1150 output: &AVCapturePhotoOutput,
1151 resolved_settings: &AVCaptureResolvedPhotoSettings,
1152 );
1153
1154 #[cfg(feature = "AVCaptureOutputBase")]
1155 /// A callback fired when photos are ready to be delivered to you (RAW or processed).
1156 ///
1157 ///
1158 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1159 ///
1160 /// Parameter `photo`: An instance of AVCapturePhoto.
1161 ///
1162 /// Parameter `error`: An error indicating what went wrong. If the photo was processed successfully, nil is returned.
1163 ///
1164 ///
1165 /// This callback fires resolvedSettings.expectedPhotoCount number of times for a given capture request. Note that the photo parameter is always non nil, even if an error is returned. The delivered AVCapturePhoto's rawPhoto property can be queried to know if it's a RAW image or processed image.
1166 #[optional]
1167 #[unsafe(method(captureOutput:didFinishProcessingPhoto:error:))]
1168 #[unsafe(method_family = none)]
1169 unsafe fn captureOutput_didFinishProcessingPhoto_error(
1170 &self,
1171 output: &AVCapturePhotoOutput,
1172 photo: &AVCapturePhoto,
1173 error: Option<&NSError>,
1174 );
1175
1176 #[cfg(feature = "AVCaptureOutputBase")]
1177 /// A callback fired just after the photo proxy has been taken.
1178 ///
1179 ///
1180 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1181 ///
1182 /// Parameter `deferredPhotoProxy`: The AVCaptureDeferredPhotoProxy instance which contains a proxy CVPixelBuffer as a placeholder for the final image. The fileDataRepresentation from this object may be used with PHAssetCreation to eventually produce the final, processed photo into the user's Photo Library. The in-memory proxy fileDataRepresentation should be added to the photo library as quickly as possible after receipt to ensure that the photo library can begin background processing and also so that the intermediates are not removed by a periodic clean-up job looking for abandoned intermediates produced by using the deferred photo processing APIs.
1183 ///
1184 ///
1185 /// Parameter `error`: An error indicating what went wrong if the photo proxy or any of the underlying intermediate files couldn't be created.
1186 ///
1187 ///
1188 /// Delegates are required to implement this method if they opt in for deferred photo processing, otherwise an NSInvalidArgumentException will be thrown from the -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] method.
1189 #[optional]
1190 #[unsafe(method(captureOutput:didFinishCapturingDeferredPhotoProxy:error:))]
1191 #[unsafe(method_family = none)]
1192 unsafe fn captureOutput_didFinishCapturingDeferredPhotoProxy_error(
1193 &self,
1194 output: &AVCapturePhotoOutput,
1195 deferred_photo_proxy: Option<&AVCaptureDeferredPhotoProxy>,
1196 error: Option<&NSError>,
1197 );
1198
1199 #[cfg(feature = "AVCaptureOutputBase")]
1200 /// A callback fired when the Live Photo movie has captured all its media data, though all media has not yet been written to file.
1201 ///
1202 ///
1203 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1204 ///
1205 /// Parameter `outputFileURL`: The URL to which the movie file will be written. This URL is equal to your AVCapturePhotoSettings.livePhotoMovieURL.
1206 ///
1207 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features have been selected.
1208 ///
1209 ///
1210 /// When this callback fires, no new media is being written to the file. If you are displaying a "Live" badge, this is an appropriate time to dismiss it. The movie file itself is not done being written until the -captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error: callback fires.
1211 #[optional]
1212 #[unsafe(method(captureOutput:didFinishRecordingLivePhotoMovieForEventualFileAtURL:resolvedSettings:))]
1213 #[unsafe(method_family = none)]
1214 unsafe fn captureOutput_didFinishRecordingLivePhotoMovieForEventualFileAtURL_resolvedSettings(
1215 &self,
1216 output: &AVCapturePhotoOutput,
1217 output_file_url: &NSURL,
1218 resolved_settings: &AVCaptureResolvedPhotoSettings,
1219 );
1220
1221 #[cfg(all(feature = "AVCaptureOutputBase", feature = "objc2-core-media"))]
1222 /// A callback fired when the Live Photo movie is finished being written to disk.
1223 ///
1224 ///
1225 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1226 ///
1227 /// Parameter `outputFileURL`: The URL where the movie file resides. This URL is equal to your AVCapturePhotoSettings.livePhotoMovieURL.
1228 ///
1229 /// Parameter `duration`: A CMTime indicating the duration of the movie file.
1230 ///
1231 /// Parameter `photoDisplayTime`: A CMTime indicating the time in the movie at which the still photo should be displayed.
1232 ///
1233 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features have been selected.
1234 ///
1235 /// Parameter `error`: An error indicating what went wrong if the outputFileURL is damaged.
1236 ///
1237 ///
1238 /// When this callback fires, the movie on disk is fully finished and ready for consumption.
1239 #[optional]
1240 #[unsafe(method(captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error:))]
1241 #[unsafe(method_family = none)]
1242 unsafe fn captureOutput_didFinishProcessingLivePhotoToMovieFileAtURL_duration_photoDisplayTime_resolvedSettings_error(
1243 &self,
1244 output: &AVCapturePhotoOutput,
1245 output_file_url: &NSURL,
1246 duration: CMTime,
1247 photo_display_time: CMTime,
1248 resolved_settings: &AVCaptureResolvedPhotoSettings,
1249 error: Option<&NSError>,
1250 );
1251
1252 #[cfg(feature = "AVCaptureOutputBase")]
1253 /// A callback fired when the photo capture is completed and no more callbacks will be fired.
1254 ///
1255 ///
1256 /// Parameter `output`: The calling instance of AVCapturePhotoOutput.
1257 ///
1258 /// Parameter `resolvedSettings`: An instance of AVCaptureResolvedPhotoSettings indicating which capture features were selected.
1259 ///
1260 /// Parameter `error`: An error indicating whether the capture was unsuccessful. Nil if there were no problems.
1261 ///
1262 ///
1263 /// This callback always fires last and when it does, you may clean up any state relating to this photo capture.
1264 #[optional]
1265 #[unsafe(method(captureOutput:didFinishCaptureForResolvedSettings:error:))]
1266 #[unsafe(method_family = none)]
1267 unsafe fn captureOutput_didFinishCaptureForResolvedSettings_error(
1268 &self,
1269 output: &AVCapturePhotoOutput,
1270 resolved_settings: &AVCaptureResolvedPhotoSettings,
1271 error: Option<&NSError>,
1272 );
1273 }
1274);
1275
1276extern_class!(
1277 /// A mutable settings object encapsulating all the desired properties of a photo capture.
1278 ///
1279 ///
1280 /// To take a picture, a client instantiates and configures an AVCapturePhotoSettings object, then calls AVCapturePhotoOutput's -capturePhotoWithSettings:delegate:, passing the settings and a delegate to be informed when events relating to the photo capture occur. Since AVCapturePhotoSettings has no reference to the AVCapturePhotoOutput instance with which it will be used, minimal validation occurs while you configure an AVCapturePhotoSettings instance. The bulk of the validation is executed when you call AVCapturePhotoOutput's -capturePhotoWithSettings:delegate:.
1281 ///
1282 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotosettings?language=objc)
1283 #[unsafe(super(NSObject))]
1284 #[derive(Debug, PartialEq, Eq, Hash)]
1285 pub struct AVCapturePhotoSettings;
1286);
1287
1288extern_conformance!(
1289 unsafe impl NSCopying for AVCapturePhotoSettings {}
1290);
1291
1292unsafe impl CopyingHelper for AVCapturePhotoSettings {
1293 type Result = Self;
1294}
1295
1296extern_conformance!(
1297 unsafe impl NSObjectProtocol for AVCapturePhotoSettings {}
1298);
1299
1300impl AVCapturePhotoSettings {
1301 extern_methods!(
1302 /// Creates a default instance of AVCapturePhotoSettings.
1303 ///
1304 ///
1305 /// Returns: An instance of AVCapturePhotoSettings.
1306 ///
1307 ///
1308 /// A default AVCapturePhotoSettings object has a format of AVVideoCodecTypeJPEG, a fileType of AVFileTypeJPEG, and photoQualityPrioritization set to AVCapturePhotoQualityPrioritizationBalanced.
1309 #[unsafe(method(photoSettings))]
1310 #[unsafe(method_family = none)]
1311 pub unsafe fn photoSettings() -> Retained<Self>;
1312
1313 /// Creates an instance of AVCapturePhotoSettings with a user-specified output format.
1314 ///
1315 ///
1316 /// Parameter `format`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property.
1317 ///
1318 /// Returns: An instance of AVCapturePhotoSettings.
1319 ///
1320 ///
1321 /// If you wish an uncompressed format, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the format specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed output. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. Passing a nil format dictionary is analogous to calling +photoSettings.
1322 #[unsafe(method(photoSettingsWithFormat:))]
1323 #[unsafe(method_family = none)]
1324 pub unsafe fn photoSettingsWithFormat(
1325 format: Option<&NSDictionary<NSString, AnyObject>>,
1326 ) -> Retained<Self>;
1327
1328 /// Creates an instance of AVCapturePhotoSettings specifying RAW only output.
1329 ///
1330 ///
1331 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
1332 ///
1333 /// Returns: An instance of AVCapturePhotoSettings.
1334 ///
1335 ///
1336 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
1337 #[unsafe(method(photoSettingsWithRawPixelFormatType:))]
1338 #[unsafe(method_family = none)]
1339 pub unsafe fn photoSettingsWithRawPixelFormatType(
1340 raw_pixel_format_type: OSType,
1341 ) -> Retained<Self>;
1342
1343 /// Creates an instance of AVCapturePhotoSettings specifying RAW + a processed format (such as JPEG).
1344 ///
1345 ///
1346 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
1347 ///
1348 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property.
1349 ///
1350 /// Returns: An instance of AVCapturePhotoSettings.
1351 ///
1352 ///
1353 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. If you wish an uncompressed processedFormat, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the processedFormat specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed processedFormat. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. Passing a nil processedFormat dictionary is analogous to calling +photoSettingsWithRawPixelFormatType:. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
1354 #[unsafe(method(photoSettingsWithRawPixelFormatType:processedFormat:))]
1355 #[unsafe(method_family = none)]
1356 pub unsafe fn photoSettingsWithRawPixelFormatType_processedFormat(
1357 raw_pixel_format_type: OSType,
1358 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
1359 ) -> Retained<Self>;
1360
1361 #[cfg(feature = "AVMediaFormat")]
1362 /// Creates an instance of AVCapturePhotoSettings specifying RAW + a processed format (such as JPEG) and a file container to which it will be written.
1363 ///
1364 ///
1365 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h). Pass 0 if you do not desire a RAW photo callback.
1366 ///
1367 /// Parameter `rawFileType`: The file container for which the RAW image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
1368 ///
1369 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property. Pass nil if you do not desire a processed photo callback.
1370 ///
1371 /// Parameter `processedFileType`: The file container for which the processed image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
1372 ///
1373 /// Returns: An instance of AVCapturePhotoSettings.
1374 ///
1375 ///
1376 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. Set rawPixelFormatType to 0 if you do not desire a RAW photo callback. If you are specifying a rawFileType, it must be present in AVCapturePhotoOutput's -availableRawPhotoFileTypes array. If you wish an uncompressed processedFormat, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the processedFormat specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed processedFormat. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. If you are specifying a processedFileType, it must be present in AVCapturePhotoOutput's -availablePhotoFileTypes array. Pass a nil processedFormat dictionary if you only desire a RAW photo capture. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
1377 #[unsafe(method(photoSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:))]
1378 #[unsafe(method_family = none)]
1379 pub unsafe fn photoSettingsWithRawPixelFormatType_rawFileType_processedFormat_processedFileType(
1380 raw_pixel_format_type: OSType,
1381 raw_file_type: Option<&AVFileType>,
1382 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
1383 processed_file_type: Option<&AVFileType>,
1384 ) -> Retained<Self>;
1385
1386 /// Creates an instance of AVCapturePhotoSettings with a new uniqueID from an existing instance of AVCapturePhotoSettings.
1387 ///
1388 ///
1389 /// Parameter `photoSettings`: An existing AVCapturePhotoSettings instance.
1390 ///
1391 /// Returns: An new instance of AVCapturePhotoSettings with new uniqueID.
1392 ///
1393 ///
1394 /// Use this factory method to create a clone of an existing photo settings instance, but with a new uniqueID that can safely be passed to AVCapturePhotoOutput -capturePhotoWithSettings:delegate:.
1395 #[unsafe(method(photoSettingsFromPhotoSettings:))]
1396 #[unsafe(method_family = none)]
1397 pub unsafe fn photoSettingsFromPhotoSettings(
1398 photo_settings: &AVCapturePhotoSettings,
1399 ) -> Retained<Self>;
1400
1401 /// A 64-bit number that uniquely identifies this instance.
1402 ///
1403 ///
1404 /// When you create an instance of AVCapturePhotoSettings, a uniqueID is generated automatically. This uniqueID is guaranteed to be unique for the life time of your process.
1405 #[unsafe(method(uniqueID))]
1406 #[unsafe(method_family = none)]
1407 pub unsafe fn uniqueID(&self) -> i64;
1408
1409 /// A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property.
1410 ///
1411 ///
1412 /// The format dictionary you passed to one of the creation methods. May be nil if you've specified RAW-only capture.
1413 #[unsafe(method(format))]
1414 #[unsafe(method_family = none)]
1415 pub unsafe fn format(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1416
1417 /// A dictionary of AVVideoSettings keys specifying the RAW file format to be used for the RAW photo.
1418 ///
1419 /// One can specify desired format properties of the RAW file that will be created. Currently only the key AVVideoAppleProRAWBitDepthKey is allowed and the value to which it can be set should be from 8-16. The AVVideoCodecKey must be present in the receiver's -availableRawPhotoCodecTypes array as well as in -supportedRawPhotoCodecTypesForRawPhotoPixelFormatType:fileType:. AVVideoQualityKey (NSNumber in range [0.0,1.0]) can be optionally set and a value between [0.0,1.0] will use lossy compression with lower values being more lossy resulting in smaller file sizes but lower image quality, while a value of 1.0 will use lossless compression resulting in the largest file size but also the best quality.
1420 #[unsafe(method(rawFileFormat))]
1421 #[unsafe(method_family = none)]
1422 pub unsafe fn rawFileFormat(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1423
1424 /// Setter for [`rawFileFormat`][Self::rawFileFormat].
1425 #[unsafe(method(setRawFileFormat:))]
1426 #[unsafe(method_family = none)]
1427 pub unsafe fn setRawFileFormat(
1428 &self,
1429 raw_file_format: Option<&NSDictionary<NSString, AnyObject>>,
1430 );
1431
1432 #[cfg(feature = "AVMediaFormat")]
1433 /// The file container for which the processed photo is formatted to be stored.
1434 ///
1435 ///
1436 /// The formatting of data within a photo buffer is often dependent on the file format intended for storage. For instance, a JPEG encoded photo buffer intended for storage in a JPEG (JPEG File Interchange Format) file differs from JPEG to be stored in HEIF. The HEIF-containerized JPEG buffer is tiled for readback efficiency and partitioned into the box structure dictated by the HEIF file format. Some codecs are only supported by AVCapturePhotoOutput if containerized. For instance, the AVVideoCodecTypeHEVC is only supported with AVFileTypeHEIF and AVFileTypeHEIC formatting. To discover which photo pixel format types and video codecs are supported for a given file type, you may query AVCapturePhotoOutput's -supportedPhotoPixelFormatTypesForFileType:, or -supportedPhotoCodecTypesForFileType: respectively.
1437 #[unsafe(method(processedFileType))]
1438 #[unsafe(method_family = none)]
1439 pub unsafe fn processedFileType(&self) -> Option<Retained<AVFileType>>;
1440
1441 /// A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
1442 ///
1443 ///
1444 /// The rawPixelFormatType you specified in one of the creation methods. Returns 0 if you did not specify RAW capture. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
1445 #[unsafe(method(rawPhotoPixelFormatType))]
1446 #[unsafe(method_family = none)]
1447 pub unsafe fn rawPhotoPixelFormatType(&self) -> OSType;
1448
1449 #[cfg(feature = "AVMediaFormat")]
1450 /// The file container for which the RAW photo is formatted to be stored.
1451 ///
1452 ///
1453 /// The formatting of data within a RAW photo buffer may be dependent on the file format intended for storage. To discover which RAW photo pixel format types are supported for a given file type, you may query AVCapturePhotoOutput's -supportedRawPhotoPixelFormatTypesForFileType:.
1454 #[unsafe(method(rawFileType))]
1455 #[unsafe(method_family = none)]
1456 pub unsafe fn rawFileType(&self) -> Option<Retained<AVFileType>>;
1457
1458 #[cfg(feature = "AVCaptureDevice")]
1459 /// Specifies whether the flash should be on, off, or chosen automatically by AVCapturePhotoOutput.
1460 ///
1461 ///
1462 /// flashMode takes the place of the deprecated AVCaptureDevice -flashMode API. Setting AVCaptureDevice.flashMode has no effect on AVCapturePhotoOutput, which only pays attention to the flashMode specified in your AVCapturePhotoSettings. The default value is AVCaptureFlashModeOff. Flash modes are defined in AVCaptureDevice.h. If you specify a flashMode of AVCaptureFlashModeOn, it wins over autoStillImageStabilizationEnabled=YES. When the device becomes very hot, the flash becomes temporarily unavailable until the device cools down (see AVCaptureDevice's -flashAvailable). While the flash is unavailable, AVCapturePhotoOutput's -supportedFlashModes property still reports AVCaptureFlashModeOn and AVCaptureFlashModeAuto as being available, thus allowing you to specify a flashMode of AVCaptureModeOn. You should always check the AVCaptureResolvedPhotoSettings provided to you in the AVCapturePhotoCaptureDelegate callbacks, as the resolved flashEnabled property will tell you definitively if the flash is being used.
1463 #[unsafe(method(flashMode))]
1464 #[unsafe(method_family = none)]
1465 pub unsafe fn flashMode(&self) -> AVCaptureFlashMode;
1466
1467 #[cfg(feature = "AVCaptureDevice")]
1468 /// Setter for [`flashMode`][Self::flashMode].
1469 #[unsafe(method(setFlashMode:))]
1470 #[unsafe(method_family = none)]
1471 pub unsafe fn setFlashMode(&self, flash_mode: AVCaptureFlashMode);
1472
1473 /// Specifies whether red-eye reduction should be applied automatically on flash captures.
1474 ///
1475 ///
1476 /// Default is YES on platforms that support automatic red-eye reduction unless you are capturing a bracket using AVCapturePhotoBracketSettings or a RAW photo without a processed photo. For RAW photos with a processed photo the red-eye reduction will be applied to the processed photo only (RAW photos by definition are not processed). When set to YES, red-eye reduction is applied as needed for flash captures if the photo output's autoRedEyeReductionSupported property returns YES.
1477 #[unsafe(method(isAutoRedEyeReductionEnabled))]
1478 #[unsafe(method_family = none)]
1479 pub unsafe fn isAutoRedEyeReductionEnabled(&self) -> bool;
1480
1481 /// Setter for [`isAutoRedEyeReductionEnabled`][Self::isAutoRedEyeReductionEnabled].
1482 #[unsafe(method(setAutoRedEyeReductionEnabled:))]
1483 #[unsafe(method_family = none)]
1484 pub unsafe fn setAutoRedEyeReductionEnabled(&self, auto_red_eye_reduction_enabled: bool);
1485
1486 /// Indicates how photo quality should be prioritized against speed of photo delivery.
1487 ///
1488 ///
1489 /// Default value is AVCapturePhotoQualityPrioritizationBalanced. The AVCapturePhotoOutput is capable of applying a variety of techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc), depending on the source device's activeFormat. Some of these techniques can take significant processing time before the photo is returned to your delegate callback. The photoQualityPrioritization property allows you to specify your preferred quality vs speed of delivery. By default, speed and quality are considered to be of equal importance. When you specify AVCapturePhotoQualityPrioritizationSpeed, you indicate that speed should be prioritized at the expense of quality. Likewise, when you choose AVCapturePhotoQualityPrioritizationQuality, you signal your willingness to prioritize the very best quality at the expense of speed, and your readiness to wait (perhaps significantly) longer for the photo to be returned to your delegate.
1490 #[unsafe(method(photoQualityPrioritization))]
1491 #[unsafe(method_family = none)]
1492 pub unsafe fn photoQualityPrioritization(&self) -> AVCapturePhotoQualityPrioritization;
1493
1494 /// Setter for [`photoQualityPrioritization`][Self::photoQualityPrioritization].
1495 #[unsafe(method(setPhotoQualityPrioritization:))]
1496 #[unsafe(method_family = none)]
1497 pub unsafe fn setPhotoQualityPrioritization(
1498 &self,
1499 photo_quality_prioritization: AVCapturePhotoQualityPrioritization,
1500 );
1501
1502 /// Specifies whether still image stabilization should be used automatically.
1503 ///
1504 ///
1505 /// Default is YES unless you are capturing a Bayer RAW photo (Bayer RAW photos may not be processed by definition) or a bracket using AVCapturePhotoBracketSettings. When set to YES, still image stabilization is applied automatically in low light to counteract hand shake. If the device has optical image stabilization, autoStillImageStabilizationEnabled makes use of lens stabilization as well.
1506 ///
1507 /// As of iOS 13 hardware, the AVCapturePhotoOutput is capable of applying a variety of multi-image fusion techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc), all of which have been previously lumped under the stillImageStabilization moniker. This property should no longer be used as it no longer provides meaningful information about the techniques used to improve quality in a photo capture. Instead, you should use -photoQualityPrioritization to indicate your preferred quality vs speed.
1508 #[deprecated]
1509 #[unsafe(method(isAutoStillImageStabilizationEnabled))]
1510 #[unsafe(method_family = none)]
1511 pub unsafe fn isAutoStillImageStabilizationEnabled(&self) -> bool;
1512
1513 /// Setter for [`isAutoStillImageStabilizationEnabled`][Self::isAutoStillImageStabilizationEnabled].
1514 #[deprecated]
1515 #[unsafe(method(setAutoStillImageStabilizationEnabled:))]
1516 #[unsafe(method_family = none)]
1517 pub unsafe fn setAutoStillImageStabilizationEnabled(
1518 &self,
1519 auto_still_image_stabilization_enabled: bool,
1520 );
1521
1522 /// Specifies whether virtual device image fusion should be used automatically.
1523 ///
1524 ///
1525 /// Default is YES unless you are capturing a RAW photo (RAW photos may not be processed by definition) or a bracket using AVCapturePhotoBracketSettings. When set to YES, and -[AVCapturePhotoOutput isVirtualDeviceFusionSupported] is also YES, constituent camera images of a virtual device may be fused to improve still image quality, depending on the current zoom factor, light levels, and focus position. You may determine whether virtual device fusion is enabled for a particular capture request by inspecting the virtualDeviceFusionEnabled property of the AVCaptureResolvedPhotoSettings. Note that when using the deprecated AVCaptureStillImageOutput interface with a virtual device, autoVirtualDeviceFusionEnabled fusion is always enabled if supported, and may not be turned off.
1526 #[unsafe(method(isAutoVirtualDeviceFusionEnabled))]
1527 #[unsafe(method_family = none)]
1528 pub unsafe fn isAutoVirtualDeviceFusionEnabled(&self) -> bool;
1529
1530 /// Setter for [`isAutoVirtualDeviceFusionEnabled`][Self::isAutoVirtualDeviceFusionEnabled].
1531 #[unsafe(method(setAutoVirtualDeviceFusionEnabled:))]
1532 #[unsafe(method_family = none)]
1533 pub unsafe fn setAutoVirtualDeviceFusionEnabled(
1534 &self,
1535 auto_virtual_device_fusion_enabled: bool,
1536 );
1537
1538 /// Specifies whether DualCamera image fusion should be used automatically.
1539 ///
1540 ///
1541 /// Default is YES unless you are capturing a RAW photo (RAW photos may not be processed by definition) or a bracket using AVCapturePhotoBracketSettings. When set to YES, and -[AVCapturePhotoOutput isDualCameraFusionSupported] is also YES, wide-angle and telephoto images may be fused to improve still image quality, depending on the current zoom factor, light levels, and focus position. You may determine whether DualCamera fusion is enabled for a particular capture request by inspecting the dualCameraFusionEnabled property of the AVCaptureResolvedPhotoSettings. Note that when using the deprecated AVCaptureStillImageOutput interface with the DualCamera, auto DualCamera fusion is always enabled and may not be turned off. As of iOS 13, this property is deprecated in favor of autoVirtualDeviceFusionEnabled.
1542 #[deprecated]
1543 #[unsafe(method(isAutoDualCameraFusionEnabled))]
1544 #[unsafe(method_family = none)]
1545 pub unsafe fn isAutoDualCameraFusionEnabled(&self) -> bool;
1546
1547 /// Setter for [`isAutoDualCameraFusionEnabled`][Self::isAutoDualCameraFusionEnabled].
1548 #[deprecated]
1549 #[unsafe(method(setAutoDualCameraFusionEnabled:))]
1550 #[unsafe(method_family = none)]
1551 pub unsafe fn setAutoDualCameraFusionEnabled(&self, auto_dual_camera_fusion_enabled: bool);
1552
1553 #[cfg(feature = "AVCaptureDevice")]
1554 /// Specifies the constituent devices for which the virtual device should deliver photos.
1555 ///
1556 ///
1557 /// Default is empty array. To opt in for constituent device photo delivery, you may set this property to any subset of 2 or more of the devices in virtualDevice.constituentDevices. Your captureOutput:didFinishProcessingPhoto:error: callback will be called n times -- one for each of the devices you include in the array. You may only set this property to a non-nil array if you've set your AVCapturePhotoOutput's virtualDeviceConstituentPhotoDeliveryEnabled property to YES, and your delegate responds to the captureOutput:didFinishProcessingPhoto:error: selector.
1558 #[unsafe(method(virtualDeviceConstituentPhotoDeliveryEnabledDevices))]
1559 #[unsafe(method_family = none)]
1560 pub unsafe fn virtualDeviceConstituentPhotoDeliveryEnabledDevices(
1561 &self,
1562 ) -> Retained<NSArray<AVCaptureDevice>>;
1563
1564 #[cfg(feature = "AVCaptureDevice")]
1565 /// Setter for [`virtualDeviceConstituentPhotoDeliveryEnabledDevices`][Self::virtualDeviceConstituentPhotoDeliveryEnabledDevices].
1566 #[unsafe(method(setVirtualDeviceConstituentPhotoDeliveryEnabledDevices:))]
1567 #[unsafe(method_family = none)]
1568 pub unsafe fn setVirtualDeviceConstituentPhotoDeliveryEnabledDevices(
1569 &self,
1570 virtual_device_constituent_photo_delivery_enabled_devices: &NSArray<AVCaptureDevice>,
1571 );
1572
1573 /// Specifies whether the DualCamera should return both the telephoto and wide image.
1574 ///
1575 ///
1576 /// Default is NO. When set to YES, your captureOutput:didFinishProcessingPhoto:error: callback will receive twice the number of callbacks, as both the telephoto image(s) and wide-angle image(s) are delivered. You may only set this property to YES if you've set your AVCapturePhotoOutput's dualCameraDualPhotoDeliveryEnabled property to YES, and your delegate responds to the captureOutput:didFinishProcessingPhoto:error: selector. As of iOS 13, this property is deprecated in favor of virtualDeviceConstituentPhotoDeliveryEnabledDevices.
1577 #[deprecated]
1578 #[unsafe(method(isDualCameraDualPhotoDeliveryEnabled))]
1579 #[unsafe(method_family = none)]
1580 pub unsafe fn isDualCameraDualPhotoDeliveryEnabled(&self) -> bool;
1581
1582 /// Setter for [`isDualCameraDualPhotoDeliveryEnabled`][Self::isDualCameraDualPhotoDeliveryEnabled].
1583 #[deprecated]
1584 #[unsafe(method(setDualCameraDualPhotoDeliveryEnabled:))]
1585 #[unsafe(method_family = none)]
1586 pub unsafe fn setDualCameraDualPhotoDeliveryEnabled(
1587 &self,
1588 dual_camera_dual_photo_delivery_enabled: bool,
1589 );
1590
1591 /// Specifies whether photos should be captured at the highest resolution supported by the source AVCaptureDevice's activeFormat.
1592 ///
1593 ///
1594 /// Default is NO. By default, AVCapturePhotoOutput emits images with the same dimensions as its source AVCaptureDevice's activeFormat.formatDescription. However, if you set this property to YES, the AVCapturePhotoOutput emits images at its source AVCaptureDevice's activeFormat.highResolutionStillImageDimensions. Note that if you enable video stabilization (see AVCaptureConnection's preferredVideoStabilizationMode) for any output, the high resolution photos emitted by AVCapturePhotoOutput may be smaller by 10 or more percent. You may inspect your AVCaptureResolvedPhotoSettings in the delegate callbacks to discover the exact dimensions of the capture photo(s).
1595 ///
1596 /// Starting in iOS 14.5 if you disable geometric distortion correction, the high resolution photo emitted by AVCapturePhotoOutput may be is smaller depending on the format.
1597 #[deprecated = "Use maxPhotoDimensions instead."]
1598 #[unsafe(method(isHighResolutionPhotoEnabled))]
1599 #[unsafe(method_family = none)]
1600 pub unsafe fn isHighResolutionPhotoEnabled(&self) -> bool;
1601
1602 /// Setter for [`isHighResolutionPhotoEnabled`][Self::isHighResolutionPhotoEnabled].
1603 #[deprecated = "Use maxPhotoDimensions instead."]
1604 #[unsafe(method(setHighResolutionPhotoEnabled:))]
1605 #[unsafe(method_family = none)]
1606 pub unsafe fn setHighResolutionPhotoEnabled(&self, high_resolution_photo_enabled: bool);
1607
1608 #[cfg(feature = "objc2-core-media")]
1609 /// Indicates the maximum resolution photo that will be captured.
1610 ///
1611 ///
1612 /// By setting this property you are requesting an image that may be up to as large as the specified dimensions, but no larger. The dimensions set must match one of the dimensions returned by AVCaptureDeviceFormat.supportedMaxPhotoDimensions for the currently configured format and be equal to or smaller than the value of AVCapturePhotoOutput.maxPhotoDimensions. This property defaults to the smallest dimensions returned by AVCaptureDeviceFormat.supportedMaxPhotoDimensions.
1613 #[unsafe(method(maxPhotoDimensions))]
1614 #[unsafe(method_family = none)]
1615 pub unsafe fn maxPhotoDimensions(&self) -> CMVideoDimensions;
1616
1617 #[cfg(feature = "objc2-core-media")]
1618 /// Setter for [`maxPhotoDimensions`][Self::maxPhotoDimensions].
1619 #[unsafe(method(setMaxPhotoDimensions:))]
1620 #[unsafe(method_family = none)]
1621 pub unsafe fn setMaxPhotoDimensions(&self, max_photo_dimensions: CMVideoDimensions);
1622
1623 /// Specifies whether AVDepthData should be captured along with the photo.
1624 ///
1625 ///
1626 /// Default is NO. Set to YES if you wish to receive depth data with your photo. Throws an exception if -[AVCapturePhotoOutput depthDataDeliveryEnabled] is not set to YES or your delegate does not respond to the captureOutput:didFinishProcessingPhoto:error: selector. Note that setting this property to YES may add significant processing time to the delivery of your didFinishProcessingPhoto: callback.
1627 ///
1628 /// For best rendering results in Apple's Photos.app, portrait photos should be captured with both embedded depth data and a portrait effects matte (see portraitEffectsMatteDeliveryEnabled). When supported, it is recommended to opt in for both of these auxiliary images in your photo captures involving depth.
1629 #[unsafe(method(isDepthDataDeliveryEnabled))]
1630 #[unsafe(method_family = none)]
1631 pub unsafe fn isDepthDataDeliveryEnabled(&self) -> bool;
1632
1633 /// Setter for [`isDepthDataDeliveryEnabled`][Self::isDepthDataDeliveryEnabled].
1634 #[unsafe(method(setDepthDataDeliveryEnabled:))]
1635 #[unsafe(method_family = none)]
1636 pub unsafe fn setDepthDataDeliveryEnabled(&self, depth_data_delivery_enabled: bool);
1637
1638 /// Specifies whether depth data included with this photo should be written to the photo's file structure.
1639 ///
1640 ///
1641 /// Default is YES. When depthDataDeliveryEnabled is set to YES, this property specifies whether the included depth data should be written to the resulting photo's internal file structure. Depth data is currently only supported in HEIF and JPEG. This property is ignored if depthDataDeliveryEnabled is set to NO.
1642 #[unsafe(method(embedsDepthDataInPhoto))]
1643 #[unsafe(method_family = none)]
1644 pub unsafe fn embedsDepthDataInPhoto(&self) -> bool;
1645
1646 /// Setter for [`embedsDepthDataInPhoto`][Self::embedsDepthDataInPhoto].
1647 #[unsafe(method(setEmbedsDepthDataInPhoto:))]
1648 #[unsafe(method_family = none)]
1649 pub unsafe fn setEmbedsDepthDataInPhoto(&self, embeds_depth_data_in_photo: bool);
1650
1651 /// Specifies whether the depth data delivered with the photo should be filtered to fill invalid values.
1652 ///
1653 ///
1654 /// Default is YES. This property is ignored unless depthDataDeliveryEnabled is set to YES. Depth data maps may contain invalid pixel values due to a variety of factors including occlusions and low light. When depthDataFiltered is set to YES, the photo output interpolates missing data, filling in all holes.
1655 #[unsafe(method(isDepthDataFiltered))]
1656 #[unsafe(method_family = none)]
1657 pub unsafe fn isDepthDataFiltered(&self) -> bool;
1658
1659 /// Setter for [`isDepthDataFiltered`][Self::isDepthDataFiltered].
1660 #[unsafe(method(setDepthDataFiltered:))]
1661 #[unsafe(method_family = none)]
1662 pub unsafe fn setDepthDataFiltered(&self, depth_data_filtered: bool);
1663
1664 /// Specifies whether AVCameraCalibrationData should be captured and delivered along with this photo.
1665 ///
1666 ///
1667 /// Default is NO. Set to YES if you wish to receive camera calibration data with your photo. Camera calibration data is delivered as a property of an AVCapturePhoto, so if you are using the CMSampleBuffer delegate callbacks rather than -captureOutput:didFinishProcessingPhoto:error:, an exception is thrown. Also, you may only set this property to YES if your AVCapturePhotoOutput's cameraCalibrationDataDeliverySupported property is YES and 2 or more devices are selected for virtual device constituent photo delivery. When requesting virtual device constituent photo delivery plus camera calibration data, the photos for each constituent device each contain camera calibration data. Note that AVCameraCalibrationData can be delivered as a property of an AVCapturePhoto or an AVDepthData, thus your delegate must respond to the captureOutput:didFinishProcessingPhoto:error: selector.
1668 #[unsafe(method(isCameraCalibrationDataDeliveryEnabled))]
1669 #[unsafe(method_family = none)]
1670 pub unsafe fn isCameraCalibrationDataDeliveryEnabled(&self) -> bool;
1671
1672 /// Setter for [`isCameraCalibrationDataDeliveryEnabled`][Self::isCameraCalibrationDataDeliveryEnabled].
1673 #[unsafe(method(setCameraCalibrationDataDeliveryEnabled:))]
1674 #[unsafe(method_family = none)]
1675 pub unsafe fn setCameraCalibrationDataDeliveryEnabled(
1676 &self,
1677 camera_calibration_data_delivery_enabled: bool,
1678 );
1679
1680 /// Specifies whether an AVPortraitEffectsMatte should be captured along with the photo.
1681 ///
1682 ///
1683 /// Default is NO. Set to YES if you wish to receive a portrait effects matte with your photo. Throws an exception if -[AVCapturePhotoOutput portraitEffectsMatteDeliveryEnabled] is not set to YES or your delegate does not respond to the captureOutput:didFinishProcessingPhoto:error: selector. Portrait effects matte generation requires depth to be present, so if you wish to enable portrait effects matte delivery, you must set depthDataDeliveryEnabled to YES. Setting this property to YES does not guarantee that a portrait effects matte will be present in the resulting AVCapturePhoto. As the property name implies, the matte is primarily used to improve the rendering quality of portrait effects on the image. If the photo's content lacks a clear foreground subject, no portrait effects matte is generated, and the -[AVCapturePhoto portraitEffectsMatte] property returns nil. Note that setting this property to YES may add significant processing time to the delivery of your didFinishProcessingPhoto: callback.
1684 ///
1685 /// For best rendering results in Apple's Photos.app, portrait photos should be captured with both embedded depth data (see depthDataDeliveryEnabled) and a portrait effects matte. When supported, it is recommended to opt in for both of these auxiliary images in your photo captures involving depth.
1686 #[unsafe(method(isPortraitEffectsMatteDeliveryEnabled))]
1687 #[unsafe(method_family = none)]
1688 pub unsafe fn isPortraitEffectsMatteDeliveryEnabled(&self) -> bool;
1689
1690 /// Setter for [`isPortraitEffectsMatteDeliveryEnabled`][Self::isPortraitEffectsMatteDeliveryEnabled].
1691 #[unsafe(method(setPortraitEffectsMatteDeliveryEnabled:))]
1692 #[unsafe(method_family = none)]
1693 pub unsafe fn setPortraitEffectsMatteDeliveryEnabled(
1694 &self,
1695 portrait_effects_matte_delivery_enabled: bool,
1696 );
1697
1698 /// Specifies whether the portrait effects matte captured with this photo should be written to the photo's file structure.
1699 ///
1700 ///
1701 /// Default is YES. When portraitEffectsMatteDeliveryEnabled is set to YES, this property specifies whether the included portrait effects matte should be written to the resulting photo's internal file structure. Portrait effects mattes are currently only supported in HEIF and JPEG. This property is ignored if portraitEffectsMatteDeliveryEnabled is set to NO.
1702 #[unsafe(method(embedsPortraitEffectsMatteInPhoto))]
1703 #[unsafe(method_family = none)]
1704 pub unsafe fn embedsPortraitEffectsMatteInPhoto(&self) -> bool;
1705
1706 /// Setter for [`embedsPortraitEffectsMatteInPhoto`][Self::embedsPortraitEffectsMatteInPhoto].
1707 #[unsafe(method(setEmbedsPortraitEffectsMatteInPhoto:))]
1708 #[unsafe(method_family = none)]
1709 pub unsafe fn setEmbedsPortraitEffectsMatteInPhoto(
1710 &self,
1711 embeds_portrait_effects_matte_in_photo: bool,
1712 );
1713
1714 #[cfg(feature = "AVSemanticSegmentationMatte")]
1715 /// Specifies which types of AVSemanticSegmentationMatte should be captured along with the photo.
1716 ///
1717 ///
1718 /// Default is empty array. You may set this property to an array of AVSemanticSegmentationMatteTypes you'd like to capture. Throws an exception if -[AVCapturePhotoOutput enabledSemanticSegmentationMatteTypes] does not contain any of the AVSemanticSegmentationMatteTypes specified. In other words, when setting up a capture session, you opt in for the superset of segmentation matte types you might like to receive, and then on a shot-by-shot basis, you may opt in to all or a subset of the previously specified types by setting this property. An exception is also thrown during -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] if your delegate does not respond to the captureOutput:didFinishProcessingPhoto:error: selector. Setting this property to YES does not guarantee that the specified mattes will be present in the resulting AVCapturePhoto. If the photo's content lacks any persons, for instance, no hair, skin, or teeth mattes are generated, and the -[AVCapturePhoto semanticSegmentationMatteForType:] property returns nil. Note that setting this property to YES may add significant processing time to the delivery of your didFinishProcessingPhoto: callback.
1719 #[unsafe(method(enabledSemanticSegmentationMatteTypes))]
1720 #[unsafe(method_family = none)]
1721 pub unsafe fn enabledSemanticSegmentationMatteTypes(
1722 &self,
1723 ) -> Retained<NSArray<AVSemanticSegmentationMatteType>>;
1724
1725 #[cfg(feature = "AVSemanticSegmentationMatte")]
1726 /// Setter for [`enabledSemanticSegmentationMatteTypes`][Self::enabledSemanticSegmentationMatteTypes].
1727 #[unsafe(method(setEnabledSemanticSegmentationMatteTypes:))]
1728 #[unsafe(method_family = none)]
1729 pub unsafe fn setEnabledSemanticSegmentationMatteTypes(
1730 &self,
1731 enabled_semantic_segmentation_matte_types: &NSArray<AVSemanticSegmentationMatteType>,
1732 );
1733
1734 /// Specifies whether enabledSemanticSegmentationMatteTypes captured with this photo should be written to the photo's file structure.
1735 ///
1736 ///
1737 /// Default is YES. This property specifies whether the captured semantic segmentation mattes should be written to the resulting photo's internal file structure. Semantic segmentation mattes are currently only supported in HEIF and JPEG. This property is ignored if enabledSemanticSegmentationMatteTypes is set to an empty array.
1738 #[unsafe(method(embedsSemanticSegmentationMattesInPhoto))]
1739 #[unsafe(method_family = none)]
1740 pub unsafe fn embedsSemanticSegmentationMattesInPhoto(&self) -> bool;
1741
1742 /// Setter for [`embedsSemanticSegmentationMattesInPhoto`][Self::embedsSemanticSegmentationMattesInPhoto].
1743 #[unsafe(method(setEmbedsSemanticSegmentationMattesInPhoto:))]
1744 #[unsafe(method_family = none)]
1745 pub unsafe fn setEmbedsSemanticSegmentationMattesInPhoto(
1746 &self,
1747 embeds_semantic_segmentation_mattes_in_photo: bool,
1748 );
1749
1750 /// A dictionary of metadata key/value pairs you'd like to have written to each photo in the capture request.
1751 ///
1752 ///
1753 /// Valid metadata keys are found in
1754 /// <ImageIO
1755 /// /CGImageProperties.h>. AVCapturePhotoOutput inserts a base set of metadata into each photo it captures, such as kCGImagePropertyOrientation, kCGImagePropertyExifDictionary, and kCGImagePropertyMakerAppleDictionary. You may specify metadata keys and values that should be written to each photo in the capture request. If you've specified metadata that also appears in AVCapturePhotoOutput's base set, your value replaces the base value. An NSInvalidArgumentException is thrown if you specify keys other than those found in
1756 /// <ImageIO
1757 /// /CGImageProperties.h>.
1758 #[unsafe(method(metadata))]
1759 #[unsafe(method_family = none)]
1760 pub unsafe fn metadata(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
1761
1762 /// Setter for [`metadata`][Self::metadata].
1763 #[unsafe(method(setMetadata:))]
1764 #[unsafe(method_family = none)]
1765 pub unsafe fn setMetadata(&self, metadata: &NSDictionary<NSString, AnyObject>);
1766
1767 /// Specifies that a Live Photo movie be captured to complement the still photo.
1768 ///
1769 ///
1770 /// A Live Photo movie is a short movie (with audio, if you've added an audio input to your session) containing the moments right before and after the still photo. A QuickTime movie file will be written to disk at the URL specified if it is a valid file URL accessible to your app's sandbox. You may only set this property if AVCapturePhotoOutput's livePhotoCaptureSupported property is YES. When you specify a Live Photo, your AVCapturePhotoCaptureDelegate object must implement -captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error:.
1771 #[unsafe(method(livePhotoMovieFileURL))]
1772 #[unsafe(method_family = none)]
1773 pub unsafe fn livePhotoMovieFileURL(&self) -> Option<Retained<NSURL>>;
1774
1775 /// Setter for [`livePhotoMovieFileURL`][Self::livePhotoMovieFileURL].
1776 #[unsafe(method(setLivePhotoMovieFileURL:))]
1777 #[unsafe(method_family = none)]
1778 pub unsafe fn setLivePhotoMovieFileURL(&self, live_photo_movie_file_url: Option<&NSURL>);
1779
1780 #[cfg(feature = "AVVideoSettings")]
1781 /// Specifies the video codec type to use when compressing video for the Live Photo movie complement.
1782 ///
1783 ///
1784 /// Prior to iOS 11, all Live Photo movie video tracks are compressed using H.264. Beginning in iOS 11, you can select the Live Photo movie video compression format by specifying one of the strings present in AVCapturePhotoOutput's availableLivePhotoVideoCodecTypes array.
1785 #[unsafe(method(livePhotoVideoCodecType))]
1786 #[unsafe(method_family = none)]
1787 pub unsafe fn livePhotoVideoCodecType(&self) -> Retained<AVVideoCodecType>;
1788
1789 #[cfg(feature = "AVVideoSettings")]
1790 /// Setter for [`livePhotoVideoCodecType`][Self::livePhotoVideoCodecType].
1791 #[unsafe(method(setLivePhotoVideoCodecType:))]
1792 #[unsafe(method_family = none)]
1793 pub unsafe fn setLivePhotoVideoCodecType(
1794 &self,
1795 live_photo_video_codec_type: &AVVideoCodecType,
1796 );
1797
1798 #[cfg(feature = "AVMetadataItem")]
1799 /// Movie-level metadata to be written to the Live Photo movie.
1800 ///
1801 ///
1802 /// An array of AVMetadataItems to be inserted into the top level of the Live Photo movie. The receiver makes immutable copies of the AVMetadataItems in the array. Live Photo movies always contain a AVMetadataQuickTimeMetadataKeyContentIdentifier which allow them to be paired with a similar identifier in the MakerNote of the photo complement. AVCapturePhotoSettings generates a unique content identifier for you. If you provide a metadata array containing an AVMetadataItem with keyspace = AVMetadataKeySpaceQuickTimeMetadata and key = AVMetadataQuickTimeMetadataKeyContentIdentifier, an NSInvalidArgumentException is thrown.
1803 #[unsafe(method(livePhotoMovieMetadata))]
1804 #[unsafe(method_family = none)]
1805 pub unsafe fn livePhotoMovieMetadata(&self) -> Retained<NSArray<AVMetadataItem>>;
1806
1807 #[cfg(feature = "AVMetadataItem")]
1808 /// Setter for [`livePhotoMovieMetadata`][Self::livePhotoMovieMetadata].
1809 #[unsafe(method(setLivePhotoMovieMetadata:))]
1810 #[unsafe(method_family = none)]
1811 pub unsafe fn setLivePhotoMovieMetadata(
1812 &self,
1813 live_photo_movie_metadata: Option<&NSArray<AVMetadataItem>>,
1814 );
1815
1816 /// An array of available kCVPixelBufferPixelFormatTypeKeys that may be used when specifying a previewPhotoFormat.
1817 ///
1818 ///
1819 /// The array is sorted such that the preview format requiring the fewest conversions is presented first.
1820 #[unsafe(method(availablePreviewPhotoPixelFormatTypes))]
1821 #[unsafe(method_family = none)]
1822 pub unsafe fn availablePreviewPhotoPixelFormatTypes(&self) -> Retained<NSArray<NSNumber>>;
1823
1824 /// A dictionary of Core Video pixel buffer attributes specifying the preview photo format to be delivered along with the RAW or processed photo.
1825 ///
1826 ///
1827 /// A dictionary of pixel buffer attributes specifying a smaller version of the RAW or processed photo for preview purposes. The kCVPixelBufferPixelFormatTypeKey is required and must be present in the receiver's -availablePreviewPhotoPixelFormatTypes array. Optional keys are { kCVPixelBufferWidthKey | kCVPixelBufferHeightKey }. If you wish to specify dimensions, you must add both width and height. Width and height are only honored up to the display dimensions. If you specify a width and height whose aspect ratio differs from the RAW or processed photo, the larger of the two dimensions is honored and aspect ratio of the RAW or processed photo is always preserved.
1828 #[unsafe(method(previewPhotoFormat))]
1829 #[unsafe(method_family = none)]
1830 pub unsafe fn previewPhotoFormat(
1831 &self,
1832 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1833
1834 /// Setter for [`previewPhotoFormat`][Self::previewPhotoFormat].
1835 #[unsafe(method(setPreviewPhotoFormat:))]
1836 #[unsafe(method_family = none)]
1837 pub unsafe fn setPreviewPhotoFormat(
1838 &self,
1839 preview_photo_format: Option<&NSDictionary<NSString, AnyObject>>,
1840 );
1841
1842 #[cfg(feature = "AVVideoSettings")]
1843 /// An array of available AVVideoCodecKeys that may be used when specifying an embeddedThumbnailPhotoFormat.
1844 ///
1845 ///
1846 /// The array is sorted such that the thumbnail codec type that is most backward compatible is listed first.
1847 #[unsafe(method(availableEmbeddedThumbnailPhotoCodecTypes))]
1848 #[unsafe(method_family = none)]
1849 pub unsafe fn availableEmbeddedThumbnailPhotoCodecTypes(
1850 &self,
1851 ) -> Retained<NSArray<AVVideoCodecType>>;
1852
1853 /// A dictionary of AVVideoSettings keys specifying the thumbnail format to be written to the processed or RAW photo.
1854 ///
1855 ///
1856 /// A dictionary of AVVideoSettings keys specifying a thumbnail (usually smaller) version of the processed photo to be embedded in that image before calling the AVCapturePhotoCaptureDelegate. This image is sometimes referred to as a "thumbnail image". The AVVideoCodecKey is required and must be present in the receiver's -availableEmbeddedThumbnailPhotoCodecTypes array. Optional keys are { AVVideoWidthKey | AVVideoHeightKey }. If you wish to specify dimensions, you must specify both width and height. If you specify a width and height whose aspect ratio differs from the processed photo, the larger of the two dimensions is honored and aspect ratio of the RAW or processed photo is always preserved. For RAW captures, use -rawEmbeddedThumbnailPhotoFormat to specify the thumbnail format you'd like to capture in the RAW image. For apps linked on or after iOS 12, the raw thumbnail format must be specified using the -rawEmbeddedThumbnailPhotoFormat API rather than -embeddedThumbnailPhotoFormat. Beginning in iOS 12, HEIC files may contain thumbnails up to the full resolution of the main image.
1857 #[unsafe(method(embeddedThumbnailPhotoFormat))]
1858 #[unsafe(method_family = none)]
1859 pub unsafe fn embeddedThumbnailPhotoFormat(
1860 &self,
1861 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1862
1863 /// Setter for [`embeddedThumbnailPhotoFormat`][Self::embeddedThumbnailPhotoFormat].
1864 #[unsafe(method(setEmbeddedThumbnailPhotoFormat:))]
1865 #[unsafe(method_family = none)]
1866 pub unsafe fn setEmbeddedThumbnailPhotoFormat(
1867 &self,
1868 embedded_thumbnail_photo_format: Option<&NSDictionary<NSString, AnyObject>>,
1869 );
1870
1871 #[cfg(feature = "AVVideoSettings")]
1872 /// An array of available AVVideoCodecKeys that may be used when specifying a rawEmbeddedThumbnailPhotoFormat.
1873 ///
1874 ///
1875 /// The array is sorted such that the thumbnail codec type that is most backward compatible is listed first.
1876 #[unsafe(method(availableRawEmbeddedThumbnailPhotoCodecTypes))]
1877 #[unsafe(method_family = none)]
1878 pub unsafe fn availableRawEmbeddedThumbnailPhotoCodecTypes(
1879 &self,
1880 ) -> Retained<NSArray<AVVideoCodecType>>;
1881
1882 /// A dictionary of AVVideoSettings keys specifying the thumbnail format to be written to the RAW photo in a RAW photo request.
1883 ///
1884 ///
1885 /// A dictionary of AVVideoSettings keys specifying a thumbnail (usually smaller) version of the RAW photo to be embedded in that image's DNG before calling back the AVCapturePhotoCaptureDelegate. The AVVideoCodecKey is required and must be present in the receiver's -availableRawEmbeddedThumbnailPhotoCodecTypes array. Optional keys are { AVVideoWidthKey | AVVideoHeightKey }. If you wish to specify dimensions, you must specify both width and height. If you specify a width and height whose aspect ratio differs from the RAW or processed photo, the larger of the two dimensions is honored and aspect ratio of the RAW or processed photo is always preserved. For apps linked on or after iOS 12, the raw thumbnail format must be specified using the -rawEmbeddedThumbnailPhotoFormat API rather than -embeddedThumbnailPhotoFormat. Beginning in iOS 12, DNG files may contain thumbnails up to the full resolution of the RAW image.
1886 #[unsafe(method(rawEmbeddedThumbnailPhotoFormat))]
1887 #[unsafe(method_family = none)]
1888 pub unsafe fn rawEmbeddedThumbnailPhotoFormat(
1889 &self,
1890 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
1891
1892 /// Setter for [`rawEmbeddedThumbnailPhotoFormat`][Self::rawEmbeddedThumbnailPhotoFormat].
1893 #[unsafe(method(setRawEmbeddedThumbnailPhotoFormat:))]
1894 #[unsafe(method_family = none)]
1895 pub unsafe fn setRawEmbeddedThumbnailPhotoFormat(
1896 &self,
1897 raw_embedded_thumbnail_photo_format: Option<&NSDictionary<NSString, AnyObject>>,
1898 );
1899
1900 /// Specifies whether the photo output should use content aware distortion correction on this photo request (at its discretion).
1901 ///
1902 ///
1903 /// Default is NO. Set to YES if you wish content aware distortion correction to be performed on your AVCapturePhotos, when the photo output deems it necessary. Photos may or may not benefit from distortion correction. For instance, photos lacking faces may be left as is. Setting this property to YES does introduce a small additional amount of latency to the photo processing. You may check your AVCaptureResolvedPhotoSettings to see whether content aware distortion correction will be enabled for a given photo request. Throws an exception if -[AVCapturePhotoOutput contentAwareDistortionCorrectionEnabled] is not set to YES.
1904 #[unsafe(method(isAutoContentAwareDistortionCorrectionEnabled))]
1905 #[unsafe(method_family = none)]
1906 pub unsafe fn isAutoContentAwareDistortionCorrectionEnabled(&self) -> bool;
1907
1908 /// Setter for [`isAutoContentAwareDistortionCorrectionEnabled`][Self::isAutoContentAwareDistortionCorrectionEnabled].
1909 #[unsafe(method(setAutoContentAwareDistortionCorrectionEnabled:))]
1910 #[unsafe(method_family = none)]
1911 pub unsafe fn setAutoContentAwareDistortionCorrectionEnabled(
1912 &self,
1913 auto_content_aware_distortion_correction_enabled: bool,
1914 );
1915
1916 /// Specifies whether the photo will be captured with constant color.
1917 ///
1918 ///
1919 /// Default is NO. Set to YES if you wish to capture a constant color photo. Throws an exception if -[AVCapturePhotoOutput constantColorEnabled] is not set to YES.
1920 #[unsafe(method(isConstantColorEnabled))]
1921 #[unsafe(method_family = none)]
1922 pub unsafe fn isConstantColorEnabled(&self) -> bool;
1923
1924 /// Setter for [`isConstantColorEnabled`][Self::isConstantColorEnabled].
1925 #[unsafe(method(setConstantColorEnabled:))]
1926 #[unsafe(method_family = none)]
1927 pub unsafe fn setConstantColorEnabled(&self, constant_color_enabled: bool);
1928
1929 /// Specifies whether a fallback photo is delivered when taking a constant color capture.
1930 ///
1931 ///
1932 /// Default is NO. Set to YES if you wish to receive a fallback photo that can be used in case the main constant color photo's confidence level is too low for your use case.
1933 #[unsafe(method(isConstantColorFallbackPhotoDeliveryEnabled))]
1934 #[unsafe(method_family = none)]
1935 pub unsafe fn isConstantColorFallbackPhotoDeliveryEnabled(&self) -> bool;
1936
1937 /// Setter for [`isConstantColorFallbackPhotoDeliveryEnabled`][Self::isConstantColorFallbackPhotoDeliveryEnabled].
1938 #[unsafe(method(setConstantColorFallbackPhotoDeliveryEnabled:))]
1939 #[unsafe(method_family = none)]
1940 pub unsafe fn setConstantColorFallbackPhotoDeliveryEnabled(
1941 &self,
1942 constant_color_fallback_photo_delivery_enabled: bool,
1943 );
1944
1945 /// Specifies whether the built-in shutter sound should be suppressed when capturing a photo with these settings.
1946 ///
1947 ///
1948 /// Default is NO. Set to YES if you wish to suppress AVCapturePhotoOutput's built-in shutter sound for this request. AVCapturePhotoOutput throws an NSInvalidArgumentException in `-capturePhotoWithSettings:` if its `shutterSoundSuppressionSupported` property returns NO.
1949 #[unsafe(method(isShutterSoundSuppressionEnabled))]
1950 #[unsafe(method_family = none)]
1951 pub unsafe fn isShutterSoundSuppressionEnabled(&self) -> bool;
1952
1953 /// Setter for [`isShutterSoundSuppressionEnabled`][Self::isShutterSoundSuppressionEnabled].
1954 #[unsafe(method(setShutterSoundSuppressionEnabled:))]
1955 #[unsafe(method_family = none)]
1956 pub unsafe fn setShutterSoundSuppressionEnabled(
1957 &self,
1958 shutter_sound_suppression_enabled: bool,
1959 );
1960 );
1961}
1962
1963/// Methods declared on superclass `NSObject`.
1964impl AVCapturePhotoSettings {
1965 extern_methods!(
1966 #[unsafe(method(init))]
1967 #[unsafe(method_family = init)]
1968 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1969
1970 #[unsafe(method(new))]
1971 #[unsafe(method_family = new)]
1972 pub unsafe fn new() -> Retained<Self>;
1973 );
1974}
1975
1976extern_class!(
1977 /// A concrete subclass of AVCapturePhotoSettings that describes a bracketed capture.
1978 ///
1979 ///
1980 /// In addition to the properties expressed in the base class, an AVCapturePhotoBracketSettings contains an array of AVCaptureBracketedStillImageSettings objects, where each describes one individual photo in the bracket. bracketedSettings.count must be
1981 /// <
1982 /// = AVCapturePhotoOutput's -maxBracketedCapturePhotoCount. Capturing a photo bracket may require the allocation of additional resources.
1983 ///
1984 /// When you request a bracketed capture, your AVCapturePhotoCaptureDelegate's -captureOutput:didFinishProcessing{Photo | RawPhoto}... callbacks are called back bracketSettings.count times and provided with the corresponding AVCaptureBracketedStillImageSettings object from your request.
1985 ///
1986 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotobracketsettings?language=objc)
1987 #[unsafe(super(AVCapturePhotoSettings, NSObject))]
1988 #[derive(Debug, PartialEq, Eq, Hash)]
1989 pub struct AVCapturePhotoBracketSettings;
1990);
1991
1992extern_conformance!(
1993 unsafe impl NSCopying for AVCapturePhotoBracketSettings {}
1994);
1995
1996unsafe impl CopyingHelper for AVCapturePhotoBracketSettings {
1997 type Result = Self;
1998}
1999
2000extern_conformance!(
2001 unsafe impl NSObjectProtocol for AVCapturePhotoBracketSettings {}
2002);
2003
2004impl AVCapturePhotoBracketSettings {
2005 extern_methods!(
2006 #[cfg(feature = "AVCaptureStillImageOutput")]
2007 /// Creates an instance of AVCapturePhotoBracketSettings.
2008 ///
2009 ///
2010 /// Parameter `rawPixelFormatType`: One of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. May be set to 0 if you do not desire RAW capture.
2011 ///
2012 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property. If you wish an uncompressed format, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the format specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed output. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. If you only wish to capture RAW, you may pass a non-zero rawPixelFormatType and a nil processedFormat dictionary. If you pass a rawPixelFormatType of 0 AND a nil processedFormat dictionary, the default output of AVVideoCodecTypeJPEG will be delivered.
2013 ///
2014 /// Parameter `bracketedSettings`: An array of AVCaptureBracketedStillImageSettings objects (defined in AVCaptureStillImageOutput.h). All must be of the same type, either AVCaptureManualExposureBracketedStillImageSettings or AVCaptureAutoExposureBracketedStillImageSettings. bracketedSettings.count must be
2015 /// <
2016 /// = AVCapturePhotoOutput's -maxBracketedCapturePhotoCount.
2017 ///
2018 /// Returns: An instance of AVCapturePhotoBracketSettings.
2019 ///
2020 ///
2021 /// An NSInvalidArgumentException is thrown if bracketedSettings is nil, contains zero elements, or mixes and matches different subclasses of AVCaptureBracketedStillImageSettings.
2022 ///
2023 /// AVCapturePhotoBracketSettings do not support flashMode, autoStillImageStabilizationEnabled, livePhotoMovieFileURL or livePhotoMovieMetadata.
2024 #[unsafe(method(photoBracketSettingsWithRawPixelFormatType:processedFormat:bracketedSettings:))]
2025 #[unsafe(method_family = none)]
2026 pub unsafe fn photoBracketSettingsWithRawPixelFormatType_processedFormat_bracketedSettings(
2027 raw_pixel_format_type: OSType,
2028 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
2029 bracketed_settings: &NSArray<AVCaptureBracketedStillImageSettings>,
2030 ) -> Retained<Self>;
2031
2032 #[cfg(all(feature = "AVCaptureStillImageOutput", feature = "AVMediaFormat"))]
2033 /// Creates an instance of AVCapturePhotoBracketSettings.
2034 ///
2035 ///
2036 /// Parameter `rawPixelFormatType`: One of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. May be set to 0 if you do not desire RAW capture.
2037 ///
2038 /// Parameter `rawFileType`: The file container for which the RAW image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
2039 ///
2040 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property. If you wish an uncompressed format, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the format specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed output. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. If you only wish to capture RAW, you may pass a non-zero rawPixelFormatType and a nil processedFormat dictionary. If you pass a rawPixelFormatType of 0 AND a nil processedFormat dictionary, the default output of AVVideoCodecTypeJPEG will be delivered.
2041 ///
2042 /// Parameter `processedFileType`: The file container for which the processed image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
2043 ///
2044 /// Parameter `bracketedSettings`: An array of AVCaptureBracketedStillImageSettings objects (defined in AVCaptureStillImageOutput.h). All must be of the same type, either AVCaptureManualExposureBracketedStillImageSettings or AVCaptureAutoExposureBracketedStillImageSettings. bracketedSettings.count must be
2045 /// <
2046 /// = AVCapturePhotoOutput's -maxBracketedCapturePhotoCount.
2047 ///
2048 /// Returns: An instance of AVCapturePhotoBracketSettings.
2049 ///
2050 ///
2051 /// An NSInvalidArgumentException is thrown if bracketedSettings is nil, contains zero elements, or mixes and matches different subclasses of AVCaptureBracketedStillImageSettings.
2052 ///
2053 /// AVCapturePhotoBracketSettings do not support flashMode, autoStillImageStabilizationEnabled, livePhotoMovieFileURL or livePhotoMovieMetadata.
2054 #[unsafe(method(photoBracketSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:bracketedSettings:))]
2055 #[unsafe(method_family = none)]
2056 pub unsafe fn photoBracketSettingsWithRawPixelFormatType_rawFileType_processedFormat_processedFileType_bracketedSettings(
2057 raw_pixel_format_type: OSType,
2058 raw_file_type: Option<&AVFileType>,
2059 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
2060 processed_file_type: Option<&AVFileType>,
2061 bracketed_settings: &NSArray<AVCaptureBracketedStillImageSettings>,
2062 ) -> Retained<Self>;
2063
2064 #[cfg(feature = "AVCaptureStillImageOutput")]
2065 /// An array of AVCaptureBracketedStillImageSettings objects you passed in -initWithFormat:rawPixelFormatType:bracketedSettings:
2066 ///
2067 ///
2068 /// This read-only property never returns nil.
2069 #[unsafe(method(bracketedSettings))]
2070 #[unsafe(method_family = none)]
2071 pub unsafe fn bracketedSettings(
2072 &self,
2073 ) -> Retained<NSArray<AVCaptureBracketedStillImageSettings>>;
2074
2075 /// Specifies whether lens (optical) stabilization should be employed during the bracketed capture.
2076 ///
2077 ///
2078 /// Default value is NO. This property may only be set to YES if AVCapturePhotoOutput's isLensStabilizationDuringBracketedCaptureSupported is YES. When set to YES, AVCapturePhotoOutput holds the lens steady for the duration of the bracket to counter hand shake and produce a sharper bracket of images.
2079 #[unsafe(method(isLensStabilizationEnabled))]
2080 #[unsafe(method_family = none)]
2081 pub unsafe fn isLensStabilizationEnabled(&self) -> bool;
2082
2083 /// Setter for [`isLensStabilizationEnabled`][Self::isLensStabilizationEnabled].
2084 #[unsafe(method(setLensStabilizationEnabled:))]
2085 #[unsafe(method_family = none)]
2086 pub unsafe fn setLensStabilizationEnabled(&self, lens_stabilization_enabled: bool);
2087 );
2088}
2089
2090/// Methods declared on superclass `AVCapturePhotoSettings`.
2091impl AVCapturePhotoBracketSettings {
2092 extern_methods!(
2093 /// Creates a default instance of AVCapturePhotoSettings.
2094 ///
2095 ///
2096 /// Returns: An instance of AVCapturePhotoSettings.
2097 ///
2098 ///
2099 /// A default AVCapturePhotoSettings object has a format of AVVideoCodecTypeJPEG, a fileType of AVFileTypeJPEG, and photoQualityPrioritization set to AVCapturePhotoQualityPrioritizationBalanced.
2100 #[unsafe(method(photoSettings))]
2101 #[unsafe(method_family = none)]
2102 pub unsafe fn photoSettings() -> Retained<Self>;
2103
2104 /// Creates an instance of AVCapturePhotoSettings with a user-specified output format.
2105 ///
2106 ///
2107 /// Parameter `format`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property.
2108 ///
2109 /// Returns: An instance of AVCapturePhotoSettings.
2110 ///
2111 ///
2112 /// If you wish an uncompressed format, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the format specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed output. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. Passing a nil format dictionary is analogous to calling +photoSettings.
2113 #[unsafe(method(photoSettingsWithFormat:))]
2114 #[unsafe(method_family = none)]
2115 pub unsafe fn photoSettingsWithFormat(
2116 format: Option<&NSDictionary<NSString, AnyObject>>,
2117 ) -> Retained<Self>;
2118
2119 /// Creates an instance of AVCapturePhotoSettings specifying RAW only output.
2120 ///
2121 ///
2122 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
2123 ///
2124 /// Returns: An instance of AVCapturePhotoSettings.
2125 ///
2126 ///
2127 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
2128 #[unsafe(method(photoSettingsWithRawPixelFormatType:))]
2129 #[unsafe(method_family = none)]
2130 pub unsafe fn photoSettingsWithRawPixelFormatType(
2131 raw_pixel_format_type: OSType,
2132 ) -> Retained<Self>;
2133
2134 /// Creates an instance of AVCapturePhotoSettings specifying RAW + a processed format (such as JPEG).
2135 ///
2136 ///
2137 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h).
2138 ///
2139 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property.
2140 ///
2141 /// Returns: An instance of AVCapturePhotoSettings.
2142 ///
2143 ///
2144 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. If you wish an uncompressed processedFormat, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the processedFormat specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed processedFormat. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. Passing a nil processedFormat dictionary is analogous to calling +photoSettingsWithRawPixelFormatType:. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
2145 #[unsafe(method(photoSettingsWithRawPixelFormatType:processedFormat:))]
2146 #[unsafe(method_family = none)]
2147 pub unsafe fn photoSettingsWithRawPixelFormatType_processedFormat(
2148 raw_pixel_format_type: OSType,
2149 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
2150 ) -> Retained<Self>;
2151
2152 #[cfg(feature = "AVMediaFormat")]
2153 /// Creates an instance of AVCapturePhotoSettings specifying RAW + a processed format (such as JPEG) and a file container to which it will be written.
2154 ///
2155 ///
2156 /// Parameter `rawPixelFormatType`: A Bayer RAW or Apple ProRAW pixel format OSType (defined in CVPixelBuffer.h). Pass 0 if you do not desire a RAW photo callback.
2157 ///
2158 /// Parameter `rawFileType`: The file container for which the RAW image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
2159 ///
2160 /// Parameter `processedFormat`: A dictionary of Core Video pixel buffer attributes or AVVideoSettings, analogous to AVCaptureStillImageOutput's outputSettings property. Pass nil if you do not desire a processed photo callback.
2161 ///
2162 /// Parameter `processedFileType`: The file container for which the processed image should be formatted to be written. Pass nil if you have no preferred file container. A default container will be chosen for you.
2163 ///
2164 /// Returns: An instance of AVCapturePhotoSettings.
2165 ///
2166 ///
2167 /// rawPixelFormatType must be one of the OSTypes contained in AVCapturePhotoOutput's -availableRawPhotoPixelFormatTypes array. Set rawPixelFormatType to 0 if you do not desire a RAW photo callback. If you are specifying a rawFileType, it must be present in AVCapturePhotoOutput's -availableRawPhotoFileTypes array. If you wish an uncompressed processedFormat, your dictionary must contain kCVPixelBufferPixelFormatTypeKey, and the processedFormat specified must be present in AVCapturePhotoOutput's -availablePhotoPixelFormatTypes array. kCVPixelBufferPixelFormatTypeKey is the only supported key when expressing uncompressed processedFormat. If you wish a compressed format, your dictionary must contain AVVideoCodecKey and the codec specified must be present in AVCapturePhotoOutput's -availablePhotoCodecTypes array. If you are specifying a compressed format, the AVVideoCompressionPropertiesKey is also supported, with a payload dictionary containing a single AVVideoQualityKey. If you are specifying a processedFileType, it must be present in AVCapturePhotoOutput's -availablePhotoFileTypes array. Pass a nil processedFormat dictionary if you only desire a RAW photo capture. See AVCapturePhotoOutput's -capturePhotoWithSettings:delegate: inline documentation for a discussion of restrictions on AVCapturePhotoSettings when requesting RAW capture.
2168 #[unsafe(method(photoSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:))]
2169 #[unsafe(method_family = none)]
2170 pub unsafe fn photoSettingsWithRawPixelFormatType_rawFileType_processedFormat_processedFileType(
2171 raw_pixel_format_type: OSType,
2172 raw_file_type: Option<&AVFileType>,
2173 processed_format: Option<&NSDictionary<NSString, AnyObject>>,
2174 processed_file_type: Option<&AVFileType>,
2175 ) -> Retained<Self>;
2176
2177 /// Creates an instance of AVCapturePhotoSettings with a new uniqueID from an existing instance of AVCapturePhotoSettings.
2178 ///
2179 ///
2180 /// Parameter `photoSettings`: An existing AVCapturePhotoSettings instance.
2181 ///
2182 /// Returns: An new instance of AVCapturePhotoSettings with new uniqueID.
2183 ///
2184 ///
2185 /// Use this factory method to create a clone of an existing photo settings instance, but with a new uniqueID that can safely be passed to AVCapturePhotoOutput -capturePhotoWithSettings:delegate:.
2186 #[unsafe(method(photoSettingsFromPhotoSettings:))]
2187 #[unsafe(method_family = none)]
2188 pub unsafe fn photoSettingsFromPhotoSettings(
2189 photo_settings: &AVCapturePhotoSettings,
2190 ) -> Retained<Self>;
2191 );
2192}
2193
2194/// Methods declared on superclass `NSObject`.
2195impl AVCapturePhotoBracketSettings {
2196 extern_methods!(
2197 #[unsafe(method(init))]
2198 #[unsafe(method_family = init)]
2199 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2200
2201 #[unsafe(method(new))]
2202 #[unsafe(method_family = new)]
2203 pub unsafe fn new() -> Retained<Self>;
2204 );
2205}
2206
2207extern_class!(
2208 /// An immutable object produced by callbacks in each and every AVCapturePhotoCaptureDelegate protocol method.
2209 ///
2210 ///
2211 /// When you initiate a photo capture request using -capturePhotoWithSettings:delegate:, some of your settings are not yet certain. For instance, auto flash and auto still image stabilization allow the AVCapturePhotoOutput to decide just in time whether to employ flash or still image stabilization, depending on the current scene. Once the request is issued, AVCapturePhotoOutput begins the capture, resolves the uncertain settings, and in its first callback informs you of its choices through an AVCaptureResolvedPhotoSettings object. This same object is presented to all the callbacks fired for a particular photo capture request. Its uniqueID property matches that of the AVCapturePhotoSettings instance you used to initiate the photo request.
2212 ///
2213 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcaptureresolvedphotosettings?language=objc)
2214 #[unsafe(super(NSObject))]
2215 #[derive(Debug, PartialEq, Eq, Hash)]
2216 pub struct AVCaptureResolvedPhotoSettings;
2217);
2218
2219extern_conformance!(
2220 unsafe impl NSObjectProtocol for AVCaptureResolvedPhotoSettings {}
2221);
2222
2223impl AVCaptureResolvedPhotoSettings {
2224 extern_methods!(
2225 #[unsafe(method(init))]
2226 #[unsafe(method_family = init)]
2227 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2228
2229 #[unsafe(method(new))]
2230 #[unsafe(method_family = new)]
2231 pub unsafe fn new() -> Retained<Self>;
2232
2233 /// uniqueID matches that of the AVCapturePhotoSettings instance you passed to -capturePhotoWithSettings:delegate:.
2234 #[unsafe(method(uniqueID))]
2235 #[unsafe(method_family = none)]
2236 pub unsafe fn uniqueID(&self) -> i64;
2237
2238 #[cfg(feature = "objc2-core-media")]
2239 /// The resolved dimensions of the photo buffer that will be delivered to the -captureOutput:didFinishProcessingPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error: callback.
2240 ///
2241 ///
2242 /// If you request a RAW capture with no processed companion image, photoDimensions resolve to { 0, 0 }.
2243 #[unsafe(method(photoDimensions))]
2244 #[unsafe(method_family = none)]
2245 pub unsafe fn photoDimensions(&self) -> CMVideoDimensions;
2246
2247 #[cfg(feature = "objc2-core-media")]
2248 /// The resolved dimensions of the RAW photo buffer that will be delivered to the -captureOutput:didFinishProcessingRawPhotoSampleBuffer:previewPhotoSampleBuffer:resolvedSettings:bracketSettings:error: callback.
2249 ///
2250 ///
2251 /// If you request a non-RAW capture, rawPhotoDimensions resolve to { 0, 0 }.
2252 #[unsafe(method(rawPhotoDimensions))]
2253 #[unsafe(method_family = none)]
2254 pub unsafe fn rawPhotoDimensions(&self) -> CMVideoDimensions;
2255
2256 #[cfg(feature = "objc2-core-media")]
2257 /// The resolved dimensions of the preview photo buffer that will be delivered to the -captureOutput:didFinishProcessing{Photo | RawPhoto}... AVCapturePhotoCaptureDelegate callbacks.
2258 ///
2259 ///
2260 /// If you don't request a preview image, previewDimensions resolve to { 0, 0 }.
2261 #[unsafe(method(previewDimensions))]
2262 #[unsafe(method_family = none)]
2263 pub unsafe fn previewDimensions(&self) -> CMVideoDimensions;
2264
2265 #[cfg(feature = "objc2-core-media")]
2266 /// The resolved dimensions of the embedded thumbnail that will be written to the processed photo delivered to the -captureOutput:didFinishProcessingPhoto:error: AVCapturePhotoCaptureDelegate callback.
2267 ///
2268 ///
2269 /// If you don't request an embedded thumbnail image, embeddedThumbnailDimensions resolve to { 0, 0 }.
2270 #[unsafe(method(embeddedThumbnailDimensions))]
2271 #[unsafe(method_family = none)]
2272 pub unsafe fn embeddedThumbnailDimensions(&self) -> CMVideoDimensions;
2273
2274 #[cfg(feature = "objc2-core-media")]
2275 /// The resolved dimensions of the embedded thumbnail that will be written to the RAW photo delivered to the -captureOutput:didFinishProcessingPhoto:error: AVCapturePhotoCaptureDelegate callback.
2276 ///
2277 ///
2278 /// If you don't request a raw embedded thumbnail image, rawEmbeddedThumbnailDimensions resolve to { 0, 0 }.
2279 #[unsafe(method(rawEmbeddedThumbnailDimensions))]
2280 #[unsafe(method_family = none)]
2281 pub unsafe fn rawEmbeddedThumbnailDimensions(&self) -> CMVideoDimensions;
2282
2283 #[cfg(feature = "objc2-core-media")]
2284 /// The resolved dimensions of the portrait effects matte that will be delivered to the AVCapturePhoto in the -captureOutput:didFinishProcessingPhoto:error: AVCapturePhotoCaptureDelegate callback.
2285 ///
2286 ///
2287 /// If you request a portrait effects matte by calling -[AVCapturePhotoSettings setPortraitEffectsMatteDeliveryEnabled:YES], portraitEffectsMatteDimensions resolve to the expected dimensions of the portrait effects matte, assuming one is generated (see -[AVCapturePhotoSettings portraitEffectsMatteDeliveryEnabled] for a discussion of why a portrait effects matte might not be delivered). If you don't request a portrait effects matte, portraitEffectsMatteDimensions always resolve to { 0, 0 }.
2288 #[unsafe(method(portraitEffectsMatteDimensions))]
2289 #[unsafe(method_family = none)]
2290 pub unsafe fn portraitEffectsMatteDimensions(&self) -> CMVideoDimensions;
2291
2292 #[cfg(all(feature = "AVSemanticSegmentationMatte", feature = "objc2-core-media"))]
2293 /// Queries the resolved dimensions of semantic segmentation mattes that will be delivered to the AVCapturePhoto in the -captureOutput:didFinishProcessingPhoto:error: AVCapturePhotoCaptureDelegate callback.
2294 ///
2295 ///
2296 /// If you request semantic segmentation mattes by calling -[AVCapturePhotoSettings setEnabledSemanticSegmentationMatteTypes:] with a non-empty array, the dimensions resolve to the expected dimensions for each of the mattes, assuming they are generated (see -[AVCapturePhotoSettings enabledSemanticSegmentationMatteTypes] for a discussion of why a particular matte might not be delivered). If you don't request any semantic segmentation mattes, the result will always be { 0, 0 }.
2297 #[unsafe(method(dimensionsForSemanticSegmentationMatteOfType:))]
2298 #[unsafe(method_family = none)]
2299 pub unsafe fn dimensionsForSemanticSegmentationMatteOfType(
2300 &self,
2301 semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType,
2302 ) -> CMVideoDimensions;
2303
2304 #[cfg(feature = "objc2-core-media")]
2305 /// The resolved dimensions of the video track in the movie that will be delivered to the -captureOutput:didFinishProcessingLivePhotoToMovieFileAtURL:duration:photoDisplayTime:resolvedSettings:error: callback.
2306 ///
2307 ///
2308 /// If you don't request Live Photo capture, livePhotoMovieDimensions resolve to { 0, 0 }.
2309 #[unsafe(method(livePhotoMovieDimensions))]
2310 #[unsafe(method_family = none)]
2311 pub unsafe fn livePhotoMovieDimensions(&self) -> CMVideoDimensions;
2312
2313 /// Indicates whether the flash will fire when capturing the photo.
2314 ///
2315 ///
2316 /// When you specify AVCaptureFlashModeAuto as your AVCapturePhotoSettings.flashMode, you don't know if flash capture will be chosen until you inspect the AVCaptureResolvedPhotoSettings flashEnabled property. If the device becomes too hot, the flash becomes temporarily unavailable. You can key-value observe AVCaptureDevice's flashAvailable property to know when this occurs. If the flash is unavailable due to thermal issues, and you specify a flashMode of AVCaptureFlashModeOn, flashEnabled still resolves to NO until the device has sufficiently cooled off.
2317 #[unsafe(method(isFlashEnabled))]
2318 #[unsafe(method_family = none)]
2319 pub unsafe fn isFlashEnabled(&self) -> bool;
2320
2321 /// Indicates whether red-eye reduction will be applied as necessary when capturing the photo if flashEnabled is YES.
2322 #[unsafe(method(isRedEyeReductionEnabled))]
2323 #[unsafe(method_family = none)]
2324 pub unsafe fn isRedEyeReductionEnabled(&self) -> bool;
2325
2326 #[cfg(feature = "objc2-core-media")]
2327 /// The resolved dimensions of the AVCaptureDeferredPhotoProxy when opting in to deferred photo delivery. See AVCaptureDeferredPhotoProxy.
2328 ///
2329 ///
2330 /// If you don't opt in to deferred photo delivery, deferredPhotoProxyDimensions resolve to { 0, 0 }. When an AVCaptureDeferredPhotoProxy is returned, the photoDimensions property of this object represents the dimensions of the final photo.
2331 #[unsafe(method(deferredPhotoProxyDimensions))]
2332 #[unsafe(method_family = none)]
2333 pub unsafe fn deferredPhotoProxyDimensions(&self) -> CMVideoDimensions;
2334
2335 /// Indicates whether still image stabilization will be employed when capturing the photo.
2336 ///
2337 /// As of iOS 13 hardware, the AVCapturePhotoOutput is capable of applying a variety of multi-image fusion techniques to improve photo quality (reduce noise, preserve detail in low light, freeze motion, etc), all of which have been previously lumped under the stillImageStabilization moniker. This property should no longer be used as it no longer provides meaningful information about the techniques used to improve quality in a photo capture. Instead, you should use -photoQualityPrioritization to indicate your preferred quality vs speed when configuring your AVCapturePhotoSettings. You may query -photoProcessingTimeRange to get an indication of how long the photo will take to process before delivery to your delegate.
2338 #[deprecated]
2339 #[unsafe(method(isStillImageStabilizationEnabled))]
2340 #[unsafe(method_family = none)]
2341 pub unsafe fn isStillImageStabilizationEnabled(&self) -> bool;
2342
2343 /// Indicates whether fusion of virtual device constituent camera images will be used when capturing the photo, such as the wide-angle and telephoto images on a DualCamera.
2344 #[unsafe(method(isVirtualDeviceFusionEnabled))]
2345 #[unsafe(method_family = none)]
2346 pub unsafe fn isVirtualDeviceFusionEnabled(&self) -> bool;
2347
2348 /// Indicates whether DualCamera wide-angle and telephoto image fusion will be employed when capturing the photo. As of iOS 13, this property is deprecated in favor of virtualDeviceFusionEnabled.
2349 #[deprecated]
2350 #[unsafe(method(isDualCameraFusionEnabled))]
2351 #[unsafe(method_family = none)]
2352 pub unsafe fn isDualCameraFusionEnabled(&self) -> bool;
2353
2354 /// Indicates the number of times your -captureOutput:didFinishProcessingPhoto:error: callback will be called. For instance, if you've requested an auto exposure bracket of 3 with JPEG and RAW, the expectedPhotoCount is 6.
2355 #[unsafe(method(expectedPhotoCount))]
2356 #[unsafe(method_family = none)]
2357 pub unsafe fn expectedPhotoCount(&self) -> NSUInteger;
2358
2359 #[cfg(feature = "objc2-core-media")]
2360 /// Indicates the processing time range you can expect for this photo to be delivered to your delegate. the .start field of the CMTimeRange is zero-based. In other words, if photoProcessingTimeRange.start is equal to .5 seconds, then the minimum processing time for this photo is .5 seconds. The .start field plus the .duration field of the CMTimeRange indicate the max expected processing time for this photo. Consider implementing a UI affordance if the max processing time is uncomfortably long.
2361 #[unsafe(method(photoProcessingTimeRange))]
2362 #[unsafe(method_family = none)]
2363 pub unsafe fn photoProcessingTimeRange(&self) -> CMTimeRange;
2364
2365 /// Indicates whether content aware distortion correction will be employed when capturing the photo.
2366 #[unsafe(method(isContentAwareDistortionCorrectionEnabled))]
2367 #[unsafe(method_family = none)]
2368 pub unsafe fn isContentAwareDistortionCorrectionEnabled(&self) -> bool;
2369
2370 /// Indicates whether fast capture prioritization will be employed when capturing the photo.
2371 #[unsafe(method(isFastCapturePrioritizationEnabled))]
2372 #[unsafe(method_family = none)]
2373 pub unsafe fn isFastCapturePrioritizationEnabled(&self) -> bool;
2374 );
2375}
2376
2377extern_class!(
2378 /// An object representing a photo in memory, produced by the -captureOutput:didFinishingProcessingPhoto:error: in the AVCapturePhotoCaptureDelegate protocol method.
2379 ///
2380 ///
2381 /// Beginning in iOS 11, AVCapturePhotoOutput's AVCapturePhotoCaptureDelegate supports a simplified callback for delivering image data, namely -captureOutput:didFinishingProcessingPhoto:error:. This callback presents each image result for your capture request as an AVCapturePhoto object, an immutable wrapper from which various properties of the photo capture may be queried, such as the photo's preview pixel buffer, metadata, depth data, camera calibration data, and image bracket specific properties. AVCapturePhoto can wrap file-containerized photo results, such as HEVC encoded image data, containerized in the HEIC file format. CMSampleBufferRef, on the other hand, may only be used to express non file format containerized photo data. For this reason, the AVCapturePhotoCaptureDelegate protocol methods that return CMSampleBuffers have been deprecated in favor of -captureOutput:didFinishingProcessingPhoto:error:. A AVCapturePhoto wraps a single image result. For instance, if you've requested a bracketed capture of 3 images, your callback is called 3 times, each time delivering an AVCapturePhoto.
2382 ///
2383 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephoto?language=objc)
2384 #[unsafe(super(NSObject))]
2385 #[derive(Debug, PartialEq, Eq, Hash)]
2386 pub struct AVCapturePhoto;
2387);
2388
2389extern_conformance!(
2390 unsafe impl NSObjectProtocol for AVCapturePhoto {}
2391);
2392
2393impl AVCapturePhoto {
2394 extern_methods!(
2395 #[unsafe(method(init))]
2396 #[unsafe(method_family = init)]
2397 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2398
2399 #[unsafe(method(new))]
2400 #[unsafe(method_family = new)]
2401 pub unsafe fn new() -> Retained<Self>;
2402
2403 #[cfg(feature = "objc2-core-media")]
2404 /// The time at which this image was captured, synchronized to the synchronizationClock of the AVCaptureSession
2405 ///
2406 ///
2407 /// The timestamp property indicates the time the image was captured, and is analogous to CMSampleBufferGetPresentationTimeStamp(). If an error was provided in the -captureOutput:didFinishingProcessingPhoto:error: callback, timestamp returns kCMTimeInvalid.
2408 #[unsafe(method(timestamp))]
2409 #[unsafe(method_family = none)]
2410 pub unsafe fn timestamp(&self) -> CMTime;
2411
2412 /// This property returns YES if this photo is a RAW image.
2413 ///
2414 ///
2415 /// Your AVCapturePhotoCaptureDelegate's -captureOutput:didFinishingProcessingPhoto:error: method may be called one or more times with image results, including RAW or non-RAW images. This property distinguishes RAW from non-RAW image results, for instance, if you've requested a RAW + JPEG capture.
2416 #[unsafe(method(isRawPhoto))]
2417 #[unsafe(method_family = none)]
2418 pub unsafe fn isRawPhoto(&self) -> bool;
2419
2420 #[cfg(feature = "objc2-core-video")]
2421 /// For uncompressed or RAW captures, this property offers access to the pixel data.
2422 ///
2423 ///
2424 /// Uncompressed captures, such as '420f' or 'BGRA', Bayer RAW captures, such as 'bgg4', or Apple ProRAW captures, such as 'l64r', present pixel data as a CVPixelBuffer. See AVCapturePhotoOutput's -appleProRAWEnabled for a discussion on the differences between Bayer RAW and Apple ProRAW. This property is analogous to CMSampleBufferGetImageBuffer(). The pixel buffer contains only the minimal attachments required for correct display. Compressed captures, such as 'jpeg', return nil.
2425 #[unsafe(method(pixelBuffer))]
2426 #[unsafe(method_family = none)]
2427 pub unsafe fn pixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
2428
2429 #[cfg(feature = "objc2-core-video")]
2430 /// This property offers access to the preview image pixel data if you've requested it.
2431 ///
2432 ///
2433 /// If you requested a preview image by calling -[AVCapturePhotoSettings setPreviewPhotoFormat:] with a non-nil value, this property offers access to the resulting preview image pixel data, and is analogous to CMSampleBufferGetImageBuffer(). The pixel buffer contains only the minimal attachments required for correct display. Nil is returned if you did not request a preview image.
2434 #[unsafe(method(previewPixelBuffer))]
2435 #[unsafe(method_family = none)]
2436 pub unsafe fn previewPixelBuffer(&self) -> Option<Retained<CVPixelBuffer>>;
2437
2438 /// The format of the embedded thumbnail contained in this AVCapturePhoto.
2439 ///
2440 ///
2441 /// If you requested an embedded thumbnail image by calling -[AVCapturePhotoSettings setEmbeddedThumbnailPhotoFormat:] with a non-nil value, this property offers access to the resolved embedded thumbnail AVVideoSettings dictionary. Nil is returned if you did not request an embedded thumbnail image.
2442 #[unsafe(method(embeddedThumbnailPhotoFormat))]
2443 #[unsafe(method_family = none)]
2444 pub unsafe fn embeddedThumbnailPhotoFormat(
2445 &self,
2446 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
2447
2448 #[cfg(feature = "AVDepthData")]
2449 /// An AVDepthData object wrapping a disparity/depth map associated with this photo.
2450 ///
2451 ///
2452 /// If you requested depth data delivery by calling -[AVCapturePhotoSettings setDepthDataDeliveryEnabled:YES], this property offers access to the resulting AVDepthData object. Nil is returned if you did not request depth data delivery. Note that the depth data is only embedded in the photo's internal file format container if you set -[AVCapturePhotoSettings setEmbedsDepthDataInPhoto:YES].
2453 #[unsafe(method(depthData))]
2454 #[unsafe(method_family = none)]
2455 pub unsafe fn depthData(&self) -> Option<Retained<AVDepthData>>;
2456
2457 #[cfg(feature = "AVPortraitEffectsMatte")]
2458 /// An AVPortraitEffectsMatte object wrapping a matte associated with this photo.
2459 ///
2460 ///
2461 /// If you requested portrait effects matte delivery by calling -[AVCapturePhotoSettings setPortraitEffectsMatteDeliveryEnabled:YES], this property offers access to the resulting AVPortraitEffectsMatte object. Nil is returned if you did not request portrait effects matte delivery. Note that the portrait effects matte is only embedded in the photo's internal file format container if you set -[AVCapturePhotoSettings setEmbedsPortraitEffectsMatteInPhoto:YES].
2462 #[unsafe(method(portraitEffectsMatte))]
2463 #[unsafe(method_family = none)]
2464 pub unsafe fn portraitEffectsMatte(&self) -> Option<Retained<AVPortraitEffectsMatte>>;
2465
2466 #[cfg(feature = "AVSemanticSegmentationMatte")]
2467 /// An accessor for semantic segmentation mattes associated with this photo.
2468 ///
2469 ///
2470 /// Parameter `semanticSegmentationMatteType`: The matte type of interest (hair, skin, etc).
2471 ///
2472 /// Returns: An instance of AVSemanticSegmentationMatte, or nil if none could be found for the specified type.
2473 ///
2474 ///
2475 /// If you requested one or more semantic segmentation mattes by calling -[AVCapturePhotoSettings setEnabledSemanticSegmentationMatteTypes:] with a non-empty array of types, this property offers access to the resulting AVSemanticSegmentationMatte objects. Nil is returned if you did not request semantic segmentation matte delivery, or if no mattes of the specified type are available. Note that semantic segmentation mattes are only embedded in the photo's internal file format container if you call -[AVCapturePhotoSettings setEmbedsSemanticSegmentationMattesInPhoto:YES].
2476 #[unsafe(method(semanticSegmentationMatteForType:))]
2477 #[unsafe(method_family = none)]
2478 pub unsafe fn semanticSegmentationMatteForType(
2479 &self,
2480 semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType,
2481 ) -> Option<Retained<AVSemanticSegmentationMatte>>;
2482
2483 /// An ImageIO property style dictionary of metadata associated with this photo.
2484 ///
2485 ///
2486 /// Valid metadata keys are found in
2487 /// <ImageIO
2488 /// /CGImageProperties.h>, such as kCGImagePropertyOrientation, kCGImagePropertyExifDictionary, kCGImagePropertyMakerAppleDictionary, etc.
2489 #[unsafe(method(metadata))]
2490 #[unsafe(method_family = none)]
2491 pub unsafe fn metadata(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
2492
2493 #[cfg(feature = "AVCameraCalibrationData")]
2494 /// An AVCameraCalibrationData object representing the calibration information for the camera providing the photo.
2495 ///
2496 ///
2497 /// Camera calibration data is only present if you set AVCapturePhotoSettings.setCameraCalibrationDataDeliveryEnabled to YES. When requesting virtual device constituent photo delivery plus cameraCalibrationDataDeliveryEnabled, camera calibration information is delivered with all resultant photos and is specific to the constituent device producing that photo.
2498 #[unsafe(method(cameraCalibrationData))]
2499 #[unsafe(method_family = none)]
2500 pub unsafe fn cameraCalibrationData(&self) -> Option<Retained<AVCameraCalibrationData>>;
2501
2502 /// The AVCaptureResolvedPhotoSettings associated with all photo results for a given -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] request.
2503 ///
2504 ///
2505 /// Even in the event of an error, the resolved settings are always non nil.
2506 #[unsafe(method(resolvedSettings))]
2507 #[unsafe(method_family = none)]
2508 pub unsafe fn resolvedSettings(&self) -> Retained<AVCaptureResolvedPhotoSettings>;
2509
2510 /// This photo's index (1-based) in the total expected photo count.
2511 ///
2512 ///
2513 /// The resolvedSettings.expectedPhotoCount property indicates the total number of images that will be returned for a given capture request. This property indicates this photo's index (1-based). When you receive a -captureOutput:didFinishProcessingPhoto:error: callback with a photo whose photoCount matches resolvedSettings.expectedPhotoCount, you know you've received the last one for the given capture request.
2514 #[unsafe(method(photoCount))]
2515 #[unsafe(method_family = none)]
2516 pub unsafe fn photoCount(&self) -> NSInteger;
2517
2518 #[cfg(feature = "AVCaptureDevice")]
2519 /// The device type of the source camera providing the photo.
2520 ///
2521 ///
2522 /// When taking a virtual device constituent photo capture, you may query this property to find out the source type of the photo. For instance, on a DualCamera, resulting photos will be of sourceDeviceType AVCaptureDeviceTypeBuiltInWideCamera, or AVCaptureDeviceTypeBuiltInTelephotoCamera. For all other types of capture, the source device type is equal to the -[AVCaptureDevice deviceType] of the AVCaptureDevice to which the AVCapturePhotoOutput is connected. Returns nil if the source of the photo is not an AVCaptureDevice.
2523 #[unsafe(method(sourceDeviceType))]
2524 #[unsafe(method_family = none)]
2525 pub unsafe fn sourceDeviceType(&self) -> Option<Retained<AVCaptureDeviceType>>;
2526
2527 #[cfg(feature = "objc2-core-video")]
2528 /// Returns a pixel buffer with the same aspect ratio as the constant color photo, where each pixel value (unsigned 8-bit integer) indicates how fully the constant color effect has been achieved in the corresponding region of the constant color photo -- 255 means full confidence, 0 means zero confidence.
2529 ///
2530 ///
2531 /// NULL is returned for any non constant color photos.
2532 #[unsafe(method(constantColorConfidenceMap))]
2533 #[unsafe(method_family = none)]
2534 pub unsafe fn constantColorConfidenceMap(&self) -> Option<Retained<CVPixelBuffer>>;
2535
2536 /// Returns a score summarizing the overall confidence level of a constant color photo -- 1.0 means full confidence, 0.0 means zero confidence.
2537 ///
2538 ///
2539 /// Default is 0.0.
2540 ///
2541 /// In most use cases (document scanning for example), the central region of the photo is considered more important than the peripherals, therefore the confidence level of the central pixels are weighted more heavily than pixels on the edges of the photo.
2542 ///
2543 /// Use constantColorConfidenceMap for more use case specific analyses of the confidence level.
2544 #[unsafe(method(constantColorCenterWeightedMeanConfidenceLevel))]
2545 #[unsafe(method_family = none)]
2546 pub unsafe fn constantColorCenterWeightedMeanConfidenceLevel(&self) -> c_float;
2547
2548 /// Indicates whether this photo is a fallback photo for a constant color capture.
2549 #[unsafe(method(isConstantColorFallbackPhoto))]
2550 #[unsafe(method_family = none)]
2551 pub unsafe fn isConstantColorFallbackPhoto(&self) -> bool;
2552 );
2553}
2554
2555/// AVCapturePhotoConversions.
2556impl AVCapturePhoto {
2557 extern_methods!(
2558 /// Flattens the AVCapturePhoto to an NSData using the file container format (processedFileType or rawFileType) specified in the AVCapturePhotoSettings (e.g. JFIF, HEIF, DNG).
2559 ///
2560 ///
2561 /// Returns: An NSData containing bits in the file container's format, or nil if the flattening process fails.
2562 #[unsafe(method(fileDataRepresentation))]
2563 #[unsafe(method_family = none)]
2564 pub unsafe fn fileDataRepresentation(&self) -> Option<Retained<NSData>>;
2565
2566 /// Flattens the AVCapturePhoto to an NSData using the file container format (processedFileType or rawFileType) specified in the AVCapturePhotoSettings (e.g. JFIF, HEIF, DNG), and allows you to strip or replace various pieces of metadata in the process.
2567 ///
2568 ///
2569 /// Parameter `customizer`: An object conforming to the AVCapturePhotoFileDataRepresentationCustomizer protocol that will be called synchronously to provide customization of metadata written to the container format. An NSInvalidArgumentException is thrown if you pass nil.
2570 ///
2571 /// Returns: An NSData containing bits in the file container's format, or nil if the flattening process fails.
2572 #[unsafe(method(fileDataRepresentationWithCustomizer:))]
2573 #[unsafe(method_family = none)]
2574 pub unsafe fn fileDataRepresentationWithCustomizer(
2575 &self,
2576 customizer: &ProtocolObject<dyn AVCapturePhotoFileDataRepresentationCustomizer>,
2577 ) -> Option<Retained<NSData>>;
2578
2579 #[cfg(all(feature = "AVDepthData", feature = "objc2-core-video"))]
2580 /// Flattens the AVCapturePhoto to an NSData using the file container format (processedFileType or rawFileType) specified in the AVCapturePhotoSettings (e.g. JFIF, HEIF, DNG), and allows you to replace metadata, thumbnail, and depth data in the process.
2581 ///
2582 ///
2583 /// Parameter `replacementMetadata`: A dictionary of keys and values from
2584 /// <ImageIO
2585 /// /CGImageProperties.h>. To preserve existing metadata to the file, pass self.metadata. To strip existing metadata, pass nil. To replace metadata, pass a replacement dictionary.
2586 ///
2587 /// Parameter `replacementEmbeddedThumbnailPhotoFormat`: A dictionary of keys and values from
2588 /// <AVFoundation
2589 /// /AVVideoSettings.h>. If you pass a non-nil dictionary, AVVideoCodecKey is required, with AVVideoWidthKey and AVVideoHeightKey being optional. To preserve the existing embedded thumbnail photo to the file, pass self.embeddedThumbnailPhotoFormat and pass nil as your replacementEmbeddedThumbnailPixelBuffer parameter. To strip the existing embedded thumbnail, pass nil for both replacementEmbeddedThumbnailPhotoFormat and replacementEmbeddedThumbnailPixelBuffer. To replace the existing embedded thumbnail photo, pass both a non-nil replacementThumbnailPixelBuffer and replacementEmbeddedThumbnailPhotoFormat dictionary.
2590 ///
2591 /// Parameter `replacementEmbeddedThumbnailPixelBuffer`: A pixel buffer containing a source image to be encoded to the file as the replacement thumbnail image. To preserve the existing embedded thumbnail photo to the file, pass self.embeddedThumbnailPhotoFormat as your replacementEmbeddedThumbnailPhotoFormat parameter and nil as your replacementEmbeddedThumbnailPixelBuffer parameter. To strip the existing embedded thumbnail, pass nil for both replacementEmbeddedThumbnailPhotoFormat and replacementEmbeddedThumbnailPixelBuffer. To replace the existing embedded thumbnail photo, pass both a non-nil replacementThumbnailPixelBuffer and replacementEmbeddedThumbnailPhotoFormat dictionary.
2592 ///
2593 /// Parameter `replacementDepthData`: Replacement depth data to be written to the flattened file container. To preserve existing depth data to the file, pass self.depthData. To strip it, pass nil. To replace it, pass a new AVDepthData instance.
2594 ///
2595 /// Returns: An NSData containing bits in the file container's format, or nil if the flattening process fails.
2596 #[deprecated]
2597 #[unsafe(method(fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:))]
2598 #[unsafe(method_family = none)]
2599 pub unsafe fn fileDataRepresentationWithReplacementMetadata_replacementEmbeddedThumbnailPhotoFormat_replacementEmbeddedThumbnailPixelBuffer_replacementDepthData(
2600 &self,
2601 replacement_metadata: Option<&NSDictionary<NSString, AnyObject>>,
2602 replacement_embedded_thumbnail_photo_format: Option<&NSDictionary<NSString, AnyObject>>,
2603 replacement_embedded_thumbnail_pixel_buffer: Option<&CVPixelBuffer>,
2604 replacement_depth_data: Option<&AVDepthData>,
2605 ) -> Option<Retained<NSData>>;
2606
2607 #[cfg(feature = "objc2-core-graphics")]
2608 /// Utility method that converts the AVCapturePhoto's primary photo to a CGImage.
2609 ///
2610 ///
2611 /// Returns: A CGImageRef, or nil if the conversion process fails.
2612 ///
2613 ///
2614 /// Each time you access this method, AVCapturePhoto generates a new CGImageRef. When backed by a compressed container (such as HEIC), the CGImageRepresentation is decoded lazily as needed. When backed by an uncompressed format such as BGRA, it is copied into a separate backing buffer whose lifetime is not tied to that of the AVCapturePhoto. For a 12 megapixel image, a BGRA CGImage represents ~48 megabytes per call. If you only intend to use the CGImage for on-screen rendering, use the previewCGImageRepresentation instead. Note that the physical rotation of the CGImageRef matches that of the main image. Exif orientation has not been applied. If you wish to apply rotation when working with UIImage, you can do so by querying the photo's metadata[kCGImagePropertyOrientation] value, and passing it as the orientation parameter to +[UIImage imageWithCGImage:scale:orientation:]. RAW images always return a CGImageRepresentation of nil. If you wish to make a CGImageRef from a RAW image, use CIRAWFilter in the CoreImage framework.
2615 #[unsafe(method(CGImageRepresentation))]
2616 #[unsafe(method_family = none)]
2617 pub unsafe fn CGImageRepresentation(&self) -> Option<Retained<CGImage>>;
2618
2619 #[cfg(feature = "objc2-core-graphics")]
2620 /// Utility method that converts the AVCapturePhoto's preview photo to a CGImage.
2621 ///
2622 ///
2623 /// Returns: A CGImageRef, or nil if the conversion process fails, or if you did not request a preview photo.
2624 ///
2625 ///
2626 /// Each time you access this method, AVCapturePhoto generates a new CGImageRef. This CGImageRepresentation is a RGB rendering of the previewPixelBuffer property. If you did not request a preview photo by setting the -[AVCapturePhotoSettings previewPhotoFormat] property, this method returns nil. Note that the physical rotation of the CGImageRef matches that of the main image. Exif orientation has not been applied. If you wish to apply rotation when working with UIImage, you can do so by querying the photo's metadata[kCGImagePropertyOrientation] value, and passing it as the orientation parameter to +[UIImage imageWithCGImage:scale:orientation:].
2627 #[unsafe(method(previewCGImageRepresentation))]
2628 #[unsafe(method_family = none)]
2629 pub unsafe fn previewCGImageRepresentation(&self) -> Option<Retained<CGImage>>;
2630 );
2631}
2632
2633/// Constants indicating the status of the lens stabilization module (aka OIS).
2634///
2635///
2636/// Indicates that lens stabilization is unsupported.
2637///
2638/// Indicates that lens stabilization was not in use for this capture.
2639///
2640/// Indicates that the lens stabilization module was active for the duration of the capture.
2641///
2642/// Indicates that device motion or capture duration exceeded the stabilization module's correction limits.
2643///
2644/// Indicates that the lens stabilization module was unavailable for use at the time of capture. The module may be available in subsequent captures.
2645///
2646/// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturelensstabilizationstatus?language=objc)
2647// NS_ENUM
2648#[repr(transparent)]
2649#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
2650pub struct AVCaptureLensStabilizationStatus(pub NSInteger);
2651impl AVCaptureLensStabilizationStatus {
2652 #[doc(alias = "AVCaptureLensStabilizationStatusUnsupported")]
2653 pub const Unsupported: Self = Self(0);
2654 #[doc(alias = "AVCaptureLensStabilizationStatusOff")]
2655 pub const Off: Self = Self(1);
2656 #[doc(alias = "AVCaptureLensStabilizationStatusActive")]
2657 pub const Active: Self = Self(2);
2658 #[doc(alias = "AVCaptureLensStabilizationStatusOutOfRange")]
2659 pub const OutOfRange: Self = Self(3);
2660 #[doc(alias = "AVCaptureLensStabilizationStatusUnavailable")]
2661 pub const Unavailable: Self = Self(4);
2662}
2663
2664unsafe impl Encode for AVCaptureLensStabilizationStatus {
2665 const ENCODING: Encoding = NSInteger::ENCODING;
2666}
2667
2668unsafe impl RefEncode for AVCaptureLensStabilizationStatus {
2669 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
2670}
2671
2672/// AVCapturePhotoBracketedCapture.
2673impl AVCapturePhoto {
2674 extern_methods!(
2675 #[cfg(feature = "AVCaptureStillImageOutput")]
2676 /// The AVCaptureBracketedStillImageSettings associated with this photo.
2677 ///
2678 ///
2679 /// When specifying a bracketed capture using AVCapturePhotoBracketSettings, you specify an array of AVCaptureBracketedStillImageSettings -- one per image in the bracket. This property indicates the AVCaptureBracketedStillImageSettings associated with this particular photo, or nil if this photo is not part of a bracketed capture.
2680 #[unsafe(method(bracketSettings))]
2681 #[unsafe(method_family = none)]
2682 pub unsafe fn bracketSettings(
2683 &self,
2684 ) -> Option<Retained<AVCaptureBracketedStillImageSettings>>;
2685
2686 /// 1-based sequence count of the photo.
2687 ///
2688 ///
2689 /// If this photo is part of a bracketed capture (invoked using AVCapturePhotoBracketSettings), this property indicates the current result's count in the sequence, starting with 1 for the first result, or 0 if this photo is not part of a bracketed capture.
2690 #[unsafe(method(sequenceCount))]
2691 #[unsafe(method_family = none)]
2692 pub unsafe fn sequenceCount(&self) -> NSInteger;
2693
2694 /// The status of the lens stabilization module during capture of this photo.
2695 ///
2696 ///
2697 /// In configurations where lens stabilization (OIS) is unsupported, AVCaptureLensStabilizationStatusUnsupported is returned. If lens stabilization is supported, but this photo is not part of a bracketed capture in which -[AVCapturePhotoBracketSettings setLensStabilizationEnabled:YES] was called, AVCaptureLensStabilizationStatusOff is returned. Otherwise a lens stabilization status is returned indicating how lens stabilization was applied during the capture.
2698 #[unsafe(method(lensStabilizationStatus))]
2699 #[unsafe(method_family = none)]
2700 pub unsafe fn lensStabilizationStatus(&self) -> AVCaptureLensStabilizationStatus;
2701 );
2702}
2703
2704extern_class!(
2705 /// A lightly-processed photo whose data may be used to process and fetch a higher-resolution asset at a later time.
2706 ///
2707 ///
2708 /// An AVCaptureDeferredPhotoProxy behaves like a normal AVCapturePhoto, and approximates the look of the final rendered image. This object represents intermediate data that can be rendered into a final image and ingested into the user's photo library via PHAsset APIs. The intermediate data are not accessible by the calling process.
2709 ///
2710 /// Use a PHAssetCreationRequest with a resourceType of PHAssetResourceTypePhotoProxy using the fileDataRepresentation of this object. Image processing to finalize the asset will occur either on-demand when accessing the image data via PHImageManager or PHAssetResource, or will execute in the background when the system has determined that it's a good time to process based on thermals, battery level, and other conditions. If the data provided to the PHAssetCreationRequest does not come from an AVCaptureDeferredPhotoProxy, then PHAssetCreationRequest will fail and a PHPhotosErrorInvalidResource error will be returned.
2711 ///
2712 /// Below is a discussion of how the superclass properties behave on an AVCaptureDeferredPhotoProxy.
2713 ///
2714 /// The time of the capture; proxy and final photos will have the same timestamp.
2715 ///
2716 ///
2717 /// The metadata of the proxy image may differ slightly from the final photo's metadata where some fields may be updated.
2718 ///
2719 ///
2720 /// Always NO, as deferred processing isn't available for raw photos.
2721 ///
2722 ///
2723 /// Describes the embedded thumbnail format of both the proxy and the final photo which have the same dimensions and codec.
2724 ///
2725 ///
2726 /// Describes the resolved settings of the whole capture, including the proxy and final photo. See AVCaptureResolvedPhotoSettings.deferredPhotoProxyDimensions.
2727 ///
2728 ///
2729 /// Same for both proxy and final.
2730 ///
2731 ///
2732 /// Same for both proxy and final.
2733 ///
2734 ///
2735 /// Same for both proxy and final.
2736 ///
2737 ///
2738 /// Same for both proxy and final.
2739 ///
2740 ///
2741 /// Same for both proxy and final.
2742 ///
2743 /// Superclass properties/methods that behave differently than a typical AVCapturePhoto:
2744 ///
2745 ///
2746 /// - (nullable CGImageRef)CGImageRepresentation;
2747 /// - (nullable CGImageRef)previewCGImageRepresentation;
2748 /// All of the above properties return the same proxy image, either as a pixel buffer or CGImageRef.
2749 ///
2750 /// - (nullable NSData *)fileDataRepresentation;
2751 /// - (nullable NSData *)fileDataRepresentationWithCustomizer:(id
2752 /// <AVCapturePhotoFileDataRepresentationCustomizer
2753 /// >)customizer;
2754 /// You may call either of the above two methods to create a NSData representation of the image, but note that it is only the proxy image quality being packaged.
2755 ///
2756 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedeferredphotoproxy?language=objc)
2757 #[unsafe(super(AVCapturePhoto, NSObject))]
2758 #[derive(Debug, PartialEq, Eq, Hash)]
2759 pub struct AVCaptureDeferredPhotoProxy;
2760);
2761
2762extern_conformance!(
2763 unsafe impl NSObjectProtocol for AVCaptureDeferredPhotoProxy {}
2764);
2765
2766impl AVCaptureDeferredPhotoProxy {
2767 extern_methods!(
2768 #[unsafe(method(init))]
2769 #[unsafe(method_family = init)]
2770 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2771
2772 #[unsafe(method(new))]
2773 #[unsafe(method_family = new)]
2774 pub unsafe fn new() -> Retained<Self>;
2775 );
2776}
2777
2778extern_protocol!(
2779 /// A set of delegate callbacks to be implemented by a client who calls AVCapturePhoto's -fileDataRepresentationWithCustomizer:.
2780 ///
2781 ///
2782 /// AVCapturePhoto is a wrapper representing a file-containerized photo in memory. If you simply wish to flatten the photo to an NSData to be written to a file, you may call -[AVCapturePhoto fileDataRepresentation]. For more complex flattening operations in which you wish to replace or strip metadata, you should call -[AVCapturePhoto fileDataRepresentationWithCustomizer:] instead, providing a delegate for customized stripping / replacing behavior. This delegate's methods are called synchronously before the flattening process commences.
2783 ///
2784 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturephotofiledatarepresentationcustomizer?language=objc)
2785 pub unsafe trait AVCapturePhotoFileDataRepresentationCustomizer:
2786 NSObjectProtocol
2787 {
2788 /// A callback in which you may provide replacement metadata, or direct the AVCapturePhoto to strip existing metadata from the flattened file data representation.
2789 ///
2790 ///
2791 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2792 ///
2793 /// Returns: A dictionary of keys and values from
2794 /// <ImageIO
2795 /// /CGImageProperties.h>. To preserve existing metadata, return photo.metadata. To strip existing metadata, return nil. To replace metadata, pass a replacement dictionary.
2796 ///
2797 ///
2798 /// This callback is optional. If your delegate does not implement this callback, the existing metadata in the in-memory AVCapturePhoto container will be written to the file data representation.
2799 #[optional]
2800 #[unsafe(method(replacementMetadataForPhoto:))]
2801 #[unsafe(method_family = none)]
2802 unsafe fn replacementMetadataForPhoto(
2803 &self,
2804 photo: &AVCapturePhoto,
2805 ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
2806
2807 #[cfg(feature = "objc2-core-video")]
2808 /// A callback in which you may provide a replacement embedded thumbnail image with compression settings, or strip the existing embedded thumbnail image from the flattened file data representation.
2809 ///
2810 ///
2811 /// Parameter `replacementEmbeddedThumbnailPhotoFormatOut`: On output, a pointer to a dictionary of keys and values from
2812 /// <AVFoundation
2813 /// /AVVideoSettings.h> If you pass a non-nil dictionary, AVVideoCodecKey is required, with AVVideoWidthKey and AVVideoHeightKey being optional. To preserve the existing embedded thumbnail photo to the flattened data, set *replacementEmbeddedThumbnailPhotoFormatOut to photo.embeddedThumbnailPhotoFormat and return nil. To strip the existing embedded thumbnail, set *replacementEmbeddedThumbnailPhotoFormatOut to nil and return nil. To replace the existing embedded thumbnail photo, pass a replacement photo format dictionary and return a non-nil replacement pixel buffer.
2814 ///
2815 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2816 ///
2817 /// Returns: A pixel buffer containing a source image to be encoded to the file as the replacement thumbnail image. To preserve the existing embedded thumbnail photo to the flattened data, set *replacementEmbeddedThumbnailPhotoFormatOut to photo.embeddedThumbnailPhotoFormat and return nil. To strip the existing embedded thumbnail, set *replacementEmbeddedThumbnailPhotoFormatOut to nil and return nil. To replace the existing embedded thumbnail photo, pass a replacement photo format dictionary and return a non-nil replacement pixel buffer.
2818 ///
2819 ///
2820 /// This callback is optional. If your delegate does not implement this callback, the existing embedded thumbnail photo in the in-memory AVCapturePhoto container will be written to the file data representation.
2821 #[optional]
2822 #[unsafe(method(replacementEmbeddedThumbnailPixelBufferWithPhotoFormat:forPhoto:))]
2823 #[unsafe(method_family = none)]
2824 unsafe fn replacementEmbeddedThumbnailPixelBufferWithPhotoFormat_forPhoto(
2825 &self,
2826 replacement_embedded_thumbnail_photo_format_out: &mut Option<
2827 Retained<NSDictionary<NSString, AnyObject>>,
2828 >,
2829 photo: &AVCapturePhoto,
2830 ) -> Option<Retained<CVPixelBuffer>>;
2831
2832 #[cfg(feature = "AVDepthData")]
2833 /// A callback in which you may provide replacement depth data, or strip the existing depth data from the flattened file data representation.
2834 ///
2835 ///
2836 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2837 ///
2838 /// Returns: An instance of AVDepthData. To preserve the existing depth data, return photo.depthData. To strip the existing one, return nil. To replace, provide a replacement AVDepthData instance.
2839 ///
2840 ///
2841 /// This callback is optional. If your delegate does not implement this callback, the existing depth data in the in-memory AVCapturePhoto container will be written to the file data representation.
2842 #[optional]
2843 #[unsafe(method(replacementDepthDataForPhoto:))]
2844 #[unsafe(method_family = none)]
2845 unsafe fn replacementDepthDataForPhoto(
2846 &self,
2847 photo: &AVCapturePhoto,
2848 ) -> Option<Retained<AVDepthData>>;
2849
2850 #[cfg(feature = "AVPortraitEffectsMatte")]
2851 /// A callback in which you may provide a replacement portrait effects matte, or strip the existing portrait effects matte from the flattened file data representation.
2852 ///
2853 ///
2854 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2855 ///
2856 /// Returns: An instance of AVPortraitEffectsMatte. To preserve the existing portrait effects matte, return photo.portraitEffectsMatte. To strip the existing one, return nil. To replace, provide a replacement AVPortraitEffectsMatte instance.
2857 ///
2858 ///
2859 /// This callback is optional. If your delegate does not implement this callback, the existing portrait effects matte in the in-memory AVCapturePhoto container will be written to the file data representation.
2860 #[optional]
2861 #[unsafe(method(replacementPortraitEffectsMatteForPhoto:))]
2862 #[unsafe(method_family = none)]
2863 unsafe fn replacementPortraitEffectsMatteForPhoto(
2864 &self,
2865 photo: &AVCapturePhoto,
2866 ) -> Option<Retained<AVPortraitEffectsMatte>>;
2867
2868 #[cfg(feature = "AVSemanticSegmentationMatte")]
2869 /// A callback in which you may provide a replacement semantic segmentation matte of the indicated type, or strip the existing one from the flattened file data representation.
2870 ///
2871 ///
2872 /// Parameter `semanticSegmentationMatteType`: The type of semantic segmentation matte to be replaced or stripped.
2873 ///
2874 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2875 ///
2876 /// Returns: An instance of AVSemanticSegmentationMatte. To preserve the existing matte, return [photo semanticSegmentationMatteForType:semanticSegmentationMatteType]. To strip the existing one, return nil. To replace, provide a replacement AVPortraitEffectsMatte instance.
2877 ///
2878 ///
2879 /// This callback is optional. If your delegate does not implement this callback, the existing semantic segmentation matte of the specified type in the in-memory AVCapturePhoto container will be written to the file data representation.
2880 #[optional]
2881 #[unsafe(method(replacementSemanticSegmentationMatteOfType:forPhoto:))]
2882 #[unsafe(method_family = none)]
2883 unsafe fn replacementSemanticSegmentationMatteOfType_forPhoto(
2884 &self,
2885 semantic_segmentation_matte_type: &AVSemanticSegmentationMatteType,
2886 photo: &AVCapturePhoto,
2887 ) -> Option<Retained<AVSemanticSegmentationMatte>>;
2888
2889 /// A callback in which you may provide replacement compression settings for the DNG flattened file data representation of Apple ProRAW. This callback will only be invoked for Apple ProRAW captures written to DNG.
2890 ///
2891 ///
2892 /// Parameter `photo`: The calling instance of AVCapturePhoto.
2893 ///
2894 /// Parameter `defaultSettings`: The default settings that will be used if not overridden.
2895 ///
2896 /// Parameter `maximumBitDepth`: The maximum bit depth that can be specified with AVVideoAppleProRAWBitDepthKey in the returned settings dictionary.
2897 ///
2898 /// Returns: An NSDictionary containing compression settings to be used when writing the DNG file representation. Currently accepted keys are:
2899 /// AVVideoQualityKey (NSNumber in range 0 to 1.0, inclusive)
2900 /// AVVideoAppleProRAWBitDepthKey (NSNumber in range 8 to maximumBitDepth, inclusive)
2901 /// Setting AVVideoQualityKey to 1.0 will use lossless compression. Any value between 0 and 1.0 will use lossy compression with that quality.
2902 /// Setting AVVideoAppleProRAWBitDepthKey to a value less than what is given in defaultSettings may result in quantization losses.
2903 /// Any keys not specified in the returned dictionary will use the values from defaultSettings. Return defaultSettings if no changes to the compression settings are desired.
2904 ///
2905 ///
2906 /// This callback is optional. If your delegate does not implement this callback, the default compression settings for the file type will be used.
2907 #[optional]
2908 #[unsafe(method(replacementAppleProRAWCompressionSettingsForPhoto:defaultSettings:maximumBitDepth:))]
2909 #[unsafe(method_family = none)]
2910 unsafe fn replacementAppleProRAWCompressionSettingsForPhoto_defaultSettings_maximumBitDepth(
2911 &self,
2912 photo: &AVCapturePhoto,
2913 default_settings: &NSDictionary<NSString, AnyObject>,
2914 maximum_bit_depth: NSInteger,
2915 ) -> Retained<NSDictionary<NSString, AnyObject>>;
2916 }
2917);