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_96versatilebayerpacked12?language=objc)
170pub const kCVPixelFormatType_96VersatileBayerPacked12: OSType = 0x62747032;
171/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_64rgba_downscaledproresraw?language=objc)
172pub const kCVPixelFormatType_64RGBA_DownscaledProResRAW: OSType = 0x62703634;
173/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_422ypcbcr16biplanarvideorange?language=objc)
174pub const kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange: OSType = 0x73763232;
175/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr16biplanarvideorange?language=objc)
176pub const kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange: OSType = 0x73763434;
177/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_444ypcbcr16videorange_16a_triplanar?language=objc)
178pub const kCVPixelFormatType_444YpCbCr16VideoRange_16A_TriPlanar: OSType = 0x73346173;
179/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_30rgble_8a_biplanar?language=objc)
180pub const kCVPixelFormatType_30RGBLE_8A_BiPlanar: OSType = 0x62336138;
181
182/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_32bgra?language=objc)
183pub const kCVPixelFormatType_Lossless_32BGRA: OSType = 0x26424741;
184/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_64rgbahalf?language=objc)
185pub const kCVPixelFormatType_Lossless_64RGBAHalf: OSType = 0x26526841;
186/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr8biplanarvideorange?language=objc)
187pub const kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarVideoRange: OSType = 0x26387630;
188/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr8biplanarfullrange?language=objc)
189pub const kCVPixelFormatType_Lossless_420YpCbCr8BiPlanarFullRange: OSType = 0x26386630;
190/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr10packedbiplanarvideorange?language=objc)
191pub const kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarVideoRange: OSType = 0x26787630;
192/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_422ypcbcr10packedbiplanarvideorange?language=objc)
193pub const kCVPixelFormatType_Lossless_422YpCbCr10PackedBiPlanarVideoRange: OSType = 0x26787632;
194/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_420ypcbcr10packedbiplanarfullrange?language=objc)
195pub const kCVPixelFormatType_Lossless_420YpCbCr10PackedBiPlanarFullRange: OSType = 0x26786630;
196/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_30rgble_8a_biplanar?language=objc)
197pub const kCVPixelFormatType_Lossless_30RGBLE_8A_BiPlanar: OSType = 0x26623338;
198/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossless_30rgblepackedwidegamut?language=objc)
199pub const kCVPixelFormatType_Lossless_30RGBLEPackedWideGamut: OSType = 0x26773372;
200
201/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_32bgra?language=objc)
202pub const kCVPixelFormatType_Lossy_32BGRA: OSType = 0x2d424741;
203/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr8biplanarvideorange?language=objc)
204pub const kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarVideoRange: OSType = 0x2d387630;
205/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr8biplanarfullrange?language=objc)
206pub const kCVPixelFormatType_Lossy_420YpCbCr8BiPlanarFullRange: OSType = 0x2d386630;
207/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_420ypcbcr10packedbiplanarvideorange?language=objc)
208pub const kCVPixelFormatType_Lossy_420YpCbCr10PackedBiPlanarVideoRange: OSType = 0x2d787630;
209/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelformattype_lossy_422ypcbcr10packedbiplanarvideorange?language=objc)
210pub const kCVPixelFormatType_Lossy_422YpCbCr10PackedBiPlanarVideoRange: OSType = 0x2d787632;
211
212/// Flags to pass to CVPixelBufferLockBaseAddress() / CVPixelBufferUnlockBaseAddress()
213///
214/// If you are not going to modify the data while you hold the lock, you should set this flag
215/// to avoid potentially invalidating any existing caches of the buffer contents.  This flag
216/// should be passed both to the lock and unlock functions.  Non-symmetrical usage of this
217/// flag will result in undefined behavior.
218///
219/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferlockflags?language=objc)
220// NS_OPTIONS
221#[cfg(feature = "CVBase")]
222#[repr(transparent)]
223#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
224pub struct CVPixelBufferLockFlags(pub CVOptionFlags);
225#[cfg(feature = "CVBase")]
226bitflags::bitflags! {
227    impl CVPixelBufferLockFlags: CVOptionFlags {
228        #[doc(alias = "kCVPixelBufferLock_ReadOnly")]
229        const ReadOnly = 0x00000001;
230    }
231}
232
233#[cfg(all(feature = "CVBase", feature = "objc2"))]
234unsafe impl Encode for CVPixelBufferLockFlags {
235    const ENCODING: Encoding = CVOptionFlags::ENCODING;
236}
237
238#[cfg(all(feature = "CVBase", feature = "objc2"))]
239unsafe impl RefEncode for CVPixelBufferLockFlags {
240    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
241}
242
243/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarcomponentinfo?language=objc)
244#[repr(C)]
245#[derive(Clone, Copy, Debug, PartialEq)]
246pub struct CVPlanarComponentInfo {
247    pub offset: i32,
248    pub rowBytes: u32,
249}
250
251#[cfg(feature = "objc2")]
252unsafe impl Encode for CVPlanarComponentInfo {
253    const ENCODING: Encoding =
254        Encoding::Struct("CVPlanarComponentInfo", &[<i32>::ENCODING, <u32>::ENCODING]);
255}
256
257#[cfg(feature = "objc2")]
258unsafe impl RefEncode for CVPlanarComponentInfo {
259    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
260}
261
262/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo?language=objc)
263#[repr(C)]
264#[derive(Clone, Copy, Debug, PartialEq)]
265pub struct CVPlanarPixelBufferInfo {
266    pub componentInfo: [CVPlanarComponentInfo; 1],
267}
268
269#[cfg(feature = "objc2")]
270unsafe impl Encode for CVPlanarPixelBufferInfo {
271    const ENCODING: Encoding = Encoding::Struct(
272        "CVPlanarPixelBufferInfo",
273        &[<[CVPlanarComponentInfo; 1]>::ENCODING],
274    );
275}
276
277#[cfg(feature = "objc2")]
278unsafe impl RefEncode for CVPlanarPixelBufferInfo {
279    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
280}
281
282/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo_ycbcrplanar?language=objc)
283#[repr(C)]
284#[derive(Clone, Copy, Debug, PartialEq)]
285pub struct CVPlanarPixelBufferInfo_YCbCrPlanar {
286    pub componentInfoY: CVPlanarComponentInfo,
287    pub componentInfoCb: CVPlanarComponentInfo,
288    pub componentInfoCr: CVPlanarComponentInfo,
289}
290
291#[cfg(feature = "objc2")]
292unsafe impl Encode for CVPlanarPixelBufferInfo_YCbCrPlanar {
293    const ENCODING: Encoding = Encoding::Struct(
294        "CVPlanarPixelBufferInfo_YCbCrPlanar",
295        &[
296            <CVPlanarComponentInfo>::ENCODING,
297            <CVPlanarComponentInfo>::ENCODING,
298            <CVPlanarComponentInfo>::ENCODING,
299        ],
300    );
301}
302
303#[cfg(feature = "objc2")]
304unsafe impl RefEncode for CVPlanarPixelBufferInfo_YCbCrPlanar {
305    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
306}
307
308/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvplanarpixelbufferinfo_ycbcrbiplanar?language=objc)
309#[repr(C)]
310#[derive(Clone, Copy, Debug, PartialEq)]
311pub struct CVPlanarPixelBufferInfo_YCbCrBiPlanar {
312    pub componentInfoY: CVPlanarComponentInfo,
313    pub componentInfoCbCr: CVPlanarComponentInfo,
314}
315
316#[cfg(feature = "objc2")]
317unsafe impl Encode for CVPlanarPixelBufferInfo_YCbCrBiPlanar {
318    const ENCODING: Encoding = Encoding::Struct(
319        "CVPlanarPixelBufferInfo_YCbCrBiPlanar",
320        &[
321            <CVPlanarComponentInfo>::ENCODING,
322            <CVPlanarComponentInfo>::ENCODING,
323        ],
324    );
325}
326
327#[cfg(feature = "objc2")]
328unsafe impl RefEncode for CVPlanarPixelBufferInfo_YCbCrBiPlanar {
329    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
330}
331
332extern "C" {
333    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferpixelformattypekey?language=objc)
334    pub static kCVPixelBufferPixelFormatTypeKey: &'static CFString;
335}
336
337extern "C" {
338    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffermemoryallocatorkey?language=objc)
339    pub static kCVPixelBufferMemoryAllocatorKey: &'static CFString;
340}
341
342extern "C" {
343    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferwidthkey?language=objc)
344    pub static kCVPixelBufferWidthKey: &'static CFString;
345}
346
347extern "C" {
348    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferheightkey?language=objc)
349    pub static kCVPixelBufferHeightKey: &'static CFString;
350}
351
352extern "C" {
353    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsleftkey?language=objc)
354    pub static kCVPixelBufferExtendedPixelsLeftKey: &'static CFString;
355}
356
357extern "C" {
358    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelstopkey?language=objc)
359    pub static kCVPixelBufferExtendedPixelsTopKey: &'static CFString;
360}
361
362extern "C" {
363    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsrightkey?language=objc)
364    pub static kCVPixelBufferExtendedPixelsRightKey: &'static CFString;
365}
366
367extern "C" {
368    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferextendedpixelsbottomkey?language=objc)
369    pub static kCVPixelBufferExtendedPixelsBottomKey: &'static CFString;
370}
371
372extern "C" {
373    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferbytesperrowalignmentkey?language=objc)
374    pub static kCVPixelBufferBytesPerRowAlignmentKey: &'static CFString;
375}
376
377extern "C" {
378    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffercgbitmapcontextcompatibilitykey?language=objc)
379    pub static kCVPixelBufferCGBitmapContextCompatibilityKey: &'static CFString;
380}
381
382extern "C" {
383    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffercgimagecompatibilitykey?language=objc)
384    pub static kCVPixelBufferCGImageCompatibilityKey: &'static CFString;
385}
386
387extern "C" {
388    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglcompatibilitykey?language=objc)
389    pub static kCVPixelBufferOpenGLCompatibilityKey: &'static CFString;
390}
391
392extern "C" {
393    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferplanealignmentkey?language=objc)
394    pub static kCVPixelBufferPlaneAlignmentKey: &'static CFString;
395}
396
397extern "C" {
398    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfacepropertieskey?language=objc)
399    pub static kCVPixelBufferIOSurfacePropertiesKey: &'static CFString;
400}
401
402extern "C" {
403    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglescompatibilitykey?language=objc)
404    pub static kCVPixelBufferOpenGLESCompatibilityKey: &'static CFString;
405}
406
407extern "C" {
408    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbuffermetalcompatibilitykey?language=objc)
409    pub static kCVPixelBufferMetalCompatibilityKey: &'static CFString;
410}
411
412extern "C" {
413    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopengltexturecachecompatibilitykey?language=objc)
414    pub static kCVPixelBufferOpenGLTextureCacheCompatibilityKey: &'static CFString;
415}
416
417extern "C" {
418    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferopenglestexturecachecompatibilitykey?language=objc)
419    pub static kCVPixelBufferOpenGLESTextureCacheCompatibilityKey: &'static CFString;
420}
421
422extern "C" {
423    /// Buffer attachment key for code indicating Bayer pattern (sensel arrangement).
424    ///
425    /// 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.
426    ///
427    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferversatilebayerkey_bayerpattern?language=objc)
428    pub static kCVPixelBufferVersatileBayerKey_BayerPattern: &'static CFString;
429}
430
431/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_rggb?language=objc)
432pub const kCVVersatileBayer_BayerPattern_RGGB: c_uint = 0;
433/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_grbg?language=objc)
434pub const kCVVersatileBayer_BayerPattern_GRBG: c_uint = 1;
435/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_gbrg?language=objc)
436pub const kCVVersatileBayer_BayerPattern_GBRG: c_uint = 2;
437/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvversatilebayer_bayerpattern_bggr?language=objc)
438pub const kCVVersatileBayer_BayerPattern_BGGR: c_uint = 3;
439
440extern "C" {
441    /// Buffer attachment key for siting offsets, relative to pixel center, of individual sensels/components constituting each pixel.
442    ///
443    /// 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.
444    ///
445    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_senselsitingoffsets?language=objc)
446    pub static kCVPixelBufferProResRAWKey_SenselSitingOffsets: &'static CFString;
447}
448
449extern "C" {
450    /// Buffer attachment key for sensel black level.
451    ///
452    /// 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.
453    ///
454    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_blacklevel?language=objc)
455    pub static kCVPixelBufferProResRAWKey_BlackLevel: &'static CFString;
456}
457
458extern "C" {
459    /// Buffer attachment key for sensel white level.
460    ///
461    /// 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.
462    ///
463    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitelevel?language=objc)
464    pub static kCVPixelBufferProResRAWKey_WhiteLevel: &'static CFString;
465}
466
467extern "C" {
468    /// Buffer attachment key for illuminant correlated color temperature.
469    ///
470    /// 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.
471    ///
472    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalancecct?language=objc)
473    pub static kCVPixelBufferProResRAWKey_WhiteBalanceCCT: &'static CFString;
474}
475
476extern "C" {
477    /// Buffer attachment key for white balance red factor.
478    ///
479    /// 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.
480    ///
481    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalanceredfactor?language=objc)
482    pub static kCVPixelBufferProResRAWKey_WhiteBalanceRedFactor: &'static CFString;
483}
484
485extern "C" {
486    /// Buffer attachment key for white balance blue factor.
487    ///
488    /// 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.
489    ///
490    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_whitebalancebluefactor?language=objc)
491    pub static kCVPixelBufferProResRAWKey_WhiteBalanceBlueFactor: &'static CFString;
492}
493
494extern "C" {
495    /// Buffer attachment key for color translation matrix.
496    ///
497    /// 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.
498    ///
499    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_colormatrix?language=objc)
500    pub static kCVPixelBufferProResRAWKey_ColorMatrix: &'static CFString;
501}
502
503extern "C" {
504    /// Buffer attachment key for gain factor.
505    ///
506    /// 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.
507    ///
508    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_gainfactor?language=objc)
509    pub static kCVPixelBufferProResRAWKey_GainFactor: &'static CFString;
510}
511
512extern "C" {
513    /// Buffer attachment key for recommended number of pixels/rows to discard from the sides of the image after raw conversion.
514    ///
515    /// 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.
516    ///
517    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_recommendedcrop?language=objc)
518    pub static kCVPixelBufferProResRAWKey_RecommendedCrop: &'static CFString;
519}
520
521extern "C" {
522    /// Buffer attachment key for metadata extension.
523    ///
524    /// 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.
525    ///
526    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferproresrawkey_metadataextension?language=objc)
527    pub static kCVPixelBufferProResRAWKey_MetadataExtension: &'static CFString;
528}
529
530extern "C" {
531    /// Key sets the IOSurface backed memory allocation for CVPixelBuffer as purgable and volatile.
532    ///
533    /// A purgeable IOSurface is capable of being switched between non-volatile, volatile and empty states using IOSurfaceSetPurgeable.  When in the volatile state, the OS is permitted to instantly change its state to empty and remove all its memory pages.  Clients should set the IOSurfaces to the non-volatile state while they are in use and the volatile state when their need and contents is optional/speculative and OK to discard in response to system memory demand.  See IOSurfaceSetPurgeable for more details.  This key is only effective for CVPixelBuffers that are backed by IOSurface.
534    ///
535    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvpixelbufferiosurfacepurgeablekey?language=objc)
536    pub static kCVPixelBufferIOSurfacePurgeableKey: &'static CFString;
537}
538
539/// Based on the image buffer type. The pixel buffer implements the memory storage for an image buffer.
540///
541/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbuffer?language=objc)
542#[doc(alias = "CVPixelBufferRef")]
543#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
544pub type CVPixelBuffer = CVImageBuffer;
545
546#[inline]
547pub extern "C-unwind" fn CVPixelBufferGetTypeID() -> CFTypeID {
548    extern "C-unwind" {
549        fn CVPixelBufferGetTypeID() -> CFTypeID;
550    }
551    unsafe { CVPixelBufferGetTypeID() }
552}
553
554extern "C-unwind" {
555    /// Takes a CFArray of CFDictionary objects describing various pixel buffer attributes and tries to resolve them into a
556    /// single dictionary.
557    ///
558    /// This is useful when you need to resolve multiple requirements between different potential clients of a buffer.
559    ///
560    /// Parameter `attributes`: CFArray of CFDictionaries containing kCVPixelBuffer key/value pairs.
561    ///
562    /// Parameter `resolvedDictionaryOut`: The resulting dictionary will be placed here.
563    ///
564    /// Returns: Return value that may be useful in discovering why resolution failed.
565    ///
566    /// # Safety
567    ///
568    /// - `attributes` generic must be of the correct type.
569    /// - `resolved_dictionary_out` must be a valid pointer.
570    #[cfg(feature = "CVReturn")]
571    pub fn CVPixelBufferCreateResolvedAttributesDictionary(
572        allocator: Option<&CFAllocator>,
573        attributes: Option<&CFArray>,
574        resolved_dictionary_out: NonNull<*const CFDictionary>,
575    ) -> CVReturn;
576}
577
578extern "C-unwind" {
579    /// Call to create a single PixelBuffer for a given size and pixelFormatType.
580    ///
581    /// 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.
582    ///
583    /// Parameter `width`: Width of the PixelBuffer in pixels.
584    ///
585    /// Parameter `height`: Height of the PixelBuffer in pixels.
586    ///
587    /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
588    ///
589    /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a pixel buffer. This parameter is optional. See BufferAttributeKeys for more details.
590    ///
591    /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
592    ///
593    /// Returns: returns kCVReturnSuccess on success.
594    ///
595    /// # Safety
596    ///
597    /// - `pixel_buffer_attributes` generics must be of the correct type.
598    /// - `pixel_buffer_out` must be a valid pointer.
599    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
600    pub fn CVPixelBufferCreate(
601        allocator: Option<&CFAllocator>,
602        width: usize,
603        height: usize,
604        pixel_format_type: OSType,
605        pixel_buffer_attributes: Option<&CFDictionary>,
606        pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
607    ) -> CVReturn;
608}
609
610/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferreleasebytescallback?language=objc)
611pub type CVPixelBufferReleaseBytesCallback =
612    Option<unsafe extern "C-unwind" fn(*mut c_void, *const c_void)>;
613
614extern "C-unwind" {
615    /// Call to create a single PixelBuffer for a given size and pixelFormatType based on a passed in piece of memory.
616    ///
617    /// 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.
618    ///
619    /// Parameter `width`: Width of the PixelBuffer in pixels
620    ///
621    /// Parameter `height`: Height of the PixelBuffer in pixels
622    ///
623    /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
624    ///
625    /// Parameter `baseAddress`: Address of the memory storing the pixels.
626    ///
627    /// Parameter `bytesPerRow`: Row bytes of the pixel storage memory.
628    ///
629    /// Parameter `releaseCallback`: CVPixelBufferReleaseBytePointerCallback function that gets called when the PixelBuffer gets destroyed.
630    ///
631    /// Parameter `releaseRefCon`: User data identifying the PixelBuffer for the release callback.
632    ///
633    /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See PixelBufferAttributes for more details.
634    ///
635    /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
636    ///
637    /// Returns: returns kCVReturnSuccess on success.
638    ///
639    /// # Safety
640    ///
641    /// - `base_address` must be a valid pointer.
642    /// - `release_callback` must be implemented correctly.
643    /// - `release_ref_con` must be a valid pointer or null.
644    /// - `pixel_buffer_attributes` generics must be of the correct type.
645    /// - `pixel_buffer_out` must be a valid pointer.
646    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
647    pub fn CVPixelBufferCreateWithBytes(
648        allocator: Option<&CFAllocator>,
649        width: usize,
650        height: usize,
651        pixel_format_type: OSType,
652        base_address: NonNull<c_void>,
653        bytes_per_row: usize,
654        release_callback: CVPixelBufferReleaseBytesCallback,
655        release_ref_con: *mut c_void,
656        pixel_buffer_attributes: Option<&CFDictionary>,
657        pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
658    ) -> CVReturn;
659}
660
661/// [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvpixelbufferreleaseplanarbytescallback?language=objc)
662pub type CVPixelBufferReleasePlanarBytesCallback = Option<
663    unsafe extern "C-unwind" fn(*mut c_void, *const c_void, usize, usize, *mut *const c_void),
664>;
665
666extern "C-unwind" {
667    /// Call to create a single PixelBuffer in planar format for a given size and pixelFormatType based on a passed in piece of memory.
668    ///
669    /// 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.
670    ///
671    /// Parameter `width`: Width of the PixelBuffer in pixels
672    ///
673    /// Parameter `height`: Height of the PixelBuffer in pixels
674    ///
675    /// Parameter `pixelFormatType`: Pixel format indentified by its respective OSType.
676    ///
677    /// Parameter `dataPtr`: Pass a pointer to a plane descriptor block, or NULL.
678    ///
679    /// Parameter `dataSize`: pass size if planes are contiguous, NULL if not.
680    ///
681    /// Parameter `numberOfPlanes`: Number of planes.
682    ///
683    /// Parameter `planeBaseAddress`: Array of base addresses for the planes.
684    ///
685    /// Parameter `planeWidth`: Array of plane widths.
686    ///
687    /// Parameter `planeHeight`: Array of plane heights.
688    ///
689    /// Parameter `planeBytesPerRow`: Array of plane bytesPerRow values.
690    ///
691    /// Parameter `releaseCallback`: CVPixelBufferReleaseBytePointerCallback function that gets called when the PixelBuffer gets destroyed.
692    ///
693    /// Parameter `releaseRefCon`: User data identifying the PixelBuffer for the release callback.
694    ///
695    /// Parameter `pixelBufferAttributes`: A dictionary with additional attributes for a a pixel buffer. This parameter is optional. See PixelBufferAttributes for more details.
696    ///
697    /// Parameter `pixelBufferOut`: The new pixel buffer will be returned here
698    ///
699    /// Returns: returns kCVReturnSuccess on success.
700    ///
701    /// # Safety
702    ///
703    /// - `data_ptr` must be a valid pointer or null.
704    /// - `plane_base_address` must be a valid pointer.
705    /// - `plane_width` must be a valid pointer.
706    /// - `plane_height` must be a valid pointer.
707    /// - `plane_bytes_per_row` must be a valid pointer.
708    /// - `release_callback` must be implemented correctly.
709    /// - `release_ref_con` must be a valid pointer or null.
710    /// - `pixel_buffer_attributes` generics must be of the correct type.
711    /// - `pixel_buffer_out` must be a valid pointer.
712    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
713    pub fn CVPixelBufferCreateWithPlanarBytes(
714        allocator: Option<&CFAllocator>,
715        width: usize,
716        height: usize,
717        pixel_format_type: OSType,
718        data_ptr: *mut c_void,
719        data_size: usize,
720        number_of_planes: usize,
721        plane_base_address: NonNull<*mut c_void>,
722        plane_width: NonNull<usize>,
723        plane_height: NonNull<usize>,
724        plane_bytes_per_row: NonNull<usize>,
725        release_callback: CVPixelBufferReleasePlanarBytesCallback,
726        release_ref_con: *mut c_void,
727        pixel_buffer_attributes: Option<&CFDictionary>,
728        pixel_buffer_out: NonNull<*mut CVPixelBuffer>,
729    ) -> CVReturn;
730}
731
732extern "C-unwind" {
733    /// Description Locks the BaseAddress of the PixelBuffer to ensure that the memory is accessible.
734    ///
735    /// 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.
736    ///
737    /// Parameter `pixelBuffer`: Target PixelBuffer.
738    ///
739    /// Parameter `lockFlags`: See CVPixelBufferLockFlags.
740    ///
741    /// Returns: kCVReturnSuccess if the lock succeeded, or error code on failure
742    #[cfg(all(
743        feature = "CVBase",
744        feature = "CVBuffer",
745        feature = "CVImageBuffer",
746        feature = "CVReturn"
747    ))]
748    pub fn CVPixelBufferLockBaseAddress(
749        pixel_buffer: &CVPixelBuffer,
750        lock_flags: CVPixelBufferLockFlags,
751    ) -> CVReturn;
752}
753
754extern "C-unwind" {
755    /// Description Unlocks the BaseAddress of the PixelBuffer.
756    ///
757    /// Parameter `pixelBuffer`: Target PixelBuffer.
758    ///
759    /// Parameter `unlockFlags`: See CVPixelBufferLockFlags.
760    ///
761    /// Returns: kCVReturnSuccess if the unlock succeeded, or error code on failure
762    #[cfg(all(
763        feature = "CVBase",
764        feature = "CVBuffer",
765        feature = "CVImageBuffer",
766        feature = "CVReturn"
767    ))]
768    pub fn CVPixelBufferUnlockBaseAddress(
769        pixel_buffer: &CVPixelBuffer,
770        unlock_flags: CVPixelBufferLockFlags,
771    ) -> CVReturn;
772}
773
774/// Returns the width of the PixelBuffer.
775///
776/// Parameter `pixelBuffer`: Target PixelBuffer.
777///
778/// Returns: Width in pixels.
779#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
780#[inline]
781pub extern "C-unwind" fn CVPixelBufferGetWidth(pixel_buffer: &CVPixelBuffer) -> usize {
782    extern "C-unwind" {
783        fn CVPixelBufferGetWidth(pixel_buffer: &CVPixelBuffer) -> usize;
784    }
785    unsafe { CVPixelBufferGetWidth(pixel_buffer) }
786}
787
788/// Returns the height of the PixelBuffer.
789///
790/// Parameter `pixelBuffer`: Target PixelBuffer.
791///
792/// Returns: Height in pixels.
793#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
794#[inline]
795pub extern "C-unwind" fn CVPixelBufferGetHeight(pixel_buffer: &CVPixelBuffer) -> usize {
796    extern "C-unwind" {
797        fn CVPixelBufferGetHeight(pixel_buffer: &CVPixelBuffer) -> usize;
798    }
799    unsafe { CVPixelBufferGetHeight(pixel_buffer) }
800}
801
802/// Returns the PixelFormatType of the PixelBuffer.
803///
804/// Parameter `pixelBuffer`: Target PixelBuffer.
805///
806/// Returns: OSType identifying the pixel format by its type.
807#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
808#[inline]
809pub extern "C-unwind" fn CVPixelBufferGetPixelFormatType(pixel_buffer: &CVPixelBuffer) -> OSType {
810    extern "C-unwind" {
811        fn CVPixelBufferGetPixelFormatType(pixel_buffer: &CVPixelBuffer) -> OSType;
812    }
813    unsafe { CVPixelBufferGetPixelFormatType(pixel_buffer) }
814}
815
816/// Returns the base address of the PixelBuffer.
817///
818/// Retrieving the base address for a PixelBuffer requires that the buffer base address be locked
819/// via a successful call to CVPixelBufferLockBaseAddress.
820///
821/// Parameter `pixelBuffer`: Target PixelBuffer.
822///
823/// Returns: Base address of the pixels.
824/// For chunky buffers, this will return a pointer to the pixel at 0,0 in the buffer
825/// For planar buffers this will return a pointer to a PlanarComponentInfo struct (defined in QuickTime).
826#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
827#[inline]
828pub extern "C-unwind" fn CVPixelBufferGetBaseAddress(pixel_buffer: &CVPixelBuffer) -> *mut c_void {
829    extern "C-unwind" {
830        fn CVPixelBufferGetBaseAddress(pixel_buffer: &CVPixelBuffer) -> *mut c_void;
831    }
832    unsafe { CVPixelBufferGetBaseAddress(pixel_buffer) }
833}
834
835/// Returns the rowBytes of the PixelBuffer.
836///
837/// Parameter `pixelBuffer`: Target PixelBuffer.
838///
839/// Returns: Bytes per row of the image data.   For planar buffers this will return a rowBytes value such that bytesPerRow * height
840/// will cover the entire image including all planes.
841#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
842#[inline]
843pub extern "C-unwind" fn CVPixelBufferGetBytesPerRow(pixel_buffer: &CVPixelBuffer) -> usize {
844    extern "C-unwind" {
845        fn CVPixelBufferGetBytesPerRow(pixel_buffer: &CVPixelBuffer) -> usize;
846    }
847    unsafe { CVPixelBufferGetBytesPerRow(pixel_buffer) }
848}
849
850/// Returns the data size for contigous planes of the PixelBuffer.
851///
852/// Parameter `pixelBuffer`: Target PixelBuffer.
853///
854/// Returns: Data size used in CVPixelBufferCreateWithPlanarBytes.
855#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
856#[inline]
857pub extern "C-unwind" fn CVPixelBufferGetDataSize(pixel_buffer: &CVPixelBuffer) -> usize {
858    extern "C-unwind" {
859        fn CVPixelBufferGetDataSize(pixel_buffer: &CVPixelBuffer) -> usize;
860    }
861    unsafe { CVPixelBufferGetDataSize(pixel_buffer) }
862}
863
864/// Returns if the PixelBuffer is planar.
865///
866/// Parameter `pixelBuffer`: Target PixelBuffer.
867///
868/// Returns: True if the PixelBuffer was created using CVPixelBufferCreateWithPlanarBytes.
869#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
870#[inline]
871pub extern "C-unwind" fn CVPixelBufferIsPlanar(pixel_buffer: &CVPixelBuffer) -> bool {
872    extern "C-unwind" {
873        fn CVPixelBufferIsPlanar(pixel_buffer: &CVPixelBuffer) -> Boolean;
874    }
875    let ret = unsafe { CVPixelBufferIsPlanar(pixel_buffer) };
876    ret != 0
877}
878
879/// Returns number of planes of the PixelBuffer.
880///
881/// Parameter `pixelBuffer`: Target PixelBuffer.
882///
883/// Returns: Number of planes.  Returns 0 for non-planar CVPixelBufferRefs.
884#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
885#[inline]
886pub extern "C-unwind" fn CVPixelBufferGetPlaneCount(pixel_buffer: &CVPixelBuffer) -> usize {
887    extern "C-unwind" {
888        fn CVPixelBufferGetPlaneCount(pixel_buffer: &CVPixelBuffer) -> usize;
889    }
890    unsafe { CVPixelBufferGetPlaneCount(pixel_buffer) }
891}
892
893/// Returns the width of the plane at planeIndex in the PixelBuffer.
894///
895/// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
896/// function with a non-planar buffer will have undefined behavior.
897///
898/// Parameter `pixelBuffer`: Target PixelBuffer.
899///
900/// Parameter `planeIndex`: Identifying the plane.
901///
902/// Returns: Width in pixels, or 0 for non-planar CVPixelBufferRefs.
903#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
904#[inline]
905pub extern "C-unwind" fn CVPixelBufferGetWidthOfPlane(
906    pixel_buffer: &CVPixelBuffer,
907    plane_index: usize,
908) -> usize {
909    extern "C-unwind" {
910        fn CVPixelBufferGetWidthOfPlane(pixel_buffer: &CVPixelBuffer, plane_index: usize) -> usize;
911    }
912    unsafe { CVPixelBufferGetWidthOfPlane(pixel_buffer, plane_index) }
913}
914
915/// Returns the height of the plane at planeIndex in the PixelBuffer.
916///
917/// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
918/// function with a non-planar buffer will have undefined behavior.
919///
920/// Parameter `pixelBuffer`: Target PixelBuffer.
921///
922/// Parameter `planeIndex`: Identifying the plane.
923///
924/// Returns: Height in pixels, or 0 for non-planar CVPixelBufferRefs.
925#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
926#[inline]
927pub extern "C-unwind" fn CVPixelBufferGetHeightOfPlane(
928    pixel_buffer: &CVPixelBuffer,
929    plane_index: usize,
930) -> usize {
931    extern "C-unwind" {
932        fn CVPixelBufferGetHeightOfPlane(pixel_buffer: &CVPixelBuffer, plane_index: usize)
933            -> usize;
934    }
935    unsafe { CVPixelBufferGetHeightOfPlane(pixel_buffer, plane_index) }
936}
937
938/// Returns the base address of the plane at planeIndex in the PixelBuffer.
939///
940/// Retrieving the base address for a PixelBuffer requires that the buffer base address be locked
941/// via a successful call to CVPixelBufferLockBaseAddress. On OSX 10.10 and earlier, or iOS 8 and
942/// earlier, calling this function with a non-planar buffer will have undefined behavior.
943///
944/// Parameter `pixelBuffer`: Target PixelBuffer.
945///
946/// Parameter `planeIndex`: Identifying the plane.
947///
948/// Returns: Base address of the plane, or NULL for non-planar CVPixelBufferRefs.
949#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
950#[inline]
951pub extern "C-unwind" fn CVPixelBufferGetBaseAddressOfPlane(
952    pixel_buffer: &CVPixelBuffer,
953    plane_index: usize,
954) -> *mut c_void {
955    extern "C-unwind" {
956        fn CVPixelBufferGetBaseAddressOfPlane(
957            pixel_buffer: &CVPixelBuffer,
958            plane_index: usize,
959        ) -> *mut c_void;
960    }
961    unsafe { CVPixelBufferGetBaseAddressOfPlane(pixel_buffer, plane_index) }
962}
963
964/// Returns the row bytes of the plane at planeIndex in the PixelBuffer.
965///
966/// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
967/// function with a non-planar buffer will have undefined behavior.
968///
969/// Parameter `pixelBuffer`: Target PixelBuffer.
970///
971/// Parameter `planeIndex`: Identifying the plane.
972///
973/// Returns: Row bytes of the plane, or NULL for non-planar CVPixelBufferRefs.
974#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
975#[inline]
976pub extern "C-unwind" fn CVPixelBufferGetBytesPerRowOfPlane(
977    pixel_buffer: &CVPixelBuffer,
978    plane_index: usize,
979) -> usize {
980    extern "C-unwind" {
981        fn CVPixelBufferGetBytesPerRowOfPlane(
982            pixel_buffer: &CVPixelBuffer,
983            plane_index: usize,
984        ) -> usize;
985    }
986    unsafe { CVPixelBufferGetBytesPerRowOfPlane(pixel_buffer, plane_index) }
987}
988
989extern "C-unwind" {
990    /// Returns the size of extended pixels of the PixelBuffer.
991    ///
992    /// On OSX 10.10 and earlier, or iOS 8 and earlier, calling this
993    /// function with a non-planar buffer will have undefined behavior.
994    ///
995    /// Parameter `pixelBuffer`: Target PixelBuffer.
996    ///
997    /// Parameter `extraColumnsOnLeft`: Returns the pixel row padding to the left.  May be NULL.
998    ///
999    /// Parameter `extraRowsOnTop`: Returns the pixel row padding to the top.  May be NULL.
1000    ///
1001    /// Parameter `extraColumnsOnRight`: Returns the pixel row padding to the right. May be NULL.
1002    ///
1003    /// Parameter `extraRowsOnBottom`: Returns the pixel row padding to the bottom. May be NULL.
1004    ///
1005    /// # Safety
1006    ///
1007    /// - `extra_columns_on_left` must be a valid pointer or null.
1008    /// - `extra_columns_on_right` must be a valid pointer or null.
1009    /// - `extra_rows_on_top` must be a valid pointer or null.
1010    /// - `extra_rows_on_bottom` must be a valid pointer or null.
1011    #[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
1012    pub fn CVPixelBufferGetExtendedPixels(
1013        pixel_buffer: &CVPixelBuffer,
1014        extra_columns_on_left: *mut usize,
1015        extra_columns_on_right: *mut usize,
1016        extra_rows_on_top: *mut usize,
1017        extra_rows_on_bottom: *mut usize,
1018    );
1019}
1020
1021/// Fills the extended pixels of the PixelBuffer.   This function replicates edge pixels to fill the entire extended region of the image.
1022///
1023/// Parameter `pixelBuffer`: Target PixelBuffer.
1024#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer", feature = "CVReturn"))]
1025#[inline]
1026pub extern "C-unwind" fn CVPixelBufferFillExtendedPixels(pixel_buffer: &CVPixelBuffer) -> CVReturn {
1027    extern "C-unwind" {
1028        fn CVPixelBufferFillExtendedPixels(pixel_buffer: &CVPixelBuffer) -> CVReturn;
1029    }
1030    unsafe { CVPixelBufferFillExtendedPixels(pixel_buffer) }
1031}
1032
1033/// Returns a copy of pixelBufferAttributes dictionary used to create the PixelBuffer.
1034///
1035/// Can be used to create similar pixelbuffers.
1036///
1037/// Parameter `pixelBuffer`: Target PixelBuffer.
1038#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
1039#[inline]
1040pub extern "C-unwind" fn CVPixelBufferCopyCreationAttributes(
1041    pixel_buffer: &CVPixelBuffer,
1042) -> CFRetained<CFDictionary> {
1043    extern "C-unwind" {
1044        fn CVPixelBufferCopyCreationAttributes(
1045            pixel_buffer: &CVPixelBuffer,
1046        ) -> Option<NonNull<CFDictionary>>;
1047    }
1048    let ret = unsafe { CVPixelBufferCopyCreationAttributes(pixel_buffer) };
1049    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
1050    unsafe { CFRetained::from_raw(ret) }
1051}
1052
1053/// Returns true if given pixel buffer is compatible with pixelBufferAttributes dictionary.
1054///
1055/// Parameter `pixelBuffer`: PixelBuffer to check for compatibility.
1056///
1057/// Parameter `attributes`: Creation attributes which pixel buffer should have.
1058///
1059/// # Safety
1060///
1061/// `attributes` generics must be of the correct type.
1062#[cfg(all(feature = "CVBuffer", feature = "CVImageBuffer"))]
1063#[inline]
1064pub unsafe extern "C-unwind" fn CVPixelBufferIsCompatibleWithAttributes(
1065    pixel_buffer: &CVPixelBuffer,
1066    attributes: Option<&CFDictionary>,
1067) -> bool {
1068    extern "C-unwind" {
1069        fn CVPixelBufferIsCompatibleWithAttributes(
1070            pixel_buffer: &CVPixelBuffer,
1071            attributes: Option<&CFDictionary>,
1072        ) -> Boolean;
1073    }
1074    let ret = unsafe { CVPixelBufferIsCompatibleWithAttributes(pixel_buffer, attributes) };
1075    ret != 0
1076}