objc2_video_toolbox/generated/
VTFrameProcessor_MotionBlur.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/vtmotionblurconfigurationqualityprioritization?language=objc)
14// NS_ENUM
15#[cfg(feature = "objc2")]
16#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct VTMotionBlurConfigurationQualityPrioritization(pub NSInteger);
19#[cfg(feature = "objc2")]
20impl VTMotionBlurConfigurationQualityPrioritization {
21    #[doc(alias = "VTMotionBlurConfigurationQualityPrioritizationNormal")]
22    pub const Normal: Self = Self(1);
23    #[doc(alias = "VTMotionBlurConfigurationQualityPrioritizationQuality")]
24    pub const Quality: Self = Self(2);
25}
26
27#[cfg(feature = "objc2")]
28unsafe impl Encode for VTMotionBlurConfigurationQualityPrioritization {
29    const ENCODING: Encoding = NSInteger::ENCODING;
30}
31
32#[cfg(feature = "objc2")]
33unsafe impl RefEncode for VTMotionBlurConfigurationQualityPrioritization {
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/vtmotionblurconfigurationrevision?language=objc)
40// NS_ENUM
41#[cfg(feature = "objc2")]
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct VTMotionBlurConfigurationRevision(pub NSInteger);
45#[cfg(feature = "objc2")]
46impl VTMotionBlurConfigurationRevision {
47    #[doc(alias = "VTMotionBlurConfigurationRevision1")]
48    pub const Revision1: Self = Self(1);
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for VTMotionBlurConfigurationRevision {
53    const ENCODING: Encoding = NSInteger::ENCODING;
54}
55
56#[cfg(feature = "objc2")]
57unsafe impl RefEncode for VTMotionBlurConfigurationRevision {
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/vtmotionblurparameterssubmissionmode?language=objc)
64// NS_ENUM
65#[cfg(feature = "objc2")]
66#[repr(transparent)]
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
68pub struct VTMotionBlurParametersSubmissionMode(pub NSInteger);
69#[cfg(feature = "objc2")]
70impl VTMotionBlurParametersSubmissionMode {
71    #[doc(alias = "VTMotionBlurParametersSubmissionModeRandom")]
72    pub const Random: Self = Self(1);
73    #[doc(alias = "VTMotionBlurParametersSubmissionModeSequential")]
74    pub const Sequential: Self = Self(2);
75}
76
77#[cfg(feature = "objc2")]
78unsafe impl Encode for VTMotionBlurParametersSubmissionMode {
79    const ENCODING: Encoding = NSInteger::ENCODING;
80}
81
82#[cfg(feature = "objc2")]
83unsafe impl RefEncode for VTMotionBlurParametersSubmissionMode {
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 the MotionBlur Processor.
90    ///
91    ///
92    /// This configuration enables the MotionBlur on a VTFrameProcesing session.
93    ///
94    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurconfiguration?language=objc)
95    #[unsafe(super(NSObject))]
96    #[derive(Debug, PartialEq, Eq, Hash)]
97    #[cfg(feature = "objc2")]
98    pub struct VTMotionBlurConfiguration;
99);
100
101#[cfg(feature = "objc2")]
102unsafe impl Send for VTMotionBlurConfiguration {}
103
104#[cfg(feature = "objc2")]
105unsafe impl Sync for VTMotionBlurConfiguration {}
106
107#[cfg(feature = "objc2")]
108extern_conformance!(
109    unsafe impl NSObjectProtocol for VTMotionBlurConfiguration {}
110);
111
112#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
113extern_conformance!(
114    unsafe impl VTFrameProcessorConfiguration for VTMotionBlurConfiguration {}
115);
116
117#[cfg(feature = "objc2")]
118impl VTMotionBlurConfiguration {
119    extern_methods!(
120        /// Creates a new VTMotionBlurConfiguration 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 VTMotionBlurConfigurationQualityPrioritization 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:usePrecomputedFlow:qualityPrioritization:revision:))]
140        #[unsafe(method_family = init)]
141        pub unsafe fn initWithFrameWidth_frameHeight_usePrecomputedFlow_qualityPrioritization_revision(
142            this: Allocated<Self>,
143            frame_width: NSInteger,
144            frame_height: NSInteger,
145            use_precomputed_flow: bool,
146            quality_prioritization: VTMotionBlurConfigurationQualityPrioritization,
147            revision: VTMotionBlurConfigurationRevision,
148        ) -> Option<Retained<Self>>;
149
150        #[unsafe(method(init))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
153
154        #[unsafe(method(new))]
155        #[unsafe(method_family = new)]
156        pub unsafe fn new() -> Retained<Self>;
157
158        /// Width of source frame in pixels.
159        #[unsafe(method(frameWidth))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn frameWidth(&self) -> NSInteger;
162
163        /// Height of source frame in pixels.
164        #[unsafe(method(frameHeight))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn frameHeight(&self) -> NSInteger;
167
168        /// Indicates that caller will provide optical flow.
169        #[unsafe(method(usePrecomputedFlow))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn usePrecomputedFlow(&self) -> bool;
172
173        /// parameter used to control quality and performance levels. See VTMotionBlurConfigurationQualityPrioritization for more info.
174        #[unsafe(method(qualityPrioritization))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn qualityPrioritization(
177            &self,
178        ) -> VTMotionBlurConfigurationQualityPrioritization;
179
180        /// The specific algorithm or configuration revision that is to be used to perform the request.
181        #[unsafe(method(revision))]
182        #[unsafe(method_family = none)]
183        pub unsafe fn revision(&self) -> VTMotionBlurConfigurationRevision;
184
185        #[cfg(feature = "objc2-foundation")]
186        /// Provides the collection of currently-supported algorithm or configuration revisions for the class of configuration.
187        ///
188        /// This property allows clients to introspect at runtime what revisions are available for each configuration.
189        #[unsafe(method(supportedRevisions))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn supportedRevisions() -> Retained<NSIndexSet>;
192
193        /// Provides the default revision of a particular algorithm or configuration.
194        #[unsafe(method(defaultRevision))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn defaultRevision() -> VTMotionBlurConfigurationRevision;
197
198        #[cfg(feature = "objc2-foundation")]
199        /// list of source frame supported pixel formats for current configuration
200        #[unsafe(method(frameSupportedPixelFormats))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
203
204        #[cfg(feature = "objc2-foundation")]
205        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as source frames and reference frames.
206        #[unsafe(method(sourcePixelBufferAttributes))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn sourcePixelBufferAttributes(
209            &self,
210        ) -> Retained<NSDictionary<NSString, AnyObject>>;
211
212        #[cfg(feature = "objc2-foundation")]
213        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as destination frames.
214        #[unsafe(method(destinationPixelBufferAttributes))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn destinationPixelBufferAttributes(
217            &self,
218        ) -> Retained<NSDictionary<NSString, AnyObject>>;
219
220        /// reports that this processor is  supported
221        #[unsafe(method(processorSupported))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn processorSupported() -> Boolean;
224    );
225}
226
227#[cfg(feature = "objc2")]
228extern_class!(
229    /// VTMotionBlurParameters object contains both input and output parameters needed to run the MotionBlur processor on a frame. This object is used in the processWithParameters call of VTFrameProcessor class. The output parameter for this class is destinationFrame where the output frame is returned (as VTFrameProcessorFrame) back to the caller function once the processWithParameters completes.
230    ///
231    ///
232    /// VTMotionBlurParameters are frame level parameters.
233    ///
234    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurparameters?language=objc)
235    #[unsafe(super(NSObject))]
236    #[derive(Debug, PartialEq, Eq, Hash)]
237    #[cfg(feature = "objc2")]
238    pub struct VTMotionBlurParameters;
239);
240
241#[cfg(feature = "objc2")]
242extern_conformance!(
243    unsafe impl NSObjectProtocol for VTMotionBlurParameters {}
244);
245
246#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
247extern_conformance!(
248    unsafe impl VTFrameProcessorParameters for VTMotionBlurParameters {}
249);
250
251#[cfg(feature = "objc2")]
252impl VTMotionBlurParameters {
253    extern_methods!(
254        #[cfg(feature = "VTFrameProcessorFrame")]
255        /// Creates a new VTMotionBlurParameters .
256        ///
257        ///
258        /// init will return nil if sourceFrame or destinationFrame is nil, sourceFrame and reference frames  are different pixelFormats, or motionBlurStrength is out of range.
259        ///
260        ///
261        /// Parameter `sourceFrame`: Current source frame. Must be non nil.
262        ///
263        ///
264        /// Parameter `nextFrame`: Next source frame in presentation time order. For the last frame this can be set to nil.
265        ///
266        ///
267        /// Parameter `previousFrame`: Previous source frame in presentation time order. For the first frame this can be set to nil.
268        ///
269        ///
270        /// Parameter `nextOpticalFlow`: Optional VTFrameProcessorOpticalFlow object that contains forward and backward optical flow with next frame. Only needed if optical flow is pre-computed. For the last frame this will always be nil.
271        ///
272        ///
273        /// Parameter `previousOpticalFlow`: Optional VTFrameProcessorOpticalFlow object that contains forward and backward optical flow with previous frame. Only needed if optical flow is pre-computed. For the first frame this will always be nil.
274        ///
275        ///
276        /// Parameter `motionBlurStrength`: NSInteger number to indicate the strength of blur to apply. Range is from 1 to 100. Default value is 50.
277        ///
278        ///
279        /// Parameter `submissionMode`: Set to VTMotionBlurParametersSubmissionModeSequential to indicate that current submission follow presentation time order without jump or skip when compared to previous submission. VTMotionBlurParametersSubmissionModeSequential will yield better performance. Set to VTMotionBlurParametersSubmissionModeRandom to indicate a skip or a jump in frame sequence. If VTMotionBlurParametersSubmissionModeRandom is set internal cache will be cleared during processWithParameters call.
280        ///
281        ///
282        /// Parameter `destinationFrame`: User allocated pixel buffer that will receive the results.
283        #[unsafe(method(initWithSourceFrame:nextFrame:previousFrame:nextOpticalFlow:previousOpticalFlow:motionBlurStrength:submissionMode:destinationFrame:))]
284        #[unsafe(method_family = init)]
285        pub unsafe fn initWithSourceFrame_nextFrame_previousFrame_nextOpticalFlow_previousOpticalFlow_motionBlurStrength_submissionMode_destinationFrame(
286            this: Allocated<Self>,
287            source_frame: &VTFrameProcessorFrame,
288            next_frame: Option<&VTFrameProcessorFrame>,
289            previous_frame: Option<&VTFrameProcessorFrame>,
290            next_optical_flow: Option<&VTFrameProcessorOpticalFlow>,
291            previous_optical_flow: Option<&VTFrameProcessorOpticalFlow>,
292            motion_blur_strength: NSInteger,
293            submission_mode: VTMotionBlurParametersSubmissionMode,
294            destination_frame: &VTFrameProcessorFrame,
295        ) -> Option<Retained<Self>>;
296
297        #[unsafe(method(init))]
298        #[unsafe(method_family = init)]
299        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
300
301        #[unsafe(method(new))]
302        #[unsafe(method_family = new)]
303        pub unsafe fn new() -> Retained<Self>;
304
305        #[cfg(feature = "VTFrameProcessorFrame")]
306        /// sourceFrame Current source frame. Must be non nil
307        #[unsafe(method(sourceFrame))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
310
311        #[cfg(feature = "VTFrameProcessorFrame")]
312        /// Next source frame in presentation time order. For the last frame this will be nil.
313        #[unsafe(method(nextFrame))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn nextFrame(&self) -> Option<Retained<VTFrameProcessorFrame>>;
316
317        #[cfg(feature = "VTFrameProcessorFrame")]
318        /// Previous source frame in presentation time order. For the first frame this will be nil.
319        #[unsafe(method(previousFrame))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn previousFrame(&self) -> Option<Retained<VTFrameProcessorFrame>>;
322
323        #[cfg(feature = "VTFrameProcessorFrame")]
324        /// Optional VTFrameProcessorOpticalFlow object that contains forward and backward optical flow with next frame. Only needed if optical flow is pre-computed. For the last frame this will be nil.
325        #[unsafe(method(nextOpticalFlow))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn nextOpticalFlow(&self) -> Option<Retained<VTFrameProcessorOpticalFlow>>;
328
329        #[cfg(feature = "VTFrameProcessorFrame")]
330        /// Optional VTFrameProcessorOpticalFlow object  that contains forward and backward optical flow with previous frame. Only needed if optical flow is pre-computed. For the first frame this will be nil.
331        #[unsafe(method(previousOpticalFlow))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn previousOpticalFlow(&self) -> Option<Retained<VTFrameProcessorOpticalFlow>>;
334
335        /// motionBlurStrength NSInteger number to indicate the strength of blur to apply. Range is from 1 to 100. Default value is 50.
336        #[unsafe(method(motionBlurStrength))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn motionBlurStrength(&self) -> NSInteger;
339
340        /// A VTMotionBlurParametersSubmissionMode value describing the processing request in this Parameters object .
341        #[unsafe(method(submissionMode))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn submissionMode(&self) -> VTMotionBlurParametersSubmissionMode;
344
345        #[cfg(feature = "VTFrameProcessorFrame")]
346        /// VTFrameProcessorFrame that contains user allocated pixel buffer that will receive the results.
347        #[unsafe(method(destinationFrame))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn destinationFrame(&self) -> Retained<VTFrameProcessorFrame>;
350    );
351}