objc2_av_foundation/generated/AVCaptureDepthDataOutput.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-media")]
7use objc2_core_media::*;
8
9use crate::*;
10
11extern_class!(
12 /// AVCaptureDepthDataOutput is a concrete subclass of AVCaptureOutput that can be used to process depth data in a streaming fashion.
13 ///
14 ///
15 /// Instances of AVCaptureDepthDataOutput capture AVDepthData objects expressing disparity/depth. Applications can access the frames with the depthDataOutput:didOutputDepthData:fromConnection: delegate method.
16 ///
17 /// AVCaptureDepthDataOutput always provides depth data in the format expressed by its source's -[AVCaptureDevice activeDepthDataFormat] property. If you wish to receive depth data in another format, you may choose from the -[AVCaptureDevice activeFormat]'s -[AVCaptureDeviceFormat supportedDepthDataFormats], and set it using -[AVCaptureDevice setActiveDepthDataFormat:].
18 ///
19 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedepthdataoutput?language=objc)
20 #[unsafe(super(AVCaptureOutput, NSObject))]
21 #[derive(Debug, PartialEq, Eq, Hash)]
22 #[cfg(feature = "AVCaptureOutputBase")]
23 pub struct AVCaptureDepthDataOutput;
24);
25
26#[cfg(feature = "AVCaptureOutputBase")]
27unsafe impl NSObjectProtocol for AVCaptureDepthDataOutput {}
28
29#[cfg(feature = "AVCaptureOutputBase")]
30impl AVCaptureDepthDataOutput {
31 extern_methods!(
32 #[unsafe(method(init))]
33 #[unsafe(method_family = init)]
34 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
35
36 #[unsafe(method(new))]
37 #[unsafe(method_family = new)]
38 pub unsafe fn new() -> Retained<Self>;
39
40 /// The receiver's delegate.
41 ///
42 ///
43 /// The value of this property is an object conforming to the AVCaptureDepthDataOutputDelegate protocol that receives depth data as it is captured. The delegate is set using the setDelegate:callbackQueue: method.
44 #[unsafe(method(delegate))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn delegate(
47 &self,
48 ) -> Option<Retained<ProtocolObject<dyn AVCaptureDepthDataOutputDelegate>>>;
49
50 /// Specifies whether the receiver should always discard any depth data that is not processed before the next depth data is captured.
51 ///
52 ///
53 /// When the value of this property is YES, the receiver will immediately discard depth data that are captured while the delegateCallbackQueue is blocked. When the value of this property is NO, delegates will be allowed more time to process old depth data before new depth data are discarded, but application memory usage may increase as a result. The default value is YES.
54 #[unsafe(method(alwaysDiscardsLateDepthData))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn alwaysDiscardsLateDepthData(&self) -> bool;
57
58 /// Setter for [`alwaysDiscardsLateDepthData`][Self::alwaysDiscardsLateDepthData].
59 #[unsafe(method(setAlwaysDiscardsLateDepthData:))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn setAlwaysDiscardsLateDepthData(&self, always_discards_late_depth_data: bool);
62
63 /// Specifies whether the depth data output should filter depth data to smooth out noise and fill invalid values.
64 ///
65 ///
66 /// When the value of this property is YES, the receiver temporally filters the stream of AVDepthData objects to reduce noise, as well as fill invalid values. Invalid values (NaN) may be present in AVDepthData pixel buffer maps due to factors such as low light or lens occlusion. When filtering is enabled, the depth data output interpolates missing depth data values. Filtering should be disabled if you desire the raw depth data values. The default value is YES.
67 #[unsafe(method(isFilteringEnabled))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn isFilteringEnabled(&self) -> bool;
70
71 /// Setter for [`isFilteringEnabled`][Self::isFilteringEnabled].
72 #[unsafe(method(setFilteringEnabled:))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn setFilteringEnabled(&self, filtering_enabled: bool);
75 );
76}
77
78extern_protocol!(
79 /// Defines an interface for delegates of AVCaptureDepthDataOutput to receive captured depth data and be notified of late depth data that were dropped.
80 ///
81 /// See also [Apple's documentation](https://developer.apple.com/documentation/avfoundation/avcapturedepthdataoutputdelegate?language=objc)
82 pub unsafe trait AVCaptureDepthDataOutputDelegate: NSObjectProtocol {
83 #[cfg(all(
84 feature = "AVCaptureOutputBase",
85 feature = "AVCaptureSession",
86 feature = "AVDepthData",
87 feature = "objc2-core-media"
88 ))]
89 /// Called whenever an AVCaptureDepthDataOutput instance outputs a new depth data object.
90 ///
91 ///
92 /// Parameter `output`: The AVCaptureDepthDataOutput instance vending the depth data.
93 ///
94 /// Parameter `depthData`: An AVDepthData object containing the depth/disparity data.
95 ///
96 /// Parameter `timestamp`: A CMTime indicating when the depth data was captured.
97 ///
98 /// Parameter `connection`: The AVCaptureConnection through which the depth data is received.
99 ///
100 ///
101 /// The delegate receives this message whenever the depth data output captures and outputs a new depth data object. This method is called on the dispatch queue specified by the output's delegateCallbackQueue property. This method is called frequently. Care must be taken to process the depth data quickly in order to prevent dropped depth data.
102 ///
103 /// Clients that need to reference the AVDepthData object outside of the scope of this method must retain it and then release it when they are finished with it (in a MRR app).
104 ///
105 /// Note that to maintain optimal performance, AVDepthData pixel buffer maps may be backed by a finite memory pool. If AVDepthData objects are held onto for too long, capture inputs will no longer be able to copy new depth data into memory, resulting in droppage. If your application is causing depth data drops by holding on to provided depth data objects for too long, consider copying the pixel buffer map data into a new pixel buffer so that the AVDepthData backing memory can be reused more quickly.
106 #[optional]
107 #[unsafe(method(depthDataOutput:didOutputDepthData:timestamp:connection:))]
108 #[unsafe(method_family = none)]
109 unsafe fn depthDataOutput_didOutputDepthData_timestamp_connection(
110 &self,
111 output: &AVCaptureDepthDataOutput,
112 depth_data: &AVDepthData,
113 timestamp: CMTime,
114 connection: &AVCaptureConnection,
115 );
116
117 #[cfg(all(
118 feature = "AVCaptureOutputBase",
119 feature = "AVCaptureSession",
120 feature = "AVDepthData",
121 feature = "objc2-core-media"
122 ))]
123 /// Called once for each depth data that is discarded.
124 ///
125 ///
126 /// Parameter `output`: The AVCaptureDepthDataOutput instance that dropped the depth data.
127 ///
128 /// Parameter `depthData`: A depth data object containing information about the dropped depth, such as its native depth type. This depth data object produces nil CVPixelBuffers for depth / disparity as it has no backing depth map.
129 ///
130 /// Parameter `timestamp`: A CMTime indicating when the depth data was captured.
131 ///
132 /// Parameter `connection`: The AVCaptureConnection from which the dropped depth data object was received.
133 ///
134 /// Parameter `reason`: The reason the depth data object was dropped.
135 ///
136 ///
137 /// Delegates receive this message whenever a depth data object is dropped. This method is called once for each dropped depth data. The object passed to this delegate method will contain a shell of an AVDepthData that contains no actual depth data backing pixel buffer, as well as a presentation time stamp and a reason for the drop. This method will be called on the dispatch queue specified by the output's delegateCallbackQueue property. Because this method is called on the same dispatch queue that outputs depth data, it must be efficient to prevent further capture performance problems, such as additional drops.
138 #[optional]
139 #[unsafe(method(depthDataOutput:didDropDepthData:timestamp:connection:reason:))]
140 #[unsafe(method_family = none)]
141 unsafe fn depthDataOutput_didDropDepthData_timestamp_connection_reason(
142 &self,
143 output: &AVCaptureDepthDataOutput,
144 depth_data: &AVDepthData,
145 timestamp: CMTime,
146 connection: &AVCaptureConnection,
147 reason: AVCaptureOutputDataDroppedReason,
148 );
149 }
150);