objc2-av-foundation 0.3.2

Bindings to the AVFoundation framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "dispatch2")]
use dispatch2::*;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// AVCaptureVideoDataOutput is a concrete subclass of AVCaptureOutput that can be used to process uncompressed or compressed frames from the video being captured.
    ///
    ///
    /// Instances of AVCaptureVideoDataOutput produce video frames suitable for processing using other media APIs. Applications can access the frames with the captureOutput:didOutputSampleBuffer:fromConnection: delegate method.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideodataoutput?language=objc)
    #[unsafe(super(AVCaptureOutput, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AVCaptureOutputBase")]
    pub struct AVCaptureVideoDataOutput;
);

#[cfg(feature = "AVCaptureOutputBase")]
extern_conformance!(
    unsafe impl NSObjectProtocol for AVCaptureVideoDataOutput {}
);

#[cfg(feature = "AVCaptureOutputBase")]
impl AVCaptureVideoDataOutput {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[cfg(feature = "dispatch2")]
        /// Sets the receiver's delegate that will accept captured buffers and dispatch queue on which the delegate will be called.
        ///
        ///
        /// Parameter `sampleBufferDelegate`: An object conforming to the AVCaptureVideoDataOutputSampleBufferDelegate protocol that will receive sample buffers after they are captured.
        ///
        /// Parameter `sampleBufferCallbackQueue`: A dispatch queue on which all sample buffer delegate methods will be called.
        ///
        ///
        /// When a new video sample buffer is captured it will be vended to the sample buffer delegate using the captureOutput:didOutputSampleBuffer:fromConnection: delegate method. All delegate methods will be called on the specified dispatch queue. If the queue is blocked when new frames are captured, those frames will be automatically dropped at a time determined by the value of the alwaysDiscardsLateVideoFrames property. This allows clients to process existing frames on the same queue without having to manage the potential memory usage increases that would otherwise occur when that processing is unable to keep up with the rate of incoming frames. If their frame processing is consistently unable to keep up with the rate of incoming frames, clients should consider using the minFrameDuration property, which will generally yield better performance characteristics and more consistent frame rates than frame dropping alone.
        ///
        /// Clients that need to minimize the chances of frames being dropped should specify a queue on which a sufficiently small amount of processing is being done outside of receiving sample buffers. However, if such clients migrate extra processing to another queue, they are responsible for ensuring that memory usage does not grow without bound from frames that have not been processed.
        ///
        /// A serial dispatch queue must be used to guarantee that video frames will be delivered in order. The sampleBufferCallbackQueue parameter may not be NULL, except when setting the sampleBufferDelegate to nil otherwise -setSampleBufferDelegate:queue: throws an NSInvalidArgumentException.
        ///
        /// # Safety
        ///
        /// `sample_buffer_callback_queue` possibly has additional threading requirements.
        #[unsafe(method(setSampleBufferDelegate:queue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSampleBufferDelegate_queue(
            &self,
            sample_buffer_delegate: Option<
                &ProtocolObject<dyn AVCaptureVideoDataOutputSampleBufferDelegate>,
            >,
            sample_buffer_callback_queue: Option<&DispatchQueue>,
        );

        /// The receiver's delegate.
        ///
        ///
        /// The value of this property is an object conforming to the AVCaptureVideoDataOutputSampleBufferDelegate protocol that will receive sample buffers after they are captured. The delegate is set using the setSampleBufferDelegate:queue: method.
        #[unsafe(method(sampleBufferDelegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn sampleBufferDelegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn AVCaptureVideoDataOutputSampleBufferDelegate>>>;

        #[cfg(feature = "dispatch2")]
        /// The dispatch queue on which all sample buffer delegate methods will be called.
        ///
        ///
        /// The value of this property is a dispatch_queue_t. The queue is set using the setSampleBufferDelegate:queue: method.
        #[unsafe(method(sampleBufferCallbackQueue))]
        #[unsafe(method_family = none)]
        pub unsafe fn sampleBufferCallbackQueue(&self) -> Option<Retained<DispatchQueue>>;

        /// Specifies the settings used to decode or re-encode video before it is output by the receiver.
        ///
        ///
        /// See AVVideoSettings.h for more information on how to construct a video settings dictionary. To receive samples in their device native format, set this property to an empty dictionary (i.e. [NSDictionary dictionary]). To receive samples in a default uncompressed format, set this property to nil. Note that after this property is set to nil, subsequent querying of this property will yield a non-nil dictionary reflecting the settings used by the AVCaptureSession's current sessionPreset.
        ///
        /// On iOS versions prior to iOS 16.0, the only supported key is kCVPixelBufferPixelFormatTypeKey. Use -availableVideoCVPixelFormatTypes for the list of supported pixel formats. For apps linked on or after iOS 16.0, kCVPixelBufferPixelFormatTypeKey, kCVPixelBufferWidthKey, and kCVPixelBufferHeightKey are supported. The width and height must match the videoOrientation specified on the output's AVCaptureConnection or an NSInvalidArgumentException is thrown. The aspect ratio of width and height must match the aspect ratio of the source's activeFormat (corrected for the connection's videoOrientation) or an NSInvalidArgumentException is thrown. If width or height exceeds the source's activeFormat's width or height, an NSInvalidArgumentException is thrown. Changing width and height when deliversPreviewSizedOutputBuffers is set to YES is not supported and throws an NSInvalidArgumentException.
        #[unsafe(method(videoSettings))]
        #[unsafe(method_family = none)]
        pub unsafe fn videoSettings(&self) -> Retained<NSDictionary<NSString, AnyObject>>;

        /// Setter for [`videoSettings`][Self::videoSettings].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `video_settings` generic should be of the correct type.
        #[unsafe(method(setVideoSettings:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVideoSettings(
            &self,
            video_settings: Option<&NSDictionary<NSString, AnyObject>>,
        );

        #[cfg(feature = "AVMediaFormat")]
        /// Specifies the recommended settings for use with an AVAssetWriterInput.
        ///
        ///
        /// Parameter `outputFileType`: Specifies the UTI of the file type to be written (see AVMediaFormat.h for a list of file format UTIs).
        ///
        /// Returns: A fully populated dictionary of keys and values that are compatible with AVAssetWriter.
        ///
        ///
        /// The value of this property is an NSDictionary containing values for compression settings keys defined in AVVideoSettings.h. This dictionary is suitable for use as the "outputSettings" parameter when creating an AVAssetWriterInput, such as,
        ///
        /// [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:outputSettings sourceFormatHint:hint];
        ///
        /// The dictionary returned contains all necessary keys and values needed by AVAssetWriter (see AVAssetWriterInput.h, -initWithMediaType:outputSettings: for a more in depth discussion). For QuickTime movie and ISO file types, the recommended video settings will produce output comparable to that of AVCaptureMovieFileOutput.
        ///
        /// Note that the dictionary of settings is dependent on the current configuration of the receiver's AVCaptureSession and its inputs. The settings dictionary may change if the session's configuration changes. As such, you should configure your session first, then query the recommended video settings. As of iOS 8.3, movies produced with these settings successfully import into the iOS camera roll and sync to and from like devices via iTunes.
        #[unsafe(method(recommendedVideoSettingsForAssetWriterWithOutputFileType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedVideoSettingsForAssetWriterWithOutputFileType(
            &self,
            output_file_type: &AVFileType,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "AVMediaFormat", feature = "AVVideoSettings"))]
        /// Specifies the available video codecs for use with AVAssetWriter and a given file type.
        ///
        ///
        /// Parameter `outputFileType`: Specifies the UTI of the file type to be written (see AVMediaFormat.h for a list of file format UTIs).
        ///
        /// Returns: An array of video codecs; see AVVideoSettings.h for a full list.
        ///
        ///
        /// This method allows you to query the available video codecs that may be used when specifying an AVVideoCodecKey in -recommendedVideoSettingsForVideoCodecType:assetWriterOutputFileType:. When specifying an outputFileType of AVFileTypeQuickTimeMovie, video codecs are ordered identically to -[AVCaptureMovieFileOutput availableVideoCodecTypes].
        #[unsafe(method(availableVideoCodecTypesForAssetWriterWithOutputFileType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableVideoCodecTypesForAssetWriterWithOutputFileType(
            &self,
            output_file_type: &AVFileType,
        ) -> Retained<NSArray<AVVideoCodecType>>;

        #[cfg(all(feature = "AVMediaFormat", feature = "AVVideoSettings"))]
        /// Specifies the recommended settings for a particular video codec type, to be used with an AVAssetWriterInput.
        ///
        ///
        /// Parameter `videoCodecType`: Specifies the desired AVVideoCodecKey to be used for compression (see AVVideoSettings.h).
        ///
        /// Parameter `outputFileType`: Specifies the UTI of the file type to be written (see AVMediaFormat.h for a list of file format UTIs).
        ///
        /// Returns: A fully populated dictionary of keys and values that are compatible with AVAssetWriter.
        ///
        ///
        /// The value of this property is an NSDictionary containing values for compression settings keys defined in AVVideoSettings.h. This dictionary is suitable for use as the "outputSettings" parameter when creating an AVAssetWriterInput, such as,
        ///
        /// [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:outputSettings sourceFormatHint:hint];
        ///
        /// The dictionary returned contains all necessary keys and values needed by AVAssetWriter (see AVAssetWriterInput.h, -initWithMediaType:outputSettings: for a more in depth discussion). For QuickTime movie and ISO file types, the recommended video settings will produce output comparable to that of AVCaptureMovieFileOutput.
        ///
        /// The videoCodecType string provided must be present in the availableVideoCodecTypesForAssetWriterWithOutputFileType: array, or an NSInvalidArgumentException is thrown.
        ///
        /// Note that the dictionary of settings is dependent on the current configuration of the receiver's AVCaptureSession and its inputs. The settings dictionary may change if the session's configuration changes. As such, you should configure your session first, then query the recommended video settings. As of iOS 8.3, movies produced with these settings successfully import into the iOS camera roll and sync to and from like devices via iTunes.
        #[unsafe(method(recommendedVideoSettingsForVideoCodecType:assetWriterOutputFileType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedVideoSettingsForVideoCodecType_assetWriterOutputFileType(
            &self,
            video_codec_type: &AVVideoCodecType,
            output_file_type: &AVFileType,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "AVMediaFormat", feature = "AVVideoSettings"))]
        /// Specifies the recommended settings for a particular video codec type with output file URL, to be used with an AVAssetWriterInput.
        ///
        ///
        /// Parameter `videoCodecType`: Specifies the desired AVVideoCodecKey to be used for compression (see AVVideoSettings.h).
        ///
        /// Parameter `outputFileType`: Specifies the UTI of the file type to be written (see AVMediaFormat.h for a list of file format UTIs).
        ///
        /// Parameter `outputFileURL`: Specifies the output URL of the file to be written.
        ///
        /// If you wish to capture onto an external storage device get an externalStorageDevice of type AVExternalStorageDevice (as defined in AVExternalStorageDevice.h):
        /// [AVExternalStorageDeviceDiscoverySession sharedSession] externalStorageDevices]
        ///
        /// Then use [externalStorageDevice nextAvailableURLsWithPathExtensions:pathExtensions error:
        /// &error
        /// ] to get the output file URL.
        ///
        ///
        /// Returns: A fully populated dictionary of keys and values that are compatible with AVAssetWriter.
        ///
        ///
        /// The value of this property is an NSDictionary containing values for compression settings keys defined in AVVideoSettings.h. This dictionary is suitable for use as the "outputSettings" parameter when creating an AVAssetWriterInput, such as,
        ///
        /// [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:outputSettings sourceFormatHint:hint];
        ///
        /// The dictionary returned contains all necessary keys and values needed by AVAssetWriter (see AVAssetWriterInput.h, -initWithMediaType:outputSettings: for a more in depth discussion). For QuickTime movie and ISO file types, the recommended video settings will produce output comparable to that of AVCaptureMovieFileOutput.
        ///
        /// The videoCodecType string provided must be present in the availableVideoCodecTypesForAssetWriterWithOutputFileType: array, or an NSInvalidArgumentException is thrown.
        ///
        /// Note that the dictionary of settings is dependent on the current configuration of the receiver's AVCaptureSession and its inputs. The settings dictionary may change if the session's configuration changes. As such, you should configure your session first, then query the recommended video settings. As of iOS 8.3, movies produced with these settings successfully import into the iOS camera roll and sync to and from like devices via iTunes.
        #[unsafe(method(recommendedVideoSettingsForVideoCodecType:assetWriterOutputFileType:outputFileURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedVideoSettingsForVideoCodecType_assetWriterOutputFileType_outputFileURL(
            &self,
            video_codec_type: &AVVideoCodecType,
            output_file_type: &AVFileType,
            output_file_url: Option<&NSURL>,
        ) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(
            feature = "AVMediaFormat",
            feature = "AVMetadataItem",
            feature = "AVVideoSettings"
        ))]
        /// Recommends movie-level metadata for a particular video codec type and output file type, to be used with an asset writer input.
        ///
        /// - Parameter videoCodecType: The desired ``AVVideoCodecKey`` to be used for compression (see
        /// <doc
        /// ://com.apple.documentation/documentation/avfoundation/video-settings>).
        /// - Parameter outputFileType: Specifies the UTI of the file type to be written (see
        /// <doc
        /// ://com.apple.documentation/documentation/avfoundation/avfiletype>).
        /// - Returns: A fully populated array of ``AVMetadataItem`` objects compatible with ``AVAssetWriter``.
        ///
        /// The value of this property is an array of ``AVMetadataItem`` objects representing the collection of top-level metadata to be written in each output file. This array is suitable to use as the ``AVAssetWriter/metadata`` property before you have called ``AVAssetWriter/startWriting``. For more details see
        /// <doc
        /// ://com.apple.documentation/documentation/avfoundation/avassetwriter/startwriting()>.
        ///
        /// The ``videoCodecType`` string you provide must be present in ``availableVideoCodecTypesForAssetWriterWithOutputFileType:`` array, or an `NSInvalidArgumentException` is thrown.
        ///
        /// For clients writing files using a ProRes Raw codec type, white balance must be locked (call ``AVCaptureDevice/setWhiteBalanceModeLockedWithDeviceWhiteBalanceGains:completionHandler:``) before querying this property, or an `NSIvalidArgumentException` is thrown.
        ///
        /// - Note: The array of metadata is dependent on the current configuration of the receiver's ``AVCaptureSession`` and its inputs. The array may change when the session's configuration changes. As such, you should configure and start your session first, then query this method.
        #[unsafe(method(recommendedMovieMetadataForVideoCodecType:assetWriterOutputFileType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedMovieMetadataForVideoCodecType_assetWriterOutputFileType(
            &self,
            video_codec_type: &AVVideoCodecType,
            output_file_type: &AVFileType,
        ) -> Option<Retained<NSArray<AVMetadataItem>>>;

        #[cfg(feature = "objc2-core-media")]
        /// Indicates the recommended media timescale for the video track.
        ///
        /// - Returns: The recommended media timescale based on the active capture session's inputs. It is never less than 600. It may or may not be a multiple of 600.
        #[unsafe(method(recommendedMediaTimeScaleForAssetWriter))]
        #[unsafe(method_family = none)]
        pub unsafe fn recommendedMediaTimeScaleForAssetWriter(&self) -> CMTimeScale;

        /// Indicates the supported video pixel formats that can be specified in videoSettings.
        ///
        ///
        /// The value of this property is an NSArray of NSNumbers that can be used as values for the kCVPixelBufferPixelFormatTypeKey in the receiver's videoSettings property. The formats are listed in an unspecified order. This list can may change if the activeFormat of the AVCaptureDevice connected to the receiver changes.
        #[unsafe(method(availableVideoCVPixelFormatTypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableVideoCVPixelFormatTypes(&self) -> Retained<NSArray<NSNumber>>;

        #[cfg(feature = "AVVideoSettings")]
        /// Indicates the supported video codec formats that can be specified in videoSettings.
        ///
        ///
        /// The value of this property is an NSArray of AVVideoCodecTypes that can be used as values for the AVVideoCodecKey in the receiver's videoSettings property.
        #[unsafe(method(availableVideoCodecTypes))]
        #[unsafe(method_family = none)]
        pub unsafe fn availableVideoCodecTypes(&self) -> Retained<NSArray<AVVideoCodecType>>;

        #[cfg(feature = "objc2-core-media")]
        /// Specifies the minimum time interval between which the receiver should output consecutive video frames.
        ///
        ///
        /// The value of this property is a CMTime specifying the minimum duration of each video frame output by the receiver, placing a lower bound on the amount of time that should separate consecutive frames. This is equivalent to the inverse of the maximum frame rate. A value of kCMTimeZero or kCMTimeInvalid indicates an unlimited maximum frame rate. The default value is kCMTimeInvalid. As of iOS 5.0, minFrameDuration is deprecated. Use AVCaptureConnection's videoMinFrameDuration property instead.
        #[deprecated = "Use AVCaptureConnection's videoMinFrameDuration property instead."]
        #[unsafe(method(minFrameDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn minFrameDuration(&self) -> CMTime;

        #[cfg(feature = "objc2-core-media")]
        /// Setter for [`minFrameDuration`][Self::minFrameDuration].
        #[deprecated = "Use AVCaptureConnection's videoMinFrameDuration property instead."]
        #[unsafe(method(setMinFrameDuration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMinFrameDuration(&self, min_frame_duration: CMTime);

        /// Specifies whether the receiver should always discard any video frame that is not processed before the next frame is captured.
        ///
        ///
        /// When the value of this property is YES, the receiver will immediately discard frames that are captured while the dispatch queue handling existing frames is blocked in the captureOutput:didOutputSampleBuffer:fromConnection: delegate method. When the value of this property is NO, delegates will be allowed more time to process old frames before new frames are discarded, but application memory usage may increase significantly as a result. The default value is YES.
        #[unsafe(method(alwaysDiscardsLateVideoFrames))]
        #[unsafe(method_family = none)]
        pub unsafe fn alwaysDiscardsLateVideoFrames(&self) -> bool;

        /// Setter for [`alwaysDiscardsLateVideoFrames`][Self::alwaysDiscardsLateVideoFrames].
        #[unsafe(method(setAlwaysDiscardsLateVideoFrames:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAlwaysDiscardsLateVideoFrames(
            &self,
            always_discards_late_video_frames: bool,
        );

        /// Indicates whether the receiver automatically configures the size of output buffers.
        ///
        ///
        /// Default value is YES. In most configurations, AVCaptureVideoDataOutput delivers full-resolution buffers, that is, buffers with the same dimensions as the source AVCaptureDevice's activeFormat's videoDimensions. When this property is set to YES, the receiver is free to configure the dimensions of the buffers delivered to -captureOutput:didOutputSampleBuffer:fromConnection:, such that they are a smaller preview size (roughly the size of the screen). For instance, when the AVCaptureSession's sessionPreset is set to AVCaptureSessionPresetPhoto, it is assumed that video data output buffers are being delivered as a preview proxy. Likewise, if an AVCapturePhotoOutput is present in the session with livePhotoCaptureEnabled, it is assumed that video data output is being used for photo preview, and thus preview-sized buffers are a better choice than full-res buffers. You can query deliversPreviewSizedOutputBuffers to find out whether automatic configuration of output buffer dimensions is currently downscaling buffers to a preview size. You can also query the videoSettings property to find out the exact width and height being delivered. If you wish to manually set deliversPreviewSizedOutputBuffers, you must first set automaticallyConfiguresOutputBufferDimensions to NO.
        #[unsafe(method(automaticallyConfiguresOutputBufferDimensions))]
        #[unsafe(method_family = none)]
        pub unsafe fn automaticallyConfiguresOutputBufferDimensions(&self) -> bool;

        /// Setter for [`automaticallyConfiguresOutputBufferDimensions`][Self::automaticallyConfiguresOutputBufferDimensions].
        #[unsafe(method(setAutomaticallyConfiguresOutputBufferDimensions:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAutomaticallyConfiguresOutputBufferDimensions(
            &self,
            automatically_configures_output_buffer_dimensions: bool,
        );

        /// Indicates whether the receiver is currently configured to deliver preview sized buffers.
        ///
        ///
        /// If you wish to manually set deliversPreviewSizedOutputBuffers, you must first set automaticallyConfiguresOutputBufferDimensions to NO. When deliversPreviewSizedOutputBuffers is set to YES, auto focus, exposure, and white balance changes are quicker. AVCaptureVideoDataOutput assumes that the buffers are being used for on-screen preview rather than recording.
        ///
        /// When AVCaptureDevice.activeFormat supports ProRes Raw video, setting deliversPreviewSizedOutputBuffers gives out buffers with 422 format that can be used for proxy video recording.
        #[unsafe(method(deliversPreviewSizedOutputBuffers))]
        #[unsafe(method_family = none)]
        pub unsafe fn deliversPreviewSizedOutputBuffers(&self) -> bool;

        /// Setter for [`deliversPreviewSizedOutputBuffers`][Self::deliversPreviewSizedOutputBuffers].
        #[unsafe(method(setDeliversPreviewSizedOutputBuffers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDeliversPreviewSizedOutputBuffers(
            &self,
            delivers_preview_sized_output_buffers: bool,
        );

        /// Indicates whether the receiver should prepare the cellular radio for imminent network activity.
        ///
        /// Apps that scan video data output buffers for information that will result in network activity (such as detecting a QRCode containing a URL) should set this property `true` to allow the cellular radio to prepare for an imminent network request. Enabling this property requires a lengthy reconfiguration of the capture render pipeline, so you should set this property to `true` before calling ``AVCaptureSession/startRunning``.
        ///
        /// Using this API requires your app to adopt the entitlement `com.apple.developer.avfoundation.video-data-output-prepares-cellular-radio-for-machine-readable-code-scanning`.
        #[unsafe(method(preparesCellularRadioForNetworkConnection))]
        #[unsafe(method_family = none)]
        pub unsafe fn preparesCellularRadioForNetworkConnection(&self) -> bool;

        /// Setter for [`preparesCellularRadioForNetworkConnection`][Self::preparesCellularRadioForNetworkConnection].
        #[unsafe(method(setPreparesCellularRadioForNetworkConnection:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreparesCellularRadioForNetworkConnection(
            &self,
            prepares_cellular_radio_for_network_connection: bool,
        );

        /// Indicates whether the receiver should preserve dynamic HDR metadata as an attachment on the output sample buffer's underlying pixel buffer.
        ///
        /// Set this property to `true` if you wish to use ``AVCaptureVideoDataOutput`` with ``AVAssetWriter`` to record HDR movies. You must also set ``kVTCompressionPropertyKey_PreserveDynamicHDRMetadata`` to `true` in the compression settings you pass to your ``AVAssetWriterInput``. These compression settings are represented under the ``AVVideoCompressionPropertiesKey`` sub-dictionary of your top-level AVVideoSettings (see
        /// <doc
        /// ://com.apple.documentation/documentation/avfoundation/video-settings>). When you set this key to `true`, performance improves, as the encoder is able to skip HDR metadata calculation for every frame. The default value is `false`.
        #[unsafe(method(preservesDynamicHDRMetadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservesDynamicHDRMetadata(&self) -> bool;

        /// Setter for [`preservesDynamicHDRMetadata`][Self::preservesDynamicHDRMetadata].
        #[unsafe(method(setPreservesDynamicHDRMetadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreservesDynamicHDRMetadata(&self, preserves_dynamic_hdr_metadata: bool);
    );
}

