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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-media")]
use objc2_core_media::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// An object that defines the cadence at which the video stream is processed.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorcadence?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNVideoProcessorCadence;
);
extern_conformance!(
unsafe impl NSCopying for VNVideoProcessorCadence {}
);
unsafe impl CopyingHelper for VNVideoProcessorCadence {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNVideoProcessorCadence {}
);
impl VNVideoProcessorCadence {
extern_methods!();
}
/// Methods declared on superclass `NSObject`.
impl VNVideoProcessorCadence {
extern_methods!(
#[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>;
);
}
extern_class!(
/// An object that defines a frame-based cadence for processing the video stream.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorframeratecadence?language=objc)
#[unsafe(super(VNVideoProcessorCadence, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNVideoProcessorFrameRateCadence;
);
extern_conformance!(
unsafe impl NSCopying for VNVideoProcessorFrameRateCadence {}
);
unsafe impl CopyingHelper for VNVideoProcessorFrameRateCadence {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNVideoProcessorFrameRateCadence {}
);
impl VNVideoProcessorFrameRateCadence {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithFrameRate:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFrameRate(
this: Allocated<Self>,
frame_rate: NSInteger,
) -> Retained<Self>;
#[unsafe(method(frameRate))]
#[unsafe(method_family = none)]
pub unsafe fn frameRate(&self) -> NSInteger;
);
}
/// Methods declared on superclass `NSObject`.
impl VNVideoProcessorFrameRateCadence {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// An object that defines a time-based cadence for processing the video stream.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessortimeintervalcadence?language=objc)
#[unsafe(super(VNVideoProcessorCadence, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNVideoProcessorTimeIntervalCadence;
);
extern_conformance!(
unsafe impl NSCopying for VNVideoProcessorTimeIntervalCadence {}
);
unsafe impl CopyingHelper for VNVideoProcessorTimeIntervalCadence {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNVideoProcessorTimeIntervalCadence {}
);
impl VNVideoProcessorTimeIntervalCadence {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(initWithTimeInterval:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithTimeInterval(
this: Allocated<Self>,
time_interval: CFTimeInterval,
) -> Retained<Self>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(timeInterval))]
#[unsafe(method_family = none)]
pub unsafe fn timeInterval(&self) -> CFTimeInterval;
);
}
/// Methods declared on superclass `NSObject`.
impl VNVideoProcessorTimeIntervalCadence {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
/// Options applied to a request's processing of the video.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorrequestprocessingoptions?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNVideoProcessorRequestProcessingOptions;
);
extern_conformance!(
unsafe impl NSCopying for VNVideoProcessorRequestProcessingOptions {}
);
unsafe impl CopyingHelper for VNVideoProcessorRequestProcessingOptions {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for VNVideoProcessorRequestProcessingOptions {}
);
impl VNVideoProcessorRequestProcessingOptions {
extern_methods!(
/// The cadence at which the request should be performed.
///
/// If this property is not defined, then every frame will be processed.
#[unsafe(method(cadence))]
#[unsafe(method_family = none)]
pub unsafe fn cadence(&self) -> Option<Retained<VNVideoProcessorCadence>>;
/// Setter for [`cadence`][Self::cadence].
///
/// This is [copied][objc2_foundation::NSCopying::copy] when set.
#[unsafe(method(setCadence:))]
#[unsafe(method_family = none)]
pub unsafe fn setCadence(&self, cadence: Option<&VNVideoProcessorCadence>);
);
}
/// Methods declared on superclass `NSObject`.
impl VNVideoProcessorRequestProcessingOptions {
extern_methods!(
#[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>;
);
}
extern_class!(
/// A controller object that is used to perform one or more requests on a video stream.
///
/// VNVideoProcessor handles the video decoding and buffer management, feeding the buffers to the associated requests at the best desired frame rate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VNVideoProcessor;
);
extern_conformance!(
unsafe impl NSObjectProtocol for VNVideoProcessor {}
);
impl VNVideoProcessor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
/// Creates a VNVideoProcessor to be used for performing requests against a video asset specified by it's URL.
///
///
/// Parameter `videoURL`: A URL pointing at a video asset on which the requests will be performed. The video format has to be supported by AVFoundation.
#[unsafe(method(initWithURL:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithURL(this: Allocated<Self>, video_url: &NSURL) -> Retained<Self>;
#[cfg(feature = "VNRequest")]
/// Add a VNRequest with the specified processing options to be performed on the video.
///
/// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
///
///
/// Parameter `request`: The VNRequest to be added to the processing pipeline. If added from within a completionHandler, it will be processed on the same frame that is currently being processed.
///
/// Parameter `processingOptions`: The options applied to the request's processing of the video.
///
/// Parameter `error`: Returns an error that happened during scheduling of the requests. Check individual requests results and errors for their respective success and failures. This parameter is optional.
///
/// Returns: Returns true if the request added to the processing pipeline.
///
/// Note: The VNRequest must have completion handler set otherwise no results can be returned.
#[unsafe(method(addRequest:processingOptions:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn addRequest_processingOptions_error(
&self,
request: &VNRequest,
processing_options: &VNVideoProcessorRequestProcessingOptions,
) -> Result<(), Retained<NSError>>;
#[cfg(all(feature = "VNRequest", feature = "VNTypes"))]
/// # Safety
///
/// `processing_options` generic should be of the correct type.
#[deprecated]
#[unsafe(method(addRequest:withProcessingOptions:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn addRequest_withProcessingOptions_error(
&self,
request: &VNRequest,
processing_options: &NSDictionary<VNVideoProcessingOption, AnyObject>,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "VNRequest")]
/// Remove a VNRequest from the video processor, which means it won't be performed anymore.
///
/// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
///
///
/// Parameter `request`: The VNRequest to be removed from the processing pipeline.
///
/// Parameter `error`: Returns an error that happened during processing of the request, such as if the request was not found in the processing queue. This parameter is optional.
///
/// Returns: Returns true if the request was found and removed from the processing pipeline.
#[unsafe(method(removeRequest:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn removeRequest_error(
&self,
request: &VNRequest,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-core-media")]
/// Processes the video over the specified time range.
///
/// This call is synchronous and only returns after the video is processed through its duration or an error prevented the processing.
///
///
/// Parameter `timeRange`: Start and duration of the timerange within video to process. If the duration is longer than the video (e.g., kCMTimeIndefinite) the processing stops at the end of the video.
///
/// Parameter `error`: Returns an error that happened during the starting of the processing queue (for instance if the time range is not valid for the video asset). This parameter is optional.
///
/// Returns: Returns true if all requests were scheduled and performed. Check individual requests results and errors for their respective success and failures.
///
/// Note: The intersection of the CMTimeRangeMake(start, duration) and CMTimeRangeMake(kCMTimeZero, asset.duration) will determine the timerange of the video to process
#[unsafe(method(analyzeTimeRange:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn analyzeTimeRange_error(
&self,
time_range: CMTimeRange,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "objc2-core-media")]
#[deprecated]
#[unsafe(method(analyzeWithTimeRange:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn analyzeWithTimeRange_error(
&self,
time_range: CMTimeRange,
) -> Result<(), Retained<NSError>>;
/// Cancel the processing of the video. This can return before the last request has completed.
#[unsafe(method(cancel))]
#[unsafe(method_family = none)]
pub unsafe fn cancel(&self);
);
}
/// Methods declared on superclass `NSObject`.
impl VNVideoProcessor {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}