objc2-core-media 0.3.2

Bindings to the CoreMedia 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
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_invalidparameter?language=objc)
pub const kCMFormatDescriptionBridgeError_InvalidParameter: OSStatus = -12712;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_allocationfailed?language=objc)
pub const kCMFormatDescriptionBridgeError_AllocationFailed: OSStatus = -12713;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_invalidserializedsampledescription?language=objc)
pub const kCMFormatDescriptionBridgeError_InvalidSerializedSampleDescription: OSStatus = -12714;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_invalidformatdescription?language=objc)
pub const kCMFormatDescriptionBridgeError_InvalidFormatDescription: OSStatus = -12715;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_incompatibleformatdescription?language=objc)
pub const kCMFormatDescriptionBridgeError_IncompatibleFormatDescription: OSStatus = -12716;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_unsupportedsampledescriptionflavor?language=objc)
pub const kCMFormatDescriptionBridgeError_UnsupportedSampleDescriptionFlavor: OSStatus = -12717;
/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmformatdescriptionbridgeerror_invalidslice?language=objc)
pub const kCMFormatDescriptionBridgeError_InvalidSlice: OSStatus = -12719;

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmimagedescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMImageDescriptionFlavor = CFString;

extern "C" {
    /// Chooses the QuickTime Movie Image Description format.
    ///
    /// Passing NULL is equivalent to passing this constant.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmimagedescriptionflavor_quicktimemovie?language=objc)
    pub static kCMImageDescriptionFlavor_QuickTimeMovie: &'static CMImageDescriptionFlavor;
}

extern "C" {
    /// Chooses the ISO family sample description format, used in MP4
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmimagedescriptionflavor_isofamily?language=objc)
    pub static kCMImageDescriptionFlavor_ISOFamily: &'static CMImageDescriptionFlavor;
}

extern "C" {
    /// Chooses the 3GP family sample description format.
    ///
    /// This implies kCMImageDescriptionFlavor_ISOFamily and adds additional rules specific to the 3GP family.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmimagedescriptionflavor_3gpfamily?language=objc)
    pub static kCMImageDescriptionFlavor_3GPFamily: &'static CMImageDescriptionFlavor;
}

extern "C" {
    /// Chooses the ISO family sample description format with use of Apple extensions where appropriate for M4V and M4A.
    ///
    /// This implies kCMImageDescriptionFlavor_ISOFamily and adds additional rules specific to the .m4a, .m4b, and .m4v file formats.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmimagedescriptionflavor_isofamilywithappleextensions?language=objc)
    pub static kCMImageDescriptionFlavor_ISOFamilyWithAppleExtensions:
        &'static CMImageDescriptionFlavor;
}

