objc2_video_toolbox/generated/
VTRAWProcessingSession.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-media")]
9use objc2_core_media::*;
10#[cfg(feature = "objc2-core-video")]
11use objc2_core_video::*;
12
13use crate::*;
14
15/// A reference to a Video Toolbox RAW Processing Session.
16///
17/// A RAW processing session supports processing of frames that have been output from decoders in camera native formats, for example RAW or bayer formats.
18/// The session reference is a reference-counted CF object.
19///
20/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtrawprocessingsession?language=objc)
21#[repr(C)]
22pub struct VTRAWProcessingSession {
23    inner: [u8; 0],
24    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
25}
26
27cf_type!(
28    #[encoding_name = "OpaqueVTRAWProcessingSession"]
29    unsafe impl VTRAWProcessingSession {}
30);
31
32/// Block invoked when processing parameters change.
33///
34/// This block is called when available parameters or parameter values change without an explicit call to VTRAWProcessingSessionSetProcessingParameters.
35/// This is intended to allow the client to update any UI driven by these parameters.
36///
37/// Parameter `newParameters`: A CFArrayRef contaiing the new parameter details.  This follows the same form as the array returned from VTRAWProcessingSessionCopyProcessingParameters.
38///
39/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtrawprocessingparameterchangehandler?language=objc)
40#[cfg(feature = "block2")]
41pub type VTRAWProcessingParameterChangeHandler = *mut block2::Block<dyn Fn(*const CFArray)>;
42
43extern "C-unwind" {
44    /// Creates a RAW video frame processing session.
45    ///
46    /// .
47    ///
48    /// Parameter `allocator`: An allocator for the session.  Pass NULL to use the default allocator.
49    ///
50    /// Parameter `formatDescription`: The CMVideoFormatDescription corresponding to the original media samples, containing sequence-level processing parameters.
51    ///
52    /// Parameter `outputPixelBufferAttributes`: A CoreVideo pixel buffer attributes dictionary describing the client's requirements for pixel buffers for output frames.
53    /// Pass NULL to receive the RAW processor's native output format.
54    ///
55    /// Parameter `processingSessionOptions`: A dictionary of creation-time options for the VTRAWProcessingSession.
56    ///
57    /// Parameter `processingSessionOut`: Points to a variable to receive the new RAW processing session.
58    /// When you are done with the session, call VTRAWProcessingSessionInvalidate
59    /// to tear it down and then CFRelease to release your object reference.
60    #[cfg(feature = "objc2-core-media")]
61    pub fn VTRAWProcessingSessionCreate(
62        allocator: Option<&CFAllocator>,
63        format_description: &CMVideoFormatDescription,
64        output_pixel_buffer_attributes: Option<&CFDictionary>,
65        processing_session_options: Option<&CFDictionary>,
66        processing_session_out: NonNull<*mut VTRAWProcessingSession>,
67    ) -> OSStatus;
68}
69
70extern "C-unwind" {
71    /// Tears down a RAW processing session.
72    ///
73    /// When you are done with a decompression session you created, call VTRAWProcessingSessionInvalidate
74    /// to tear it down and then CFRelease to release your object reference.
75    /// When a  session's retain count reaches zero, it is automatically invalidated, but
76    /// since sessions may be retained by multiple parties, it can be hard to predict when this will happen.
77    /// Calling VTRAWProcessingSessionInvalidate ensures a deterministic, orderly teardown.
78    pub fn VTRAWProcessingSessionInvalidate(session: &VTRAWProcessingSession);
79}
80
81unsafe impl ConcreteType for VTRAWProcessingSession {
82    /// Returns the CFTypeID for RAW processing sessions.
83    #[doc(alias = "VTRAWProcessingSessionGetTypeID")]
84    #[inline]
85    fn type_id() -> CFTypeID {
86        extern "C-unwind" {
87            fn VTRAWProcessingSessionGetTypeID() -> CFTypeID;
88        }
89        unsafe { VTRAWProcessingSessionGetTypeID() }
90    }
91}
92
93extern "C-unwind" {
94    /// Provides a block which will be called when the VTRAWProcessingPlugin changes the set of processing parameters..
95    ///
96    /// This block will be called the VTRAWProcessingPlugin either changes the set of available processing parameters, or changes the current value of parameters.
97    /// The VTRAWProcessingPlugin may change parameters based on metadata associated with input frames, or in response to other parameters configured by VTRAWProcessingSessionSetProcessingParameters.
98    /// This optional and does not need to be configured if the client is not driving UI based on these parameters, or otherwise does not need this.
99    ///
100    /// Parameter `session`: The RAW processing session.
101    ///
102    /// Parameter `parameterChangeHandler`: A VTRAWProcessingParameterChangeHandler block which will be called when the set of processing parameters changes, or the value of a parameter changes without the client explicitly requesting it.
103    /// Setting this to NULL removes the current handler.
104    #[cfg(feature = "block2")]
105    pub fn VTRAWProcessingSessionSetParameterChangedHander(
106        session: &VTRAWProcessingSession,
107        parameter_change_handler: VTRAWProcessingParameterChangeHandler,
108    ) -> OSStatus;
109}
110
111/// Block invoked when frame processing is complete.
112///
113/// On successful processing, will return a CVPixelBuffer conforming to the session's outputPixelBufferAttributes if any were provided.
114///
115/// Parameter `status`: noErr if processing request was successful; an error code if it was not successful.
116///
117/// Parameter `processedPixelBuffer`: A CVPixelBuffer containing the processed video frame if processing request was successful;
118/// otherwise, NULL.
119///
120/// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/vtrawprocessingoutputhandler?language=objc)
121#[cfg(all(feature = "block2", feature = "objc2-core-video"))]
122pub type VTRAWProcessingOutputHandler = *mut block2::Block<dyn Fn(OSStatus, *mut CVPixelBuffer)>;
123
124extern "C-unwind" {
125    /// Call this function to submit RAW frames for format-specific processing using sequence and frame level parameters.
126    ///
127    /// Processed frames may or may not be output before the function returns,
128    /// The client should not modify the input pixel data after making this call.
129    /// The RAW Processor will retain the input pixel buffer as long as necessary.
130    ///
131    /// For any RAW processor, there is a finite number of frames that can be
132    /// presented to VTRAWProcessingSessionProcessFrame before the function will block
133    /// until the output callback is invoked.
134    ///
135    /// Parameter `session`: The RAW processing session.
136    ///
137    /// Parameter `inputPixelBuffer`: A CVPixelBuffer containing an input video frame to be processed.
138    ///
139    /// Parameter `frameOptions`: Contains key/value pairs specifying additional properties for processing this frame.
140    /// No keys currently.  Pass NULL.
141    ///
142    /// Parameter `outputHandler`: A VTRAWProcessingOutputHandler block which will be called once when processing is complete.
143    #[cfg(all(feature = "block2", feature = "objc2-core-video"))]
144    pub fn VTRAWProcessingSessionProcessFrame(
145        session: &VTRAWProcessingSession,
146        input_pixel_buffer: &CVPixelBuffer,
147        frame_options: Option<&CFDictionary>,
148        output_handler: VTRAWProcessingOutputHandler,
149    ) -> OSStatus;
150}
151
152extern "C-unwind" {
153    /// Forces the RAW Processor to complete processing frames.
154    ///
155    /// Call this after calling a set of VTRAWProcessingSessionProcessFrame calls to ensure that all frames have been processed.
156    /// Before VTRAWProcessingSessionCompleteFrames returns, the output handler will be invoked for all pending frames.
157    ///
158    /// Parameter `session`: The RAW processing session.
159    pub fn VTRAWProcessingSessionCompleteFrames(session: &VTRAWProcessingSession) -> OSStatus;
160}
161
162extern "C-unwind" {
163    /// Copies an array of dictionaries describing the parameters provided by the RAW Processor for frame processing
164    ///
165    /// This will return an array of dictionaries, one dictionary for each parameter that can be controlled in the RAW Processing operation.
166    /// The dictionary for each parameter will contain a set of kVTRAWProcessingParameter keys whose values provide a name, value type,
167    /// value range, and current value for each parameter.
168    ///
169    /// The returned values can be used to contruct dynamic UI presenting RAW Processing controls allowing the various knobs for this
170    /// specific RAW Processor to be viewed and manipulated.
171    ///
172    /// Parameter `session`: The RAW processing session.
173    ///
174    /// Parameter `outParameterArray`: Pointer for receiving the RAW Processing parameter array..
175    pub fn VTRAWProcessingSessionCopyProcessingParameters(
176        session: &VTRAWProcessingSession,
177        out_parameter_array: NonNull<*const CFArray>,
178    ) -> OSStatus;
179}
180
181extern "C-unwind" {
182    /// Sets a collection of RAW Processing parameters
183    ///
184    /// This call will set a collection of RAW Processing parameters on the RAW Processor.  These are set as a dictionary where the keys match
185    /// kVTRAWProcessingParameter_Key values that were returned in VTRAWProcessingSessionCopyProcessingParameters and where values conform
186    /// to the type and range defined in the kVTRAWProcessingParameter dictionary for each parameter.
187    ///
188    /// Not all parameters from the RAWProcessingParameter array need to be set at any given time.  Changining the parameters will not change
189    /// processing on frames already submitted for processing, it will only impact frames where VTRAWProcessingSessionProcessFrame is called
190    /// after VTRAWProcessingSessionSetProcessingParameters returns.
191    ///
192    /// If any parameters specified are not in the array reported by VTRAWProcessingSessionCopyProcessingParameters, or are the wrong type or are out of range,
193    /// kVTParameterErr will be returned and none of the parameters will be applied.
194    ///
195    /// Parameter `session`: The RAW processing session.
196    ///
197    /// Parameter `processingParameters`: A dictionary of keys and values setting parameters reported by VTRAWProcessingSessionCopyProcessingParameters.
198    ///
199    /// Returns: Returns an error if any of the provided parameters are invalid, disabled or outside of the declared valid range.
200    /// None of the provided parameters will be set on the processor if an error is returned.
201    pub fn VTRAWProcessingSessionSetProcessingParameters(
202        session: &VTRAWProcessingSession,
203        processing_parameters: &CFDictionary,
204    ) -> OSStatus;
205}
206
207extern "C" {
208    /// The value corresponding to this key is the string used when specifying this parameter when calling VTRAWProcessingSessionSetProcessingParameters.
209    ///
210    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_key?language=objc)
211    pub static kVTRAWProcessingParameter_Key: &'static CFString;
212}
213
214extern "C" {
215    /// The value corresponding to this key is a localized string  which can be displayed in UI representing this parameter.
216    ///
217    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_name?language=objc)
218    pub static kVTRAWProcessingParameter_Name: &'static CFString;
219}
220
221extern "C" {
222    /// The value corresponding to this key is a localized string with a description of the parameter suitable for display in a tooltip or other descriptive UI.
223    ///
224    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_description?language=objc)
225    pub static kVTRAWProcessingParameter_Description: &'static CFString;
226}
227
228extern "C" {
229    /// The value corresponding to this key is Boolean indicating whether the parameter is enabled and can be modified.
230    ///
231    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_enabled?language=objc)
232    pub static kVTRAWProcessingParameter_Enabled: &'static CFString;
233}
234
235extern "C" {
236    /// The value corresponding to this key is the type of the parameter - a Boolean, Integer, Float, List, or SubGroup.
237    ///
238    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_valuetype?language=objc)
239    pub static kVTRAWProcessingParameter_ValueType: &'static CFString;
240}
241
242extern "C" {
243    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparametervaluetype_boolean?language=objc)
244    pub static kVTRAWProcessingParameterValueType_Boolean: &'static CFString;
245}
246
247extern "C" {
248    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparametervaluetype_integer?language=objc)
249    pub static kVTRAWProcessingParameterValueType_Integer: &'static CFString;
250}
251
252extern "C" {
253    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparametervaluetype_float?language=objc)
254    pub static kVTRAWProcessingParameterValueType_Float: &'static CFString;
255}
256
257extern "C" {
258    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparametervaluetype_list?language=objc)
259    pub static kVTRAWProcessingParameterValueType_List: &'static CFString;
260}
261
262extern "C" {
263    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparametervaluetype_subgroup?language=objc)
264    pub static kVTRAWProcessingParameterValueType_SubGroup: &'static CFString;
265}
266
267extern "C" {
268    /// The value corresponding to this key is a CFArray of CFDictionaries describing each element in the list..
269    ///
270    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_listarray?language=objc)
271    pub static kVTRAWProcessingParameter_ListArray: &'static CFString;
272}
273
274extern "C" {
275    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameterlistelement_label?language=objc)
276    pub static kVTRAWProcessingParameterListElement_Label: &'static CFString;
277}
278
279extern "C" {
280    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameterlistelement_description?language=objc)
281    pub static kVTRAWProcessingParameterListElement_Description: &'static CFString;
282}
283
284extern "C" {
285    /// [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameterlistelement_listelementid?language=objc)
286    pub static kVTRAWProcessingParameterListElement_ListElementID: &'static CFString;
287}
288
289extern "C" {
290    /// The value corresponding to this key is a CFArray of CFDictionaries representing the individual sub-parameters in this group.
291    ///
292    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_subgroup?language=objc)
293    pub static kVTRAWProcessingParameter_SubGroup: &'static CFString;
294}
295
296extern "C" {
297    /// The value corresponding to this key is the maximum value allowed for this parameter when calling VTRAWProcessingSessionSetProcessingParameters.
298    /// This parameter is optional and not required for parameters where it is not appropriate (such as Boolean or List types).
299    ///
300    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_maximumvalue?language=objc)
301    pub static kVTRAWProcessingParameter_MaximumValue: &'static CFString;
302}
303
304extern "C" {
305    /// The value corresponding to this key is the minimum value allowed for this parameter when calling VTRAWProcessingSessionSetProcessingParameters.
306    /// This parameter is optional and not required for parameters where it is not appropriate (such as Boolean or List types).
307    ///
308    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_minimumvalue?language=objc)
309    pub static kVTRAWProcessingParameter_MinimumValue: &'static CFString;
310}
311
312extern "C" {
313    /// The value corresponding to this key is the initial value for this parameter as defined by the container and metadata provided at creation time.
314    /// For List types, this is the ListElementID for the List element.
315    ///
316    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_initialvalue?language=objc)
317    pub static kVTRAWProcessingParameter_InitialValue: &'static CFString;
318}
319
320extern "C" {
321    /// The value corresponding to this key is a neutral setting for the processor.
322    /// For List types, this is the ListElementID for the List element.
323    ///
324    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_neutralvalue?language=objc)
325    pub static kVTRAWProcessingParameter_NeutralValue: &'static CFString;
326}
327
328extern "C" {
329    /// The value corresponding to this key is the "As Shot" value for this parameter as originally captured by the camera.
330    /// For List types, this is the ListElementID for the List element.
331    ///
332    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_cameravalue?language=objc)
333    pub static kVTRAWProcessingParameter_CameraValue: &'static CFString;
334}
335
336extern "C" {
337    /// The value corresponding to this key is the currently configured value for this parameter.  For List types, this is the ListElementID for the List element.
338    ///
339    /// See also [Apple's documentation](https://developer.apple.com/documentation/videotoolbox/kvtrawprocessingparameter_currentvalue?language=objc)
340    pub static kVTRAWProcessingParameter_CurrentValue: &'static CFString;
341}