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