objc2-core-video 0.3.2

Bindings to the CoreVideo framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;

use crate::*;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercgcolorspacekey?language=objc)
    pub static kCVImageBufferCGColorSpaceKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturekey?language=objc)
    pub static kCVImageBufferCleanApertureKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturewidthkey?language=objc)
    pub static kCVImageBufferCleanApertureWidthKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanapertureheightkey?language=objc)
    pub static kCVImageBufferCleanApertureHeightKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanaperturehorizontaloffsetkey?language=objc)
    pub static kCVImageBufferCleanApertureHorizontalOffsetKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercleanapertureverticaloffsetkey?language=objc)
    pub static kCVImageBufferCleanApertureVerticalOffsetKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpreferredcleanaperturekey?language=objc)
    pub static kCVImageBufferPreferredCleanApertureKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfieldcountkey?language=objc)
    pub static kCVImageBufferFieldCountKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailkey?language=objc)
    pub static kCVImageBufferFieldDetailKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailtemporaltopfirst?language=objc)
    pub static kCVImageBufferFieldDetailTemporalTopFirst: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailtemporalbottomfirst?language=objc)
    pub static kCVImageBufferFieldDetailTemporalBottomFirst: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailspatialfirstlineearly?language=objc)
    pub static kCVImageBufferFieldDetailSpatialFirstLineEarly: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferfielddetailspatialfirstlinelate?language=objc)
    pub static kCVImageBufferFieldDetailSpatialFirstLineLate: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratiokey?language=objc)
    pub static kCVImageBufferPixelAspectRatioKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratiohorizontalspacingkey?language=objc)
    pub static kCVImageBufferPixelAspectRatioHorizontalSpacingKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpixelaspectratioverticalspacingkey?language=objc)
    pub static kCVImageBufferPixelAspectRatioVerticalSpacingKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaydimensionskey?language=objc)
    pub static kCVImageBufferDisplayDimensionsKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaywidthkey?language=objc)
    pub static kCVImageBufferDisplayWidthKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplayheightkey?language=objc)
    pub static kCVImageBufferDisplayHeightKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffergammalevelkey?language=objc)
    pub static kCVImageBufferGammaLevelKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffericcprofilekey?language=objc)
    pub static kCVImageBufferICCProfileKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrixkey?language=objc)
    pub static kCVImageBufferYCbCrMatrixKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_709_2?language=objc)
    pub static kCVImageBufferYCbCrMatrix_ITU_R_709_2: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_601_4?language=objc)
    pub static kCVImageBufferYCbCrMatrix_ITU_R_601_4: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_smpte_240m_1995?language=objc)
    pub static kCVImageBufferYCbCrMatrix_SMPTE_240M_1995: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_dci_p3?language=objc)
    #[deprecated = "kCVImageBufferYCbCrMatrix_DCI_P3 no longer supported."]
    pub static kCVImageBufferYCbCrMatrix_DCI_P3: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_p3_d65?language=objc)
    #[deprecated = "kCVImageBufferYCbCrMatrix_P3_D65 no longer supported."]
    pub static kCVImageBufferYCbCrMatrix_P3_D65: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferycbcrmatrix_itu_r_2020?language=objc)
    pub static kCVImageBufferYCbCrMatrix_ITU_R_2020: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimarieskey?language=objc)
    pub static kCVImageBufferColorPrimariesKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_itu_r_709_2?language=objc)
    pub static kCVImageBufferColorPrimaries_ITU_R_709_2: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_ebu_3213?language=objc)
    pub static kCVImageBufferColorPrimaries_EBU_3213: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_smpte_c?language=objc)
    pub static kCVImageBufferColorPrimaries_SMPTE_C: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_p22?language=objc)
    pub static kCVImageBufferColorPrimaries_P22: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_dci_p3?language=objc)
    pub static kCVImageBufferColorPrimaries_DCI_P3: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_p3_d65?language=objc)
    pub static kCVImageBufferColorPrimaries_P3_D65: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercolorprimaries_itu_r_2020?language=objc)
    pub static kCVImageBufferColorPrimaries_ITU_R_2020: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunctionkey?language=objc)
    pub static kCVImageBufferTransferFunctionKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_709_2?language=objc)
    pub static kCVImageBufferTransferFunction_ITU_R_709_2: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_240m_1995?language=objc)
    pub static kCVImageBufferTransferFunction_SMPTE_240M_1995: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_usegamma?language=objc)
    pub static kCVImageBufferTransferFunction_UseGamma: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_ebu_3213?language=objc)
    #[deprecated]
    pub static kCVImageBufferTransferFunction_EBU_3213: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_c?language=objc)
    #[deprecated]
    pub static kCVImageBufferTransferFunction_SMPTE_C: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_srgb?language=objc)
    pub static kCVImageBufferTransferFunction_sRGB: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_2020?language=objc)
    pub static kCVImageBufferTransferFunction_ITU_R_2020: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_st_428_1?language=objc)
    pub static kCVImageBufferTransferFunction_SMPTE_ST_428_1: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_smpte_st_2084_pq?language=objc)
    pub static kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_itu_r_2100_hlg?language=objc)
    pub static kCVImageBufferTransferFunction_ITU_R_2100_HLG: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffertransferfunction_linear?language=objc)
    pub static kCVImageBufferTransferFunction_Linear: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocationtopfieldkey?language=objc)
    pub static kCVImageBufferChromaLocationTopFieldKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocationbottomfieldkey?language=objc)
    pub static kCVImageBufferChromaLocationBottomFieldKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_left?language=objc)
    pub static kCVImageBufferChromaLocation_Left: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_center?language=objc)
    pub static kCVImageBufferChromaLocation_Center: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_topleft?language=objc)
    pub static kCVImageBufferChromaLocation_TopLeft: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_top?language=objc)
    pub static kCVImageBufferChromaLocation_Top: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_bottomleft?language=objc)
    pub static kCVImageBufferChromaLocation_BottomLeft: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_bottom?language=objc)
    pub static kCVImageBufferChromaLocation_Bottom: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromalocation_dv420?language=objc)
    pub static kCVImageBufferChromaLocation_DV420: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsamplingkey?language=objc)
    pub static kCVImageBufferChromaSubsamplingKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_420?language=objc)
    pub static kCVImageBufferChromaSubsampling_420: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_422?language=objc)
    pub static kCVImageBufferChromaSubsampling_422: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferchromasubsampling_411?language=objc)
    pub static kCVImageBufferChromaSubsampling_411: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelisopaque?language=objc)
    pub static kCVImageBufferAlphaChannelIsOpaque: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmodekey?language=objc)
    pub static kCVImageBufferAlphaChannelModeKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmode_straightalpha?language=objc)
    pub static kCVImageBufferAlphaChannelMode_StraightAlpha: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferalphachannelmode_premultipliedalpha?language=objc)
    pub static kCVImageBufferAlphaChannelMode_PremultipliedAlpha: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpostdecodeprocessingsequencemetadatakey?language=objc)
    pub static kCVImageBufferPostDecodeProcessingSequenceMetadataKey: Option<&'static CFString>;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferpostdecodeprocessingframemetadatakey?language=objc)
    pub static kCVImageBufferPostDecodeProcessingFrameMetadataKey: Option<&'static CFString>;
}

