objc2_core_video/generated/
CVImageBuffer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2_core_foundation::*;
6#[cfg(feature = "objc2-core-graphics")]
7use objc2_core_graphics::*;
8
9use crate::*;
10
11extern "C" {
12    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercgcolorspacekey?language=objc)
13    pub static kCVImageBufferCGColorSpaceKey: &'static CFString;
14}
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturekey?language=objc)
18    pub static kCVImageBufferCleanApertureKey: &'static CFString;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturewidthkey?language=objc)
23    pub static kCVImageBufferCleanApertureWidthKey: &'static CFString;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanapertureheightkey?language=objc)
28    pub static kCVImageBufferCleanApertureHeightKey: &'static CFString;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturehorizontaloffsetkey?language=objc)
33    pub static kCVImageBufferCleanApertureHorizontalOffsetKey: &'static CFString;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanapertureverticaloffsetkey?language=objc)
38    pub static kCVImageBufferCleanApertureVerticalOffsetKey: &'static CFString;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpreferredcleanaperturekey?language=objc)
43    pub static kCVImageBufferPreferredCleanApertureKey: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfieldcountkey?language=objc)
48    pub static kCVImageBufferFieldCountKey: &'static CFString;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailkey?language=objc)
53    pub static kCVImageBufferFieldDetailKey: &'static CFString;
54}
55
56extern "C" {
57    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailtemporaltopfirst?language=objc)
58    pub static kCVImageBufferFieldDetailTemporalTopFirst: &'static CFString;
59}
60
61extern "C" {
62    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailtemporalbottomfirst?language=objc)
63    pub static kCVImageBufferFieldDetailTemporalBottomFirst: &'static CFString;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailspatialfirstlineearly?language=objc)
68    pub static kCVImageBufferFieldDetailSpatialFirstLineEarly: &'static CFString;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailspatialfirstlinelate?language=objc)
73    pub static kCVImageBufferFieldDetailSpatialFirstLineLate: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratiokey?language=objc)
78    pub static kCVImageBufferPixelAspectRatioKey: &'static CFString;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratiohorizontalspacingkey?language=objc)
83    pub static kCVImageBufferPixelAspectRatioHorizontalSpacingKey: &'static CFString;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratioverticalspacingkey?language=objc)
88    pub static kCVImageBufferPixelAspectRatioVerticalSpacingKey: &'static CFString;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaydimensionskey?language=objc)
93    pub static kCVImageBufferDisplayDimensionsKey: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaywidthkey?language=objc)
98    pub static kCVImageBufferDisplayWidthKey: &'static CFString;
99}
100
101extern "C" {
102    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplayheightkey?language=objc)
103    pub static kCVImageBufferDisplayHeightKey: &'static CFString;
104}
105
106extern "C" {
107    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffergammalevelkey?language=objc)
108    pub static kCVImageBufferGammaLevelKey: &'static CFString;
109}
110
111extern "C" {
112    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffericcprofilekey?language=objc)
113    pub static kCVImageBufferICCProfileKey: &'static CFString;
114}
115
116extern "C" {
117    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrixkey?language=objc)
118    pub static kCVImageBufferYCbCrMatrixKey: &'static CFString;
119}
120
121extern "C" {
122    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_709_2?language=objc)
123    pub static kCVImageBufferYCbCrMatrix_ITU_R_709_2: &'static CFString;
124}
125
126extern "C" {
127    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_601_4?language=objc)
128    pub static kCVImageBufferYCbCrMatrix_ITU_R_601_4: &'static CFString;
129}
130
131extern "C" {
132    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_smpte_240m_1995?language=objc)
133    pub static kCVImageBufferYCbCrMatrix_SMPTE_240M_1995: &'static CFString;
134}
135
136extern "C" {
137    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_dci_p3?language=objc)
138    #[deprecated = "kCVImageBufferYCbCrMatrix_DCI_P3 no longer supported."]
139    pub static kCVImageBufferYCbCrMatrix_DCI_P3: &'static CFString;
140}
141
142extern "C" {
143    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_p3_d65?language=objc)
144    #[deprecated = "kCVImageBufferYCbCrMatrix_P3_D65 no longer supported."]
145    pub static kCVImageBufferYCbCrMatrix_P3_D65: &'static CFString;
146}
147
148extern "C" {
149    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_2020?language=objc)
150    pub static kCVImageBufferYCbCrMatrix_ITU_R_2020: &'static CFString;
151}
152
153extern "C" {
154    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimarieskey?language=objc)
155    pub static kCVImageBufferColorPrimariesKey: &'static CFString;
156}
157
158extern "C" {
159    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_itu_r_709_2?language=objc)
160    pub static kCVImageBufferColorPrimaries_ITU_R_709_2: &'static CFString;
161}
162
163extern "C" {
164    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_ebu_3213?language=objc)
165    pub static kCVImageBufferColorPrimaries_EBU_3213: &'static CFString;
166}
167
168extern "C" {
169    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_smpte_c?language=objc)
170    pub static kCVImageBufferColorPrimaries_SMPTE_C: &'static CFString;
171}
172
173extern "C" {
174    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_p22?language=objc)
175    pub static kCVImageBufferColorPrimaries_P22: &'static CFString;
176}
177
178extern "C" {
179    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_dci_p3?language=objc)
180    pub static kCVImageBufferColorPrimaries_DCI_P3: &'static CFString;
181}
182
183extern "C" {
184    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_p3_d65?language=objc)
185    pub static kCVImageBufferColorPrimaries_P3_D65: &'static CFString;
186}
187
188extern "C" {
189    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_itu_r_2020?language=objc)
190    pub static kCVImageBufferColorPrimaries_ITU_R_2020: &'static CFString;
191}
192
193extern "C" {
194    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunctionkey?language=objc)
195    pub static kCVImageBufferTransferFunctionKey: &'static CFString;
196}
197
198extern "C" {
199    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_709_2?language=objc)
200    pub static kCVImageBufferTransferFunction_ITU_R_709_2: &'static CFString;
201}
202
203extern "C" {
204    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_240m_1995?language=objc)
205    pub static kCVImageBufferTransferFunction_SMPTE_240M_1995: &'static CFString;
206}
207
208extern "C" {
209    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_usegamma?language=objc)
210    pub static kCVImageBufferTransferFunction_UseGamma: &'static CFString;
211}
212
213extern "C" {
214    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_ebu_3213?language=objc)
215    #[deprecated]
216    pub static kCVImageBufferTransferFunction_EBU_3213: &'static CFString;
217}
218
219extern "C" {
220    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_c?language=objc)
221    #[deprecated]
222    pub static kCVImageBufferTransferFunction_SMPTE_C: &'static CFString;
223}
224
225extern "C" {
226    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_srgb?language=objc)
227    pub static kCVImageBufferTransferFunction_sRGB: &'static CFString;
228}
229
230extern "C" {
231    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_2020?language=objc)
232    pub static kCVImageBufferTransferFunction_ITU_R_2020: &'static CFString;
233}
234
235extern "C" {
236    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_st_428_1?language=objc)
237    pub static kCVImageBufferTransferFunction_SMPTE_ST_428_1: &'static CFString;
238}
239
240extern "C" {
241    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_st_2084_pq?language=objc)
242    pub static kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ: &'static CFString;
243}
244
245extern "C" {
246    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_2100_hlg?language=objc)
247    pub static kCVImageBufferTransferFunction_ITU_R_2100_HLG: &'static CFString;
248}
249
250extern "C" {
251    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_linear?language=objc)
252    pub static kCVImageBufferTransferFunction_Linear: &'static CFString;
253}
254
255extern "C" {
256    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocationtopfieldkey?language=objc)
257    pub static kCVImageBufferChromaLocationTopFieldKey: &'static CFString;
258}
259
260extern "C" {
261    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocationbottomfieldkey?language=objc)
262    pub static kCVImageBufferChromaLocationBottomFieldKey: &'static CFString;
263}
264
265extern "C" {
266    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_left?language=objc)
267    pub static kCVImageBufferChromaLocation_Left: &'static CFString;
268}
269
270extern "C" {
271    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_center?language=objc)
272    pub static kCVImageBufferChromaLocation_Center: &'static CFString;
273}
274
275extern "C" {
276    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_topleft?language=objc)
277    pub static kCVImageBufferChromaLocation_TopLeft: &'static CFString;
278}
279
280extern "C" {
281    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_top?language=objc)
282    pub static kCVImageBufferChromaLocation_Top: &'static CFString;
283}
284
285extern "C" {
286    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_bottomleft?language=objc)
287    pub static kCVImageBufferChromaLocation_BottomLeft: &'static CFString;
288}
289
290extern "C" {
291    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_bottom?language=objc)
292    pub static kCVImageBufferChromaLocation_Bottom: &'static CFString;
293}
294
295extern "C" {
296    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_dv420?language=objc)
297    pub static kCVImageBufferChromaLocation_DV420: &'static CFString;
298}
299
300extern "C" {
301    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsamplingkey?language=objc)
302    pub static kCVImageBufferChromaSubsamplingKey: &'static CFString;
303}
304
305extern "C" {
306    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_420?language=objc)
307    pub static kCVImageBufferChromaSubsampling_420: &'static CFString;
308}
309
310extern "C" {
311    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_422?language=objc)
312    pub static kCVImageBufferChromaSubsampling_422: &'static CFString;
313}
314
315extern "C" {
316    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_411?language=objc)
317    pub static kCVImageBufferChromaSubsampling_411: &'static CFString;
318}
319
320extern "C" {
321    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelisopaque?language=objc)
322    pub static kCVImageBufferAlphaChannelIsOpaque: &'static CFString;
323}
324
325extern "C" {
326    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmodekey?language=objc)
327    pub static kCVImageBufferAlphaChannelModeKey: &'static CFString;
328}
329
330extern "C" {
331    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmode_straightalpha?language=objc)
332    pub static kCVImageBufferAlphaChannelMode_StraightAlpha: &'static CFString;
333}
334
335extern "C" {
336    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmode_premultipliedalpha?language=objc)
337    pub static kCVImageBufferAlphaChannelMode_PremultipliedAlpha: &'static CFString;
338}
339
340extern "C" {
341    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpostdecodeprocessingsequencemetadatakey?language=objc)
342    pub static kCVImageBufferPostDecodeProcessingSequenceMetadataKey: Option<&'static CFString>;
343}
344
345extern "C" {
346    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpostdecodeprocessingframemetadatakey?language=objc)
347    pub static kCVImageBufferPostDecodeProcessingFrameMetadataKey: Option<&'static CFString>;
348}
349
350#[inline]
351pub extern "C-unwind" fn CVYCbCrMatrixGetIntegerCodePointForString(
352    y_cb_cr_matrix_string: Option<&CFString>,
353) -> c_int {
354    extern "C-unwind" {
355        fn CVYCbCrMatrixGetIntegerCodePointForString(
356            y_cb_cr_matrix_string: Option<&CFString>,
357        ) -> c_int;
358    }
359    unsafe { CVYCbCrMatrixGetIntegerCodePointForString(y_cb_cr_matrix_string) }
360}
361
362#[inline]
363pub extern "C-unwind" fn CVColorPrimariesGetIntegerCodePointForString(
364    color_primaries_string: Option<&CFString>,
365) -> c_int {
366    extern "C-unwind" {
367        fn CVColorPrimariesGetIntegerCodePointForString(
368            color_primaries_string: Option<&CFString>,
369        ) -> c_int;
370    }
371    unsafe { CVColorPrimariesGetIntegerCodePointForString(color_primaries_string) }
372}
373
374#[inline]
375pub extern "C-unwind" fn CVTransferFunctionGetIntegerCodePointForString(
376    transfer_function_string: Option<&CFString>,
377) -> c_int {
378    extern "C-unwind" {
379        fn CVTransferFunctionGetIntegerCodePointForString(
380            transfer_function_string: Option<&CFString>,
381        ) -> c_int;
382    }
383    unsafe { CVTransferFunctionGetIntegerCodePointForString(transfer_function_string) }
384}
385
386#[inline]
387pub extern "C-unwind" fn CVYCbCrMatrixGetStringForIntegerCodePoint(
388    y_cb_cr_matrix_code_point: c_int,
389) -> Option<CFRetained<CFString>> {
390    extern "C-unwind" {
391        fn CVYCbCrMatrixGetStringForIntegerCodePoint(
392            y_cb_cr_matrix_code_point: c_int,
393        ) -> Option<NonNull<CFString>>;
394    }
395    let ret = unsafe { CVYCbCrMatrixGetStringForIntegerCodePoint(y_cb_cr_matrix_code_point) };
396    ret.map(|ret| unsafe { CFRetained::retain(ret) })
397}
398
399#[inline]
400pub extern "C-unwind" fn CVColorPrimariesGetStringForIntegerCodePoint(
401    color_primaries_code_point: c_int,
402) -> Option<CFRetained<CFString>> {
403    extern "C-unwind" {
404        fn CVColorPrimariesGetStringForIntegerCodePoint(
405            color_primaries_code_point: c_int,
406        ) -> Option<NonNull<CFString>>;
407    }
408    let ret = unsafe { CVColorPrimariesGetStringForIntegerCodePoint(color_primaries_code_point) };
409    ret.map(|ret| unsafe { CFRetained::retain(ret) })
410}
411
412#[inline]
413pub extern "C-unwind" fn CVTransferFunctionGetStringForIntegerCodePoint(
414    transfer_function_code_point: c_int,
415) -> Option<CFRetained<CFString>> {
416    extern "C-unwind" {
417        fn CVTransferFunctionGetStringForIntegerCodePoint(
418            transfer_function_code_point: c_int,
419        ) -> Option<NonNull<CFString>>;
420    }
421    let ret =
422        unsafe { CVTransferFunctionGetStringForIntegerCodePoint(transfer_function_code_point) };
423    ret.map(|ret| unsafe { CFRetained::retain(ret) })
424}
425
426/// Base type for all CoreVideo image buffers
427///
428/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvimagebuffer?language=objc)
429#[doc(alias = "CVImageBufferRef")]
430#[cfg(feature = "CVBuffer")]
431pub type CVImageBuffer = CVBuffer;
432
433/// Returns the full encoded dimensions of a CVImageBuffer.  For example, for an NTSC DV frame this would be 720x480
434///
435/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the encoded size from.
436///
437/// Returns: A CGSize returning the full encoded size of the buffer
438/// Returns zero size if called with a non-CVImageBufferRef type or NULL.
439#[cfg(feature = "CVBuffer")]
440#[inline]
441pub extern "C-unwind" fn CVImageBufferGetEncodedSize(image_buffer: &CVImageBuffer) -> CGSize {
442    extern "C-unwind" {
443        fn CVImageBufferGetEncodedSize(image_buffer: &CVImageBuffer) -> CGSize;
444    }
445    unsafe { CVImageBufferGetEncodedSize(image_buffer) }
446}
447
448/// Returns the nominal output display size (in square pixels) of a CVImageBuffer.
449/// For example, for an NTSC DV frame this would be 640x480
450///
451/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the display size from.
452///
453/// Returns: A CGSize returning the nominal display size of the buffer
454/// Returns zero size if called with a non-CVImageBufferRef type or NULL.
455#[cfg(feature = "CVBuffer")]
456#[inline]
457pub extern "C-unwind" fn CVImageBufferGetDisplaySize(image_buffer: &CVImageBuffer) -> CGSize {
458    extern "C-unwind" {
459        fn CVImageBufferGetDisplaySize(image_buffer: &CVImageBuffer) -> CGSize;
460    }
461    unsafe { CVImageBufferGetDisplaySize(image_buffer) }
462}
463
464/// Returns the source rectangle of a CVImageBuffer that represents the clean aperture
465/// of the buffer in encoded pixels.    For example, an NTSC DV frame would return a CGRect with an
466/// origin of 8,0 and a size of 704,480.
467/// Note that the origin of this rect always the lower left    corner.   This is the same coordinate system as
468/// used by CoreImage.
469///
470/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the display size from.
471///
472/// Returns: A CGSize returning the nominal display size of the buffer
473/// Returns zero rect if called with a non-CVImageBufferRef type or NULL.
474#[cfg(feature = "CVBuffer")]
475#[inline]
476pub extern "C-unwind" fn CVImageBufferGetCleanRect(image_buffer: &CVImageBuffer) -> CGRect {
477    extern "C-unwind" {
478        fn CVImageBufferGetCleanRect(image_buffer: &CVImageBuffer) -> CGRect;
479    }
480    unsafe { CVImageBufferGetCleanRect(image_buffer) }
481}
482
483/// Returns whether the image is flipped vertically or not.
484///
485/// Parameter `imageBuffer`: target
486///
487/// Returns: True if 0,0 in the texture is upper left, false if 0,0 is lower left.
488#[cfg(feature = "CVBuffer")]
489#[inline]
490pub extern "C-unwind" fn CVImageBufferIsFlipped(image_buffer: &CVImageBuffer) -> bool {
491    extern "C-unwind" {
492        fn CVImageBufferIsFlipped(image_buffer: &CVImageBuffer) -> Boolean;
493    }
494    let ret = unsafe { CVImageBufferIsFlipped(image_buffer) };
495    ret != 0
496}
497
498/// Returns the color space of a CVImageBuffer.
499///
500/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the color space from.
501///
502/// Returns: A CGColorSpaceRef representing the color space of the buffer.
503/// Returns NULL if called with a non-CVImageBufferRef type or NULL.
504#[cfg(all(feature = "CVBuffer", feature = "objc2-core-graphics"))]
505#[inline]
506pub extern "C-unwind" fn CVImageBufferGetColorSpace(
507    image_buffer: &CVImageBuffer,
508) -> Option<CFRetained<CGColorSpace>> {
509    extern "C-unwind" {
510        fn CVImageBufferGetColorSpace(
511            image_buffer: &CVImageBuffer,
512        ) -> Option<NonNull<CGColorSpace>>;
513    }
514    let ret = unsafe { CVImageBufferGetColorSpace(image_buffer) };
515    ret.map(|ret| unsafe { CFRetained::retain(ret) })
516}
517
518/// Attempts to synthesize a CGColorSpace from an image buffer's attachments.
519///
520/// Parameter `attachments`: A CFDictionary of attachments for an image buffer, obtained using CVBufferCopyAttachments().
521///
522/// Returns: A CGColorSpaceRef representing the color space of the buffer.
523/// Returns NULL if the attachments dictionary does not contain the information required to synthesize a CGColorSpace.
524///
525/// To generate a CGColorSpace, the attachments dictionary should include values for either:
526/// 1. kCVImageBufferICCProfile
527/// 2. kCVImageBufferColorPrimariesKey, kCVImageBufferTransferFunctionKey, and kCVImageBufferYCbCrMatrixKey (and possibly kCVImageBufferGammaLevelKey)
528/// The client is responsible for releasing the CGColorSpaceRef when it is done with it (CGColorSpaceRelease() or CFRelease())
529///
530/// # Safety
531///
532/// `attachments` generics must be of the correct type.
533#[cfg(feature = "objc2-core-graphics")]
534#[inline]
535pub unsafe extern "C-unwind" fn CVImageBufferCreateColorSpaceFromAttachments(
536    attachments: &CFDictionary,
537) -> Option<CFRetained<CGColorSpace>> {
538    extern "C-unwind" {
539        fn CVImageBufferCreateColorSpaceFromAttachments(
540            attachments: &CFDictionary,
541        ) -> Option<NonNull<CGColorSpace>>;
542    }
543    let ret = unsafe { CVImageBufferCreateColorSpaceFromAttachments(attachments) };
544    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
545}
546
547extern "C" {
548    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffermasteringdisplaycolorvolumekey?language=objc)
549    pub static kCVImageBufferMasteringDisplayColorVolumeKey: &'static CFString;
550}
551
552extern "C" {
553    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercontentlightlevelinfokey?language=objc)
554    pub static kCVImageBufferContentLightLevelInfoKey: &'static CFString;
555}
556
557extern "C" {
558    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferambientviewingenvironmentkey?language=objc)
559    pub static kCVImageBufferAmbientViewingEnvironmentKey: &'static CFString;
560}
561
562extern "C" {
563    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffersceneilluminationkey?language=objc)
564    pub static kCVImageBufferSceneIlluminationKey: &'static CFString;
565}
566
567extern "C" {
568    /// Specifies region of interest that image statistics cover.
569    ///
570    /// This value should be a CGRect dictionary created by CGRectCreateDictionaryRepresentation(). The origin in the CGRect represents the x,y coordinate within the CVPixelBuffer where region of interest is located.
571    ///
572    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferregionofinterestkey?language=objc)
573    pub static kCVImageBufferRegionOfInterestKey: &'static CFString;
574}
575
576extern "C" {
577    /// Indicates that the transfer function or gamma of the content is a log format and identifies the specific log curve.
578    ///
579    /// The value is a CFString holding fully specified reverse DNS identifier.
580    /// Log is a specific video format usually processed in a camera's ISP. A Log video format usually defines:
581    /// Scene-referred color primaries designed to preserve the chromaticity range captured by a camera sensor. In cinematography, "scene-referred" color primaries refers to a color space designed to accurately preserve the chromaticity and dynamic range directly captured by a camera sensor.
582    /// A specific gamma curve (or transfer characteristic) tailored to capturing the full dynamic range from the sensor. This gamma curve is usually shaped like a log curve (hence the name Log).
583    /// A set of matrix transforms to go from RGB to Y'CbCr (Y'CbCr being the most common format used to store the bits compressed into a file).
584    /// As described above, a Log video format defines a whole color space (even though the “log” part of the name comes only from the “transfer characteristic” or gamma curve)
585    /// Content captured in Apple Log will have this key set to kCVImageBufferLogTransferFunction_AppleLog or kCVImageBufferLogTransferFunction_AppleLog2.
586    ///
587    /// Indicates the Apple Log identifier.
588    ///
589    /// Indicates the Apple Log 2 identifier.
590    /// To use Apple Log 2, set other color attachments as follows:
591    /// kCVImageBufferColorPrimariesKey = undefined or absent
592    /// kCVImageBufferTransferFunctionKey = undefined or absent
593    /// kCVImageBufferYCbCrMatrixKey = kCVImageBufferYCbCrMatrix_ITU_R_2020
594    /// https://developer.apple.com/download/all/?q=Apple%20log%20profile
595    ///
596    /// You can download the Apple Log Profile White Paper from the Apple Developer Downloads website.
597    ///
598    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunctionkey?language=objc)
599    pub static kCVImageBufferLogTransferFunctionKey: &'static CFString;
600}
601
602extern "C" {
603    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunction_applelog?language=objc)
604    pub static kCVImageBufferLogTransferFunction_AppleLog: &'static CFString;
605}
606
607extern "C" {
608    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunction_applelog2?language=objc)
609    pub static kCVImageBufferLogTransferFunction_AppleLog2: &'static CFString;
610}
611
612extern "C" {
613    /// Specifies the rectangular display area within the image. The left, width, top and height are specified relative to a reference raster width and height that should be scaled to the image buffer dimensions.
614    ///
615    /// Value is a dictionary containing these keys for the raster rectangle:
616    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
617    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
618    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
619    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
620    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
621    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
622    ///
623    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglekey?language=objc)
624    pub static kCVImageBufferDisplayMaskRectangleKey: &'static CFString;
625}
626
627extern "C" {
628    /// Specifies the width in pixels of the 2D coordinate system to define the rectangle. 0,0 origin is the top-left. The raster width value is a CFNumber of unsigned 16-bit integer. Usually matches the width of the video or the output device.
629    ///
630    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_referencerasterwidthkey?language=objc)
631    pub static kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey: &'static CFString;
632}
633
634extern "C" {
635    /// Specifies the height in pixels of the 2D coordinate system to define the rectangle. 0,0 origin is the top-left. The raster height value is a CFNumber of unsigned 16-bit integer. Usually matches the height of the video or the output device.
636    ///
637    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_referencerasterheightkey?language=objc)
638    pub static kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey: &'static CFString;
639}
640
641extern "C" {
642    /// Specifies the horizontal pixel offset of the rectangle from the left of the bounding raster. The left offset value is a CFNumber of unsigned 16-bit integer that is less than the reference raster width value.
643    ///
644    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangleleftkey?language=objc)
645    pub static kCVImageBufferDisplayMaskRectangle_RectangleLeftKey: &'static CFString;
646}
647
648extern "C" {
649    /// Specifies the width of the rectangle starting at rectangle's left offset toward the rectangle's right edge. The width value is a CFNumber of unsigned 16-bit integer.
650    ///
651    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectanglewidthkey?language=objc)
652    pub static kCVImageBufferDisplayMaskRectangle_RectangleWidthKey: &'static CFString;
653}
654
655extern "C" {
656    /// Specifies the vertical pixel offset of the rectangle from the top of the bounding raster. The top offset value is a CFNumber of unsigned 16-bit integer that is less than the reference raster height value.
657    ///
658    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangletopkey?language=objc)
659    pub static kCVImageBufferDisplayMaskRectangle_RectangleTopKey: &'static CFString;
660}
661
662extern "C" {
663    /// Specifies the height of the rectangle starting at rectangle's top offset toward the rectangle's bottom edge. The height value is a CFNumber of unsigned 16-bit integer.
664    ///
665    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangleheightkey?language=objc)
666    pub static kCVImageBufferDisplayMaskRectangle_RectangleHeightKey: &'static CFString;
667}
668
669extern "C" {
670    /// Specifies the rectangular display area within the left eye view of stereo images, using the same keys as with kCVImageBufferDisplayMaskRectangleKey. To address window violations in stereo video, points insetting the left and right edges of the rectangle are supported through additional keys, allowing the description of the "extended raster rectangle".
671    ///
672    /// Value is a dictionary containing these keys for the extended raster rectangle:
673    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
674    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
675    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
676    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
677    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
678    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
679    /// kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey
680    /// kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey
681    ///
682    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglestereoleftkey?language=objc)
683    pub static kCVImageBufferDisplayMaskRectangleStereoLeftKey: &'static CFString;
684}
685
686extern "C" {
687    /// Specifies the rectangular display area within the right eye view of stereo images, using the same keys as with kCVImageBufferDisplayMaskRectangleKey. To address window violations in stereo video, points insetting the left and right edges of the rectangle are supported through additional keys, allowing the description of the "extended raster rectangle".
688    ///
689    /// Value is a dictionary containing these keys for the extended raster rectangle:
690    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
691    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
692    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
693    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
694    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
695    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
696    /// kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey
697    /// kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey
698    ///
699    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglestereorightkey?language=objc)
700    pub static kCVImageBufferDisplayMaskRectangleStereoRightKey: &'static CFString;
701}
702
703extern "C" {
704    /// Specifies inset points on the left vertical edge of the rectangle. The points are CFArray of unsigned 16-bit integer CFNumber pairs alternating between inset X and inset Y. Inset X is an unsigned offset from left edge (0) towards the right edge (width). Inset Y is an unsigned offset from top edge (0) towards the bottom edge (height)
705    ///
706    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_leftedgepointskey?language=objc)
707    pub static kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey: &'static CFString;
708}
709
710extern "C" {
711    /// Specifies inset points on the right vertical edge of the rectangle. The points are CFArray of unsigned 16-bit integer CFNumber pairs alternating between inset X and inset Y. Inset X is an unsigned offset from right edge (0) towards the left edge (width). Inset Y is an unsigned offset from top edge (0) towards the bottom edge (height)
712    ///
713    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rightedgepointskey?language=objc)
714    pub static kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey: &'static CFString;
715}