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 |
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( |
Public methods |
|
|---|---|
int |
getIndexOfEarlierOrEqualSynchronizationSample(long timeUs)Returns the sample index of the closest synchronization sample at or before the given timestamp, if one is available. |
int |
getIndexOfLaterOrEqualSynchronizationSample(long timeUs)Returns the sample index of the closest synchronization sample at or after the given timestamp, if one is available. |
boolean |
Returns whether the per-sample mapping arrays (such as |
Public fields
hasOnlySyncSamples
public final boolean hasOnlySyncSamples
Whether all samples in the track are sync samples.
offsets
public final long[] offsets
Sample offsets in bytes. Populated only if hasSampleTableData is true.
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. Populated only if hasSampleTableData is
true.
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 |
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 |
hasSampleTableData
public boolean hasSampleTableData()
Returns whether the per-sample mapping arrays (such as offsets, sizes, timestampsUs, and flags) are populated.
When FLAG_OMIT_TRACK_SAMPLE_TABLE is set, this returns false while sampleCount may still be greater than 0.