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/// Quality prioritization levels to favor 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/// 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/vtframerateconversionconfigurationrevision?language=objc)
40// NS_ENUM
41#[cfg(feature = "objc2")]
42#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct VTFrameRateConversionConfigurationRevision(pub NSInteger);
45#[cfg(feature = "objc2")]
46impl VTFrameRateConversionConfigurationRevision {
47    #[doc(alias = "VTFrameRateConversionConfigurationRevision1")]
48    pub const Revision1: Self = Self(1);
49}
50
51#[cfg(feature = "objc2")]
52unsafe impl Encode for VTFrameRateConversionConfigurationRevision {
53    const ENCODING: Encoding = NSInteger::ENCODING;
54}
55
56#[cfg(feature = "objc2")]
57unsafe impl RefEncode for VTFrameRateConversionConfigurationRevision {
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/vtframerateconversionparameterssubmissionmode?language=objc)
64// NS_ENUM
65#[cfg(feature = "objc2")]
66#[repr(transparent)]
67#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
68pub struct VTFrameRateConversionParametersSubmissionMode(pub NSInteger);
69#[cfg(feature = "objc2")]
70impl VTFrameRateConversionParametersSubmissionMode {
71    #[doc(alias = "VTFrameRateConversionParametersSubmissionModeRandom")]
72    pub const Random: Self = Self(1);
73    #[doc(alias = "VTFrameRateConversionParametersSubmissionModeSequential")]
74    pub const Sequential: Self = Self(2);
75    #[doc(alias = "VTFrameRateConversionParametersSubmissionModeSequentialReferencesUnchanged")]
76    pub const SequentialReferencesUnchanged: Self = Self(3);
77}
78
79#[cfg(feature = "objc2")]
80unsafe impl Encode for VTFrameRateConversionParametersSubmissionMode {
81    const ENCODING: Encoding = NSInteger::ENCODING;
82}
83
84#[cfg(feature = "objc2")]
85unsafe impl RefEncode for VTFrameRateConversionParametersSubmissionMode {
86    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
87}
88
89#[cfg(feature = "objc2")]
90extern_class!(
91    /// Configuration that is used to set up the FrameRateConversion Processor.
92    ///
93    ///
94    /// This configuration enables the FrameRateConversion on a VTFrameProcesing session.
95    ///
96    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtframerateconversionconfiguration?language=objc)
97    #[unsafe(super(NSObject))]
98    #[derive(Debug, PartialEq, Eq, Hash)]
99    #[cfg(feature = "objc2")]
100    pub struct VTFrameRateConversionConfiguration;
101);
102
103#[cfg(feature = "objc2")]
104unsafe impl Send for VTFrameRateConversionConfiguration {}
105
106#[cfg(feature = "objc2")]
107unsafe impl Sync for VTFrameRateConversionConfiguration {}
108
109#[cfg(feature = "objc2")]
110extern_conformance!(
111    unsafe impl NSObjectProtocol for VTFrameRateConversionConfiguration {}
112);
113
114#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
115extern_conformance!(
116    unsafe impl VTFrameProcessorConfiguration for VTFrameRateConversionConfiguration {}
117);
118
119#[cfg(feature = "objc2")]
120impl VTFrameRateConversionConfiguration {
121    extern_methods!(
122        /// Creates a new VTFrameRateConversionConfiguration with specified flow width and height.
123        ///
124        ///
125        /// init will return nil if dimensions are out of range or revision is unsupported.
126        ///
127        ///
128        /// Parameter `frameWidth`: Width of source frame in pixels. Maximum value is 8192 for macOS, and 4096 for iOS.
129        ///
130        ///
131        /// Parameter `frameHeight`: Height of source frame in pixels. Maximum value is 4320 for macOS, and 2160 for iOS.
132        ///
133        ///
134        /// 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.
135        ///
136        ///
137        /// Parameter `qualityPrioritization`: Used to control quality and performance levels. See VTFrameRateConversionConfigurationQualityPrioritization for more info.
138        ///
139        ///
140        /// Parameter `revision`: The specific algorithm or configuration revision that is to be used to perform the request.
141        #[unsafe(method(initWithFrameWidth:frameHeight:usePrecomputedFlow:qualityPrioritization:revision:))]
142        #[unsafe(method_family = init)]
143        pub unsafe fn initWithFrameWidth_frameHeight_usePrecomputedFlow_qualityPrioritization_revision(
144            this: Allocated<Self>,
145            frame_width: NSInteger,
146            frame_height: NSInteger,
147            use_precomputed_flow: bool,
148            quality_prioritization: VTFrameRateConversionConfigurationQualityPrioritization,
149            revision: VTFrameRateConversionConfigurationRevision,
150        ) -> Option<Retained<Self>>;
151
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159
160        /// Width of source frame in pixels.
161        #[unsafe(method(frameWidth))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn frameWidth(&self) -> NSInteger;
164
165        /// Height of source frame in pixels.
166        #[unsafe(method(frameHeight))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn frameHeight(&self) -> NSInteger;
169
170        /// Indicates that caller will provide optical flow.
171        #[unsafe(method(usePrecomputedFlow))]
172        #[unsafe(method_family = none)]
173        pub unsafe fn usePrecomputedFlow(&self) -> bool;
174
175        /// parameter used to control quality and performance levels. See VTFrameRateConversionConfigurationQualityPrioritization for more info.
176        #[unsafe(method(qualityPrioritization))]
177        #[unsafe(method_family = none)]
178        pub unsafe fn qualityPrioritization(
179            &self,
180        ) -> VTFrameRateConversionConfigurationQualityPrioritization;
181
182        /// The specific algorithm or configuration revision that is to be used to perform the request.
183        #[unsafe(method(revision))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn revision(&self) -> VTFrameRateConversionConfigurationRevision;
186
187        #[cfg(feature = "objc2-foundation")]
188        /// Provides the collection of currently-supported algorithm or configuration revisions for the class of configuration.
189        ///
190        /// This property allows clients to introspect at runtime what revisions are available for each configuration.
191        #[unsafe(method(supportedRevisions))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn supportedRevisions() -> Retained<NSIndexSet>;
194
195        /// Provides the default revision of a particular algorithm or configuration.
196        #[unsafe(method(defaultRevision))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn defaultRevision() -> VTFrameRateConversionConfigurationRevision;
199
200        #[cfg(feature = "objc2-foundation")]
201        /// list of source frame supported pixel formats for current configuration
202        #[unsafe(method(frameSupportedPixelFormats))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
205
206        #[cfg(feature = "objc2-foundation")]
207        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as source frames and reference frames.
208        #[unsafe(method(sourcePixelBufferAttributes))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn sourcePixelBufferAttributes(
211            &self,
212        ) -> Retained<NSDictionary<NSString, AnyObject>>;
213
214        #[cfg(feature = "objc2-foundation")]
215        /// returns a pixelBufferAttributes dictionary describing requirements for pixelBuffers used as destination frames.
216        #[unsafe(method(destinationPixelBufferAttributes))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn destinationPixelBufferAttributes(
219            &self,
220        ) -> Retained<NSDictionary<NSString, AnyObject>>;
221
222        /// reports that this processor is  supported
223        #[unsafe(method(processorSupported))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn processorSupported() -> Boolean;
226    );
227}
228
229#[cfg(feature = "objc2")]
230extern_class!(
231    /// VTFrameRateConversionParameters object contains both input and output parameters needed to run the FrameRateConversion 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 VTFrameProcessorMutableFrame) back to the caller function once the processWithParameters completes.
232    ///
233    ///
234    /// VTFrameRateConversionParameters are frame level parameters.
235    ///
236    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtframerateconversionparameters?language=objc)
237    #[unsafe(super(NSObject))]
238    #[derive(Debug, PartialEq, Eq, Hash)]
239    #[cfg(feature = "objc2")]
240    pub struct VTFrameRateConversionParameters;
241);
242
243#[cfg(feature = "objc2")]
244extern_conformance!(
245    unsafe impl NSObjectProtocol for VTFrameRateConversionParameters {}
246);
247
248#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
249extern_conformance!(
250    unsafe impl VTFrameProcessorParameters for VTFrameRateConversionParameters {}
251);
252
253#[cfg(feature = "objc2")]
254impl VTFrameRateConversionParameters {
255    extern_methods!(
256        #[cfg(all(feature = "VTFrameProcessorFrame", feature = "objc2-foundation"))]
257        /// Creates a new VTFrameRateConversionParameters .
258        ///
259        ///
260        /// init will return nil if sourceFrame or nextFrame is nil, if sourceFrame and reference frames don't have the same pixelformat, or if interpolationPhase array count does not match destinationFrames array count.
261        ///
262        ///
263        /// Parameter `sourceFrame`: Current source frame. Must be non nil.
264        ///
265        ///
266        /// Parameter `nextFrame`: Next source frame in presentation time order.  Must be non nil.
267        ///
268        ///
269        /// Parameter `opticalFlow`: Optional VTFrameProcessorOpticalFlow object that contains forward and backward optical flow with next frame. Only needed if optical flow is pre-computed. For the first frame this will always be nil.
270        ///
271        ///
272        /// Parameter `interpolationPhase`: Array of float numbers to indicate at what intervals to insert a frame between current and next frame. Array size indicates how many frames to interpolate and needs to match destinationFrames size, one interval for each destination frame. Float number values should be between 0 and 1, e.g to insert one frame in the middle a value of 0.5 can be used.
273        ///
274        ///
275        /// Parameter `submissionMode`: Set to VTFrameRateConversionParametersSubmissionModeSequential to indicate that current submission follow presentation time order without jump or skip when compared to previous submission. VTFrameRateConversionParametersSubmissionModeSequential will yield better performance. Set to  VTFrameRateConversionParametersSubmissionModeRandom to indicate a skip or a jump in frame sequence. If VTFrameRateConversionParametersSubmissionModeRandom is set internal cache will be cleared during processWithParameters call.
276        ///
277        ///
278        /// Parameter `destinationFrames`: Caller-allocated NSArray of VTFrameProcessorFrame that contains  pixel buffers that will receive the results.  Must contain the same number of elements as interpolationPhase NSArray.
279        #[unsafe(method(initWithSourceFrame:nextFrame:opticalFlow:interpolationPhase:submissionMode:destinationFrames:))]
280        #[unsafe(method_family = init)]
281        pub unsafe fn initWithSourceFrame_nextFrame_opticalFlow_interpolationPhase_submissionMode_destinationFrames(
282            this: Allocated<Self>,
283            source_frame: &VTFrameProcessorFrame,
284            next_frame: &VTFrameProcessorFrame,
285            optical_flow: Option<&VTFrameProcessorOpticalFlow>,
286            interpolation_phase: &NSArray<NSNumber>,
287            submission_mode: VTFrameRateConversionParametersSubmissionMode,
288            destination_frame: &NSArray<VTFrameProcessorFrame>,
289        ) -> Option<Retained<Self>>;
290
291        #[unsafe(method(init))]
292        #[unsafe(method_family = init)]
293        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
294
295        #[unsafe(method(new))]
296        #[unsafe(method_family = new)]
297        pub unsafe fn new() -> Retained<Self>;
298
299        #[cfg(feature = "VTFrameProcessorFrame")]
300        /// sourceFrame Current source frame. Must be non nil
301        #[unsafe(method(sourceFrame))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
304
305        #[cfg(feature = "VTFrameProcessorFrame")]
306        /// Next source frame in presentation time order. For the last frame this will be nil.
307        #[unsafe(method(nextFrame))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn nextFrame(&self) -> Option<Retained<VTFrameProcessorFrame>>;
310
311        #[cfg(feature = "VTFrameProcessorFrame")]
312        /// Optional VTFrameProcessorReadOnlyOpticalFlow 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.
313        #[unsafe(method(opticalFlow))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn opticalFlow(&self) -> Option<Retained<VTFrameProcessorOpticalFlow>>;
316
317        #[cfg(feature = "objc2-foundation")]
318        /// Array of float numbers to indicate at what intervals to insert a frame between current and next frame. Array size indicates how many frames to interpolate and needs to match destinationFrames size, one interval for each destination frame. Float number values should be between 0 and 1, e.g to insert one frame in the middle a value of 0.5 can be used.
319        #[unsafe(method(interpolationPhase))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn interpolationPhase(&self) -> Retained<NSArray<NSNumber>>;
322
323        /// A VTFrameRateConversionParametersSubmissionMode value describing the processing request in this Parameters object .
324        #[unsafe(method(submissionMode))]
325        #[unsafe(method_family = none)]
326        pub unsafe fn submissionMode(&self) -> VTFrameRateConversionParametersSubmissionMode;
327
328        #[cfg(all(feature = "VTFrameProcessorFrame", feature = "objc2-foundation"))]
329        /// Caller-allocated NSArray of VTFrameProcessorFrame that contains  pixel buffers that will receive the results.  Must contain the same number of elements as interpolationPhase NSArray.
330        #[unsafe(method(destinationFrames))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn destinationFrames(&self) -> Retained<NSArray<VTFrameProcessorFrame>>;
333    );
334}