objc2_vision/generated/
VNVideoProcessor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10use objc2_foundation::*;
11
12use crate::*;
13
14extern_class!(
15    /// An object that defines the cadence at which the video stream is processed.
16    ///
17    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorcadence?language=objc)
18    #[unsafe(super(NSObject))]
19    #[derive(Debug, PartialEq, Eq, Hash)]
20    pub struct VNVideoProcessorCadence;
21);
22
23extern_conformance!(
24    unsafe impl NSCopying for VNVideoProcessorCadence {}
25);
26
27unsafe impl CopyingHelper for VNVideoProcessorCadence {
28    type Result = Self;
29}
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for VNVideoProcessorCadence {}
33);
34
35impl VNVideoProcessorCadence {
36    extern_methods!();
37}
38
39/// Methods declared on superclass `NSObject`.
40impl VNVideoProcessorCadence {
41    extern_methods!(
42        #[unsafe(method(init))]
43        #[unsafe(method_family = init)]
44        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
45
46        #[unsafe(method(new))]
47        #[unsafe(method_family = new)]
48        pub unsafe fn new() -> Retained<Self>;
49    );
50}
51
52extern_class!(
53    /// An object that defines a frame-based cadence for processing the video stream.
54    ///
55    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorframeratecadence?language=objc)
56    #[unsafe(super(VNVideoProcessorCadence, NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    pub struct VNVideoProcessorFrameRateCadence;
59);
60
61extern_conformance!(
62    unsafe impl NSCopying for VNVideoProcessorFrameRateCadence {}
63);
64
65unsafe impl CopyingHelper for VNVideoProcessorFrameRateCadence {
66    type Result = Self;
67}
68
69extern_conformance!(
70    unsafe impl NSObjectProtocol for VNVideoProcessorFrameRateCadence {}
71);
72
73impl VNVideoProcessorFrameRateCadence {
74    extern_methods!(
75        #[unsafe(method(init))]
76        #[unsafe(method_family = init)]
77        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
78
79        #[unsafe(method(initWithFrameRate:))]
80        #[unsafe(method_family = init)]
81        pub unsafe fn initWithFrameRate(
82            this: Allocated<Self>,
83            frame_rate: NSInteger,
84        ) -> Retained<Self>;
85
86        #[unsafe(method(frameRate))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn frameRate(&self) -> NSInteger;
89    );
90}
91
92/// Methods declared on superclass `NSObject`.
93impl VNVideoProcessorFrameRateCadence {
94    extern_methods!(
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub unsafe fn new() -> Retained<Self>;
98    );
99}
100
101extern_class!(
102    /// An object that defines a time-based cadence for processing the video stream.
103    ///
104    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessortimeintervalcadence?language=objc)
105    #[unsafe(super(VNVideoProcessorCadence, NSObject))]
106    #[derive(Debug, PartialEq, Eq, Hash)]
107    pub struct VNVideoProcessorTimeIntervalCadence;
108);
109
110extern_conformance!(
111    unsafe impl NSCopying for VNVideoProcessorTimeIntervalCadence {}
112);
113
114unsafe impl CopyingHelper for VNVideoProcessorTimeIntervalCadence {
115    type Result = Self;
116}
117
118extern_conformance!(
119    unsafe impl NSObjectProtocol for VNVideoProcessorTimeIntervalCadence {}
120);
121
122impl VNVideoProcessorTimeIntervalCadence {
123    extern_methods!(
124        #[unsafe(method(init))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
127
128        #[cfg(feature = "objc2-core-foundation")]
129        #[unsafe(method(initWithTimeInterval:))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn initWithTimeInterval(
132            this: Allocated<Self>,
133            time_interval: CFTimeInterval,
134        ) -> Retained<Self>;
135
136        #[cfg(feature = "objc2-core-foundation")]
137        #[unsafe(method(timeInterval))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn timeInterval(&self) -> CFTimeInterval;
140    );
141}
142
143/// Methods declared on superclass `NSObject`.
144impl VNVideoProcessorTimeIntervalCadence {
145    extern_methods!(
146        #[unsafe(method(new))]
147        #[unsafe(method_family = new)]
148        pub unsafe fn new() -> Retained<Self>;
149    );
150}
151
152extern_class!(
153    /// Options applied to a request's processing of the video.
154    ///
155    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessorrequestprocessingoptions?language=objc)
156    #[unsafe(super(NSObject))]
157    #[derive(Debug, PartialEq, Eq, Hash)]
158    pub struct VNVideoProcessorRequestProcessingOptions;
159);
160
161extern_conformance!(
162    unsafe impl NSCopying for VNVideoProcessorRequestProcessingOptions {}
163);
164
165unsafe impl CopyingHelper for VNVideoProcessorRequestProcessingOptions {
166    type Result = Self;
167}
168
169extern_conformance!(
170    unsafe impl NSObjectProtocol for VNVideoProcessorRequestProcessingOptions {}
171);
172
173impl VNVideoProcessorRequestProcessingOptions {
174    extern_methods!(
175        /// The cadence at which the request should be performed.
176        ///
177        /// If this property is not defined, then every frame will be processed.
178        #[unsafe(method(cadence))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn cadence(&self) -> Option<Retained<VNVideoProcessorCadence>>;
181
182        /// Setter for [`cadence`][Self::cadence].
183        #[unsafe(method(setCadence:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setCadence(&self, cadence: Option<&VNVideoProcessorCadence>);
186    );
187}
188
189/// Methods declared on superclass `NSObject`.
190impl VNVideoProcessorRequestProcessingOptions {
191    extern_methods!(
192        #[unsafe(method(init))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
195
196        #[unsafe(method(new))]
197        #[unsafe(method_family = new)]
198        pub unsafe fn new() -> Retained<Self>;
199    );
200}
201
202extern_class!(
203    /// A controller object that is used to perform one or more requests on a video stream.
204    ///
205    /// VNVideoProcessor handles the video decoding and buffer management, feeding the buffers to the associated requests at the best desired frame rate.
206    ///
207    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessor?language=objc)
208    #[unsafe(super(NSObject))]
209    #[derive(Debug, PartialEq, Eq, Hash)]
210    pub struct VNVideoProcessor;
211);
212
213extern_conformance!(
214    unsafe impl NSObjectProtocol for VNVideoProcessor {}
215);
216
217impl VNVideoProcessor {
218    extern_methods!(
219        #[unsafe(method(init))]
220        #[unsafe(method_family = init)]
221        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
222
223        /// Creates a VNVideoProcessor to be used for performing requests against a video asset specified by it's URL.
224        ///
225        ///
226        /// 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.
227        #[unsafe(method(initWithURL:))]
228        #[unsafe(method_family = init)]
229        pub unsafe fn initWithURL(this: Allocated<Self>, video_url: &NSURL) -> Retained<Self>;
230
231        #[cfg(feature = "VNRequest")]
232        /// Add a VNRequest with the specified processing options to be performed on the video.
233        ///
234        /// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
235        ///
236        ///
237        /// 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.
238        ///
239        /// Parameter `processingOptions`: The options applied to the request's processing of the video.
240        ///
241        /// 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.
242        ///
243        /// Returns: Returns true if the request added to the processing pipeline.
244        ///
245        /// Note: The VNRequest must have completion handler set otherwise no results can be returned.
246        #[unsafe(method(addRequest:processingOptions:error:_))]
247        #[unsafe(method_family = none)]
248        pub unsafe fn addRequest_processingOptions_error(
249            &self,
250            request: &VNRequest,
251            processing_options: &VNVideoProcessorRequestProcessingOptions,
252        ) -> Result<(), Retained<NSError>>;
253
254        #[cfg(all(feature = "VNRequest", feature = "VNTypes"))]
255        #[deprecated]
256        #[unsafe(method(addRequest:withProcessingOptions:error:_))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn addRequest_withProcessingOptions_error(
259            &self,
260            request: &VNRequest,
261            processing_options: &NSDictionary<VNVideoProcessingOption, AnyObject>,
262        ) -> Result<(), Retained<NSError>>;
263
264        #[cfg(feature = "VNRequest")]
265        /// Remove a VNRequest from the video processor, which means it won't be performed anymore.
266        ///
267        /// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
268        ///
269        ///
270        /// Parameter `request`: The VNRequest to be removed from the processing pipeline.
271        ///
272        /// 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.
273        ///
274        /// Returns: Returns true if the request was found and removed from the processing pipeline.
275        #[unsafe(method(removeRequest:error:_))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn removeRequest_error(
278            &self,
279            request: &VNRequest,
280        ) -> Result<(), Retained<NSError>>;
281
282        #[cfg(feature = "objc2-core-media")]
283        /// Processes the video over the specified time range.
284        ///
285        /// This call is synchronous and only returns after the video is processed through its duration or an error prevented the processing.
286        ///
287        ///
288        /// 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.
289        ///
290        /// 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.
291        ///
292        /// Returns: Returns true if all requests were scheduled and performed. Check individual requests results and errors for their respective success and failures.
293        ///
294        /// Note: The intersection of the CMTimeRangeMake(start, duration) and CMTimeRangeMake(kCMTimeZero, asset.duration) will determine the timerange of the video to process
295        #[unsafe(method(analyzeTimeRange:error:_))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn analyzeTimeRange_error(
298            &self,
299            time_range: CMTimeRange,
300        ) -> Result<(), Retained<NSError>>;
301
302        #[cfg(feature = "objc2-core-media")]
303        #[deprecated]
304        #[unsafe(method(analyzeWithTimeRange:error:_))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn analyzeWithTimeRange_error(
307            &self,
308            time_range: CMTimeRange,
309        ) -> Result<(), Retained<NSError>>;
310
311        /// Cancel the processing of the video. This can return before the last request has completed.
312        #[unsafe(method(cancel))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn cancel(&self);
315    );
316}
317
318/// Methods declared on superclass `NSObject`.
319impl VNVideoProcessor {
320    extern_methods!(
321        #[unsafe(method(new))]
322        #[unsafe(method_family = new)]
323        pub unsafe fn new() -> Retained<Self>;
324    );
325}