objc2_core_media/generated/
CMTimeRange.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// A time range represented as two CMTime structures.
12///
13/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtimerange?language=objc)
14#[cfg(feature = "CMTime")]
15#[repr(C)]
16#[derive(Clone, Copy, Debug, PartialEq)]
17pub struct CMTimeRange {
18    /// The start time of the time range.
19    pub start: CMTime,
20    /// The duration of the time range.
21    pub duration: CMTime,
22}
23
24#[cfg(all(feature = "CMTime", feature = "objc2"))]
25unsafe impl Encode for CMTimeRange {
26    const ENCODING: Encoding = Encoding::Struct("?", &[<CMTime>::ENCODING, <CMTime>::ENCODING]);
27}
28
29#[cfg(all(feature = "CMTime", feature = "objc2"))]
30unsafe impl RefEncode for CMTimeRange {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern "C" {
35    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangezero?language=objc)
36    #[cfg(feature = "CMTime")]
37    pub static kCMTimeRangeZero: CMTimeRange;
38}
39
40extern "C" {
41    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangeinvalid?language=objc)
42    #[cfg(feature = "CMTime")]
43    pub static kCMTimeRangeInvalid: CMTimeRange;
44}
45
46#[cfg(feature = "CMTime")]
47impl CMTimeRange {
48    /// Make a valid CMTimeRange with start and duration.
49    ///
50    /// Returns: The resulting CMTimeRange.
51    ///
52    /// The duration parameter must have an epoch of 0; otherwise an invalid time range will be returned.
53    #[doc(alias = "CMTimeRangeMake")]
54    #[cfg(feature = "CMTime")]
55    #[inline]
56    pub unsafe fn new(start: CMTime, duration: CMTime) -> CMTimeRange {
57        extern "C-unwind" {
58            fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
59        }
60        unsafe { CMTimeRangeMake(start, duration) }
61    }
62
63    /// Returns the union of two CMTimeRanges.
64    ///
65    /// This function returns a CMTimeRange structure that represents the union of the time ranges specified by the
66    /// <i>
67    /// range
68    /// </i>
69    /// and
70    /// <i>
71    /// otherRange
72    /// </i>
73    /// parameters.
74    /// This is the smallest range that includes all times that are in either range.
75    ///
76    /// Returns: The union of the two CMTimeRanges.
77    #[doc(alias = "CMTimeRangeGetUnion")]
78    #[cfg(feature = "CMTime")]
79    #[inline]
80    pub unsafe fn union(self, other_range: CMTimeRange) -> CMTimeRange {
81        extern "C-unwind" {
82            fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
83        }
84        unsafe { CMTimeRangeGetUnion(self, other_range) }
85    }
86
87    /// Returns the intersection of two CMTimeRanges.
88    ///
89    /// This function returns a CMTimeRange structure that represents the intersection of the time ranges specified by the
90    /// <i>
91    /// range
92    /// </i>
93    /// and
94    /// <i>
95    /// otherRange
96    /// </i>
97    /// parameters.
98    /// This is the largest range that both ranges include.
99    ///
100    /// Returns: The intersection of the two CMTimeRanges.
101    #[doc(alias = "CMTimeRangeGetIntersection")]
102    #[cfg(feature = "CMTime")]
103    #[inline]
104    pub unsafe fn intersection(self, other_range: CMTimeRange) -> CMTimeRange {
105        extern "C-unwind" {
106            fn CMTimeRangeGetIntersection(
107                range: CMTimeRange,
108                other_range: CMTimeRange,
109            ) -> CMTimeRange;
110        }
111        unsafe { CMTimeRangeGetIntersection(self, other_range) }
112    }
113
114    /// Returns a Boolean value that indicates whether two CMTimeRanges are identical.
115    ///
116    /// This function returns a Boolean value that indicates whether the time ranges specified by the
117    /// <i>
118    /// range1
119    /// </i>
120    /// and
121    /// <i>
122    /// range2
123    /// </i>
124    /// parameters are identical.
125    ///
126    /// Returns: Returns true if the two time ranges are identical, false if they differ.
127    #[doc(alias = "CMTimeRangeEqual")]
128    #[cfg(feature = "CMTime")]
129    #[inline]
130    pub unsafe fn equal(self, range2: CMTimeRange) -> bool {
131        extern "C-unwind" {
132            fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
133        }
134        let ret = unsafe { CMTimeRangeEqual(self, range2) };
135        ret != 0
136    }
137
138    /// Indicates whether a time is contained within a time range.
139    ///
140    /// This function returns a Boolean value that indicates whether the time specified by the
141    /// <i>
142    /// time
143    /// </i>
144    /// parameter
145    /// is contained within the range specified by the
146    /// <i>
147    /// range
148    /// </i>
149    /// parameter.
150    ///
151    /// Returns: Returns true if the specified time is contained within the specified time range, false if it is not.
152    #[doc(alias = "CMTimeRangeContainsTime")]
153    #[cfg(feature = "CMTime")]
154    #[inline]
155    pub unsafe fn contains_time(self, time: CMTime) -> bool {
156        extern "C-unwind" {
157            fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
158        }
159        let ret = unsafe { CMTimeRangeContainsTime(self, time) };
160        ret != 0
161    }
162
163    /// Indicates whether a time range is contained within a time range.
164    ///
165    /// This function returns a Boolean value that indicates whether the time range specified by the
166    /// <i>
167    /// range
168    /// </i>
169    /// parameter
170    /// contains the range specified by the
171    /// <i>
172    /// otherRange
173    /// </i>
174    /// parameter.
175    ///
176    /// Returns: Returns true if the second time range is contained within the first time range, false if it is not.
177    #[doc(alias = "CMTimeRangeContainsTimeRange")]
178    #[cfg(feature = "CMTime")]
179    #[inline]
180    pub unsafe fn contains_time_range(self, other_range: CMTimeRange) -> bool {
181        extern "C-unwind" {
182            fn CMTimeRangeContainsTimeRange(
183                range: CMTimeRange,
184                other_range: CMTimeRange,
185            ) -> Boolean;
186        }
187        let ret = unsafe { CMTimeRangeContainsTimeRange(self, other_range) };
188        ret != 0
189    }
190
191    /// Returns a CMTime structure representing the end of a time range.
192    ///
193    /// Returns: A CMTime structure representing the end of the specified time range.
194    ///
195    /// This function returns a CMTime structure that indicates the end of the time range specified by the
196    /// <i>
197    /// range
198    /// </i>
199    /// parameter.
200    /// CMTimeRangeContainsTime(range, CMTimeRangeGetEnd(range)) is always false.
201    #[doc(alias = "CMTimeRangeGetEnd")]
202    #[cfg(feature = "CMTime")]
203    #[inline]
204    pub unsafe fn end(self) -> CMTime {
205        extern "C-unwind" {
206            fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
207        }
208        unsafe { CMTimeRangeGetEnd(self) }
209    }
210}
211
212#[cfg(feature = "CMTime")]
213impl CMTime {
214    /// Translates a time through a mapping from CMTimeRange to CMTimeRange.
215    ///
216    /// Returns: A CMTime structure representing the translated time.
217    ///
218    /// The start and end time of fromRange will be mapped to the start and end time of toRange respectively.
219    /// Other times will be mapped linearly, using the formula:
220    /// result = (t-fromRange.start)*(toRange.duration/fromRange.duration)+toRange.start
221    /// If either CMTimeRange argument is empty, an invalid CMTime will be returned.
222    /// If t does not have the same epoch as fromRange.start, an invalid CMTime will be returned.
223    /// If both fromRange and toRange have duration kCMTimePositiveInfinity,
224    /// t will be offset relative to the differences between their starts, but not scaled.
225    #[doc(alias = "CMTimeMapTimeFromRangeToRange")]
226    #[cfg(feature = "CMTime")]
227    #[inline]
228    pub unsafe fn map_time_from_range_to_range(
229        self,
230        from_range: CMTimeRange,
231        to_range: CMTimeRange,
232    ) -> CMTime {
233        extern "C-unwind" {
234            fn CMTimeMapTimeFromRangeToRange(
235                t: CMTime,
236                from_range: CMTimeRange,
237                to_range: CMTimeRange,
238            ) -> CMTime;
239        }
240        unsafe { CMTimeMapTimeFromRangeToRange(self, from_range, to_range) }
241    }
242
243    /// For a given CMTime and CMTimeRange, returns the nearest CMTime inside that time range.
244    ///
245    /// Returns: A CMTime structure inside the given time range.
246    ///
247    /// Times inside the given time range will be returned unmodified.
248    /// Times before the start and after the end time of the time range will return the start and end time of
249    /// the range respectively.
250    /// If the CMTimeRange argument is empty, an invalid CMTime will be returned.
251    /// If the given CMTime is invalid, the returned CMTime will be invalid,
252    #[doc(alias = "CMTimeClampToRange")]
253    #[cfg(feature = "CMTime")]
254    #[inline]
255    pub unsafe fn clamp_to_range(self, range: CMTimeRange) -> CMTime {
256        extern "C-unwind" {
257            fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
258        }
259        unsafe { CMTimeClampToRange(self, range) }
260    }
261
262    /// Translates a duration through a mapping from CMTimeRange to CMTimeRange.
263    ///
264    /// Returns: A CMTime structure representing the translated duration.
265    ///
266    /// The duration will be scaled in proportion to the ratio between the ranges' durations:
267    /// result = dur*(toRange.duration/fromRange.duration)
268    /// If dur does not have the epoch zero, an invalid CMTime will be returned.
269    #[doc(alias = "CMTimeMapDurationFromRangeToRange")]
270    #[cfg(feature = "CMTime")]
271    #[inline]
272    pub unsafe fn map_duration_from_range_to_range(
273        self,
274        from_range: CMTimeRange,
275        to_range: CMTimeRange,
276    ) -> CMTime {
277        extern "C-unwind" {
278            fn CMTimeMapDurationFromRangeToRange(
279                dur: CMTime,
280                from_range: CMTimeRange,
281                to_range: CMTimeRange,
282            ) -> CMTime;
283        }
284        unsafe { CMTimeMapDurationFromRangeToRange(self, from_range, to_range) }
285    }
286
287    /// Folds a time into the given range.  This can be used in looping time calculations.
288    ///
289    /// Returns: A CMTime structure representing the translated duration.
290    ///
291    /// Note that for certain types of looping, you may want to NOT fold times that are prior
292    /// to the loop range.  That's up to the client.
293    #[doc(alias = "CMTimeFoldIntoRange")]
294    #[cfg(feature = "CMTime")]
295    #[inline]
296    pub unsafe fn fold_into_range(self, fold_range: CMTimeRange) -> CMTime {
297        extern "C-unwind" {
298            fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
299        }
300        unsafe { CMTimeFoldIntoRange(self, fold_range) }
301    }
302}
303
304#[cfg(feature = "CMTime")]
305impl CMTimeRange {
306    /// Make a valid CMTimeRange with the given starting and ending times.
307    ///
308    /// Returns: The resulting CMTimeRange.
309    #[doc(alias = "CMTimeRangeFromTimeToTime")]
310    #[cfg(feature = "CMTime")]
311    #[inline]
312    pub unsafe fn from_time_to_time(start: CMTime, end: CMTime) -> CMTimeRange {
313        extern "C-unwind" {
314            fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
315        }
316        unsafe { CMTimeRangeFromTimeToTime(start, end) }
317    }
318
319    /// Returns a CFDictionary version of a CMTimeRange.
320    ///
321    /// This is useful when putting CMTimeRanges in CF container types.
322    ///
323    /// Returns: A CFDictionary version of the CMTimeRange.
324    #[doc(alias = "CMTimeRangeCopyAsDictionary")]
325    #[cfg(feature = "CMTime")]
326    #[inline]
327    pub unsafe fn as_dictionary(
328        self,
329        allocator: Option<&CFAllocator>,
330    ) -> Option<CFRetained<CFDictionary>> {
331        extern "C-unwind" {
332            fn CMTimeRangeCopyAsDictionary(
333                range: CMTimeRange,
334                allocator: Option<&CFAllocator>,
335            ) -> Option<NonNull<CFDictionary>>;
336        }
337        let ret = unsafe { CMTimeRangeCopyAsDictionary(self, allocator) };
338        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
339    }
340
341    /// Reconstitutes a CMTimeRange struct from a CFDictionary previously created by CMTimeRangeCopyAsDictionary.
342    ///
343    /// This is useful when getting CMTimeRanges from CF container types.  If the CFDictionary does not
344    /// have the requisite keyed values, an invalid time range is returned.
345    ///
346    /// Returns: The created CMTimeRange.
347    ///
348    /// # Safety
349    ///
350    /// `dictionary_representation` generics must be of the correct type.
351    #[doc(alias = "CMTimeRangeMakeFromDictionary")]
352    #[cfg(feature = "CMTime")]
353    #[inline]
354    pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeRange {
355        extern "C-unwind" {
356            fn CMTimeRangeMakeFromDictionary(
357                dictionary_representation: &CFDictionary,
358            ) -> CMTimeRange;
359        }
360        unsafe { CMTimeRangeMakeFromDictionary(dictionary_representation) }
361    }
362}
363
364extern "C" {
365    /// CFDictionary key for start field of a CMTimeRange (CMTime)
366    ///
367    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangestartkey?language=objc)
368    pub static kCMTimeRangeStartKey: &'static CFString;
369}
370
371extern "C" {
372    /// CFDictionary key for timescale field of a CMTimeRange (CMTime)
373    ///
374    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimerangedurationkey?language=objc)
375    pub static kCMTimeRangeDurationKey: &'static CFString;
376}
377
378#[cfg(feature = "CMTime")]
379impl CMTimeRange {
380    /// Creates a CFString with a description of a CMTimeRange (just like CFCopyDescription).
381    ///
382    /// This is used from within CFShow on an object that contains CMTimeRange fields. It is
383    /// also useful from other client debugging code.  The caller owns the returned CFString and is responsible for releasing it.
384    ///
385    /// Returns: The created CFString description.
386    #[doc(alias = "CMTimeRangeCopyDescription")]
387    #[cfg(feature = "CMTime")]
388    #[inline]
389    pub unsafe fn description(
390        allocator: Option<&CFAllocator>,
391        range: CMTimeRange,
392    ) -> Option<CFRetained<CFString>> {
393        extern "C-unwind" {
394            fn CMTimeRangeCopyDescription(
395                allocator: Option<&CFAllocator>,
396                range: CMTimeRange,
397            ) -> Option<NonNull<CFString>>;
398        }
399        let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
400        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
401    }
402
403    /// Prints a description of the CMTimeRange (just like CFShow).
404    ///
405    /// This is most useful from within gdb.
406    #[doc(alias = "CMTimeRangeShow")]
407    #[cfg(feature = "CMTime")]
408    #[inline]
409    pub unsafe fn show(self) {
410        extern "C-unwind" {
411            fn CMTimeRangeShow(range: CMTimeRange);
412        }
413        unsafe { CMTimeRangeShow(self) }
414    }
415}
416
417/// A CMTimeMapping specifies the mapping of a segment of one time line (called "source") into another time line (called "target").
418///
419/// When used for movie edit lists, the source time line is the media and the target time line is the track/movie.
420/// Field: source
421/// The time range on the source time line.
422/// For an empty edit, source.start is an invalid CMTime, in which case source.duration shall be ignored.
423/// Otherwise, source.start is the starting time within the source, and source.duration is the duration
424/// of the source timeline to be mapped to the target time range.
425/// Field: target
426/// The time range on the target time line.
427/// If target.duration and source.duration are different, then the source segment should
428/// be played at rate source.duration/target.duration to fit.
429///
430/// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/cmtimemapping?language=objc)
431#[cfg(feature = "CMTime")]
432#[repr(C)]
433#[derive(Clone, Copy, Debug, PartialEq)]
434pub struct CMTimeMapping {
435    pub source: CMTimeRange,
436    pub target: CMTimeRange,
437}
438
439#[cfg(all(feature = "CMTime", feature = "objc2"))]
440unsafe impl Encode for CMTimeMapping {
441    const ENCODING: Encoding =
442        Encoding::Struct("?", &[<CMTimeRange>::ENCODING, <CMTimeRange>::ENCODING]);
443}
444
445#[cfg(all(feature = "CMTime", feature = "objc2"))]
446unsafe impl RefEncode for CMTimeMapping {
447    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
448}
449
450extern "C" {
451    /// [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappinginvalid?language=objc)
452    #[cfg(feature = "CMTime")]
453    pub static kCMTimeMappingInvalid: CMTimeMapping;
454}
455
456#[cfg(feature = "CMTime")]
457impl CMTimeMapping {
458    /// Make a valid CMTimeMapping with source and target.
459    ///
460    /// Returns: The resulting CMTimeMapping.
461    ///
462    /// The source and target parameters must have durations whose epoch is 0; otherwise an invalid time mapping will be returned.
463    #[doc(alias = "CMTimeMappingMake")]
464    #[cfg(feature = "CMTime")]
465    #[inline]
466    pub unsafe fn new(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping {
467        extern "C-unwind" {
468            fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
469        }
470        unsafe { CMTimeMappingMake(source, target) }
471    }
472
473    /// Make a valid CMTimeMapping with an empty source.
474    ///
475    /// Returns: The resulting CMTimeMapping.
476    ///
477    /// The target parameter must have a duration whose epoch is 0; otherwise an invalid time mapping will be returned.
478    #[doc(alias = "CMTimeMappingMakeEmpty")]
479    #[cfg(feature = "CMTime")]
480    #[inline]
481    pub unsafe fn empty(target: CMTimeRange) -> CMTimeMapping {
482        extern "C-unwind" {
483            fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
484        }
485        unsafe { CMTimeMappingMakeEmpty(target) }
486    }
487
488    /// Returns a CFDictionary version of a CMTimeMapping.
489    ///
490    /// This is useful when putting CMTimeMappings in CF container types.
491    ///
492    /// Returns: A CFDictionary version of the CMTimeMapping.
493    #[doc(alias = "CMTimeMappingCopyAsDictionary")]
494    #[cfg(feature = "CMTime")]
495    #[inline]
496    pub unsafe fn as_dictionary(
497        self,
498        allocator: Option<&CFAllocator>,
499    ) -> Option<CFRetained<CFDictionary>> {
500        extern "C-unwind" {
501            fn CMTimeMappingCopyAsDictionary(
502                mapping: CMTimeMapping,
503                allocator: Option<&CFAllocator>,
504            ) -> Option<NonNull<CFDictionary>>;
505        }
506        let ret = unsafe { CMTimeMappingCopyAsDictionary(self, allocator) };
507        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
508    }
509
510    /// Reconstitutes a CMTimeMapping struct from a CFDictionary previously created by CMTimeMappingCopyAsDictionary.
511    ///
512    /// This is useful when getting CMTimeMappings from CF container types.  If the CFDictionary does not
513    /// have the requisite keyed values, an invalid time mapping is returned.
514    ///
515    /// Returns: The created CMTimeMapping.
516    ///
517    /// # Safety
518    ///
519    /// `dictionary_representation` generics must be of the correct type.
520    #[doc(alias = "CMTimeMappingMakeFromDictionary")]
521    #[cfg(feature = "CMTime")]
522    #[inline]
523    pub unsafe fn from_dictionary(dictionary_representation: &CFDictionary) -> CMTimeMapping {
524        extern "C-unwind" {
525            fn CMTimeMappingMakeFromDictionary(
526                dictionary_representation: &CFDictionary,
527            ) -> CMTimeMapping;
528        }
529        unsafe { CMTimeMappingMakeFromDictionary(dictionary_representation) }
530    }
531}
532
533extern "C" {
534    /// CFDictionary key for source field of a CMTimeMapping (CMTimeRange)
535    ///
536    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappingsourcekey?language=objc)
537    pub static kCMTimeMappingSourceKey: &'static CFString;
538}
539
540extern "C" {
541    /// CFDictionary key for target field of a CMTimeMapping (CMTimeRange)
542    ///
543    /// See also [Apple's documentation](https://developer.apple.com/documentation/coremedia/kcmtimemappingtargetkey?language=objc)
544    pub static kCMTimeMappingTargetKey: &'static CFString;
545}
546
547#[cfg(feature = "CMTime")]
548impl CMTimeMapping {
549    /// Creates a CFString with a description of a CMTimeMapping (just like CFCopyDescription).
550    ///
551    /// This is used from within CFShow on an object that contains CMTimeMapping fields. It is
552    /// also useful from other client debugging code.  The caller owns the returned CFString and is responsible for releasing it.
553    ///
554    /// Returns: The created CFString description.
555    #[doc(alias = "CMTimeMappingCopyDescription")]
556    #[cfg(feature = "CMTime")]
557    #[inline]
558    pub unsafe fn description(
559        allocator: Option<&CFAllocator>,
560        mapping: CMTimeMapping,
561    ) -> Option<CFRetained<CFString>> {
562        extern "C-unwind" {
563            fn CMTimeMappingCopyDescription(
564                allocator: Option<&CFAllocator>,
565                mapping: CMTimeMapping,
566            ) -> Option<NonNull<CFString>>;
567        }
568        let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
569        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
570    }
571
572    /// Prints a description of a CMTimeMapping (just like CFShow).
573    ///
574    /// This is most useful from within gdb.
575    #[doc(alias = "CMTimeMappingShow")]
576    #[cfg(feature = "CMTime")]
577    #[inline]
578    pub unsafe fn show(self) {
579        extern "C-unwind" {
580            fn CMTimeMappingShow(mapping: CMTimeMapping);
581        }
582        unsafe { CMTimeMappingShow(self) }
583    }
584}
585
586extern "C-unwind" {
587    #[cfg(feature = "CMTime")]
588    #[deprecated = "renamed to `CMTimeRange::new`"]
589    pub fn CMTimeRangeMake(start: CMTime, duration: CMTime) -> CMTimeRange;
590}
591
592extern "C-unwind" {
593    #[cfg(feature = "CMTime")]
594    #[deprecated = "renamed to `CMTimeRange::union`"]
595    pub fn CMTimeRangeGetUnion(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
596}
597
598extern "C-unwind" {
599    #[cfg(feature = "CMTime")]
600    #[deprecated = "renamed to `CMTimeRange::intersection`"]
601    pub fn CMTimeRangeGetIntersection(range: CMTimeRange, other_range: CMTimeRange) -> CMTimeRange;
602}
603
604#[cfg(feature = "CMTime")]
605#[deprecated = "renamed to `CMTimeRange::equal`"]
606#[inline]
607pub unsafe extern "C-unwind" fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> bool {
608    extern "C-unwind" {
609        fn CMTimeRangeEqual(range1: CMTimeRange, range2: CMTimeRange) -> Boolean;
610    }
611    let ret = unsafe { CMTimeRangeEqual(range1, range2) };
612    ret != 0
613}
614
615#[cfg(feature = "CMTime")]
616#[deprecated = "renamed to `CMTimeRange::contains_time`"]
617#[inline]
618pub unsafe extern "C-unwind" fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> bool {
619    extern "C-unwind" {
620        fn CMTimeRangeContainsTime(range: CMTimeRange, time: CMTime) -> Boolean;
621    }
622    let ret = unsafe { CMTimeRangeContainsTime(range, time) };
623    ret != 0
624}
625
626#[cfg(feature = "CMTime")]
627#[deprecated = "renamed to `CMTimeRange::contains_time_range`"]
628#[inline]
629pub unsafe extern "C-unwind" fn CMTimeRangeContainsTimeRange(
630    range: CMTimeRange,
631    other_range: CMTimeRange,
632) -> bool {
633    extern "C-unwind" {
634        fn CMTimeRangeContainsTimeRange(range: CMTimeRange, other_range: CMTimeRange) -> Boolean;
635    }
636    let ret = unsafe { CMTimeRangeContainsTimeRange(range, other_range) };
637    ret != 0
638}
639
640extern "C-unwind" {
641    #[cfg(feature = "CMTime")]
642    #[deprecated = "renamed to `CMTimeRange::end`"]
643    pub fn CMTimeRangeGetEnd(range: CMTimeRange) -> CMTime;
644}
645
646extern "C-unwind" {
647    #[cfg(feature = "CMTime")]
648    #[deprecated = "renamed to `CMTime::map_time_from_range_to_range`"]
649    pub fn CMTimeMapTimeFromRangeToRange(
650        t: CMTime,
651        from_range: CMTimeRange,
652        to_range: CMTimeRange,
653    ) -> CMTime;
654}
655
656extern "C-unwind" {
657    #[cfg(feature = "CMTime")]
658    #[deprecated = "renamed to `CMTime::clamp_to_range`"]
659    pub fn CMTimeClampToRange(time: CMTime, range: CMTimeRange) -> CMTime;
660}
661
662extern "C-unwind" {
663    #[cfg(feature = "CMTime")]
664    #[deprecated = "renamed to `CMTime::map_duration_from_range_to_range`"]
665    pub fn CMTimeMapDurationFromRangeToRange(
666        dur: CMTime,
667        from_range: CMTimeRange,
668        to_range: CMTimeRange,
669    ) -> CMTime;
670}
671
672extern "C-unwind" {
673    #[cfg(feature = "CMTime")]
674    #[deprecated = "renamed to `CMTime::fold_into_range`"]
675    pub fn CMTimeFoldIntoRange(time: CMTime, fold_range: CMTimeRange) -> CMTime;
676}
677
678extern "C-unwind" {
679    #[cfg(feature = "CMTime")]
680    #[deprecated = "renamed to `CMTimeRange::from_time_to_time`"]
681    pub fn CMTimeRangeFromTimeToTime(start: CMTime, end: CMTime) -> CMTimeRange;
682}
683
684#[cfg(feature = "CMTime")]
685#[deprecated = "renamed to `CMTimeRange::as_dictionary`"]
686#[inline]
687pub unsafe extern "C-unwind" fn CMTimeRangeCopyAsDictionary(
688    range: CMTimeRange,
689    allocator: Option<&CFAllocator>,
690) -> Option<CFRetained<CFDictionary>> {
691    extern "C-unwind" {
692        fn CMTimeRangeCopyAsDictionary(
693            range: CMTimeRange,
694            allocator: Option<&CFAllocator>,
695        ) -> Option<NonNull<CFDictionary>>;
696    }
697    let ret = unsafe { CMTimeRangeCopyAsDictionary(range, allocator) };
698    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
699}
700
701extern "C-unwind" {
702    #[cfg(feature = "CMTime")]
703    #[deprecated = "renamed to `CMTimeRange::from_dictionary`"]
704    pub fn CMTimeRangeMakeFromDictionary(dictionary_representation: &CFDictionary) -> CMTimeRange;
705}
706
707#[cfg(feature = "CMTime")]
708#[deprecated = "renamed to `CMTimeRange::description`"]
709#[inline]
710pub unsafe extern "C-unwind" fn CMTimeRangeCopyDescription(
711    allocator: Option<&CFAllocator>,
712    range: CMTimeRange,
713) -> Option<CFRetained<CFString>> {
714    extern "C-unwind" {
715        fn CMTimeRangeCopyDescription(
716            allocator: Option<&CFAllocator>,
717            range: CMTimeRange,
718        ) -> Option<NonNull<CFString>>;
719    }
720    let ret = unsafe { CMTimeRangeCopyDescription(allocator, range) };
721    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
722}
723
724extern "C-unwind" {
725    #[cfg(feature = "CMTime")]
726    #[deprecated = "renamed to `CMTimeRange::show`"]
727    pub fn CMTimeRangeShow(range: CMTimeRange);
728}
729
730extern "C-unwind" {
731    #[cfg(feature = "CMTime")]
732    #[deprecated = "renamed to `CMTimeMapping::new`"]
733    pub fn CMTimeMappingMake(source: CMTimeRange, target: CMTimeRange) -> CMTimeMapping;
734}
735
736extern "C-unwind" {
737    #[cfg(feature = "CMTime")]
738    #[deprecated = "renamed to `CMTimeMapping::empty`"]
739    pub fn CMTimeMappingMakeEmpty(target: CMTimeRange) -> CMTimeMapping;
740}
741
742#[cfg(feature = "CMTime")]
743#[deprecated = "renamed to `CMTimeMapping::as_dictionary`"]
744#[inline]
745pub unsafe extern "C-unwind" fn CMTimeMappingCopyAsDictionary(
746    mapping: CMTimeMapping,
747    allocator: Option<&CFAllocator>,
748) -> Option<CFRetained<CFDictionary>> {
749    extern "C-unwind" {
750        fn CMTimeMappingCopyAsDictionary(
751            mapping: CMTimeMapping,
752            allocator: Option<&CFAllocator>,
753        ) -> Option<NonNull<CFDictionary>>;
754    }
755    let ret = unsafe { CMTimeMappingCopyAsDictionary(mapping, allocator) };
756    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
757}
758
759extern "C-unwind" {
760    #[cfg(feature = "CMTime")]
761    #[deprecated = "renamed to `CMTimeMapping::from_dictionary`"]
762    pub fn CMTimeMappingMakeFromDictionary(
763        dictionary_representation: &CFDictionary,
764    ) -> CMTimeMapping;
765}
766
767#[cfg(feature = "CMTime")]
768#[deprecated = "renamed to `CMTimeMapping::description`"]
769#[inline]
770pub unsafe extern "C-unwind" fn CMTimeMappingCopyDescription(
771    allocator: Option<&CFAllocator>,
772    mapping: CMTimeMapping,
773) -> Option<CFRetained<CFString>> {
774    extern "C-unwind" {
775        fn CMTimeMappingCopyDescription(
776            allocator: Option<&CFAllocator>,
777            mapping: CMTimeMapping,
778        ) -> Option<NonNull<CFString>>;
779    }
780    let ret = unsafe { CMTimeMappingCopyDescription(allocator, mapping) };
781    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
782}
783
784extern "C-unwind" {
785    #[cfg(feature = "CMTime")]
786    #[deprecated = "renamed to `CMTimeMapping::show`"]
787    pub fn CMTimeMappingShow(mapping: CMTimeMapping);
788}