#[inline]
pub extern "C-unwind" fn CVYCbCrMatrixGetIntegerCodePointForString(
    y_cb_cr_matrix_string: Option<&CFString>,
) -> c_int {
    extern "C-unwind" {
        fn CVYCbCrMatrixGetIntegerCodePointForString(
            y_cb_cr_matrix_string: Option<&CFString>,
        ) -> c_int;
    }
    unsafe { CVYCbCrMatrixGetIntegerCodePointForString(y_cb_cr_matrix_string) }
}

#[inline]
pub extern "C-unwind" fn CVColorPrimariesGetIntegerCodePointForString(
    color_primaries_string: Option<&CFString>,
) -> c_int {
    extern "C-unwind" {
        fn CVColorPrimariesGetIntegerCodePointForString(
            color_primaries_string: Option<&CFString>,
        ) -> c_int;
    }
    unsafe { CVColorPrimariesGetIntegerCodePointForString(color_primaries_string) }
}

#[inline]
pub extern "C-unwind" fn CVTransferFunctionGetIntegerCodePointForString(
    transfer_function_string: Option<&CFString>,
) -> c_int {
    extern "C-unwind" {
        fn CVTransferFunctionGetIntegerCodePointForString(
            transfer_function_string: Option<&CFString>,
        ) -> c_int;
    }
    unsafe { CVTransferFunctionGetIntegerCodePointForString(transfer_function_string) }
}

