Function

CMTimeMapTimeFromRangeToRange

Translates a time through a mapping from CMTimeRange to CMTimeRange.

Declaration

CMTime CMTimeMapTimeFromRangeToRange(CMTime t, CMTimeRange fromRange, CMTimeRange toRange);

Parameters

t

The CMTime to be translated.

fromRange

The time range from which CMTime is translated.

toRange

The time range to which CMTime is mapped to.

Return Value

A CMTime structure representing the translated time.

Discussion

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.

See Also

Utility Functions

CMTimeClampToRange

For a given CMTime and CMTimeRange, returns the nearest CMTime inside that time range.

CMTimeMapDurationFromRangeToRange

Translates a duration through a mapping from CMTimeRange to CMTimeRange.

CMTimeRangeCopyAsDictionary

Returns a CFDictionary version of a CMTimeRange.

CMTimeRangeCopyDescription

Creates a CFString with a description of a CMTimeRange (similar to CFCopyDescription).

CMTimeRangeShow

Prints a description of the CMTimeRange to stderr (similar to CFShow).