TrackSampleTable


@UnstableApi
public final class TrackSampleTable


Sample table for a track in an MP4 file.

Summary

Public fields

final long

The duration of the track sample table in microseconds.

final int[]

Sample flags.

final boolean

Whether all samples in the track are sync samples.

final int

Maximum sample size in sizes.

final long[]

Sample offsets in bytes.

final int

Number of samples.

final int[]

Sample sizes in bytes.

final int[]

The indices of sync samples, sorted in ascending order.

final long[]

Sample timestamps in microseconds.

final Track

The track corresponding to this sample table.

Public constructors

TrackSampleTable(
    Track track,
    long[] offsets,
    int[] sizes,
    int maximumSize,
    long[] timestampsUs,
    int[] flags,
    int[] syncSampleIndices,
    boolean hasOnlySyncSamples,
    long durationUs,
    int sampleCount
)

Public methods

int

Returns the sample index of the closest synchronization sample at or before the given timestamp, if one is available.

int

Returns the sample index of the closest synchronization sample at or after the given timestamp, if one is available.

Public fields

durationUs

public final long durationUs

The duration of the track sample table in microseconds.

flags

public final int[] flags

Sample flags.

hasOnlySyncSamples

public final boolean hasOnlySyncSamples

Whether all samples in the track are sync samples.

maximumSize

public final int maximumSize

Maximum sample size in sizes.

offsets

public final long[] offsets

Sample offsets in bytes.

sampleCount

public final int sampleCount

Number of samples.

sizes

public final int[] sizes

Sample sizes in bytes.

syncSampleIndices

public final int[] syncSampleIndices

The indices of sync samples, sorted in ascending order. This array is only populated if hasOnlySyncSamples is false.

timestampsUs

public final long[] timestampsUs

Sample timestamps in microseconds.

track

public final Track track

The track corresponding to this sample table.

Public constructors

TrackSampleTable

public TrackSampleTable(
    Track track,
    long[] offsets,
    int[] sizes,
    int maximumSize,
    long[] timestampsUs,
    int[] flags,
    int[] syncSampleIndices,
    boolean hasOnlySyncSamples,
    long durationUs,
    int sampleCount
)

Public methods

getIndexOfEarlierOrEqualSynchronizationSample

public int getIndexOfEarlierOrEqualSynchronizationSample(long timeUs)

Returns the sample index of the closest synchronization sample at or before the given timestamp, if one is available.

Parameters
long timeUs

Timestamp adjacent to which to find a synchronization sample.

Returns
int

Index of the synchronization sample, or INDEX_UNSET if none.

getIndexOfLaterOrEqualSynchronizationSample

public int getIndexOfLaterOrEqualSynchronizationSample(long timeUs)

Returns the sample index of the closest synchronization sample at or after the given timestamp, if one is available.

Parameters
long timeUs

Timestamp adjacent to which to find a synchronization sample.

Returns
int

index Index of the synchronization sample, or INDEX_UNSET if none.