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