objc2_core_video/generated/
CVPixelFormatDescription.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::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern "C" {
12    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatname?language=objc)
13    pub static kCVPixelFormatName: &'static CFString;
14}
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatconstant?language=objc)
18    pub static kCVPixelFormatConstant: &'static CFString;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcodectype?language=objc)
23    pub static kCVPixelFormatCodecType: &'static CFString;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatfourcc?language=objc)
28    pub static kCVPixelFormatFourCC: &'static CFString;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsalpha?language=objc)
33    pub static kCVPixelFormatContainsAlpha: &'static CFString;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsycbcr?language=objc)
38    pub static kCVPixelFormatContainsYCbCr: &'static CFString;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsrgb?language=objc)
43    pub static kCVPixelFormatContainsRGB: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainsgrayscale?language=objc)
48    pub static kCVPixelFormatContainsGrayscale: &'static CFString;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcontainssenselarray?language=objc)
53    pub static kCVPixelFormatContainsSenselArray: &'static CFString;
54}
55
56extern "C" {
57    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange?language=objc)
58    pub static kCVPixelFormatComponentRange: &'static CFString;
59}
60
61extern "C" {
62    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_videorange?language=objc)
63    pub static kCVPixelFormatComponentRange_VideoRange: &'static CFString;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_fullrange?language=objc)
68    pub static kCVPixelFormatComponentRange_FullRange: &'static CFString;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcomponentrange_widerange?language=objc)
73    pub static kCVPixelFormatComponentRange_WideRange: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatplanes?language=objc)
78    pub static kCVPixelFormatPlanes: &'static CFString;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockwidth?language=objc)
83    pub static kCVPixelFormatBlockWidth: &'static CFString;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockheight?language=objc)
88    pub static kCVPixelFormatBlockHeight: &'static CFString;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatbitsperblock?language=objc)
93    pub static kCVPixelFormatBitsPerBlock: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatbitspercomponent?language=objc)
98    pub static kCVPixelFormatBitsPerComponent: &'static CFString;
99}
100
101extern "C" {
102    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockhorizontalalignment?language=objc)
103    pub static kCVPixelFormatBlockHorizontalAlignment: &'static CFString;
104}
105
106extern "C" {
107    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblockverticalalignment?language=objc)
108    pub static kCVPixelFormatBlockVerticalAlignment: &'static CFString;
109}
110
111extern "C" {
112    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatblackblock?language=objc)
113    pub static kCVPixelFormatBlackBlock: &'static CFString;
114}
115
116extern "C" {
117    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformathorizontalsubsampling?language=objc)
118    pub static kCVPixelFormatHorizontalSubsampling: &'static CFString;
119}
120
121extern "C" {
122    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatverticalsubsampling?language=objc)
123    pub static kCVPixelFormatVerticalSubsampling: &'static CFString;
124}
125
126extern "C" {
127    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglformat?language=objc)
128    pub static kCVPixelFormatOpenGLFormat: &'static CFString;
129}
130
131extern "C" {
132    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopengltype?language=objc)
133    pub static kCVPixelFormatOpenGLType: &'static CFString;
134}
135
136extern "C" {
137    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglinternalformat?language=objc)
138    pub static kCVPixelFormatOpenGLInternalFormat: &'static CFString;
139}
140
141extern "C" {
142    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgbitmapinfo?language=objc)
143    pub static kCVPixelFormatCGBitmapInfo: &'static CFString;
144}
145
146extern "C" {
147    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatqdcompatibility?language=objc)
148    pub static kCVPixelFormatQDCompatibility: &'static CFString;
149}
150
151extern "C" {
152    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgbitmapcontextcompatibility?language=objc)
153    pub static kCVPixelFormatCGBitmapContextCompatibility: &'static CFString;
154}
155
156extern "C" {
157    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatcgimagecompatibility?language=objc)
158    pub static kCVPixelFormatCGImageCompatibility: &'static CFString;
159}
160
161extern "C" {
162    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglcompatibility?language=objc)
163    pub static kCVPixelFormatOpenGLCompatibility: &'static CFString;
164}
165
166extern "C" {
167    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatopenglescompatibility?language=objc)
168    pub static kCVPixelFormatOpenGLESCompatibility: &'static CFString;
169}
170
171/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvfillextendedpixelscallback?language=objc)
172#[cfg(all(
173    feature = "CVBuffer",
174    feature = "CVImageBuffer",
175    feature = "CVPixelBuffer"
176))]
177pub type CVFillExtendedPixelsCallBack =
178    Option<unsafe extern "C-unwind" fn(NonNull<CVPixelBuffer>, *mut c_void) -> Boolean>;
179
180/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvfillextendedpixelscallbackdata?language=objc)
181#[cfg(all(
182    feature = "CVBuffer",
183    feature = "CVImageBuffer",
184    feature = "CVPixelBuffer"
185))]
186#[repr(C)]
187#[allow(unpredictable_function_pointer_comparisons)]
188#[derive(Clone, Copy, Debug, PartialEq)]
189pub struct CVFillExtendedPixelsCallBackData {
190    pub version: CFIndex,
191    pub fillCallBack: CVFillExtendedPixelsCallBack,
192    pub refCon: *mut c_void,
193}
194
195#[cfg(all(
196    feature = "CVBuffer",
197    feature = "CVImageBuffer",
198    feature = "CVPixelBuffer",
199    feature = "objc2"
200))]
201unsafe impl Encode for CVFillExtendedPixelsCallBackData {
202    const ENCODING: Encoding = Encoding::Struct(
203        "?",
204        &[
205            <CFIndex>::ENCODING,
206            <CVFillExtendedPixelsCallBack>::ENCODING,
207            <*mut c_void>::ENCODING,
208        ],
209    );
210}
211
212#[cfg(all(
213    feature = "CVBuffer",
214    feature = "CVImageBuffer",
215    feature = "CVPixelBuffer",
216    feature = "objc2"
217))]
218unsafe impl RefEncode for CVFillExtendedPixelsCallBackData {
219    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
220}
221
222extern "C" {
223    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformatfillextendedpixelscallback?language=objc)
224    pub static kCVPixelFormatFillExtendedPixelsCallback: &'static CFString;
225}
226
227#[inline]
228pub extern "C-unwind" fn CVPixelFormatDescriptionCreateWithPixelFormatType(
229    allocator: Option<&CFAllocator>,
230    pixel_format: OSType,
231) -> Option<CFRetained<CFDictionary>> {
232    extern "C-unwind" {
233        fn CVPixelFormatDescriptionCreateWithPixelFormatType(
234            allocator: Option<&CFAllocator>,
235            pixel_format: OSType,
236        ) -> Option<NonNull<CFDictionary>>;
237    }
238    let ret = unsafe { CVPixelFormatDescriptionCreateWithPixelFormatType(allocator, pixel_format) };
239    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
240}
241
242#[inline]
243pub extern "C-unwind" fn CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(
244    allocator: Option<&CFAllocator>,
245) -> Option<CFRetained<CFArray>> {
246    extern "C-unwind" {
247        fn CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(
248            allocator: Option<&CFAllocator>,
249        ) -> Option<NonNull<CFArray>>;
250    }
251    let ret = unsafe { CVPixelFormatDescriptionArrayCreateWithAllPixelFormatTypes(allocator) };
252    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
253}
254
255extern "C-unwind" {
256    /// # Safety
257    ///
258    /// `description` generics must be of the correct type.
259    pub fn CVPixelFormatDescriptionRegisterDescriptionWithPixelFormatType(
260        description: &CFDictionary,
261        pixel_format: OSType,
262    );
263}
264
265/// Creates a string with a formatted representation of a pixel format
266///
267/// Parameter `pixelFormat`: The pixel format to convert
268///
269/// Returns: A string with a user displayable conversion of a pixel format.
270#[inline]
271pub extern "C-unwind" fn CVPixelFormatTypeCopyFourCharCodeString(
272    pixel_format: OSType,
273) -> CFRetained<CFString> {
274    extern "C-unwind" {
275        fn CVPixelFormatTypeCopyFourCharCodeString(
276            pixel_format: OSType,
277        ) -> Option<NonNull<CFString>>;
278    }
279    let ret = unsafe { CVPixelFormatTypeCopyFourCharCodeString(pixel_format) };
280    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
281    unsafe { CFRetained::from_raw(ret) }
282}
283
284/// Checks if a compressed pixel format is supported on the current platform.
285///
286/// Parameter `pixelFormatType`: compressed pixel format.
287///
288/// Returns: True if pixel format is supported on the current platform.
289#[inline]
290pub extern "C-unwind" fn CVIsCompressedPixelFormatAvailable(pixel_format_type: OSType) -> bool {
291    extern "C-unwind" {
292        fn CVIsCompressedPixelFormatAvailable(pixel_format_type: OSType) -> Boolean;
293    }
294    let ret = unsafe { CVIsCompressedPixelFormatAvailable(pixel_format_type) };
295    ret != 0
296}