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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;

use crate::*;

/// A time range represented as two CMTime structures.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtimerange?language=objc)
#[cfg(feature = "CMTime")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CMTimeRange {
    /// The start time of the time range.
    pub start: CMTime,
    /// The duration of the time range.
    pub duration: CMTime,
}

#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl Encode for CMTimeRange {
    const ENCODING: Encoding = Encoding::Struct("?", &[<CMTime>::ENCODING, <CMTime>::ENCODING]);
}

#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl RefEncode for CMTimeRange {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangezero?language=objc)
    #[cfg(feature = "CMTime")]
    pub static kCMTimeRangeZero: CMTimeRange;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangeinvalid?language=objc)
    #[cfg(feature = "CMTime")]
    pub static kCMTimeRangeInvalid: CMTimeRange;
}

#[cfg(feature = "CMTime")]
impl CMTimeRange {
    /// Make a valid CMTimeRange with start and duration.
    ///
    /// Returns: The resulting CMTimeRange.
    ///
    /// The duration parameter must have an epoch of 0; otherwise an invalid time range will be returned.
    #[doc(alias = "CMTimeRangeMake")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn new(start: CMTime, duration: CMTime) -> CMTimeRange {
        extern "C-unwind" {
            fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
        }
        unsafe { CMTimeRangeMake(start, duration) }
    }

    /// Returns the union of two CMTimeRanges.
    ///
    /// This function returns a CMTimeRange structure that represents the union of the time ranges specified by the
    /// <i>
    /// range
    /// </i>
    /// and
    /// <i>
    /// otherRange
    /// </i>
    /// parameters.
    /// This is the smallest range that includes all times that are in either range.
    ///
    /// Returns: The union of the two CMTimeRanges.
    #[doc(alias = "CMTimeRangeGetUnion")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn union(self, other_range: CMTimeRange) -> CMTimeRange {
        extern "C-unwind" {
            fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
        }
        unsafe { CMTimeRangeGetUnion(self, other_range) }
    }

    /// Returns the intersection of two CMTimeRanges.
    ///
    /// This function returns a CMTimeRange structure that represents the intersection of the time ranges specified by the
    /// <i>
    /// range
    /// </i>
    /// and
    /// <i>
    /// otherRange
    /// </i>
    /// parameters.
    /// This is the largest range that both ranges include.
    ///
    /// Returns: The intersection of the two CMTimeRanges.
    #[doc(alias = "CMTimeRangeGetIntersection")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn intersection(self, other_range: CMTimeRange) -> CMTimeRange {
        extern "C-unwind" {
            fn CMTimeRangeGetIntersection(
                range: CMTimeRange,
                other_range: CMTimeRange,
            ) -> CMTimeRange;
        }
        unsafe { CMTimeRangeGetIntersection(self, other_range) }
    }

    /// Returns a Boolean value that indicates whether two CMTimeRanges are identical.
    ///
    /// This function returns a Boolean value that indicates whether the time ranges specified by the
    /// <i>
    /// range1
    /// </i>
    /// and
    /// <i>
    /// range2
    /// </i>
    /// parameters are identical.
    ///
    /// Returns: Returns true if the two time ranges are identical, false if they differ.
    #[doc(alias = "CMTimeRangeEqual")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn equal(self, range2: CMTimeRange) -> bool {
        extern "C-unwind" {
            fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
        }
        let ret = unsafe { CMTimeRangeEqual(self, range2) };
        ret != 0
    }

    /// Indicates whether a time is contained within a time range.
    ///
    /// This function returns a Boolean value that indicates whether the time specified by the
    /// <i>
    /// time
    /// </i>
    /// parameter
    /// is contained within the range specified by the
    /// <i>
    /// range
    /// </i>
    /// parameter.
    ///
    /// Returns: Returns true if the specified time is contained within the specified time range, false if it is not.
    #[doc(alias = "CMTimeRangeContainsTime")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn contains_time(self, time: CMTime) -> bool {
        extern "C-unwind" {
            fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
        }
        let ret = unsafe { CMTimeRangeContainsTime(self, time) };
        ret != 0
    }

    /// Indicates whether a time range is contained within a time range.
    ///
    /// This function returns a Boolean value that indicates whether the time range specified by the
    /// <i>
    /// range
    /// </i>
    /// parameter
    /// contains the range specified by the
    /// <i>
    /// otherRange
    /// </i>
    /// parameter.
    ///
    /// Returns: Returns true if the second time range is contained within the first time range, false if it is not.
    #[doc(alias = "CMTimeRangeContainsTimeRange")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn contains_time_range(self, other_range: CMTimeRange) -> bool {
        extern "C-unwind" {
            fn CMTimeRangeContainsTimeRange(
                range: CMTimeRange,
                other_range: CMTimeRange,
            ) -> Boolean;
        }
        let ret = unsafe { CMTimeRangeContainsTimeRange(self, other_range) };
        ret != 0
    }

    /// Returns a CMTime structure representing the end of a time range.
    ///
    /// Returns: A CMTime structure representing the end of the specified time range.
    ///
    /// This function returns a CMTime structure that indicates the end of the time range specified by the
    /// <i>
    /// range
    /// </i>
    /// parameter.
    /// CMTimeRangeContainsTime(range, CMTimeRangeGetEnd(range)) is always false.
    #[doc(alias = "CMTimeRangeGetEnd")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn end(self) -> CMTime {
        extern "C-unwind" {
            fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
        }
        unsafe { CMTimeRangeGetEnd(self) }
    }
}

