public final class TimestampAdjuster
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static long |
DO_NOT_OFFSET
A special
firstSampleTimestampUs value indicating that presentation timestamps should
not be offset. |
Constructor and Description |
---|
TimestampAdjuster(long firstSampleTimestampUs) |
Modifier and Type | Method and Description |
---|---|
long |
adjustSampleTimestamp(long timeUs)
Offsets a sample timestamp in microseconds.
|
long |
adjustTsTimestamp(long pts)
Scales and offsets an MPEG-2 TS presentation timestamp considering wraparound.
|
static long |
ptsToUs(long pts)
Converts a value in MPEG-2 timestamp units to the corresponding value in microseconds.
|
void |
reset()
Resets the instance to its initial state.
|
static long |
usToPts(long us)
Converts a value in microseconds to the corresponding values in MPEG-2 timestamp units.
|
void |
waitUntilInitialized()
Blocks the calling thread until this adjuster is initialized.
|
public static final long DO_NOT_OFFSET
firstSampleTimestampUs
value indicating that presentation timestamps should
not be offset.public TimestampAdjuster(long firstSampleTimestampUs)
firstSampleTimestampUs
- The desired result of the first call to
adjustSampleTimestamp(long)
, or DO_NOT_OFFSET
if presentation timestamps
should not be offset.public void reset()
public long adjustTsTimestamp(long pts)
pts
- The MPEG-2 TS presentation timestamp.public long adjustSampleTimestamp(long timeUs)
timeUs
- The timestamp of a sample to adjust.public void waitUntilInitialized() throws java.lang.InterruptedException
java.lang.InterruptedException
- If the thread was interrupted.public static long ptsToUs(long pts)
pts
- A value in MPEG-2 timestamp units.public static long usToPts(long us)
us
- A value in microseconds.