objc2_core_video/generated/CVPixelBuffer.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
11/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_1monochrome?language=objc)
12pub const kCVPixelFormatType_1Monochrome: OSType = 0x00000001;
13/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_2indexed?language=objc)
14pub const kCVPixelFormatType_2Indexed: OSType = 0x00000002;
15/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4indexed?language=objc)
16pub const kCVPixelFormatType_4Indexed: OSType = 0x00000004;
17/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_8indexed?language=objc)
18pub const kCVPixelFormatType_8Indexed: OSType = 0x00000008;
19/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_1indexedgray_whiteiszero?language=objc)
20pub const kCVPixelFormatType_1IndexedGray_WhiteIsZero: OSType = 0x00000021;
21/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_2indexedgray_whiteiszero?language=objc)
22pub const kCVPixelFormatType_2IndexedGray_WhiteIsZero: OSType = 0x00000022;
23/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4indexedgray_whiteiszero?language=objc)
24pub const kCVPixelFormatType_4IndexedGray_WhiteIsZero: OSType = 0x00000024;
25/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_8indexedgray_whiteiszero?language=objc)
26pub const kCVPixelFormatType_8IndexedGray_WhiteIsZero: OSType = 0x00000028;
27/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16be555?language=objc)
28pub const kCVPixelFormatType_16BE555: OSType = 0x00000010;
29/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16le555?language=objc)
30pub const kCVPixelFormatType_16LE555: OSType = 0x4c353535;
31/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16le5551?language=objc)
32pub const kCVPixelFormatType_16LE5551: OSType = 0x35353531;
33/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16be565?language=objc)
34pub const kCVPixelFormatType_16BE565: OSType = 0x42353635;
35/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16le565?language=objc)
36pub const kCVPixelFormatType_16LE565: OSType = 0x4c353635;
37/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_24rgb?language=objc)
38pub const kCVPixelFormatType_24RGB: OSType = 0x00000018;
39/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_24bgr?language=objc)
40pub const kCVPixelFormatType_24BGR: OSType = 0x32344247;
41/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_32argb?language=objc)
42pub const kCVPixelFormatType_32ARGB: OSType = 0x00000020;
43/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_32bgra?language=objc)
44pub const kCVPixelFormatType_32BGRA: OSType = 0x42475241;
45/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_32abgr?language=objc)
46pub const kCVPixelFormatType_32ABGR: OSType = 0x41424752;
47/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_32rgba?language=objc)
48pub const kCVPixelFormatType_32RGBA: OSType = 0x52474241;
49/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_64argb?language=objc)
50pub const kCVPixelFormatType_64ARGB: OSType = 0x62363461;
51/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_64rgbale?language=objc)
52pub const kCVPixelFormatType_64RGBALE: OSType = 0x6c363472;
53/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_48rgb?language=objc)
54pub const kCVPixelFormatType_48RGB: OSType = 0x62343872;
55/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_32alphagray?language=objc)
56pub const kCVPixelFormatType_32AlphaGray: OSType = 0x62333261;
57/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16gray?language=objc)
58pub const kCVPixelFormatType_16Gray: OSType = 0x62313667;
59/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_30rgb?language=objc)
60pub const kCVPixelFormatType_30RGB: OSType = 0x5231306b;
61/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_30rgb_r210?language=objc)
62pub const kCVPixelFormatType_30RGB_r210: OSType = 0x72323130;
63/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr8?language=objc)
64pub const kCVPixelFormatType_422YpCbCr8: OSType = 0x32767579;
65/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4444ypcbcra8?language=objc)
66pub const kCVPixelFormatType_4444YpCbCrA8: OSType = 0x76343038;
67/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4444ypcbcra8r?language=objc)
68pub const kCVPixelFormatType_4444YpCbCrA8R: OSType = 0x72343038;
69/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4444aypcbcr8?language=objc)
70pub const kCVPixelFormatType_4444AYpCbCr8: OSType = 0x79343038;
71/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4444aypcbcr16?language=objc)
72pub const kCVPixelFormatType_4444AYpCbCr16: OSType = 0x79343136;
73/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_4444aypcbcrfloat?language=objc)
74pub const kCVPixelFormatType_4444AYpCbCrFloat: OSType = 0x7234666c;
75/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr8?language=objc)
76pub const kCVPixelFormatType_444YpCbCr8: OSType = 0x76333038;
77/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr16?language=objc)
78pub const kCVPixelFormatType_422YpCbCr16: OSType = 0x76323136;
79/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr10?language=objc)
80pub const kCVPixelFormatType_422YpCbCr10: OSType = 0x76323130;
81/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr10?language=objc)
82pub const kCVPixelFormatType_444YpCbCr10: OSType = 0x76343130;
83/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr8planar?language=objc)
84pub const kCVPixelFormatType_420YpCbCr8Planar: OSType = 0x79343230;
85/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr8planarfullrange?language=objc)
86pub const kCVPixelFormatType_420YpCbCr8PlanarFullRange: OSType = 0x66343230;
87/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr_4a_8biplanar?language=objc)
88pub const kCVPixelFormatType_422YpCbCr_4A_8BiPlanar: OSType = 0x61327679;
89/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr8biplanarvideorange?language=objc)
90pub const kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange: OSType = 0x34323076;
91/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr8biplanarfullrange?language=objc)
92pub const kCVPixelFormatType_420YpCbCr8BiPlanarFullRange: OSType = 0x34323066;
93/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr8biplanarvideorange?language=objc)
94pub const kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange: OSType = 0x34323276;
95/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr8biplanarfullrange?language=objc)
96pub const kCVPixelFormatType_422YpCbCr8BiPlanarFullRange: OSType = 0x34323266;
97/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr8biplanarvideorange?language=objc)
98pub const kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange: OSType = 0x34343476;
99/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr8biplanarfullrange?language=objc)
100pub const kCVPixelFormatType_444YpCbCr8BiPlanarFullRange: OSType = 0x34343466;
101/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr8_yuvs?language=objc)
102pub const kCVPixelFormatType_422YpCbCr8_yuvs: OSType = 0x79757673;
103/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr8fullrange?language=objc)
104pub const kCVPixelFormatType_422YpCbCr8FullRange: OSType = 0x79757666;
105/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent8?language=objc)
106pub const kCVPixelFormatType_OneComponent8: OSType = 0x4c303038;
107/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_twocomponent8?language=objc)
108pub const kCVPixelFormatType_TwoComponent8: OSType = 0x32433038;
109/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_30rgblepackedwidegamut?language=objc)
110pub const kCVPixelFormatType_30RGBLEPackedWideGamut: OSType = 0x77333072;
111/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_argb2101010lepacked?language=objc)
112pub const kCVPixelFormatType_ARGB2101010LEPacked: OSType = 0x6c313072;
113/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_40argblewidegamut?language=objc)
114pub const kCVPixelFormatType_40ARGBLEWideGamut: OSType = 0x77343061;
115/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_40argblewidegamutpremultiplied?language=objc)
116pub const kCVPixelFormatType_40ARGBLEWideGamutPremultiplied: OSType = 0x7734306d;
117/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent10?language=objc)
118pub const kCVPixelFormatType_OneComponent10: OSType = 0x4c303130;
119/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent12?language=objc)
120pub const kCVPixelFormatType_OneComponent12: OSType = 0x4c303132;
121/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent16?language=objc)
122pub const kCVPixelFormatType_OneComponent16: OSType = 0x4c303136;
123/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_twocomponent16?language=objc)
124pub const kCVPixelFormatType_TwoComponent16: OSType = 0x32433136;
125/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent16half?language=objc)
126pub const kCVPixelFormatType_OneComponent16Half: OSType = 0x4c303068;
127/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_onecomponent32float?language=objc)
128pub const kCVPixelFormatType_OneComponent32Float: OSType = 0x4c303066;
129/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_twocomponent16half?language=objc)
130pub const kCVPixelFormatType_TwoComponent16Half: OSType = 0x32433068;
131/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_twocomponent32float?language=objc)
132pub const kCVPixelFormatType_TwoComponent32Float: OSType = 0x32433066;
133/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_64rgbahalf?language=objc)
134pub const kCVPixelFormatType_64RGBAHalf: OSType = 0x52476841;
135/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_128rgbafloat?language=objc)
136pub const kCVPixelFormatType_128RGBAFloat: OSType = 0x52476641;
137/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_14bayer_grbg?language=objc)
138pub const kCVPixelFormatType_14Bayer_GRBG: OSType = 0x67726234;
139/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_14bayer_rggb?language=objc)
140pub const kCVPixelFormatType_14Bayer_RGGB: OSType = 0x72676734;
141/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_14bayer_bggr?language=objc)
142pub const kCVPixelFormatType_14Bayer_BGGR: OSType = 0x62676734;
143/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_14bayer_gbrg?language=objc)
144pub const kCVPixelFormatType_14Bayer_GBRG: OSType = 0x67627234;
145/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_disparityfloat16?language=objc)
146pub const kCVPixelFormatType_DisparityFloat16: OSType = 0x68646973;
147/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_disparityfloat32?language=objc)
148pub const kCVPixelFormatType_DisparityFloat32: OSType = 0x66646973;
149/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_depthfloat16?language=objc)
150pub const kCVPixelFormatType_DepthFloat16: OSType = 0x68646570;
151/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_depthfloat32?language=objc)
152pub const kCVPixelFormatType_DepthFloat32: OSType = 0x66646570;
153/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr10biplanarvideorange?language=objc)
154pub const kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange: OSType = 0x78343230;
155/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr10biplanarvideorange?language=objc)
156pub const kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange: OSType = 0x78343232;
157/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr10biplanarvideorange?language=objc)
158pub const kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange: OSType = 0x78343434;
159/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr10biplanarfullrange?language=objc)
160pub const kCVPixelFormatType_420YpCbCr10BiPlanarFullRange: OSType = 0x78663230;
161/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr10biplanarfullrange?language=objc)
162pub const kCVPixelFormatType_422YpCbCr10BiPlanarFullRange: OSType = 0x78663232;
163/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr10biplanarfullrange?language=objc)
164pub const kCVPixelFormatType_444YpCbCr10BiPlanarFullRange: OSType = 0x78663434;
165/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_420ypcbcr8videorange_8a_triplanar?language=objc)
166pub const kCVPixelFormatType_420YpCbCr8VideoRange_8A_TriPlanar: OSType = 0x76306138;
167/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_16versatilebayer?language=objc)
168pub const kCVPixelFormatType_16VersatileBayer: OSType = 0x62703136;
169/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_64rgba_downscaledproresraw?language=objc)
170pub const kCVPixelFormatType_64RGBA_DownscaledProResRAW: OSType = 0x62703634;
171/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr16biplanarvideorange?language=objc)
172pub const kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange: OSType = 0x73763232;
173/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr16biplanarvideorange?language=objc)
174pub const kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange: OSType = 0x73763434;
175/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr16videorange_16a_triplanar?language=objc)
176pub const kCVPixelFormatType_444YpCbCr16VideoRange_16A_TriPlanar: OSType = 0x73346173;
177
178/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_32bgra?language=objc)
179pub const kCVPixelFormatType_Lossless_32BGRA: OSType = 0x26424741;
180/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_64rgbahalf?language=objc)
181pub const kCVPixelFormatType_Lossless_64RGBAHalf: OSType = 0x26526841;
182/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr8biplanarvideorange?language=objc)
183pub const kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange: OSType = 0x26387630;
184/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr8biplanarfullrange?language=objc)
185pub const kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarFullRange: OSType = 0x26386630;
186/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr10packedbiplanarvideorange?language=objc)
187pub const kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange: OSType = 0x26787630;
188/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_422ypcbcr10packedbiplanarvideorange?language=objc)
189pub const kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange: OSType = 0x26787632;
190/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr10packedbiplanarfullrange?language=objc)
191pub const kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarFullRange: OSType = 0x26786630;
192
193/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_32bgra?language=objc)
194pub const kCVPixelFormatType_Lossy_32BGRA: OSType = 0x2d424741;
195/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr8biplanarvideorange?language=objc)
196pub const kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarVideoRange: OSType = 0x2d387630;
197/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr8biplanarfullrange?language=objc)
198pub const kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarFullRange: OSType = 0x2d386630;
199/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr10packedbiplanarvideorange?language=objc)
200pub const kCVPixelFormatType_Lossy_420YpCbCr10PackedBiPlanarVideoRange: OSType = 0x2d787630;
201/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_422ypcbcr10packedbiplanarvideorange?language=objc)
202pub const kCVPixelFormatType_Lossy_422YpCbCr10PackedBiPlanarVideoRange: OSType = 0x2d787632;
203
204/// Flags to pass to CVPixelBufferLockBaseAddress() / CVPixelBufferUnlockBaseAddress()
205///
206/// If you are not going to modify the data while you hold the lock, you should set this flag
207/// to avoid potentially invalidating any existing caches of the buffer contents. This flag
208/// should be passed both to the lock and unlock functions. Non-symmetrical usage of this
209/// flag will result in undefined behavior.
210///
211/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferlockflags?language=objc)
212// NS_OPTIONS
213#[cfg(feature = "CVBase")]
214#[repr(transparent)]
215#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
216pub struct CVPixelBufferLockFlags(pub CVOptionFlags);
217#[cfg(feature = "CVBase")]
218bitflags::bitflags! {
219 impl CVPixelBufferLockFlags: CVOptionFlags {
220 #[doc(alias = "kCVPixelBufferLock_ReadOnly")]
221 const ReadOnly = 0x00000001;
222 }
223}
224
225#[cfg(all(feature = "CVBase", feature = "objc2"))]
226unsafe impl Encode for CVPixelBufferLockFlags {
227 const ENCODING: Encoding = CVOptionFlags::ENCODING;
228}
229
230#[cfg(all(feature = "CVBase", feature = "objc2"))]
231unsafe impl RefEncode for CVPixelBufferLockFlags {
232 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
233}
234
235/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarcomponentinfo?language=objc)
236#[repr(C)]
237#[derive(Clone, Copy, Debug, PartialEq)]
238pub struct CVPlanarComponentInfo {
239 pub offset: i32,
240 pub rowBytes: u32,
241}
242
243#[cfg(feature = "objc2")]
244unsafe impl Encode for CVPlanarComponentInfo {
245 const ENCODING: Encoding =
246 Encoding::Struct("CVPlanarComponentInfo", &[<i32>::ENCODING, <u32>::ENCODING]);
247}
248
249#[cfg(feature = "objc2")]
250unsafe impl RefEncode for CVPlanarComponentInfo {
251 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
252}
253
254/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo?language=objc)
255#[repr(C)]
256#[derive(Clone, Copy, Debug, PartialEq)]
257pub struct CVPlanarPixelBufferInfo {
258 pub componentInfo: [CVPlanarComponentInfo; 1],
259}
260
261#[cfg(feature = "objc2")]
262unsafe impl Encode for CVPlanarPixelBufferInfo {
263 const ENCODING: Encoding = Encoding::Struct(
264 "CVPlanarPixelBufferInfo",
265 &[<[CVPlanarComponentInfo; 1]>::ENCODING],
266 );
267}
268
269#[cfg(feature = "objc2")]
270unsafe impl RefEncode for CVPlanarPixelBufferInfo {
271 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
272}
273
274/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo_ycbcrplanar?language=objc)
275#[repr(C)]
276#[derive(Clone, Copy, Debug, PartialEq)]
277pub struct CVPlanarPixelBufferInfo_YCbCrPlanar {
278 pub componentInfoY: CVPlanarComponentInfo,
279 pub componentInfoCb: CVPlanarComponentInfo,
280 pub componentInfoCr: CVPlanarComponentInfo,
281}
282
283#[cfg(feature = "objc2")]
284unsafe impl Encode for CVPlanarPixelBufferInfo_YCbCrPlanar {
285 const ENCODING: Encoding = Encoding::Struct(
286 "CVPlanarPixelBufferInfo_YCbCrPlanar",
287 &[
288 <CVPlanarComponentInfo>::ENCODING,
289 <CVPlanarComponentInfo>::ENCODING,
290 <CVPlanarComponentInfo>::ENCODING,
291 ],
292 );
293}
294
295#[cfg(feature = "objc2")]
296unsafe impl RefEncode for CVPlanarPixelBufferInfo_YCbCrPlanar {
297 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
298}
299
300/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo_ycbcrbiplanar?language=objc)
301#[repr(C)]
302#[derive(Clone, Copy, Debug, PartialEq)]
303pub struct CVPlanarPixelBufferInfo_YCbCrBiPlanar {
304 pub componentInfoY: CVPlanarComponentInfo,
305 pub componentInfoCbCr: CVPlanarComponentInfo,
306}
307
308#[cfg(feature = "objc2")]
309unsafe impl Encode for CVPlanarPixelBufferInfo_YCbCrBiPlanar {
310 const ENCODING: Encoding = Encoding::Struct(
311 "CVPlanarPixelBufferInfo_YCbCrBiPlanar",
312 &[
313 <CVPlanarComponentInfo>::ENCODING,
314 <CVPlanarComponentInfo>::ENCODING,
315 ],
316 );
317}
318
319#[cfg(feature = "objc2")]
320unsafe impl RefEncode for CVPlanarPixelBufferInfo_YCbCrBiPlanar {
321 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
322}
323
324extern "C" {
325 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferpixelformattypekey?language=objc)
326 pub static kCVPixelBufferPixelFormatTypeKey: &'static CFString;
327}
328
329extern "C" {
330 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffermemoryallocatorkey?language=objc)
331 pub static kCVPixelBufferMemoryAllocatorKey: &'static CFString;
332}
333
334extern "C" {
335 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferwidthkey?language=objc)
336 pub static kCVPixelBufferWidthKey: &'static CFString;
337}
338
339extern "C" {
340 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferheightkey?language=objc)
341 pub static kCVPixelBufferHeightKey: &'static CFString;
342}
343
344extern "C" {
345 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsleftkey?language=objc)
346 pub static kCVPixelBufferExtendedPixelsLeftKey: &'static CFString;
347}
348
349extern "C" {
350 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelstopkey?language=objc)
351 pub static kCVPixelBufferExtendedPixelsTopKey: &'static CFString;
352}
353
354extern "C" {
355 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsrightkey?language=objc)
356 pub static kCVPixelBufferExtendedPixelsRightKey: &'static CFString;
357}
358
359extern "C" {
360 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsbottomkey?language=objc)
361 pub static kCVPixelBufferExtendedPixelsBottomKey: &'static CFString;
362}
363
364extern "C" {
365 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferbytesperrowalignmentkey?language=objc)
366 pub static kCVPixelBufferBytesPerRowAlignmentKey: &'static CFString;
367}
368
369extern "C" {
370 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffercgbitmapcontextcompatibilitykey?language=objc)
371 pub static kCVPixelBufferCGBitmapContextCompatibilityKey: &'static CFString;
372}
373
374extern "C" {
375 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffercgimagecompatibilitykey?language=objc)
376 pub static kCVPixelBufferCGImageCompatibilityKey: &'static CFString;
377}
378
379extern "C" {
380 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglcompatibilitykey?language=objc)
381 pub static kCVPixelBufferOpenGLCompatibilityKey: &'static CFString;
382}
383
384extern "C" {
385 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferplanealignmentkey?language=objc)
386 pub static kCVPixelBufferPlaneAlignmentKey: &'static CFString;
387}
388
389extern "C" {
390 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfacepropertieskey?language=objc)
391 pub static kCVPixelBufferIOSurfacePropertiesKey: &'static CFString;
392}
393
394extern "C" {
395 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglescompatibilitykey?language=objc)
396 pub static kCVPixelBufferOpenGLESCompatibilityKey: &'static CFString;
397}
398
399extern "C" {
400 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffermetalcompatibilitykey?language=objc)
401 pub static kCVPixelBufferMetalCompatibilityKey: &'static CFString;
402}
403
404extern "C" {
405 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopengltexturecachecompatibilitykey?language=objc)
406 pub static kCVPixelBufferOpenGLTextureCacheCompatibilityKey: &'static CFString;
407}
408
409extern "C" {
410 /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglestexturecachecompatibilitykey?language=objc)
411 pub static kCVPixelBufferOpenGLESTextureCacheCompatibilityKey: &'static CFString;
412}
413
414extern "C" {
415 /// Buffer attachment key for code indicating Bayer pattern (sensel arrangement).
416 ///
417 /// Associated attachment is a CFNumber of type kCFNumberSInt32Type. The value follows the semantics of the ProRes RAW bayer_pattern bitstream syntax element, namely 0, 1, 2, or 3, where 0 means the top-left sensel of the frame is red-filtered ("RGGB"); 1 means the top-left sensel of the frame is green-filtered, with the top row alternating between green- and red-filtered sensels ("GRBG"); 2 means the top-left sensel of the frame is green- filtered, with the top row alternating between green- and blue-filtered sensels ("GBRG"); and 3 means the top-left sensel of the frame is blue-filtered ("BGGR"). This attachment applies only to buffers with VersatileBayer formats.
418 ///
419 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferversatilebayerkey_bayerpattern?language=objc)
420 pub static kCVPixelBufferVersatileBayerKey_BayerPattern: &'static CFString;
421}
422
423/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_rggb?language=objc)
424pub const kCVVersatileBayer_BayerPattern_RGGB: c_uint = 0;
425/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_grbg?language=objc)
426pub const kCVVersatileBayer_BayerPattern_GRBG: c_uint = 1;
427/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_gbrg?language=objc)
428pub const kCVVersatileBayer_BayerPattern_GBRG: c_uint = 2;
429/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_bggr?language=objc)
430pub const kCVVersatileBayer_BayerPattern_BGGR: c_uint = 3;
431
432extern "C" {
433 /// Buffer attachment key for siting offsets, relative to pixel center, of individual sensels/components constituting each pixel.
434 ///
435 /// Associated attachment is CFData containing an array of 8 32-bit floats. The eight CFData array elements specify, in order, the following sensel/component offsets from pixel center: red horizontal offset, red vertical offset, green horizontal offset, green vertical offset, blue horizontal offset, blue vertical offset, alpha horizontal offset, and alpha vertical offset. A positive offset value indicates that the sensel/component lies to the right of or below the center of its pixel, while a negative value indicates that the sensel/component lies to the left of or above the center of its pixel. Horizontal and vertical offset magnitudes are respectively in terms of the spacing between horizontally- and vertically-adjacent pixel centers. This attachment applies only to buffers with the bp64 format, and is optional for those buffers; if not present, all offsets are considered to be 0.
436 ///
437 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_senselsitingoffsets?language=objc)
438 pub static kCVPixelBufferProResRAWKey_SenselSitingOffsets: &'static CFString;
439}
440
441extern "C" {
442 /// Buffer attachment key for sensel black level.
443 ///
444 /// Associated attachment is a CFNumber of type kCFNumberSInt32Type. The value is the sensel level corresponding to no light exposure. This attachment is required for buffers with either the bp16 or bp64 format.
445 ///
446 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_blacklevel?language=objc)
447 pub static kCVPixelBufferProResRAWKey_BlackLevel: &'static CFString;
448}
449
450extern "C" {
451 /// Buffer attachment key for sensel white level.
452 ///
453 /// Associated attachment is a CFNumber of type kCFNumberSInt32Type. The value is the sensel level corresponding to sensor (or camera A-to-D converter) saturation. This attachment is required for buffers with either the bp16 or bp64 format.
454 ///
455 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitelevel?language=objc)
456 pub static kCVPixelBufferProResRAWKey_WhiteLevel: &'static CFString;
457}
458
459extern "C" {
460 /// Buffer attachment key for illuminant correlated color temperature.
461 ///
462 /// Associated attachment is a CFNumber of type kCFNumberSInt32Type. The value is the illuminant correlated color temperature (CCT), in kelvins, selected at the time of capture. May be 0, indicating that the CCT is unknown or unspecified. This attachment is optional for buffers with either the bp16 or bp64 format; if not present, the CCT is considered unknown or unspecified.
463 ///
464 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalancecct?language=objc)
465 pub static kCVPixelBufferProResRAWKey_WhiteBalanceCCT: &'static CFString;
466}
467
468extern "C" {
469 /// Buffer attachment key for white balance red factor.
470 ///
471 /// Associated attachment is a CFNumber of type kCFNumberFloat32Type. The value is the white balance multiplication factor for red-filtered sensels. This attachment is required for buffers with either the bp16 or bp64 format.
472 ///
473 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalanceredfactor?language=objc)
474 pub static kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor: &'static CFString;
475}
476
477extern "C" {
478 /// Buffer attachment key for white balance blue factor.
479 ///
480 /// Associated attachment is a CFNumber of type kCFNumberFloat32Type. The value is the white balance multiplication factor for blue-filtered sensels. This attachment is required for buffers with either the bp16 or bp64 format.
481 ///
482 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalancebluefactor?language=objc)
483 pub static kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor: &'static CFString;
484}
485
486extern "C" {
487 /// Buffer attachment key for color translation matrix.
488 ///
489 /// Associated attachment is CFData containing an array of 9 32-bit floats. The value is a 3x3 matrix which transforms linear RGB pixel values in the camera native color space to CIE 1931 XYZ values relative to the D65 illuminant, where the matrix entries are stored in the CFData in row-major order. This attachment is required for buffers with either the bp16 or bp64 format.
490 ///
491 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_colormatrix?language=objc)
492 pub static kCVPixelBufferProResRAWKey_ColorMatrix: &'static CFString;
493}
494
495extern "C" {
496 /// Buffer attachment key for gain factor.
497 ///
498 /// Associated attachment is a CFNumber of type kCFNumberFloat32Type. The value is the overall gain factor for raw conversion. This attachment is required for buffers with either the bp16 or bp64 format.
499 ///
500 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_gainfactor?language=objc)
501 pub static kCVPixelBufferProResRAWKey_GainFactor: &'static CFString;
502}
503
504extern "C" {
505 /// Buffer attachment key for recommended number of pixels/rows to discard from the sides of the image after raw conversion.
506 ///
507 /// Associated attachment is CFData containing an array of 4 32-bit floats. The four CFData array elements specify, in order, the recommended number of: pixels to discard from the start (left) of each row of the image; pixels to discard from the end (right) of each row of the image; rows of pixels to discard from the top of the image; and rows of pixels to discard from the bottom of the image. (Pixels/rows are discarded after raw conversion.) This attachment is optional for buffers with either the bp16 or bp64 format; if not present, the recommended crop values are considered to be 0. For buffers with the bp64 format, the values may be nonintegral due to downscaling, in which case the handling of fractional parts is implementation-dependent.
508 ///
509 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_recommendedcrop?language=objc)
510 pub static kCVPixelBufferProResRAWKey_RecommendedCrop: &'static CFString;
511}
512
513extern "C" {
514 /// Buffer attachment key for metadata extension.
515 ///
516 /// Associated attachment is CFData containing ProRes RAW metadata extension. This attachment is optional for buffers with either bp16 or bp64. The CFData contains a big-endian uint32 representing the size of the item in bytes followed by a 4-character code ('psim') followed by a variable-length pascal string identifying the metadata (like a key string) followed by the metadata payload.
517 ///
518 /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_metadataextension?language=objc)
519 pub static kCVPixelBufferProResRAWKey_MetadataExtension: &'static CFString;
520}
521
522/// Based on the image buffer type. The pixel buffer implements the memory storage for an image buffer.
523///
524/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbuffer?language=objc)
525#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
526pub type CVPixelBuffer = CVImageBuffer;
527
528#[inline]
529pub extern "C-unwind" fn CVPixelBufferGetTypeID() -> CFTypeID {
530 extern "C-unwind" {
531 fn CVPixelBufferGetTypeID() -> CFTypeID;
532 }
533 unsafe { CVPixelBufferGetTypeID() }
534}
535
536extern "C-unwind" {
537 /// Takes a CFArray of CFDictionary objects describing various pixel buffer attributes and tries to resolve them into a
538 /// single dictionary.
539 ///
540 /// This is useful when you need to resolve multiple requirements between different potential clients of a buffer.
541 ///
542 /// Parameter `attributes`: CFArray of CFDictionaries containing kCVPixelBuffer key/value pairs.
543 ///
544 /// Parameter `resolvedDictionaryOut`: The resulting dictionary will be placed here.
545 ///
546 /// Returns: Return value that may be useful in discovering why resolution failed.
547 #[cfg(feature = "CVReturn")]
548 pub fn CVPixelBufferCreateResolvedAttributesDictionary(
549 allocator: Option<&CFAllocator>,
550 attributes: Option<&CFArray>,
551 resolved_dictionary_out: NonNull<*const CFDictionary>,
552 ) -> CVReturn;
553}
554
555extern "C-unwind" {
556 /// Call to create a single PixelBuffer for a given size and pixelFormatType.
557 ///
558 /// Creates a single PixelBuffer for a given size and pixelFormatType. It allocates the necessary memory based on the pixel dimensions, pixelFormatType and extended pixels described in the pixelBufferAttributes. Not all parameters of the pixelBufferAttributes will be used here.
559 ///
560 /// Parameter `width`: Width of the PixelBuffer in pixels.
561 ///
562 /// Parameter `height`: Height of the PixelBuffer in pixels.
563 ///
564 /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
565 ///
566 /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a pixel buffer. This parameter is optional. See BufferAttributeKeys for more details.
567 ///
568 /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
569 ///
570 /// Returns: returns kCVReturnSuccess on success.
571 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
572 pub fn CVPixelBufferCreate(
573 allocator: Option<&CFAllocator>,
574 width: usize,
575 height: usize,
576 pixel_format_type: OSType,
577 pixel_buffer_attributes: Option<&CFDictionary>,
578 pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
579 ) -> CVReturn;
580}
581
582/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferreleasebytescallback?language=objc)
583pub type CVPixelBufferReleaseBytesCallback =
584 Option<unsafe extern "C-unwind" fn(*mut c_void, *const c_void)>;
585
586extern "C-unwind" {
587 /// Call to create a single PixelBuffer for a given size and pixelFormatType based on a passed in piece of memory.
588 ///
589 /// Creates a single PixelBuffer for a given size and pixelFormatType. Not all parameters of the pixelBufferAttributes will be used here. It requires a release callback function that will be called, when the PixelBuffer gets destroyed so that the owner of the pixels can free the memory.
590 ///
591 /// Parameter `width`: Width of the PixelBuffer in pixels
592 ///
593 /// Parameter `height`: Height of the PixelBuffer in pixels
594 ///
595 /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
596 ///
597 /// Parameter `baseAddress`: Address of the memory storing the pixels.
598 ///
599 /// Parameter `bytesPerRow`: Row bytes of the pixel storage memory.
600 ///
601 /// Parameter `releaseCallback`: CVPixelBufferReleaseBytePointerCallback function that gets called when the PixelBuffer gets destroyed.
602 ///
603 /// Parameter `releaseRefCon`: User data identifying the PixelBuffer for the release callback.
604 ///
605 /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See PixelBufferAttributes for more details.
606 ///
607 /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
608 ///
609 /// Returns: returns kCVReturnSuccess on success.
610 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
611 pub fn CVPixelBufferCreateWithBytes(
612 allocator: Option<&CFAllocator>,
613 width: usize,
614 height: usize,
615 pixel_format_type: OSType,
616 base_address: NonNull<c_void>,
617 bytes_per_row: usize,
618 release_callback: CVPixelBufferReleaseBytesCallback,
619 release_ref_con: *mut c_void,
620 pixel_buffer_attributes: Option<&CFDictionary>,
621 pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
622 ) -> CVReturn;
623}
624
625/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferreleaseplanarbytescallback?language=objc)
626pub type CVPixelBufferReleasePlanarBytesCallback = Option<
627 unsafe extern "C-unwind" fn(*mut c_void, *const c_void, usize, usize, *mut *const c_void),
628>;
629
630extern "C-unwind" {
631 /// Call to create a single PixelBuffer in planar format for a given size and pixelFormatType based on a passed in piece of memory.
632 ///
633 /// Creates a single PixelBuffer for a given size and pixelFormatType. Not all parameters of the pixelBufferAttributes will be used here. It requires a release callback function that will be called, when the PixelBuffer gets destroyed so that the owner of the pixels can free the memory.
634 ///
635 /// Parameter `width`: Width of the PixelBuffer in pixels
636 ///
637 /// Parameter `height`: Height of the PixelBuffer in pixels
638 ///
639 /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
640 ///
641 /// Parameter `dataPtr`: Pass a pointer to a plane descriptor block, or NULL.
642 ///
643 /// Parameter `dataSize`: pass size if planes are contiguous, NULL if not.
644 ///
645 /// Parameter `numberOfPlanes`: Number of planes.
646 ///
647 /// Parameter `planeBaseAddress`: Array of base addresses for the planes.
648 ///
649 /// Parameter `planeWidth`: Array of plane widths.
650 ///
651 /// Parameter `planeHeight`: Array of plane heights.
652 ///
653 /// Parameter `planeBytesPerRow`: Array of plane bytesPerRow values.
654 ///
655 /// Parameter `releaseCallback`: CVPixelBufferReleaseBytePointerCallback function that gets called when the PixelBuffer gets destroyed.
656 ///
657 /// Parameter `releaseRefCon`: User data identifying the PixelBuffer for the release callback.
658 ///
659 /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See PixelBufferAttributes for more details.
660 ///
661 /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
662 ///
663 /// Returns: returns kCVReturnSuccess on success.
664 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
665 pub fn CVPixelBufferCreateWithPlanarBytes(
666 allocator: Option<&CFAllocator>,
667 width: usize,
668 height: usize,
669 pixel_format_type: OSType,
670 data_ptr: *mut c_void,
671 data_size: usize,
672 number_of_planes: usize,
673 plane_base_address: NonNull<*mut c_void>,
674 plane_width: NonNull<usize>,
675 plane_height: NonNull<usize>,
676 plane_bytes_per_row: NonNull<usize>,
677 release_callback: CVPixelBufferReleasePlanarBytesCallback,
678 release_ref_con: *mut c_void,
679 pixel_buffer_attributes: Option<&CFDictionary>,
680 pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
681 ) -> CVReturn;
682}
683
684extern "C-unwind" {
685 /// Description Locks the BaseAddress of the PixelBuffer to ensure that the memory is accessible.
686 ///
687 /// This API ensures that the CVPixelBuffer is accessible in system memory. This should only be called if the base address is going to be used and the pixel data will be accessed by the CPU.
688 ///
689 /// Parameter `pixelBuffer`: Target PixelBuffer.
690 ///
691 /// Parameter `lockFlags`: See CVPixelBufferLockFlags.
692 ///
693 /// Returns: kCVReturnSuccess if the lock succeeded, or error code on failure
694 #[cfg(all(
695 feature = "CVBase",
696 feature = "CVBuffer",
697 feature = "CVImageBuffer",
698 feature = "CVReturn"
699 ))]
700 pub fn CVPixelBufferLockBaseAddress(
701 pixel_buffer: &CVPixelBuffer,
702 lock_flags: CVPixelBufferLockFlags,
703 ) -> CVReturn;
704}
705
706extern "C-unwind" {
707 /// Description Unlocks the BaseAddress of the PixelBuffer.
708 ///
709 /// Parameter `pixelBuffer`: Target PixelBuffer.
710 ///
711 /// Parameter `unlockFlags`: See CVPixelBufferLockFlags.
712 ///
713 /// Returns: kCVReturnSuccess if the unlock succeeded, or error code on failure
714 #[cfg(all(
715 feature = "CVBase",
716 feature = "CVBuffer",
717 feature = "CVImageBuffer",
718 feature = "CVReturn"
719 ))]
720 pub fn CVPixelBufferUnlockBaseAddress(
721 pixel_buffer: &CVPixelBuffer,
722 unlock_flags: CVPixelBufferLockFlags,
723 ) -> CVReturn;
724}
725
726extern "C-unwind" {
727 /// Returns the width of the PixelBuffer.
728 ///
729 /// Parameter `pixelBuffer`: Target PixelBuffer.
730 ///
731 /// Returns: Width in pixels.
732 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
733 pub fn CVPixelBufferGetWidth(pixel_buffer: &CVPixelBuffer) -> usize;
734}
735
736extern "C-unwind" {
737 /// Returns the height of the PixelBuffer.
738 ///
739 /// Parameter `pixelBuffer`: Target PixelBuffer.
740 ///
741 /// Returns: Height in pixels.
742 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
743 pub fn CVPixelBufferGetHeight(pixel_buffer: &CVPixelBuffer) -> usize;
744}
745
746extern "C-unwind" {
747 /// Returns the PixelFormatType of the PixelBuffer.
748 ///
749 /// Parameter `pixelBuffer`: Target PixelBuffer.
750 ///
751 /// Returns: OSType identifying the pixel format by its type.
752 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
753 pub fn CVPixelBufferGetPixelFormatType(pixel_buffer: &CVPixelBuffer) -> OSType;
754}
755
756extern "C-unwind" {
757 /// Returns the base address of the PixelBuffer.
758 ///
759 /// Retrieving the base address for a PixelBuffer requires that the buffer base address be locked
760 /// via a successful call to CVPixelBufferLockBaseAddress.
761 ///
762 /// Parameter `pixelBuffer`: Target PixelBuffer.
763 ///
764 /// Returns: Base address of the pixels.
765 /// For chunky buffers, this will return a pointer to the pixel at 0,0 in the buffer
766 /// For planar buffers this will return a pointer to a PlanarComponentInfo struct (defined in QuickTime).
767 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
768 pub fn CVPixelBufferGetBaseAddress(pixel_buffer: &CVPixelBuffer) -> *mut c_void;
769}
770
771extern "C-unwind" {
772 /// Returns the rowBytes of the PixelBuffer.
773 ///
774 /// Parameter `pixelBuffer`: Target PixelBuffer.
775 ///
776 /// Returns: Bytes per row of the image data. For planar buffers this will return a rowBytes value such that bytesPerRow * height
777 /// will cover the entire image including all planes.
778 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
779 pub fn CVPixelBufferGetBytesPerRow(pixel_buffer: &CVPixelBuffer) -> usize;
780}
781
782extern "C-unwind" {
783 /// Returns the data size for contigous planes of the PixelBuffer.
784 ///
785 /// Parameter `pixelBuffer`: Target PixelBuffer.
786 ///
787 /// Returns: Data size used in CVPixelBufferCreateWithPlanarBytes.
788 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
789 pub fn CVPixelBufferGetDataSize(pixel_buffer: &CVPixelBuffer) -> usize;
790}
791
792/// Returns if the PixelBuffer is planar.
793///
794/// Parameter `pixelBuffer`: Target PixelBuffer.
795///
796/// Returns: True if the PixelBuffer was created using CVPixelBufferCreateWithPlanarBytes.
797#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
798#[inline]
799pub unsafe extern "C-unwind" fn CVPixelBufferIsPlanar(pixel_buffer: &CVPixelBuffer) -> bool {
800 extern "C-unwind" {
801 fn CVPixelBufferIsPlanar(pixel_buffer: &CVPixelBuffer) -> Boolean;
802 }
803 let ret = unsafe { CVPixelBufferIsPlanar(pixel_buffer) };
804 ret != 0
805}
806
807extern "C-unwind" {
808 /// Returns number of planes of the PixelBuffer.
809 ///
810 /// Parameter `pixelBuffer`: Target PixelBuffer.
811 ///
812 /// Returns: Number of planes. Returns 0 for non-planar CVPixelBufferRefs.
813 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
814 pub fn CVPixelBufferGetPlaneCount(pixel_buffer: &CVPixelBuffer) -> usize;
815}
816
817extern "C-unwind" {
818 /// Returns the width of the plane at planeIndex in the PixelBuffer.
819 ///
820 /// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
821 /// function with a non-planar buffer will have undefined behavior.
822 ///
823 /// Parameter `pixelBuffer`: Target PixelBuffer.
824 ///
825 /// Parameter `planeIndex`: Identifying the plane.
826 ///
827 /// Returns: Width in pixels, or 0 for non-planar CVPixelBufferRefs.
828 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
829 pub fn CVPixelBufferGetWidthOfPlane(pixel_buffer: &CVPixelBuffer, plane_index: usize) -> usize;
830}
831
832extern "C-unwind" {
833 /// Returns the height of the plane at planeIndex in the PixelBuffer.
834 ///
835 /// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
836 /// function with a non-planar buffer will have undefined behavior.
837 ///
838 /// Parameter `pixelBuffer`: Target PixelBuffer.
839 ///
840 /// Parameter `planeIndex`: Identifying the plane.
841 ///
842 /// Returns: Height in pixels, or 0 for non-planar CVPixelBufferRefs.
843 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
844 pub fn CVPixelBufferGetHeightOfPlane(pixel_buffer: &CVPixelBuffer, plane_index: usize)
845 -> usize;
846}
847
848extern "C-unwind" {
849 /// Returns the base address of the plane at planeIndex in the PixelBuffer.
850 ///
851 /// Retrieving the base address for a PixelBuffer requires that the buffer base address be locked
852 /// via a successful call to CVPixelBufferLockBaseAddress. On OSX 10.10 and earlier, or iOS 8 and
853 /// earlier, calling this function with a non-planar buffer will have undefined behavior.
854 ///
855 /// Parameter `pixelBuffer`: Target PixelBuffer.
856 ///
857 /// Parameter `planeIndex`: Identifying the plane.
858 ///
859 /// Returns: Base address of the plane, or NULL for non-planar CVPixelBufferRefs.
860 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
861 pub fn CVPixelBufferGetBaseAddressOfPlane(
862 pixel_buffer: &CVPixelBuffer,
863 plane_index: usize,
864 ) -> *mut c_void;
865}
866
867extern "C-unwind" {
868 /// Returns the row bytes of the plane at planeIndex in the PixelBuffer.
869 ///
870 /// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
871 /// function with a non-planar buffer will have undefined behavior.
872 ///
873 /// Parameter `pixelBuffer`: Target PixelBuffer.
874 ///
875 /// Parameter `planeIndex`: Identifying the plane.
876 ///
877 /// Returns: Row bytes of the plane, or NULL for non-planar CVPixelBufferRefs.
878 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
879 pub fn CVPixelBufferGetBytesPerRowOfPlane(
880 pixel_buffer: &CVPixelBuffer,
881 plane_index: usize,
882 ) -> usize;
883}
884
885extern "C-unwind" {
886 /// Returns the size of extended pixels of the PixelBuffer.
887 ///
888 /// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
889 /// function with a non-planar buffer will have undefined behavior.
890 ///
891 /// Parameter `pixelBuffer`: Target PixelBuffer.
892 ///
893 /// Parameter `extraColumnsOnLeft`: Returns the pixel row padding to the left. May be NULL.
894 ///
895 /// Parameter `extraRowsOnTop`: Returns the pixel row padding to the top. May be NULL.
896 ///
897 /// Parameter `extraColumnsOnRight`: Returns the pixel row padding to the right. May be NULL.
898 ///
899 /// Parameter `extraRowsOnBottom`: Returns the pixel row padding to the bottom. May be NULL.
900 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
901 pub fn CVPixelBufferGetExtendedPixels(
902 pixel_buffer: &CVPixelBuffer,
903 extra_columns_on_left: *mut usize,
904 extra_columns_on_right: *mut usize,
905 extra_rows_on_top: *mut usize,
906 extra_rows_on_bottom: *mut usize,
907 );
908}
909
910extern "C-unwind" {
911 /// Fills the extended pixels of the PixelBuffer. This function replicates edge pixels to fill the entire extended region of the image.
912 ///
913 /// Parameter `pixelBuffer`: Target PixelBuffer.
914 #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
915 pub fn CVPixelBufferFillExtendedPixels(pixel_buffer: &CVPixelBuffer) -> CVReturn;
916}
917
918/// Returns a copy of pixelBufferAttributes dictionary used to create the PixelBuffer.
919///
920/// Can be used to create similar pixelbuffers.
921///
922/// Parameter `pixelBuffer`: Target PixelBuffer.
923#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
924#[inline]
925pub unsafe extern "C-unwind" fn CVPixelBufferCopyCreationAttributes(
926 pixel_buffer: &CVPixelBuffer,
927) -> CFRetained<CFDictionary> {
928 extern "C-unwind" {
929 fn CVPixelBufferCopyCreationAttributes(
930 pixel_buffer: &CVPixelBuffer,
931 ) -> Option<NonNull<CFDictionary>>;
932 }
933 let ret = unsafe { CVPixelBufferCopyCreationAttributes(pixel_buffer) };
934 let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
935 unsafe { CFRetained::from_raw(ret) }
936}