#[cfg(feature = "CMTime")]
impl CMTime {
    /// Translates a time through a mapping from CMTimeRange to CMTimeRange.
    ///
    /// Returns: A CMTime structure representing the translated time.
    ///
    /// The start and end time of fromRange will be mapped to the start and end time of toRange respectively.
    /// Other times will be mapped linearly, using the formula:
    /// result = (t-fromRange.start)*(toRange.duration/fromRange.duration)+toRange.start
    /// If either CMTimeRange argument is empty, an invalid CMTime will be returned.
    /// If t does not have the same epoch as fromRange.start, an invalid CMTime will be returned.
    /// If both fromRange and toRange have duration kCMTimePositiveInfinity,
    /// t will be offset relative to the differences between their starts, but not scaled.
    #[doc(alias = "CMTimeMapTimeFromRangeToRange")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn map_time_from_range_to_range(
        self,
        from_range: CMTimeRange,
        to_range: CMTimeRange,
    ) -> CMTime {
        extern "C-unwind" {
            fn CMTimeMapTimeFromRangeToRange(
                t: CMTime,
                from_range: CMTimeRange,
                to_range: CMTimeRange,
            ) -> CMTime;
        }
        unsafe { CMTimeMapTimeFromRangeToRange(self, from_range, to_range) }
    }

    /// For a given CMTime and CMTimeRange, returns the nearest CMTime inside that time range.
    ///
    /// Returns: A CMTime structure inside the given time range.
    ///
    /// Times inside the given time range will be returned unmodified.
    /// Times before the start and after the end time of the time range will return the start and end time of
    /// the range respectively.
    /// If the CMTimeRange argument is empty, an invalid CMTime will be returned.
    /// If the given CMTime is invalid, the returned CMTime will be invalid,
    #[doc(alias = "CMTimeClampToRange")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn clamp_to_range(self, range: CMTimeRange) -> CMTime {
        extern "C-unwind" {
            fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
        }
        unsafe { CMTimeClampToRange(self, range) }
    }

    /// Translates a duration through a mapping from CMTimeRange to CMTimeRange.
    ///
    /// Returns: A CMTime structure representing the translated duration.
    ///
    /// The duration will be scaled in proportion to the ratio between the ranges' durations:
    /// result = dur*(toRange.duration/fromRange.duration)
    /// If dur does not have the epoch zero, an invalid CMTime will be returned.
    #[doc(alias = "CMTimeMapDurationFromRangeToRange")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn map_duration_from_range_to_range(
        self,
        from_range: CMTimeRange,
        to_range: CMTimeRange,
    ) -> CMTime {
        extern "C-unwind" {
            fn CMTimeMapDurationFromRangeToRange(
                dur: CMTime,
                from_range: CMTimeRange,
                to_range: CMTimeRange,
            ) -> CMTime;
        }
        unsafe { CMTimeMapDurationFromRangeToRange(self, from_range, to_range) }
    }

    /// Folds a time into the given range.  This can be used in looping time calculations.
    ///
    /// Returns: A CMTime structure representing the translated duration.
    ///
    /// Note that for certain types of looping, you may want to NOT fold times that are prior
    /// to the loop range.  That's up to the client.
    #[doc(alias = "CMTimeFoldIntoRange")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn fold_into_range(self, fold_range: CMTimeRange) -> CMTime {
        extern "C-unwind" {
            fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
        }
        unsafe { CMTimeFoldIntoRange(self, fold_range) }
    }
}