extern_protocol!(
    /// Defines an interface for delegates of AVCaptureVideoDataOutput to receive captured video sample buffers and be notified of late sample buffers that were dropped.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturevideodataoutputsamplebufferdelegate?language=objc)
    pub unsafe trait AVCaptureVideoDataOutputSampleBufferDelegate: NSObjectProtocol {
        #[cfg(all(
            feature = "AVCaptureOutputBase",
            feature = "AVCaptureSession",
            feature = "objc2-core-media"
        ))]
        /// Called whenever an AVCaptureVideoDataOutput instance outputs a new video frame.
        ///
        ///
        /// Parameter `output`: The AVCaptureVideoDataOutput instance that output the frame.
        ///
        /// Parameter `sampleBuffer`: A CMSampleBuffer object containing the video frame data and additional information about the frame, such as its format and presentation time.
        ///
        /// Parameter `connection`: The AVCaptureConnection from which the video was received.
        ///
        ///
        /// Delegates receive this message whenever the output captures and outputs a new video frame, decoding or re-encoding it as specified by its videoSettings property. Delegates can use the provided video frame in conjunction with other APIs for further processing. This method will be called on the dispatch queue specified by the output's sampleBufferCallbackQueue property. This method is called periodically, so it must be efficient to prevent capture performance problems, including dropped frames.
        ///
        /// Clients that need to reference the CMSampleBuffer object outside of the scope of this method must CFRetain it and then CFRelease it when they are finished with it.
        ///
        /// Note that to maintain optimal performance, some sample buffers directly reference pools of memory that may need to be reused by the device system and other capture inputs. This is frequently the case for uncompressed device native capture where memory blocks are copied as little as possible. If multiple sample buffers reference such pools of memory for too long, inputs will no longer be able to copy new samples into memory and those samples will be dropped. If your application is causing samples to be dropped by retaining the provided CMSampleBuffer objects for too long, but it needs access to the sample data for a long period of time, consider copying the data into a new buffer and then calling CFRelease on the sample buffer if it was previously retained so that the memory it references can be reused.
        #[optional]
        #[unsafe(method(captureOutput:didOutputSampleBuffer:fromConnection:))]
        #[unsafe(method_family = none)]
        unsafe fn captureOutput_didOutputSampleBuffer_fromConnection(
            &self,
            output: &AVCaptureOutput,
            sample_buffer: &CMSampleBuffer,
            connection: &AVCaptureConnection,
        );

        #[cfg(all(
            feature = "AVCaptureOutputBase",
            feature = "AVCaptureSession",
            feature = "objc2-core-media"
        ))]
        /// Called once for each frame that is discarded.
        ///
        ///
        /// Parameter `output`: The AVCaptureVideoDataOutput instance that dropped the frame.
        ///
        /// Parameter `sampleBuffer`: A CMSampleBuffer object containing information about the dropped frame, such as its format and presentation time. This sample buffer will contain none of the original video data.
        ///
        /// Parameter `connection`: The AVCaptureConnection from which the dropped video frame was received.
        ///
        ///
        /// Delegates receive this message whenever a video frame is dropped. This method is called once for each dropped frame. The CMSampleBuffer object passed to this delegate method will contain metadata about the dropped video frame, such as its duration and presentation time stamp, but will contain no actual video data. On iOS, Included in the sample buffer attachments is the kCMSampleBufferAttachmentKey_DroppedFrameReason, which indicates why the frame was dropped. This method will be called on the dispatch queue specified by the output's sampleBufferCallbackQueue property. Because this method will be called on the same dispatch queue that is responsible for outputting video frames, it must be efficient to prevent further capture performance problems, such as additional dropped video frames.
        #[optional]
        #[unsafe(method(captureOutput:didDropSampleBuffer:fromConnection:))]
        #[unsafe(method_family = none)]
        unsafe fn captureOutput_didDropSampleBuffer_fromConnection(
            &self,
            output: &AVCaptureOutput,
            sample_buffer: &CMSampleBuffer,
            connection: &AVCaptureConnection,
        );
    }
);