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        ///
184        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
185        #[unsafe(method(setCadence:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setCadence(&self, cadence: Option<&VNVideoProcessorCadence>);
188    );
189}
190
191/// Methods declared on superclass `NSObject`.
192impl VNVideoProcessorRequestProcessingOptions {
193    extern_methods!(
194        #[unsafe(method(init))]
195        #[unsafe(method_family = init)]
196        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
197
198        #[unsafe(method(new))]
199        #[unsafe(method_family = new)]
200        pub unsafe fn new() -> Retained<Self>;
201    );
202}
203
204extern_class!(
205    /// A controller object that is used to perform one or more requests on a video stream.
206    ///
207    /// VNVideoProcessor handles the video decoding and buffer management, feeding the buffers to the associated requests at the best desired frame rate.
208    ///
209    /// See also [Apple's documentation](https://developer.apple.com/documentation/vision/vnvideoprocessor?language=objc)
210    #[unsafe(super(NSObject))]
211    #[derive(Debug, PartialEq, Eq, Hash)]
212    pub struct VNVideoProcessor;
213);
214
215extern_conformance!(
216    unsafe impl NSObjectProtocol for VNVideoProcessor {}
217);
218
219impl VNVideoProcessor {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
224
225        /// Creates a VNVideoProcessor to be used for performing requests against a video asset specified by it's URL.
226        ///
227        ///
228        /// 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.
229        #[unsafe(method(initWithURL:))]
230        #[unsafe(method_family = init)]
231        pub unsafe fn initWithURL(this: Allocated<Self>, video_url: &NSURL) -> Retained<Self>;
232
233        #[cfg(feature = "VNRequest")]
234        /// Add a VNRequest with the specified processing options to be performed on the video.
235        ///
236        /// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
237        ///
238        ///
239        /// 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.
240        ///
241        /// Parameter `processingOptions`: The options applied to the request's processing of the video.
242        ///
243        /// 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.
244        ///
245        /// Returns: Returns true if the request added to the processing pipeline.
246        ///
247        /// Note: The VNRequest must have completion handler set otherwise no results can be returned.
248        #[unsafe(method(addRequest:processingOptions:error:_))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn addRequest_processingOptions_error(
251            &self,
252            request: &VNRequest,
253            processing_options: &VNVideoProcessorRequestProcessingOptions,
254        ) -> Result<(), Retained<NSError>>;
255
256        #[cfg(all(feature = "VNRequest", feature = "VNTypes"))]
257        /// # Safety
258        ///
259        /// `processing_options` generic should be of the correct type.
260        #[deprecated]
261        #[unsafe(method(addRequest:withProcessingOptions:error:_))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn addRequest_withProcessingOptions_error(
264            &self,
265            request: &VNRequest,
266            processing_options: &NSDictionary<VNVideoProcessingOption, AnyObject>,
267        ) -> Result<(), Retained<NSError>>;
268
269        #[cfg(feature = "VNRequest")]
270        /// Remove a VNRequest from the video processor, which means it won't be performed anymore.
271        ///
272        /// This method can be called either before calling -analyzeTimeRange:error: or from within one of the already associated request's completion handlers.
273        ///
274        ///
275        /// Parameter `request`: The VNRequest to be removed from the processing pipeline.
276        ///
277        /// 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.
278        ///
279        /// Returns: Returns true if the request was found and removed from the processing pipeline.
280        #[unsafe(method(removeRequest:error:_))]
281        #[unsafe(method_family = none)]
282        pub unsafe fn removeRequest_error(
283            &self,
284            request: &VNRequest,
285        ) -> Result<(), Retained<NSError>>;
286
287        #[cfg(feature = "objc2-core-media")]
288        /// Processes the video over the specified time range.
289        ///
290        /// This call is synchronous and only returns after the video is processed through its duration or an error prevented the processing.
291        ///
292        ///
293        /// 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.
294        ///
295        /// 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.
296        ///
297        /// Returns: Returns true if all requests were scheduled and performed. Check individual requests results and errors for their respective success and failures.
298        ///
299        /// Note: The intersection of the CMTimeRangeMake(start, duration) and CMTimeRangeMake(kCMTimeZero, asset.duration) will determine the timerange of the video to process
300        #[unsafe(method(analyzeTimeRange:error:_))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn analyzeTimeRange_error(
303            &self,
304            time_range: CMTimeRange,
305        ) -> Result<(), Retained<NSError>>;
306
307        #[cfg(feature = "objc2-core-media")]
308        #[deprecated]
309        #[unsafe(method(analyzeWithTimeRange:error:_))]
310        #[unsafe(method_family = none)]
311        pub unsafe fn analyzeWithTimeRange_error(
312            &self,
313            time_range: CMTimeRange,
314        ) -> Result<(), Retained<NSError>>;
315
316        /// Cancel the processing of the video. This can return before the last request has completed.
317        #[unsafe(method(cancel))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn cancel(&self);
320    );
321}
322
323/// Methods declared on superclass `NSObject`.
324impl VNVideoProcessor {
325    extern_methods!(
326        #[unsafe(method(new))]
327        #[unsafe(method_family = new)]
328        pub unsafe fn new() -> Retained<Self>;
329    );
330}