#[cfg(feature = "CMTime")]
impl CMTimeRange {
    /// Make a valid CMTimeRange with the given starting and ending times.
    ///
    /// Returns: The resulting CMTimeRange.
    #[doc(alias = "CMTimeRangeFromTimeToTime")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn from_time_to_time(start: CMTime, end: CMTime) -> CMTimeRange {
        extern "C-unwind" {
            fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
        }
        unsafe { CMTimeRangeFromTimeToTime(start, end) }
    }

    /// Returns a CFDictionary version of a CMTimeRange.
    ///
    /// This is useful when putting CMTimeRanges in CF container types.
    ///
    /// Returns: A CFDictionary version of the CMTimeRange.
    #[doc(alias = "CMTimeRangeCopyAsDictionary")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn as_dictionary(
        self,
        allocator: Option<&CFAllocator>,
    ) -> Option<CFRetained<CFDictionary>> {
        extern "C-unwind" {
            fn CMTimeRangeCopyAsDictionary(
                range: CMTimeRange,
                allocator: Option<&CFAllocator>,
            ) -> Option<NonNull<CFDictionary>>;
        }
        let ret = unsafe { CMTimeRangeCopyAsDictionary(self, allocator) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Reconstitutes a CMTimeRange struct from a CFDictionary previously created by CMTimeRangeCopyAsDictionary.
    ///
    /// This is useful when getting CMTimeRanges from CF container types.  If the CFDictionary does not
    /// have the requisite keyed values, an invalid time range is returned.
    ///
    /// Returns: The created CMTimeRange.
    ///
    /// # Safety
    ///
    /// `dictionary_representation` generics must be of the correct type.
    #[doc(alias = "CMTimeRangeMakeFromDictionary")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeRange {
        extern "C-unwind" {
            fn CMTimeRangeMakeFromDictionary(
                dictionary_representation: &CFDictionary,
            ) -> CMTimeRange;
        }
        unsafe { CMTimeRangeMakeFromDictionary(dictionary_representation) }
    }
}

extern "C" {
    /// CFDictionary key for start field of a CMTimeRange (CMTime)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangestartkey?language=objc)
    pub static kCMTimeRangeStartKey: &'static CFString;
}

extern "C" {
    /// CFDictionary key for timescale field of a CMTimeRange (CMTime)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangedurationkey?language=objc)
    pub static kCMTimeRangeDurationKey: &'static CFString;
}

#[cfg(feature = "CMTime")]
impl CMTimeRange {
    /// Creates a CFString with a description of a CMTimeRange (just like CFCopyDescription).
    ///
    /// This is used from within CFShow on an object that contains CMTimeRange fields. It is
    /// also useful from other client debugging code.  The caller owns the returned CFString and is responsible for releasing it.
    ///
    /// Returns: The created CFString description.
    #[doc(alias = "CMTimeRangeCopyDescription")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn description(
        allocator: Option<&CFAllocator>,
        range: CMTimeRange,
    ) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn CMTimeRangeCopyDescription(
                allocator: Option<&CFAllocator>,
                range: CMTimeRange,
            ) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Prints a description of the CMTimeRange (just like CFShow).
    ///
    /// This is most useful from within gdb.
    #[doc(alias = "CMTimeRangeShow")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn show(self) {
        extern "C-unwind" {
            fn CMTimeRangeShow(range: CMTimeRange);
        }
        unsafe { CMTimeRangeShow(self) }
    }
}

/// A CMTimeMapping specifies the mapping of a segment of one time line (called "source") into another time line (called "target").
///
/// When used for movie edit lists, the source time line is the media and the target time line is the track/movie.
/// Field: source
/// The time range on the source time line.
/// For an empty edit, source.start is an invalid CMTime, in which case source.duration shall be ignored.
/// Otherwise, source.start is the starting time within the source, and source.duration is the duration
/// of the source timeline to be mapped to the target time range.
/// Field: target
/// The time range on the target time line.
/// If target.duration and source.duration are different, then the source segment should
/// be played at rate source.duration/target.duration to fit.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtimemapping?language=objc)
#[cfg(feature = "CMTime")]
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CMTimeMapping {
    pub source: CMTimeRange,
    pub target: CMTimeRange,
}

