objc2_video_toolbox/generated/VTFrameProcessor.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7#[cfg(feature = "objc2-foundation")]
8use objc2_foundation::*;
9#[cfg(feature = "objc2-metal")]
10use objc2_metal::*;
11
12use crate::*;
13
14#[cfg(feature = "objc2")]
15extern_class!(
16 /// Creates a new VTFrameProcessor for the configured video effect
17 ///
18 /// The VTFrameProcessor class is the main class to perform frame processing. Users can specify a video effect by passing a VTFrameProcessorConfiguration based object to the startSessionWithConfiguration call. Once a session is created, the processWithParameters method is called in a loop to process the frames one by one. Once all the frames are processed, endSession needs to called to finish all pending processing. The caller needs to ensure that all buffers passed to the processWithParameters interface are unmodified (inclduing attachments) until the function returns or the callback is received in the case of asynchronous mode.
19 ///
20 /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtframeprocessor?language=objc)
21 #[unsafe(super(NSObject))]
22 #[derive(Debug, PartialEq, Eq, Hash)]
23 #[cfg(feature = "objc2")]
24 pub struct VTFrameProcessor;
25);
26
27#[cfg(feature = "objc2")]
28extern_conformance!(
29 unsafe impl NSObjectProtocol for VTFrameProcessor {}
30);
31
32#[cfg(feature = "objc2")]
33impl VTFrameProcessor {
34 extern_methods!(
35 #[unsafe(method(init))]
36 #[unsafe(method_family = init)]
37 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
38
39 #[cfg(all(
40 feature = "VTFrameProcessorConfiguration",
41 feature = "objc2-foundation"
42 ))]
43 /// Starts a new session and configures the processor pipeline.
44 ///
45 /// Parameter `configuration`: A VTFrameProcessorConfiguration based object corresponding to the video effect that will be applied in the subsequent processWithParameters calls.
46 ///
47 /// Parameter `error`: Will contain error information if any. You may specify NULL for this parameter if you do not want the error information.
48 #[unsafe(method(startSessionWithConfiguration:error:_))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn startSessionWithConfiguration_error(
51 &self,
52 configuration: &ProtocolObject<dyn VTFrameProcessorConfiguration>,
53 ) -> Result<(), Retained<NSError>>;
54
55 #[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2-foundation"))]
56 /// Synchronously performs the effect specified in startSessionWithConfigurations.
57 ///
58 /// Frame level settings and frame level input/output parameters are passed by using the respective VTFrameProcessorParameters for the effect that VTFrameProcessor is configured for.
59 ///
60 /// Parameter `parameters`: A VTFrameProcessorParameters based object to specify additional frame based parameters to be used during processing. it needs to match the configuration type used during start session.
61 ///
62 /// Parameter `error`: Will contain error information if any. You may specify NULL for this parameter if you do not want the error information.
63 #[unsafe(method(processWithParameters:error:_))]
64 #[unsafe(method_family = none)]
65 pub unsafe fn processWithParameters_error(
66 &self,
67 parameters: &ProtocolObject<dyn VTFrameProcessorParameters>,
68 ) -> Result<(), Retained<NSError>>;
69
70 #[cfg(all(
71 feature = "VTFrameProcessorParameters",
72 feature = "block2",
73 feature = "objc2-foundation"
74 ))]
75 /// Asynchronously performs the effect specified in startSessionWithConfigurations.
76 ///
77 /// Parameter `parameters`: A VTFrameProcessorParameters based object to specify additional frame based parameters to be used during processing. it needs to match the configuration type used during start session.
78 ///
79 /// Parameter `completionHandler`: This completion handler will be called when frame processing in competed. The completion handler will receive the same parameters object that was provided tot he original call, as well as an NSError which will contain an error code if processing was not successful.
80 #[unsafe(method(processWithParameters:completionHandler:))]
81 #[unsafe(method_family = none)]
82 pub unsafe fn processWithParameters_completionHandler(
83 &self,
84 parameters: &ProtocolObject<dyn VTFrameProcessorParameters>,
85 completion_handler: &block2::DynBlock<
86 dyn Fn(NonNull<ProtocolObject<dyn VTFrameProcessorParameters>>, *mut NSError),
87 >,
88 );
89
90 #[cfg(all(feature = "VTFrameProcessorParameters", feature = "objc2-metal"))]
91 /// This API provides a Metal API friendly version of processWithParameters.
92 ///
93 /// This function allows clients to add the effect to an existing Metal command buffer. This can be used by clients that have an existing Metal pipeline and want to add this effect to it. Note: this function will wait until all previously inserted tasks in the command buffer finished before running. Tasks inserted after the processWithCommandBuffer will run after the effect is applied. Processing does not happen until the commandBuffer is executed.
94 ///
95 /// Parameter `commandBuffer`: An existing Metal command buffer where the frame processing will be inserted.
96 ///
97 /// Parameter `parameters`: A VTFrameProcessorParameters based object to specify additional frame based parameters to be used during processing. it needs to match the configuration type used during start session.
98 #[unsafe(method(processWithCommandBuffer:parameters:))]
99 #[unsafe(method_family = none)]
100 pub unsafe fn processWithCommandBuffer_parameters(
101 &self,
102 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
103 parameters: &ProtocolObject<dyn VTFrameProcessorParameters>,
104 );
105
106 /// Performs all necessary tasks to end the session. After this call completes, no new frames can be processed unless startSessionWithConfigurations is called again.
107 #[unsafe(method(endSession))]
108 #[unsafe(method_family = none)]
109 pub unsafe fn endSession(&self);
110 );
111}
112
113/// Methods declared on superclass `NSObject`.
114#[cfg(feature = "objc2")]
115impl VTFrameProcessor {
116 extern_methods!(
117 #[unsafe(method(new))]
118 #[unsafe(method_family = new)]
119 pub unsafe fn new() -> Retained<Self>;
120 );
121}