extern "C-unwind" {
    /// Creates a CMVideoFormatDescription from a big-endian ImageDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMVideoFormatDescription object. May be NULL.
    ///
    /// Parameter `imageDescriptionData`: ImageDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of ImageDescription data structure.
    ///
    /// Parameter `stringEncoding`: Pass CFStringGetSystemEncoding() or GetApplicationTextEncoding().
    ///
    /// Parameter `flavor`: kCMImageDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMVideoFormatDescription.
    ///
    /// # Safety
    ///
    /// - `image_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMVideoFormatDescriptionCreateFromBigEndianImageDescriptionData(
        allocator: Option<&CFAllocator>,
        image_description_data: NonNull<u8>,
        size: usize,
        string_encoding: CFStringEncoding,
        flavor: Option<&CMImageDescriptionFlavor>,
        format_description_out: NonNull<*const CMVideoFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMVideoFormatDescription from a big-endian ImageDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMVideoFormatDescription object. May be NULL.
    ///
    /// Parameter `imageDescriptionBlockBuffer`: CMBlockBuffer containing ImageDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `stringEncoding`: Pass CFStringGetSystemEncoding() or GetApplicationTextEncoding().
    ///
    /// Parameter `flavor`: kCMImageDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMVideoFormatDescription.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMVideoFormatDescriptionCreateFromBigEndianImageDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        image_description_block_buffer: &CMBlockBuffer,
        string_encoding: CFStringEncoding,
        flavor: Option<&CMImageDescriptionFlavor>,
        format_description_out: NonNull<*const CMVideoFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMVideoFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `videoFormatDescription`: CMVideoFormatDescription to be copied.
    ///
    /// Parameter `stringEncoding`: Pass CFStringGetSystemEncoding() or GetApplicationTextEncoding().
    ///
    /// Parameter `flavor`: kCMImageDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing ImageDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMVideoFormatDescriptionCopyAsBigEndianImageDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        video_format_description: &CMVideoFormatDescription,
        string_encoding: CFStringEncoding,
        flavor: Option<&CMImageDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts an ImageDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `imageDescriptionData`: ImageDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `imageDescriptionSize`: Size of ImageDescription data structure.
    ///
    /// # Safety
    ///
    /// `image_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianImageDescriptionToHost(
        image_description_data: NonNull<u8>,
        image_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts an ImageDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `imageDescriptionData`: ImageDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `imageDescriptionSize`: Size of ImageDescription data structure.
    ///
    /// # Safety
    ///
    /// `image_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianImageDescriptionToBig(
        image_description_data: NonNull<u8>,
        image_description_size: usize,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmsounddescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMSoundDescriptionFlavor = CFString;

extern "C" {
    /// Chooses the most backwards-compatible QuickTime Movie Sound Description format.
    ///
    /// A V1 sound description will be written if possible.
    /// If a V1 sound description is written for CBR or PCM audio, the sample tables will need to use the legacy CBR layout.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmsounddescriptionflavor_quicktimemovie?language=objc)
    pub static kCMSoundDescriptionFlavor_QuickTimeMovie: &'static CMSoundDescriptionFlavor;
}

extern "C" {
    /// Chooses the QuickTime Movie Sound Description V2 format.
    ///
    /// A V2 sound description will be written.
    /// V2 Sound Descriptions contain no legacy CBR layout, and use 'lpcm' for all flavors of PCM.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmsounddescriptionflavor_quicktimemoviev2?language=objc)
    pub static kCMSoundDescriptionFlavor_QuickTimeMovieV2: &'static CMSoundDescriptionFlavor;
}

extern "C" {
    /// Chooses the ISO family sample description format, used in MP4, M4A, etc.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmsounddescriptionflavor_isofamily?language=objc)
    pub static kCMSoundDescriptionFlavor_ISOFamily: &'static CMSoundDescriptionFlavor;
}

extern "C" {
    /// Chooses the 3GP family sample description format.
    ///
    /// This implies kCMSoundDescriptionFlavor_ISOFamily and adds additional rules specific to the 3GP family.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmsounddescriptionflavor_3gpfamily?language=objc)
    pub static kCMSoundDescriptionFlavor_3GPFamily: &'static CMSoundDescriptionFlavor;
}

extern "C-unwind" {
    /// Creates a CMAudioFormatDescription from a big-endian SoundDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMAudioFormatDescription object. May be NULL.
    ///
    /// Parameter `soundDescriptionData`: SoundDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of SoundDescription data structure.
    ///
    /// Parameter `flavor`: kCMSoundDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMAudioFormatDescription.
    ///
    /// # Safety
    ///
    /// - `sound_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionData(
        allocator: Option<&CFAllocator>,
        sound_description_data: NonNull<u8>,
        size: usize,
        flavor: Option<&CMSoundDescriptionFlavor>,
        format_description_out: NonNull<*const CMAudioFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMAudioFormatDescription from a big-endian SoundDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMAudioFormatDescription object. May be NULL.
    ///
    /// Parameter `soundDescriptionBlockBuffer`: CMBlockBuffer containing SoundDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `flavor`: kCMSoundDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMAudioFormatDescription.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMAudioFormatDescriptionCreateFromBigEndianSoundDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        sound_description_block_buffer: &CMBlockBuffer,
        flavor: Option<&CMSoundDescriptionFlavor>,
        format_description_out: NonNull<*const CMAudioFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMAudioFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `audioFormatDescription`: CMAudioFormatDescription to be copied.
    ///
    /// Parameter `flavor`: kCMSoundDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing SoundDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMAudioFormatDescriptionCopyAsBigEndianSoundDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        audio_format_description: &CMAudioFormatDescription,
        flavor: Option<&CMSoundDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

/// Examine a big-endian SoundDescription data structure in a CMBlockBuffer, and report whether the sample tables will need to use the legacy CBR layout.
///
///
/// Parameter `soundDescriptionBlockBuffer`: CMBlockBuffer containing SoundDescription data structure in big-endian byte ordering.
///
/// Parameter `flavor`: kCMSoundDescriptionFlavor constant or NULL for QuickTimeMovie flavor.
#[cfg(feature = "CMBlockBuffer")]
#[inline]
pub unsafe extern "C-unwind" fn CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(
    sound_description_block_buffer: &CMBlockBuffer,
    flavor: Option<&CMSoundDescriptionFlavor>,
) -> bool {
    extern "C-unwind" {
        fn CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(
            sound_description_block_buffer: &CMBlockBuffer,
            flavor: Option<&CMSoundDescriptionFlavor>,
        ) -> Boolean;
    }
    let ret = unsafe {
        CMDoesBigEndianSoundDescriptionRequireLegacyCBRSampleTableLayout(
            sound_description_block_buffer,
            flavor,
        )
    };
    ret != 0
}

extern "C-unwind" {
    /// Converts a SoundDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `soundDescriptionData`: SoundDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `soundDescriptionSize`: Size of SoundDescription data structure.
    ///
    /// # Safety
    ///
    /// `sound_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianSoundDescriptionToHost(
        sound_description_data: NonNull<u8>,
        sound_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a SoundDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `soundDescriptionData`: SoundDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `soundDescriptionSize`: Size of SoundDescription data structure.
    ///
    /// # Safety
    ///
    /// `sound_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianSoundDescriptionToBig(
        sound_description_data: NonNull<u8>,
        sound_description_size: usize,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtextdescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMTextDescriptionFlavor = CFString;

extern "C-unwind" {
    /// Creates a CMTextFormatDescription from a big-endian TextDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMTextFormatDescription object. May be NULL.
    ///
    /// Parameter `textDescriptionData`: TextDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of TextDescription data structure.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `mediaType`: Pass kCMMediaType_Text or kCMMediaType_Subtitle.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMTextFormatDescription.
    ///
    /// # Safety
    ///
    /// - `text_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMTextFormatDescriptionCreateFromBigEndianTextDescriptionData(
        allocator: Option<&CFAllocator>,
        text_description_data: NonNull<u8>,
        size: usize,
        flavor: Option<&CMTextDescriptionFlavor>,
        media_type: CMMediaType,
        format_description_out: NonNull<*const CMTextFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMTextFormatDescription from a big-endian TextDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMTextFormatDescription object. May be NULL.
    ///
    /// Parameter `textDescriptionBlockBuffer`: CMBlockBuffer containing TextDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `mediaType`: Pass kCMMediaType_Text or kCMMediaType_Subtitle.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMTextFormatDescription.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMTextFormatDescriptionCreateFromBigEndianTextDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        text_description_block_buffer: &CMBlockBuffer,
        flavor: Option<&CMTextDescriptionFlavor>,
        media_type: CMMediaType,
        format_description_out: NonNull<*const CMTextFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMTextFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `textFormatDescription`: CMTextFormatDescription to be copied.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing TextDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMTextFormatDescriptionCopyAsBigEndianTextDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        text_format_description: &CMTextFormatDescription,
        flavor: Option<&CMTextDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a TextDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `textDescriptionData`: TextDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `textDescriptionSize`: Size of TextDescription data structure.
    ///
    /// # Safety
    ///
    /// `text_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianTextDescriptionToHost(
        text_description_data: NonNull<u8>,
        text_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a TextDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `textDescriptionData`: TextDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `textDescriptionSize`: Size of TextDescription data structure.
    ///
    /// # Safety
    ///
    /// `text_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianTextDescriptionToBig(
        text_description_data: NonNull<u8>,
        text_description_size: usize,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmclosedcaptiondescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMClosedCaptionDescriptionFlavor = CFString;

extern "C-unwind" {
    /// Creates a CMClosedCaptionFormatDescription from a big-endian ClosedCaptionDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMClosedCaptionFormatDescription object. May be NULL.
    ///
    /// Parameter `closedCaptionDescriptionData`: ClosedCaptionDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of ClosedCaptionDescription data structure.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMClosedCaptionFormatDescription.
    ///
    /// # Safety
    ///
    /// - `closed_caption_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMClosedCaptionFormatDescriptionCreateFromBigEndianClosedCaptionDescriptionData(
        allocator: Option<&CFAllocator>,
        closed_caption_description_data: NonNull<u8>,
        size: usize,
        flavor: Option<&CMClosedCaptionDescriptionFlavor>,
        format_description_out: NonNull<*const CMClosedCaptionFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMClosedCaptionFormatDescription from a big-endian ClosedCaptionDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMClosedCaptionFormatDescription object. May be NULL.
    ///
    /// Parameter `closedCaptionDescriptionBlockBuffer`: CMBlockBuffer containing ClosedCaptionDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMClosedCaptionFormatDescription.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMClosedCaptionFormatDescriptionCreateFromBigEndianClosedCaptionDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        closed_caption_description_block_buffer: &CMBlockBuffer,
        flavor: Option<&CMClosedCaptionDescriptionFlavor>,
        format_description_out: NonNull<*const CMClosedCaptionFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMClosedCaptionFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `closedCaptionFormatDescription`: CMClosedCaptionFormatDescription to be copied.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing ClosedCaptionDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMClosedCaptionFormatDescriptionCopyAsBigEndianClosedCaptionDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        closed_caption_format_description: &CMClosedCaptionFormatDescription,
        flavor: Option<&CMClosedCaptionDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a ClosedCaptionDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `closedCaptionDescriptionData`: ClosedCaptionDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `closedCaptionDescriptionSize`: Size of ClosedCaptionDescription data structure.
    ///
    /// # Safety
    ///
    /// `closed_caption_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianClosedCaptionDescriptionToHost(
        closed_caption_description_data: NonNull<u8>,
        closed_caption_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a ClosedCaptionDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `closedCaptionDescriptionData`: ClosedCaptionDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `closedCaptionDescriptionSize`: Size of ClosedCaptionDescription data structure.
    ///
    /// # Safety
    ///
    /// `closed_caption_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianClosedCaptionDescriptionToBig(
        closed_caption_description_data: NonNull<u8>,
        closed_caption_description_size: usize,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtimecodedescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMTimeCodeDescriptionFlavor = CFString;

extern "C-unwind" {
    /// Creates a CMTimeCodeFormatDescription from a big-endian TimeCodeDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMTimeCodeFormatDescription object. May be NULL.
    ///
    /// Parameter `timeCodeDescriptionData`: TimeCodeDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of TimeCodeDescription data structure.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMTimeCodeFormatDescription.
    ///
    /// # Safety
    ///
    /// - `time_code_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMTimeCodeFormatDescriptionCreateFromBigEndianTimeCodeDescriptionData(
        allocator: Option<&CFAllocator>,
        time_code_description_data: NonNull<u8>,
        size: usize,
        flavor: Option<&CMTimeCodeDescriptionFlavor>,
        format_description_out: NonNull<*const CMTimeCodeFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMTimeCodeFormatDescription from a big-endian TimeCodeDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMTimeCodeFormatDescription object. May be NULL.
    ///
    /// Parameter `timeCodeDescriptionBlockBuffer`: CMBlockBuffer containing TimeCodeDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMTimeCodeFormatDescription.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMTimeCodeFormatDescriptionCreateFromBigEndianTimeCodeDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        time_code_description_block_buffer: &CMBlockBuffer,
        flavor: Option<&CMTimeCodeDescriptionFlavor>,
        format_description_out: NonNull<*const CMTimeCodeFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMTimeCodeFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `timeCodeFormatDescription`: CMTimeCodeFormatDescription to be copied.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing TimeCodeDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMTimeCodeFormatDescriptionCopyAsBigEndianTimeCodeDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        time_code_format_description: &CMTimeCodeFormatDescription,
        flavor: Option<&CMTimeCodeDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a TimeCodeDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `timeCodeDescriptionData`: TimeCodeDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `timeCodeDescriptionSize`: Size of TimeCodeDescription data structure.
    ///
    /// # Safety
    ///
    /// `time_code_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianTimeCodeDescriptionToHost(
        time_code_description_data: NonNull<u8>,
        time_code_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a TimeCodeDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `timeCodeDescriptionData`: TimeCodeDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `timeCodeDescriptionSize`: Size of TimeCodeDescription data structure.
    ///
    /// # Safety
    ///
    /// `time_code_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianTimeCodeDescriptionToBig(
        time_code_description_data: NonNull<u8>,
        time_code_description_size: usize,
    ) -> OSStatus;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmmetadatadescriptionflavor?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type CMMetadataDescriptionFlavor = CFString;

extern "C-unwind" {
    /// Creates a CMMetadataFormatDescription from a big-endian MetadataDescription data structure.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMMetadataFormatDescription object. May be NULL.
    ///
    /// Parameter `metadataDescriptionData`: MetadataDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `size`: Size of MetadataDescription data structure.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMMetadataFormatDescriptionRef.
    ///
    /// # Safety
    ///
    /// - `metadata_description_data` must be a valid pointer.
    /// - `format_description_out` must be a valid pointer.
    #[cfg(feature = "CMFormatDescription")]
    pub fn CMMetadataFormatDescriptionCreateFromBigEndianMetadataDescriptionData(
        allocator: Option<&CFAllocator>,
        metadata_description_data: NonNull<u8>,
        size: usize,
        flavor: Option<&CMMetadataDescriptionFlavor>,
        format_description_out: NonNull<*const CMMetadataFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Creates a CMMetadataFormatDescription from a big-endian MetadataDescription data structure in a CMBlockBuffer.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMMetadataFormatDescription object. May be NULL.
    ///
    /// Parameter `metadataDescriptionBlockBuffer`: CMBlockBuffer containing MetadataDescription data structure in big-endian byte ordering.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `formatDescriptionOut`: Receives new CMMetadataFormatDescriptionRef.
    ///
    /// # Safety
    ///
    /// `format_description_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMMetadataFormatDescriptionCreateFromBigEndianMetadataDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        metadata_description_block_buffer: &CMBlockBuffer,
        flavor: Option<&CMMetadataDescriptionFlavor>,
        format_description_out: NonNull<*const CMMetadataFormatDescription>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Copies the contents of a CMMetadataFormatDescription to a CMBlockBuffer in big-endian byte ordering.
    ///
    /// On return, the caller owns the returned CMBlockBuffer, and must release it when done with it.
    /// Note that the dataRefIndex field of the SampleDescription is intentionally filled with
    /// garbage values (0xFFFF).  The caller must overwrite these values with a valid dataRefIndex
    /// if writing the SampleDescription to a QuickTime/ISO file.
    ///
    ///
    /// Parameter `allocator`: Allocator to use for allocating the CMBlockBuffer object. May be NULL.
    ///
    /// Parameter `metadataFormatDescription`: CMMetadataFormatDescriptionRef to be copied.
    ///
    /// Parameter `flavor`: Reserved for future use. Pass NULL for QuickTime Movie or ISO flavor.
    ///
    /// Parameter `blockBufferOut`: Receives new CMBlockBuffer containing MetadataDescription data structure in big-endian byte ordering.
    ///
    /// # Safety
    ///
    /// `block_buffer_out` must be a valid pointer.
    #[cfg(all(feature = "CMBlockBuffer", feature = "CMFormatDescription"))]
    pub fn CMMetadataFormatDescriptionCopyAsBigEndianMetadataDescriptionBlockBuffer(
        allocator: Option<&CFAllocator>,
        metadata_format_description: &CMMetadataFormatDescription,
        flavor: Option<&CMMetadataDescriptionFlavor>,
        block_buffer_out: NonNull<*mut CMBlockBuffer>,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a MetadataDescription data structure from big-endian to host-endian in place.
    ///
    ///
    /// Parameter `metadataDescriptionData`: MetadataDescription data structure in big-endian byte ordering to be converted to host-endian byte ordering.
    ///
    /// Parameter `metadataDescriptionSize`: Size of MetadataDescription data structure.
    ///
    /// # Safety
    ///
    /// `metadata_description_data` must be a valid pointer.
    pub fn CMSwapBigEndianMetadataDescriptionToHost(
        metadata_description_data: NonNull<u8>,
        metadata_description_size: usize,
    ) -> OSStatus;
}

extern "C-unwind" {
    /// Converts a MetadataDescription data structure from host-endian to big-endian in place.
    ///
    ///
    /// Parameter `metadataDescriptionData`: MetadataDescription data structure in host-endian byte ordering to be converted to big-endian byte ordering.
    ///
    /// Parameter `metadataDescriptionSize`: Size of MetadataDescription data structure.
    ///
    /// # Safety
    ///
    /// `metadata_description_data` must be a valid pointer.
    pub fn CMSwapHostEndianMetadataDescriptionToBig(
        metadata_description_data: NonNull<u8>,
        metadata_description_size: usize,
    ) -> OSStatus;
}