#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl Encode for CMTimeMapping {
    const ENCODING: Encoding =
        Encoding::Struct("?", &[<CMTimeRange>::ENCODING, <CMTimeRange>::ENCODING]);
}

#[cfg(all(feature = "CMTime", feature = "objc2"))]
unsafe impl RefEncode for CMTimeMapping {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappinginvalid?language=objc)
    #[cfg(feature = "CMTime")]
    pub static kCMTimeMappingInvalid: CMTimeMapping;
}

#[cfg(feature = "CMTime")]
impl CMTimeMapping {
    /// Make a valid CMTimeMapping with source and target.
    ///
    /// Returns: The resulting CMTimeMapping.
    ///
    /// The source and target parameters must have durations whose epoch is 0; otherwise an invalid time mapping will be returned.
    #[doc(alias = "CMTimeMappingMake")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn new(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping {
        extern "C-unwind" {
            fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
        }
        unsafe { CMTimeMappingMake(source, target) }
    }

    /// Make a valid CMTimeMapping with an empty source.
    ///
    /// Returns: The resulting CMTimeMapping.
    ///
    /// The target parameter must have a duration whose epoch is 0; otherwise an invalid time mapping will be returned.
    #[doc(alias = "CMTimeMappingMakeEmpty")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn empty(target: CMTimeRange) -> CMTimeMapping {
        extern "C-unwind" {
            fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
        }
        unsafe { CMTimeMappingMakeEmpty(target) }
    }

    /// Returns a CFDictionary version of a CMTimeMapping.
    ///
    /// This is useful when putting CMTimeMappings in CF container types.
    ///
    /// Returns: A CFDictionary version of the CMTimeMapping.
    #[doc(alias = "CMTimeMappingCopyAsDictionary")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn as_dictionary(
        self,
        allocator: Option<&CFAllocator>,
    ) -> Option<CFRetained<CFDictionary>> {
        extern "C-unwind" {
            fn CMTimeMappingCopyAsDictionary(
                mapping: CMTimeMapping,
                allocator: Option<&CFAllocator>,
            ) -> Option<NonNull<CFDictionary>>;
        }
        let ret = unsafe { CMTimeMappingCopyAsDictionary(self, allocator) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Reconstitutes a CMTimeMapping struct from a CFDictionary previously created by CMTimeMappingCopyAsDictionary.
    ///
    /// This is useful when getting CMTimeMappings from CF container types.  If the CFDictionary does not
    /// have the requisite keyed values, an invalid time mapping is returned.
    ///
    /// Returns: The created CMTimeMapping.
    ///
    /// # Safety
    ///
    /// `dictionary_representation` generics must be of the correct type.
    #[doc(alias = "CMTimeMappingMakeFromDictionary")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeMapping {
        extern "C-unwind" {
            fn CMTimeMappingMakeFromDictionary(
                dictionary_representation: &CFDictionary,
            ) -> CMTimeMapping;
        }
        unsafe { CMTimeMappingMakeFromDictionary(dictionary_representation) }
    }
}

extern "C" {
    /// CFDictionary key for source field of a CMTimeMapping (CMTimeRange)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappingsourcekey?language=objc)
    pub static kCMTimeMappingSourceKey: &'static CFString;
}

extern "C" {
    /// CFDictionary key for target field of a CMTimeMapping (CMTimeRange)
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappingtargetkey?language=objc)
    pub static kCMTimeMappingTargetKey: &'static CFString;
}