#[inline]
pub extern "C-unwind" fn CVYCbCrMatrixGetStringForIntegerCodePoint(
    y_cb_cr_matrix_code_point: c_int,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CVYCbCrMatrixGetStringForIntegerCodePoint(
            y_cb_cr_matrix_code_point: c_int,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CVYCbCrMatrixGetStringForIntegerCodePoint(y_cb_cr_matrix_code_point) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[inline]
pub extern "C-unwind" fn CVColorPrimariesGetStringForIntegerCodePoint(
    color_primaries_code_point: c_int,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CVColorPrimariesGetStringForIntegerCodePoint(
            color_primaries_code_point: c_int,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CVColorPrimariesGetStringForIntegerCodePoint(color_primaries_code_point) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

#[inline]
pub extern "C-unwind" fn CVTransferFunctionGetStringForIntegerCodePoint(
    transfer_function_code_point: c_int,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CVTransferFunctionGetStringForIntegerCodePoint(
            transfer_function_code_point: c_int,
        ) -> Option<NonNull<CFString>>;
    }
    let ret =
        unsafe { CVTransferFunctionGetStringForIntegerCodePoint(transfer_function_code_point) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

/// Base type for all CoreVideo image buffers
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/cvimagebuffer?language=objc)
#[doc(alias = "CVImageBufferRef")]
#[cfg(feature = "CVBuffer")]
pub type CVImageBuffer = CVBuffer;

/// Returns the full encoded dimensions of a CVImageBuffer.  For example, for an NTSC DV frame this would be 720x480
///
/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the encoded size from.
///
/// Returns: A CGSize returning the full encoded size of the buffer
/// Returns zero size if called with a non-CVImageBufferRef type or NULL.
#[cfg(feature = "CVBuffer")]
#[inline]
pub extern "C-unwind" fn CVImageBufferGetEncodedSize(image_buffer: &CVImageBuffer) -> CGSize {
    extern "C-unwind" {
        fn CVImageBufferGetEncodedSize(image_buffer: &CVImageBuffer) -> CGSize;
    }
    unsafe { CVImageBufferGetEncodedSize(image_buffer) }
}

/// Returns the nominal output display size (in square pixels) of a CVImageBuffer.
/// For example, for an NTSC DV frame this would be 640x480
///
/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the display size from.
///
/// Returns: A CGSize returning the nominal display size of the buffer
/// Returns zero size if called with a non-CVImageBufferRef type or NULL.
#[cfg(feature = "CVBuffer")]
#[inline]
pub extern "C-unwind" fn CVImageBufferGetDisplaySize(image_buffer: &CVImageBuffer) -> CGSize {
    extern "C-unwind" {
        fn CVImageBufferGetDisplaySize(image_buffer: &CVImageBuffer) -> CGSize;
    }
    unsafe { CVImageBufferGetDisplaySize(image_buffer) }
}

/// Returns the source rectangle of a CVImageBuffer that represents the clean aperture
/// of the buffer in encoded pixels.    For example, an NTSC DV frame would return a CGRect with an
/// origin of 8,0 and a size of 704,480.
/// Note that the origin of this rect always the lower left    corner.   This is the same coordinate system as
/// used by CoreImage.
///
/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the display size from.
///
/// Returns: A CGSize returning the nominal display size of the buffer
/// Returns zero rect if called with a non-CVImageBufferRef type or NULL.
#[cfg(feature = "CVBuffer")]
#[inline]
pub extern "C-unwind" fn CVImageBufferGetCleanRect(image_buffer: &CVImageBuffer) -> CGRect {
    extern "C-unwind" {
        fn CVImageBufferGetCleanRect(image_buffer: &CVImageBuffer) -> CGRect;
    }
    unsafe { CVImageBufferGetCleanRect(image_buffer) }
}

/// Returns whether the image is flipped vertically or not.
///
/// Parameter `imageBuffer`: target
///
/// Returns: True if 0,0 in the texture is upper left, false if 0,0 is lower left.
#[cfg(feature = "CVBuffer")]
#[inline]
pub extern "C-unwind" fn CVImageBufferIsFlipped(image_buffer: &CVImageBuffer) -> bool {
    extern "C-unwind" {
        fn CVImageBufferIsFlipped(image_buffer: &CVImageBuffer) -> Boolean;
    }
    let ret = unsafe { CVImageBufferIsFlipped(image_buffer) };
    ret != 0
}

/// Returns the color space of a CVImageBuffer.
///
/// Parameter `imageBuffer`: A CVImageBuffer that you wish to retrieve the color space from.
///
/// Returns: A CGColorSpaceRef representing the color space of the buffer.
/// Returns NULL if called with a non-CVImageBufferRef type or NULL.
#[cfg(all(feature = "CVBuffer", feature = "objc2-core-graphics"))]
#[inline]
pub extern "C-unwind" fn CVImageBufferGetColorSpace(
    image_buffer: &CVImageBuffer,
) -> Option<CFRetained<CGColorSpace>> {
    extern "C-unwind" {
        fn CVImageBufferGetColorSpace(
            image_buffer: &CVImageBuffer,
        ) -> Option<NonNull<CGColorSpace>>;
    }
    let ret = unsafe { CVImageBufferGetColorSpace(image_buffer) };
    ret.map(|ret| unsafe { CFRetained::retain(ret) })
}

/// Attempts to synthesize a CGColorSpace from an image buffer's attachments.
///
/// Parameter `attachments`: A CFDictionary of attachments for an image buffer, obtained using CVBufferCopyAttachments().
///
/// Returns: A CGColorSpaceRef representing the color space of the buffer.
/// Returns NULL if the attachments dictionary does not contain the information required to synthesize a CGColorSpace.
///
/// To generate a CGColorSpace, the attachments dictionary should include values for either:
/// 1. kCVImageBufferICCProfile
/// 2. kCVImageBufferColorPrimariesKey, kCVImageBufferTransferFunctionKey, and kCVImageBufferYCbCrMatrixKey (and possibly kCVImageBufferGammaLevelKey)
/// The client is responsible for releasing the CGColorSpaceRef when it is done with it (CGColorSpaceRelease() or CFRelease())
///
/// # Safety
///
/// `attachments` generics must be of the correct type.
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe extern "C-unwind" fn CVImageBufferCreateColorSpaceFromAttachments(
    attachments: &CFDictionary,
) -> Option<CFRetained<CGColorSpace>> {
    extern "C-unwind" {
        fn CVImageBufferCreateColorSpaceFromAttachments(
            attachments: &CFDictionary,
        ) -> Option<NonNull<CGColorSpace>>;
    }
    let ret = unsafe { CVImageBufferCreateColorSpaceFromAttachments(attachments) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffermasteringdisplaycolorvolumekey?language=objc)
    pub static kCVImageBufferMasteringDisplayColorVolumeKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffercontentlightlevelinfokey?language=objc)
    pub static kCVImageBufferContentLightLevelInfoKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferambientviewingenvironmentkey?language=objc)
    pub static kCVImageBufferAmbientViewingEnvironmentKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebuffersceneilluminationkey?language=objc)
    pub static kCVImageBufferSceneIlluminationKey: &'static CFString;
}

extern "C" {
    /// Specifies region of interest that image statistics cover.
    ///
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferregionofinterestkey?language=objc)
    pub static kCVImageBufferRegionOfInterestKey: &'static CFString;
}

