objc2_video_toolbox/generated/
VTFrameProcessor_OpticalFlow.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4#[cfg(feature = "objc2")]
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-foundation")]
7use objc2_foundation::*;
8
9use crate::*;
10
11/// Quality prioritization levels to favor quality or performance.
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtopticalflowconfigurationqualityprioritization?language=objc)
14// NS_ENUM
15#[cfg(feature = "objc2")]
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct VTOpticalFlowConfigurationQualityPrioritization(pub NSInteger);
19#[cfg(feature = "objc2")]
20impl VTOpticalFlowConfigurationQualityPrioritization {
21    #[doc(alias = "VTOpticalFlowConfigurationQualityPrioritizationNormal")]
22    pub const Normal: Self = Self(1);
23    #[doc(alias = "VTOpticalFlowConfigurationQualityPrioritizationQuality")]
24    pub const Quality: Self = Self(2);
25}
26
27#[cfg(feature = "objc2")]
28unsafe impl Encode for VTOpticalFlowConfigurationQualityPrioritization {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32#[cfg(feature = "objc2")]
33unsafe impl RefEncode for VTOpticalFlowConfigurationQualityPrioritization {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37/// List of existing algorithm revisions with the highest being the latest. Clients can read defaultRevision property to find the default revision.
38///
39/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtopticalflowconfigurationrevision?language=objc)
40// NS_ENUM
41#[cfg(feature = "objc2")]
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct VTOpticalFlowConfigurationRevision(pub NSInteger);
45#[cfg(feature = "objc2")]
46impl VTOpticalFlowConfigurationRevision {
47    #[doc(alias = "VTOpticalFlowConfigurationRevision1")]
48    pub const Revision1: Self = Self(1);
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for VTOpticalFlowConfigurationRevision {
53    const ENCODING: Encoding = NSInteger::ENCODING;
54}
55
56#[cfg(feature = "objc2")]
57unsafe impl RefEncode for VTOpticalFlowConfigurationRevision {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61/// Hint to let the processor know whether frames are being submitted in presenatation sequence, allowing performance optimizations based on previous processing requests
62///
63/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtopticalflowparameterssubmissionmode?language=objc)
64// NS_ENUM
65#[cfg(feature = "objc2")]
66#[repr(transparent)]
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
68pub struct VTOpticalFlowParametersSubmissionMode(pub NSInteger);
69#[cfg(feature = "objc2")]
70impl VTOpticalFlowParametersSubmissionMode {
71    #[doc(alias = "VTOpticalFlowParametersSubmissionModeRandom")]
72    pub const Random: Self = Self(1);
73    #[doc(alias = "VTOpticalFlowParametersSubmissionModeSequential")]
74    pub const Sequential: Self = Self(2);
75}
76
77#[cfg(feature = "objc2")]
78unsafe impl Encode for VTOpticalFlowParametersSubmissionMode {
79    const ENCODING: Encoding = NSInteger::ENCODING;
80}
81
82#[cfg(feature = "objc2")]
83unsafe impl RefEncode for VTOpticalFlowParametersSubmissionMode {
84    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
85}
86
87#[cfg(feature = "objc2")]
88extern_class!(
89    /// Configuration that is used to set up an OpticalFlow processor
90    ///
91    ///
92    /// This configuration enables the OpticalFlow on a VTFrameProcessing session.
93    ///
94    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtopticalflowconfiguration?language=objc)
95    #[unsafe(super(NSObject))]
96    #[derive(Debug, PartialEq, Eq, Hash)]
97    #[cfg(feature = "objc2")]
98    pub struct VTOpticalFlowConfiguration;
99);
100
101#[cfg(feature = "objc2")]
102unsafe impl Send for VTOpticalFlowConfiguration {}
103
104#[cfg(feature = "objc2")]
105unsafe impl Sync for VTOpticalFlowConfiguration {}
106
107#[cfg(feature = "objc2")]
108extern_conformance!(
109    unsafe impl NSObjectProtocol for VTOpticalFlowConfiguration {}
110);
111
112#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
113extern_conformance!(
114    unsafe impl VTFrameProcessorConfiguration for VTOpticalFlowConfiguration {}
115);
116
117#[cfg(feature = "objc2")]
118impl VTOpticalFlowConfiguration {
119    extern_methods!(
120        /// Creates a new VTOpticalFlowConfiguration with specified flow width and height.
121        ///
122        ///
123        /// init will return nil if dimensions are out of range or revision is unsupported.
124        ///
125        ///
126        /// Parameter `frameWidth`: Width of source frame in pixels. Maximum value is 8192 for macOS, and 4096 for iOS.
127        ///
128        ///
129        /// Parameter `frameHeight`: Height of source frame in pixels. Maximum value is 4320 for macOS, and 2160 for iOS.
130        ///
131        ///
132        /// Parameter `usePrecomputedFlow`: Boolean value to indicate that Optical Flow will be provided by the user, if false this configuration will compute the optical flow on the fly.
133        ///
134        ///
135        /// Parameter `qualityPrioritization`: Used to control quality and performance levels. See VTOpticalFlowConfigurationQualityPrioritization for more info.
136        ///
137        ///
138        /// Parameter `revision`: The specific algorithm or configuration revision that is to be used to perform the request.
139        #[unsafe(method(initWithFrameWidth:frameHeight:qualityPrioritization:revision:))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn initWithFrameWidth_frameHeight_qualityPrioritization_revision(
142            this: Allocated<Self>,
143            frame_width: NSInteger,
144            frame_height: NSInteger,
145            quality_prioritization: VTOpticalFlowConfigurationQualityPrioritization,
146            revision: VTOpticalFlowConfigurationRevision,
147        ) -> Option<Retained<Self>>;
148
149        #[unsafe(method(init))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
152
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new() -> Retained<Self>;
156
157        /// Width of source frame in pixels.
158        #[unsafe(method(frameWidth))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn frameWidth(&self) -> NSInteger;
161
162        /// Height of source frame in pixels.
163        #[unsafe(method(frameHeight))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn frameHeight(&self) -> NSInteger;
166
167        /// parameter used to control quality and performance levels. See VTOpticalFlowConfigurationQualityPrioritization for more info.
168        #[unsafe(method(qualityPrioritization))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn qualityPrioritization(
171            &self,
172        ) -> VTOpticalFlowConfigurationQualityPrioritization;
173
174        /// The specific algorithm or configuration revision that is to be used to perform the request.
175        #[unsafe(method(revision))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn revision(&self) -> VTOpticalFlowConfigurationRevision;
178
179        #[cfg(feature = "objc2-foundation")]
180        /// Provides the collection of currently-supported algorithm or configuration revisions for the class of configuration.
181        ///
182        /// This property allows clients to introspect at runtime what revisions are available for each configuration.
183        #[unsafe(method(supportedRevisions))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn supportedRevisions() -> Retained<NSIndexSet>;
186
187        /// Provides the default revision of a particular algorithm or configuration.
188        #[unsafe(method(defaultRevision))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn defaultRevision() -> VTOpticalFlowConfigurationRevision;
191
192        #[cfg(feature = "objc2-foundation")]
193        /// list of source frame supported pixel formats for current configuration
194        #[unsafe(method(frameSupportedPixelFormats))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
197
198        #[cfg(feature = "objc2-foundation")]
199        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as source frames and reference frames.
200        #[unsafe(method(sourcePixelBufferAttributes))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn sourcePixelBufferAttributes(
203            &self,
204        ) -> Retained<NSDictionary<NSString, AnyObject>>;
205
206        #[cfg(feature = "objc2-foundation")]
207        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as OpticalFlow buffers
208        #[unsafe(method(destinationPixelBufferAttributes))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn destinationPixelBufferAttributes(
211            &self,
212        ) -> Retained<NSDictionary<NSString, AnyObject>>;
213
214        /// reports that this processor is  supported
215        #[unsafe(method(processorSupported))]
216        #[unsafe(method_family = none)]
217        pub unsafe fn processorSupported() -> Boolean;
218    );
219}
220
221#[cfg(feature = "objc2")]
222extern_class!(
223    /// VTOpticalFlowParameters object contains both input and output parameters needed to generate optical flow between two frames. This object is used in the processWithParameters call of VTFrameProcessor class. The output parameter for this class is destinationOpticalFlow where the output flow is returned (as VTFrameProcessorMutableOpticalFlow) back to the caller function once the processWithParameters completes.
224    ///
225    ///
226    /// VTOpticalFlowParameters are frame level parameters.
227    ///
228    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtopticalflowparameters?language=objc)
229    #[unsafe(super(NSObject))]
230    #[derive(Debug, PartialEq, Eq, Hash)]
231    #[cfg(feature = "objc2")]
232    pub struct VTOpticalFlowParameters;
233);
234
235#[cfg(feature = "objc2")]
236extern_conformance!(
237    unsafe impl NSObjectProtocol for VTOpticalFlowParameters {}
238);
239
240#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
241extern_conformance!(
242    unsafe impl VTFrameProcessorParameters for VTOpticalFlowParameters {}
243);
244
245#[cfg(feature = "objc2")]
246impl VTOpticalFlowParameters {
247    extern_methods!(
248        #[cfg(feature = "VTFrameProcessorFrame")]
249        /// Creates a new VTOpticalFlowParameters .
250        ///
251        ///
252        /// init will return nil if sourceFrame or nextFrame is nil, or sourceFrame and nextFrame are different pixelFormats..
253        ///
254        ///
255        /// Parameter `sourceFrame`: Current source frame. Must be non nil.
256        ///
257        ///
258        /// Parameter `nextFrame`: Next source frame in presentation time order.
259        ///
260        ///
261        /// Parameter `submissionMode`: Set to VTOpticalFlowParametersSubmissionModeSequential to indicate that current submission follow presentation time order without jump or skip when compared to previous submission. VTOpticalFlowParametersSubmissionModeSequential will yield better performance. Set to  VTOpticalFlowParametersSubmissionModeRandom to indicate a skip or a jump in frame sequence. If VTOpticalFlowParametersSubmissionModeRandom is set internal cache will be cleared during processWithParameters call.
262        ///
263        ///
264        /// Parameter `destinationOpticalFlow`: User allocated VTFrameProcessorMutableOpticalFlow that will receive the results.
265        #[unsafe(method(initWithSourceFrame:nextFrame:submissionMode:destinationOpticalFlow:))]
266        #[unsafe(method_family = init)]
267        pub unsafe fn initWithSourceFrame_nextFrame_submissionMode_destinationOpticalFlow(
268            this: Allocated<Self>,
269            source_frame: &VTFrameProcessorFrame,
270            next_frame: &VTFrameProcessorFrame,
271            submission_mode: VTOpticalFlowParametersSubmissionMode,
272            destination_optical_flow: &VTFrameProcessorOpticalFlow,
273        ) -> Option<Retained<Self>>;
274
275        #[unsafe(method(init))]
276        #[unsafe(method_family = init)]
277        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
278
279        #[unsafe(method(new))]
280        #[unsafe(method_family = new)]
281        pub unsafe fn new() -> Retained<Self>;
282
283        #[cfg(feature = "VTFrameProcessorFrame")]
284        /// sourceFrame Current source frame. Must be non nil
285        #[unsafe(method(sourceFrame))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
288
289        #[cfg(feature = "VTFrameProcessorFrame")]
290        /// Next source frame in presentation time order.
291        #[unsafe(method(nextFrame))]
292        #[unsafe(method_family = none)]
293        pub unsafe fn nextFrame(&self) -> Retained<VTFrameProcessorFrame>;
294
295        /// A VTOpticalFlowParametersSubmissionMode value describing the processing request in this Parameters object .
296        #[unsafe(method(submissionMode))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn submissionMode(&self) -> VTOpticalFlowParametersSubmissionMode;
299
300        #[cfg(feature = "VTFrameProcessorFrame")]
301        /// VTFrameProcessorMutableOpticalFlow that contains user allocated flow pixel buffers that will receive the results.
302        #[unsafe(method(destinationOpticalFlow))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn destinationOpticalFlow(&self) -> Retained<VTFrameProcessorOpticalFlow>;
305    );
306}