#[cfg(feature = "CMTime")]
impl CMTimeMapping {
    /// Creates a CFString with a description of a CMTimeMapping (just like CFCopyDescription).
    ///
    /// This is used from within CFShow on an object that contains CMTimeMapping fields. It is
    /// also useful from other client debugging code.  The caller owns the returned CFString and is responsible for releasing it.
    ///
    /// Returns: The created CFString description.
    #[doc(alias = "CMTimeMappingCopyDescription")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn description(
        allocator: Option<&CFAllocator>,
        mapping: CMTimeMapping,
    ) -> Option<CFRetained<CFString>> {
        extern "C-unwind" {
            fn CMTimeMappingCopyDescription(
                allocator: Option<&CFAllocator>,
                mapping: CMTimeMapping,
            ) -> Option<NonNull<CFString>>;
        }
        let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
    }

    /// Prints a description of a CMTimeMapping (just like CFShow).
    ///
    /// This is most useful from within gdb.
    #[doc(alias = "CMTimeMappingShow")]
    #[cfg(feature = "CMTime")]
    #[inline]
    pub unsafe fn show(self) {
        extern "C-unwind" {
            fn CMTimeMappingShow(mapping: CMTimeMapping);
        }
        unsafe { CMTimeMappingShow(self) }
    }
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::new`"]
    pub fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::union`"]
    pub fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::intersection`"]
    pub fn CMTimeRangeGetIntersection(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::equal`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> bool {
    extern "C-unwind" {
        fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
    }
    let ret = unsafe { CMTimeRangeEqual(range1, range2) };
    ret != 0
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::contains_time`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> bool {
    extern "C-unwind" {
        fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
    }
    let ret = unsafe { CMTimeRangeContainsTime(range, time) };
    ret != 0
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::contains_time_range`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeContainsTimeRange(
    range: CMTimeRange,
    other_range: CMTimeRange,
) -> bool {
    extern "C-unwind" {
        fn CMTimeRangeContainsTimeRange(range: CMTimeRange, other_range: CMTimeRange) -> Boolean;
    }
    let ret = unsafe { CMTimeRangeContainsTimeRange(range, other_range) };
    ret != 0
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::end`"]
    pub fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTime::map_time_from_range_to_range`"]
    pub fn CMTimeMapTimeFromRangeToRange(
        t: CMTime,
        from_range: CMTimeRange,
        to_range: CMTimeRange,
    ) -> CMTime;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTime::clamp_to_range`"]
    pub fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTime::map_duration_from_range_to_range`"]
    pub fn CMTimeMapDurationFromRangeToRange(
        dur: CMTime,
        from_range: CMTimeRange,
        to_range: CMTimeRange,
    ) -> CMTime;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTime::fold_into_range`"]
    pub fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::from_time_to_time`"]
    pub fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::as_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeCopyAsDictionary(
    range: CMTimeRange,
    allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CMTimeRangeCopyAsDictionary(
            range: CMTimeRange,
            allocator: Option<&CFAllocator>,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CMTimeRangeCopyAsDictionary(range, allocator) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::from_dictionary`"]
    pub fn CMTimeRangeMakeFromDictionary(dictionary_representation: &CFDictionary) -> CMTimeRange;
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeRange::description`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeRangeCopyDescription(
    allocator: Option<&CFAllocator>,
    range: CMTimeRange,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CMTimeRangeCopyDescription(
            allocator: Option<&CFAllocator>,
            range: CMTimeRange,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeRange::show`"]
    pub fn CMTimeRangeShow(range: CMTimeRange);
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeMapping::new`"]
    pub fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeMapping::empty`"]
    pub fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::as_dictionary`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeMappingCopyAsDictionary(
    mapping: CMTimeMapping,
    allocator: Option<&CFAllocator>,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn CMTimeMappingCopyAsDictionary(
            mapping: CMTimeMapping,
            allocator: Option<&CFAllocator>,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { CMTimeMappingCopyAsDictionary(mapping, allocator) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeMapping::from_dictionary`"]
    pub fn CMTimeMappingMakeFromDictionary(
        dictionary_representation: &CFDictionary,
    ) -> CMTimeMapping;
}

#[cfg(feature = "CMTime")]
#[deprecated = "renamed to `CMTimeMapping::description`"]
#[inline]
pub unsafe extern "C-unwind" fn CMTimeMappingCopyDescription(
    allocator: Option<&CFAllocator>,
    mapping: CMTimeMapping,
) -> Option<CFRetained<CFString>> {
    extern "C-unwind" {
        fn CMTimeMappingCopyDescription(
            allocator: Option<&CFAllocator>,
            mapping: CMTimeMapping,
        ) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    #[cfg(feature = "CMTime")]
    #[deprecated = "renamed to `CMTimeMapping::show`"]
    pub fn CMTimeMappingShow(mapping: CMTimeMapping);
}