extern "C" {
    /// Indicates that the transfer function or gamma of the content is a log format and identifies the specific log curve.
    ///
    /// The value is a CFString holding fully specified reverse DNS identifier.
    /// Log is a specific video format usually processed in a camera's ISP. A Log video format usually defines:
    /// 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.
    /// 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).
    /// 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).
    /// 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)
    /// Content captured in Apple Log will have this key set to kCVImageBufferLogTransferFunction_AppleLog or kCVImageBufferLogTransferFunction_AppleLog2.
    ///
    /// Indicates the Apple Log identifier.
    ///
    /// Indicates the Apple Log 2 identifier.
    /// To use Apple Log 2, set other color attachments as follows:
    /// kCVImageBufferColorPrimariesKey = undefined or absent
    /// kCVImageBufferTransferFunctionKey = undefined or absent
    /// kCVImageBufferYCbCrMatrixKey = kCVImageBufferYCbCrMatrix_ITU_R_2020
    /// https://developer.apple.com/download/all/?q=Apple%20log%20profile
    ///
    /// You can download the Apple Log Profile White Paper from the Apple Developer Downloads website.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunctionkey?language=objc)
    pub static kCVImageBufferLogTransferFunctionKey: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunction_applelog?language=objc)
    pub static kCVImageBufferLogTransferFunction_AppleLog: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferlogtransferfunction_applelog2?language=objc)
    pub static kCVImageBufferLogTransferFunction_AppleLog2: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// Value is a dictionary containing these keys for the raster rectangle:
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglekey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangleKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_referencerasterwidthkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_referencerasterheightkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangleleftkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_RectangleLeftKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectanglewidthkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_RectangleWidthKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangletopkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_RectangleTopKey: &'static CFString;
}

extern "C" {
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rectangleheightkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_RectangleHeightKey: &'static CFString;
}

extern "C" {
    /// 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".
    ///
    /// Value is a dictionary containing these keys for the extended raster rectangle:
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
    /// kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey
    /// kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglestereoleftkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangleStereoLeftKey: &'static CFString;
}

extern "C" {
    /// 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".
    ///
    /// Value is a dictionary containing these keys for the extended raster rectangle:
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterWidthKey
    /// kCVImageBufferDisplayMaskRectangle_ReferenceRasterHeightKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleLeftKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleWidthKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleTopKey
    /// kCVImageBufferDisplayMaskRectangle_RectangleHeightKey
    /// kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey
    /// kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectanglestereorightkey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangleStereoRightKey: &'static CFString;
}

extern "C" {
    /// 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)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_leftedgepointskey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_LeftEdgePointsKey: &'static CFString;
}

extern "C" {
    /// 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)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/corevideo/kcvimagebufferdisplaymaskrectangle_rightedgepointskey?language=objc)
    pub static kCVImageBufferDisplayMaskRectangle_RightEdgePointsKey: &'static CFString;
}