objc2_video_toolbox/generated/
VTFrameProcessor_LowLatencySuperResolutionScaler.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-core-media")]
8use objc2_core_media::*;
9#[cfg(feature = "objc2-foundation")]
10use objc2_foundation::*;
11
12use crate::*;
13
14#[cfg(feature = "objc2")]
15extern_class!(
16    /// An object you use to configure frame processor for low-latency super-resolution scaler processing.
17    ///
18    /// Use this object to configure a ``VTFrameProcessor``. Query this interface also for important operating details, like
19    /// the pixel buffer attributes required for frames you submit to the processor.
20    ///
21    /// > Important: When calling ``VTFrameProcessor/startSessionWithConfiguration:error:`` to create a `VTLowLatencySuperResolutionScaler`
22    /// session, ML model loading may take longer than a frame time. Avoid blocking the UI thread or stalling frame rendering
23    /// pipelines during this call.
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtlowlatencysuperresolutionscalerconfiguration?language=objc)
26    #[unsafe(super(NSObject))]
27    #[derive(Debug, PartialEq, Eq, Hash)]
28    #[cfg(feature = "objc2")]
29    pub struct VTLowLatencySuperResolutionScalerConfiguration;
30);
31
32#[cfg(feature = "objc2")]
33unsafe impl Send for VTLowLatencySuperResolutionScalerConfiguration {}
34
35#[cfg(feature = "objc2")]
36unsafe impl Sync for VTLowLatencySuperResolutionScalerConfiguration {}
37
38#[cfg(feature = "objc2")]
39extern_conformance!(
40    unsafe impl NSObjectProtocol for VTLowLatencySuperResolutionScalerConfiguration {}
41);
42
43#[cfg(all(feature = "VTFrameProcessorConfiguration", feature = "objc2"))]
44extern_conformance!(
45    unsafe impl VTFrameProcessorConfiguration for VTLowLatencySuperResolutionScalerConfiguration {}
46);
47
48#[cfg(feature = "objc2")]
49impl VTLowLatencySuperResolutionScalerConfiguration {
50    extern_methods!(
51        /// Creates a new low-latency super-resolution scaler configuration with specified frame width and height.
52        ///
53        /// - Parameters:
54        /// - frameWidth: Width of source frame in pixels.
55        /// - frameHeight: Height of source frame in pixels.
56        /// - scaleFactor: The scale factor to apply. This must be a supported value that ``supportedScaleFactorsForFrameWidth:frameHeight:`` returns.
57        #[unsafe(method(initWithFrameWidth:frameHeight:scaleFactor:))]
58        #[unsafe(method_family = init)]
59        pub unsafe fn initWithFrameWidth_frameHeight_scaleFactor(
60            this: Allocated<Self>,
61            frame_width: NSInteger,
62            frame_height: NSInteger,
63            scale_factor: c_float,
64        ) -> Retained<Self>;
65
66        #[unsafe(method(init))]
67        #[unsafe(method_family = init)]
68        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
69
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub unsafe fn new() -> Retained<Self>;
73
74        /// Width of source frame in pixels.
75        ///
76        /// This property is not atomic.
77        ///
78        /// # Safety
79        ///
80        /// This might not be thread-safe.
81        #[unsafe(method(frameWidth))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn frameWidth(&self) -> NSInteger;
84
85        /// Height of source frame in pixels.
86        ///
87        /// This property is not atomic.
88        ///
89        /// # Safety
90        ///
91        /// This might not be thread-safe.
92        #[unsafe(method(frameHeight))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn frameHeight(&self) -> NSInteger;
95
96        #[cfg(feature = "objc2-foundation")]
97        /// Available supported pixel formats for source frames for current configuration.
98        ///
99        /// This property is not atomic.
100        ///
101        /// # Safety
102        ///
103        /// This might not be thread-safe.
104        #[unsafe(method(frameSupportedPixelFormats))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn frameSupportedPixelFormats(&self) -> Retained<NSArray<NSNumber>>;
107
108        #[cfg(feature = "objc2-foundation")]
109        /// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent source frames and reference frames.
110        ///
111        /// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
112        ///
113        /// This property is not atomic.
114        ///
115        /// # Safety
116        ///
117        /// This might not be thread-safe.
118        #[unsafe(method(sourcePixelBufferAttributes))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn sourcePixelBufferAttributes(
121            &self,
122        ) -> Retained<NSDictionary<NSString, AnyObject>>;
123
124        #[cfg(feature = "objc2-foundation")]
125        /// Pixel buffer attributes dictionary that describes requirements for pixel buffers which represent destination frames.
126        ///
127        /// Use ``CVPixelBufferCreateResolvedAttributesDictionary`` to combine this dictionary with your pixel buffer attributes dictionary.
128        ///
129        /// This property is not atomic.
130        ///
131        /// # Safety
132        ///
133        /// This might not be thread-safe.
134        #[unsafe(method(destinationPixelBufferAttributes))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn destinationPixelBufferAttributes(
137            &self,
138        ) -> Retained<NSDictionary<NSString, AnyObject>>;
139
140        /// Scale factor with which you initialized the configuration.
141        ///
142        /// This property is not atomic.
143        ///
144        /// # Safety
145        ///
146        /// This might not be thread-safe.
147        #[unsafe(method(scaleFactor))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn scaleFactor(&self) -> c_float;
150
151        #[cfg(feature = "objc2-core-media")]
152        /// Maximum dimensions for a source frame for the processor.
153        #[unsafe(method(maximumDimensions))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn maximumDimensions() -> CMVideoDimensions;
156
157        #[cfg(feature = "objc2-core-media")]
158        /// Minimum dimensions for a source frame for the processor.
159        #[unsafe(method(minimumDimensions))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn minimumDimensions() -> CMVideoDimensions;
162
163        /// Reports whether the system supports this processor on the current configuration.
164        #[unsafe(method(isSupported))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn isSupported() -> bool;
167
168        #[cfg(feature = "objc2-foundation")]
169        /// Returns an array of supported scale factors values, or an empty list if the processor doesn't support the dimensions.
170        #[unsafe(method(supportedScaleFactorsForFrameWidth:frameHeight:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn supportedScaleFactorsForFrameWidth_frameHeight(
173            frame_width: NSInteger,
174            frame_height: NSInteger,
175        ) -> Retained<NSArray<NSNumber>>;
176    );
177}
178
179#[cfg(feature = "objc2")]
180extern_class!(
181    /// An object that contains both input and output parameters that the low-latency super-resolution scaler frame processor needs.
182    ///
183    /// Use this object in the `processWithParameters` call of `VTFrameProcessor` class.
184    ///
185    /// `VTLowLatencySuperResolutionScalerParameters` are frame-level parameters.
186    ///
187    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtlowlatencysuperresolutionscalerparameters?language=objc)
188    #[unsafe(super(NSObject))]
189    #[derive(Debug, PartialEq, Eq, Hash)]
190    #[cfg(feature = "objc2")]
191    pub struct VTLowLatencySuperResolutionScalerParameters;
192);
193
194#[cfg(feature = "objc2")]
195extern_conformance!(
196    unsafe impl NSObjectProtocol for VTLowLatencySuperResolutionScalerParameters {}
197);
198
199#[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2"))]
200extern_conformance!(
201    unsafe impl VTFrameProcessorParameters for VTLowLatencySuperResolutionScalerParameters {}
202);
203
204#[cfg(feature = "objc2")]
205impl VTLowLatencySuperResolutionScalerParameters {
206    extern_methods!(
207        #[cfg(feature = "VTFrameProcessorFrame")]
208        /// Creates a new low-latency, super-resolution scaler parameters object.
209        ///
210        /// - Parameters:
211        /// - sourceFrame: Current source frame; must be non `nil`.
212        /// - destinationFrame: User-allocated pixel buffer that receives the scaled processor output; must be non `nil`.
213        #[unsafe(method(initWithSourceFrame:destinationFrame:))]
214        #[unsafe(method_family = init)]
215        pub unsafe fn initWithSourceFrame_destinationFrame(
216            this: Allocated<Self>,
217            source_frame: &VTFrameProcessorFrame,
218            destination_frame: &VTFrameProcessorFrame,
219        ) -> Retained<Self>;
220
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
224
225        #[unsafe(method(new))]
226        #[unsafe(method_family = new)]
227        pub unsafe fn new() -> Retained<Self>;
228
229        #[cfg(feature = "VTFrameProcessorFrame")]
230        /// Current source frame, which must be non `nil`.
231        #[unsafe(method(sourceFrame))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn sourceFrame(&self) -> Retained<VTFrameProcessorFrame>;
234
235        #[cfg(feature = "VTFrameProcessorFrame")]
236        /// Destination frame that contains user-allocated pixel buffer that receives the scaled processor output.
237        #[unsafe(method(destinationFrame))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn destinationFrame(&self) -> Retained<VTFrameProcessorFrame>;
240    );
241}