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/// Configuration value you set to prioritize 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/// Available algorithm revisions.
38///
39/// A new enum case with higher revision number is added when the processing algorithm is updated.
40/// The ``VTMotionBlurConfiguration/defaultRevision`` property provides the default algorithm revision.
41///
42/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurconfigurationrevision?language=objc)
43// NS_ENUM
44#[cfg(feature = "objc2")]
45#[repr(transparent)]
46#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
47pub struct VTMotionBlurConfigurationRevision(pub NSInteger);
48#[cfg(feature = "objc2")]
49impl VTMotionBlurConfigurationRevision {
50    #[doc(alias = "VTMotionBlurConfigurationRevision1")]
51    pub const Revision1: Self = Self(1);
52}
53
54#[cfg(feature = "objc2")]
55unsafe impl Encode for VTMotionBlurConfigurationRevision {
56    const ENCODING: Encoding = NSInteger::ENCODING;
57}
58
59#[cfg(feature = "objc2")]
60unsafe impl RefEncode for VTMotionBlurConfigurationRevision {
61    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
62}
63
64/// Indicates the order of input frames.
65///
66/// When submitting ``VTMotionBlurParameters`` to the processor, you need to provide one of these values based on how
67/// the input frames are related to each other.
68///
69/// Use ``VTMotionBlurParametersSubmissionModeSequential`` to indicate that the current submission follows presentation
70/// time order without jump or skip, when compared to previous submissions. This value provides better processor
71/// performance than other values.
72///
73/// Use ``VTMotionBlurParametersSubmissionModeRandom`` to indicate that the current submission has no relation to the
74/// previous submission. Typically, this indicates a jump or a skip in the frame sequence. The processor clears internal
75/// caches when it receives this value in ``VTFrameProcessor/processWithParameters`` function call.
76///
77/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurparameterssubmissionmode?language=objc)
78// NS_ENUM
79#[cfg(feature = "objc2")]
80#[repr(transparent)]
81#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
82pub struct VTMotionBlurParametersSubmissionMode(pub NSInteger);
83#[cfg(feature = "objc2")]
84impl VTMotionBlurParametersSubmissionMode {
85    #[doc(alias = "VTMotionBlurParametersSubmissionModeRandom")]
86    pub const Random: Self = Self(1);
87    #[doc(alias = "VTMotionBlurParametersSubmissionModeSequential")]
88    pub const Sequential: Self = Self(2);
89}
90
91#[cfg(feature = "objc2")]
92unsafe impl Encode for VTMotionBlurParametersSubmissionMode {
93    const ENCODING: Encoding = NSInteger::ENCODING;
94}
95
96#[cfg(feature = "objc2")]
97unsafe impl RefEncode for VTMotionBlurParametersSubmissionMode {
98    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101#[cfg(feature = "objc2")]
102extern_class!(
103    /// Configuration that you use to set up the motion blur processor.
104    ///
105    /// This configuration enables the motion blur on a `VTFrameProcessor` session.
106    ///
107    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurconfiguration?language=objc)
108    #[unsafe(super(NSObject))]
109    #[derive(Debug, PartialEq, Eq, Hash)]
110    #[cfg(feature = "objc2")]
111    pub struct VTMotionBlurConfiguration;
112);
113
114#[cfg(feature = "objc2")]
115unsafe impl Send for VTMotionBlurConfiguration {}
116
117#[cfg(feature = "objc2")]
118unsafe impl Sync for VTMotionBlurConfiguration {}
119
120#[cfg(feature = "objc2")]
121extern_conformance!(
122    unsafe impl NSObjectProtocol for VTMotionBlurConfiguration {}
123);
124
125#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
126extern_conformance!(
127    unsafe impl VTFrameProcessorConfiguration for VTMotionBlurConfiguration {}
128);
129
130#[cfg(feature = "objc2")]
131impl VTMotionBlurConfiguration {
132    extern_methods!(
133        /// Creates a new motion blur configuration.
134        ///
135        /// Returns `nil` if dimensions are out of range or revision is unsupported.
136        ///
137        /// - Parameters:
138        /// - frameWidth: Width of source frame in pixels; the maximum value is 8192 for macOS, and 4096 for iOS.
139        /// - frameHeight: Height of source frame in pixels; the maximum value is 4320 for macOS, and 2160 for iOS.
140        /// - usePrecomputedFlow: Boolean value that indicates whether you will provide optical flow; if false, this
141        /// configuration computes the optical flow on the fly.
142        /// - qualityPrioritization: A level you use to prioritize quality or performance; for more information about supported
143        /// levels, see ``VTMotionBlurConfigurationQualityPrioritization``.
144        /// - revision: The specific algorithm or configuration revision you use to perform the request.
145        #[unsafe(method(initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision:))]
146        #[unsafe(method_family = init)]
147        pub unsafe fn initWithFrameWidth_frameHeight_usePrecomputedFlow_qualityPrioritization_revision(
148            this: Allocated<Self>,
149            frame_width: NSInteger,
150            frame_height: NSInteger,
151            use_precomputed_flow: bool,
152            quality_prioritization: VTMotionBlurConfigurationQualityPrioritization,
153            revision: VTMotionBlurConfigurationRevision,
154        ) -> Option<Retained<Self>>;
155
156        #[unsafe(method(init))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
159
160        #[unsafe(method(new))]
161        #[unsafe(method_family = new)]
162        pub unsafe fn new() -> Retained<Self>;
163
164        /// Width of source frame in pixels.
165        ///
166        /// This property is not atomic.
167        ///
168        /// # Safety
169        ///
170        /// This might not be thread-safe.
171        #[unsafe(method(frameWidth))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn frameWidth(&self) -> NSInteger;
174
175        /// Height of source frame in pixels.
176        ///
177        /// This property is not atomic.
178        ///
179        /// # Safety
180        ///
181        /// This might not be thread-safe.
182        #[unsafe(method(frameHeight))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn frameHeight(&self) -> NSInteger;
185
186        /// Indicates that you provide optical flow.
187        ///
188        /// This property is not atomic.
189        ///
190        /// # Safety
191        ///
192        /// This might not be thread-safe.
193        #[unsafe(method(usePrecomputedFlow))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn usePrecomputedFlow(&self) -> bool;
196
197        /// A parameter you use to control quality and performance levels.
198        ///
199        /// For more information about supported levels, see ``VTMotionBlurConfigurationQualityPrioritization``.
200        ///
201        /// This property is not atomic.
202        ///
203        /// # Safety
204        ///
205        /// This might not be thread-safe.
206        #[unsafe(method(qualityPrioritization))]
207        #[unsafe(method_family = none)]
208        pub unsafe fn qualityPrioritization(
209            &self,
210        ) -> VTMotionBlurConfigurationQualityPrioritization;
211
212        /// The specific algorithm or configuration revision you use to perform the request.
213        ///
214        /// This property is not atomic.
215        ///
216        /// # Safety
217        ///
218        /// This might not be thread-safe.
219        #[unsafe(method(revision))]
220        #[unsafe(method_family = none)]
221        pub unsafe fn revision(&self) -> VTMotionBlurConfigurationRevision;
222
223        #[cfg(feature = "objc2-foundation")]
224        /// Provides the collection of currently supported algorithms or configuration revisions for the class of configuration.
225        ///
226        /// A property you use to introspect at runtime which revisions are available for each configuration.
227        #[unsafe(method(supportedRevisions))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn supportedRevisions() -> Retained<NSIndexSet>;
230
231        /// Provides the default revision of a specific algorithm or configuration.
232        #[unsafe(method(defaultRevision))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn defaultRevision() -> VTMotionBlurConfigurationRevision;
235
236        #[cfg(feature = "objc2-foundation")]
237        /// Available supported pixel formats for source frames for current configuration.
238        ///
239        /// This property is not atomic.
240        ///
241        /// # Safety
242        ///
243        /// This might not be thread-safe.
244        #[unsafe(method(frameSupportedPixelFormats))]
245        #[unsafe(method_family = none)]
246        pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
247
248        #[cfg(feature = "objc2-foundation")]
249        /// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent source frames and reference frames.
250        ///
251        /// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
252        ///
253        /// This property is not atomic.
254        ///
255        /// # Safety
256        ///
257        /// This might not be thread-safe.
258        #[unsafe(method(sourcePixelBufferAttributes))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn sourcePixelBufferAttributes(
261            &self,
262        ) -> Retained<NSDictionary<NSString, AnyObject>>;
263
264        #[cfg(feature = "objc2-foundation")]
265        /// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent destination frames.
266        ///
267        /// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
268        ///
269        /// This property is not atomic.
270        ///
271        /// # Safety
272        ///
273        /// This might not be thread-safe.
274        #[unsafe(method(destinationPixelBufferAttributes))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn destinationPixelBufferAttributes(
277            &self,
278        ) -> Retained<NSDictionary<NSString, AnyObject>>;
279
280        /// Reports whether the system supports this processor.
281        #[unsafe(method(isSupported))]
282        #[unsafe(method_family = none)]
283        pub unsafe fn isSupported() -> bool;
284
285        #[deprecated]
286        #[unsafe(method(processorSupported))]
287        #[unsafe(method_family = none)]
288        pub unsafe fn processorSupported() -> Boolean;
289    );
290}
291
292#[cfg(feature = "objc2")]
293extern_class!(
294    /// An object that contains both input and output parameters that the motion blur processor needs to run on a frame.
295    ///
296    /// Use this object in the `processWithParameters` call of `VTFrameProcessor` class. The output parameter for this class is `destinationFrame` where the processor returns the output frame (as `VTFrameProcessorFrame`) back to you once the `processWithParameters` completes.
297    ///
298    /// `VTMotionBlurParameters` are frame-level parameters.
299    ///
300    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtmotionblurparameters?language=objc)
301    #[unsafe(super(NSObject))]
302    #[derive(Debug, PartialEq, Eq, Hash)]
303    #[cfg(feature = "objc2")]
304    pub struct VTMotionBlurParameters;
305);
306
307#[cfg(feature = "objc2")]
308extern_conformance!(
309    unsafe impl NSObjectProtocol for VTMotionBlurParameters {}
310);
311
312#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
313extern_conformance!(
314    unsafe impl VTFrameProcessorParameters for VTMotionBlurParameters {}
315);
316
317#[cfg(feature = "objc2")]
318impl VTMotionBlurParameters {
319    extern_methods!(
320        #[cfg(feature = "VTFrameProcessorFrame")]
321        /// Creates a new motion blur parameters object.
322        ///
323        /// Returns `nil` if `sourceFrame` or `destinationFrame` is `nil`, `sourceFrame` and reference frames are different pixel
324        /// formats, or `motionBlurStrength` is out of range.
325        ///
326        /// - Parameters:
327        /// - sourceFrame: Current source frame; must be non `nil`.
328        /// - nextFrame: Next source frame in presentation time order; for the last frame you can set this to `nil`.
329        /// - previousFrame: Previous source frame in presentation time order; for the first frame you can set this to `nil`.
330        /// - nextOpticalFlow: Optional `VTFrameProcessorOpticalFlow` object that contains forward and backward optical flow
331        /// with `nextFrame`. You only need this object if optical flow is pre-computed. For the last frame this is always `nil`.
332        /// - previousOpticalFlow: Optional VTFrameProcessorOpticalFlow object that contains forward and backward optical flow
333        /// with `previousFrame`. You only need to use this if the optical flow is pre-computed. For the first frame this is always `nil`.
334        /// - motionBlurStrength: Number that indicates the strength of blur applied by the processor. Range is from 1 to 100. Default value is 50.
335        /// - submissionMode: Provides a hint to let the processor know whether you are submitting frames in presenatation
336        /// sequence. For more information about supported modes see ``VTMotionBlurParametersSubmissionMode``.
337        /// - destinationFrame: User-allocated pixel buffer that receives a frame with motion blur applied by the processor.
338        #[unsafe(method(initWithSourceFrame:nextFrame:previousFrame:nextOpticalFlow:previousOpticalFlow:motionBlurStrength:submissionMode:destinationFrame:))]
339        #[unsafe(method_family = init)]
340        pub unsafe fn initWithSourceFrame_nextFrame_previousFrame_nextOpticalFlow_previousOpticalFlow_motionBlurStrength_submissionMode_destinationFrame(
341            this: Allocated<Self>,
342            source_frame: &VTFrameProcessorFrame,
343            next_frame: Option<&VTFrameProcessorFrame>,
344            previous_frame: Option<&VTFrameProcessorFrame>,
345            next_optical_flow: Option<&VTFrameProcessorOpticalFlow>,
346            previous_optical_flow: Option<&VTFrameProcessorOpticalFlow>,
347            motion_blur_strength: NSInteger,
348            submission_mode: VTMotionBlurParametersSubmissionMode,
349            destination_frame: &VTFrameProcessorFrame,
350        ) -> Option<Retained<Self>>;
351
352        #[unsafe(method(init))]
353        #[unsafe(method_family = init)]
354        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
355
356        #[unsafe(method(new))]
357        #[unsafe(method_family = new)]
358        pub unsafe fn new() -> Retained<Self>;
359
360        #[cfg(feature = "VTFrameProcessorFrame")]
361        /// Current source frame, which must be non `nil`.
362        #[unsafe(method(sourceFrame))]
363        #[unsafe(method_family = none)]
364        pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
365
366        #[cfg(feature = "VTFrameProcessorFrame")]
367        /// The next source frame in presentation time order, which is `nil` for the last frame.
368        #[unsafe(method(nextFrame))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn nextFrame(&self) -> Option<Retained<VTFrameProcessorFrame>>;
371
372        #[cfg(feature = "VTFrameProcessorFrame")]
373        /// Previous source frame in presentation time order, which is `nil` for the first frame.
374        #[unsafe(method(previousFrame))]
375        #[unsafe(method_family = none)]
376        pub unsafe fn previousFrame(&self) -> Option<Retained<VTFrameProcessorFrame>>;
377
378        #[cfg(feature = "VTFrameProcessorFrame")]
379        /// Optional frame processor optical flow object that contains forward and backward optical flow with next frame.
380        ///
381        /// You only need to use this object if the optical flow is pre-computed. For the last frame this is `nil`.
382        #[unsafe(method(nextOpticalFlow))]
383        #[unsafe(method_family = none)]
384        pub unsafe fn nextOpticalFlow(&self) -> Option<Retained<VTFrameProcessorOpticalFlow>>;
385
386        #[cfg(feature = "VTFrameProcessorFrame")]
387        /// Optional frame processor optical flow object that contains forward and backward optical flow with previous frame.
388        ///
389        /// You only need to use this object if the optical flow is pre-computed. For the first frame this is `nil`.
390        #[unsafe(method(previousOpticalFlow))]
391        #[unsafe(method_family = none)]
392        pub unsafe fn previousOpticalFlow(&self) -> Option<Retained<VTFrameProcessorOpticalFlow>>;
393
394        /// Number that indicates the strength of motion blur.
395        ///
396        /// The range is from 1 to 100; the default value is 50.
397        #[unsafe(method(motionBlurStrength))]
398        #[unsafe(method_family = none)]
399        pub unsafe fn motionBlurStrength(&self) -> NSInteger;
400
401        /// Ordering of the input frames this submission related to the previous submission.
402        #[unsafe(method(submissionMode))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn submissionMode(&self) -> VTMotionBlurParametersSubmissionMode;
405
406        #[cfg(feature = "VTFrameProcessorFrame")]
407        /// Destination frame that contains user-allocated pixel buffer that receive a frame with motion blur applied by the processor.
408        #[unsafe(method(destinationFrame))]
409        #[unsafe(method_family = none)]
410        pub unsafe fn destinationFrame(&self) -> Retained<VTFrameProcessorFrame>;
411    );
412}