Function

CMTimeConvertScale(_:timescale:method:)

Returns a new CMTime containing the source CMTime converted to a new timescale (rounding as requested).

Declaration

func CMTimeConvertScale(_ time: CMTime, timescale newTimescale: Int32, method: CMTimeRoundingMethod) -> CMTime

Parameters

time

Source CMTime.

newTimescale

The timescale to which the source CMTime is converted.

method

The requested rounding method.

Return Value

The converted CMTime.

Discussion

If the value needs to be rounded, the hasBeenRounded flag will be set. See definition of CMTimeRoundingMethod for a discussion of the various rounding methods available. If the source time is non-numeric (i.e.. infinite, indefinite, invalid), the result will be similarly non-numeric.

See Also

Performing Common Operations

func CMTimeAdd(CMTime, CMTime) -> CMTime

Returns the sum of two CMTimes.

func CMTimeSubtract(CMTime, CMTime) -> CMTime

Returns the difference of two CMTimes.

func CMTimeMultiply(CMTime, multiplier: Int32) -> CMTime

Returns the product of a CMTime and a 32-bit integer.

func CMTimeMultiplyByFloat64(CMTime, multiplier: Float64) -> CMTime

Returns the product of a CMTime and a 64-bit float.

func CMTimeMultiplyByRatio(CMTime, multiplier: Int32, divisor: Int32) -> CMTime

Returns the result of multiplying a CMTime by an integer, then dividing by another integer.