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