CMTimeMapDurationFromRangeToRange(_:fromRange:toRange:)
Translates a duration through a mapping from two time ranges.
Declaration
func CMTimeMapDurationFromRangeToRange(_ dur: CMTime, fromRange: CMTimeRange, toRange: CMTimeRange) -> CMTimeParameters
- dur:
The duration to translate.
- fromRange:
The time range from which the function translates the duration.
- toRange:
The time range to which the function maps the duration.
Return Value
A time structure that represents the translated duration.
Discussion
The function scales the duration in proportion to the ratio between the ranges’ durations:
result = dur*(toRange.duration/fromRange.duration)If dur doesn’t have the epoch 0, the function returns an invalid CMTime.