SpeedProviderUtil


@UnstableApi
class SpeedProviderUtil


Utilities for SpeedProvider.

Summary

Public functions

java-static Long
getDurationAfterSpeedProviderApplied(
    speedProvider: SpeedProvider!,
    durationUs: Long
)

Returns the duration of the output when the given SpeedProvider is applied given an input stream with the given durationUs.

java-static Long
getNextSpeedChangeSamplePosition(
    speedProvider: SpeedProvider!,
    samplePosition: Long,
    sampleRate: Int
)

Returns the sample position of the next speed change or INDEX_UNSET if none is set.

java-static Float
getSampleAlignedSpeed(
    speedProvider: SpeedProvider!,
    samplePosition: Long,
    sampleRate: Int
)

Returns the speed at the specified sample position.

Public functions

getDurationAfterSpeedProviderApplied

java-static fun getDurationAfterSpeedProviderApplied(
    speedProvider: SpeedProvider!,
    durationUs: Long
): Long

Returns the duration of the output when the given SpeedProvider is applied given an input stream with the given durationUs.

getNextSpeedChangeSamplePosition

java-static fun getNextSpeedChangeSamplePosition(
    speedProvider: SpeedProvider!,
    samplePosition: Long,
    sampleRate: Int
): Long

Returns the sample position of the next speed change or INDEX_UNSET if none is set.

If the next speed change falls between sample boundaries, this method will return the next closest sample position, which ensures that speed regions stay consistent with getSampleAlignedSpeed.

getSampleAlignedSpeed

java-static fun getSampleAlignedSpeed(
    speedProvider: SpeedProvider!,
    samplePosition: Long,
    sampleRate: Int
): Float

Returns the speed at the specified sample position.

This method is consistent with the alignment done by getNextSpeedChangeSamplePosition.