public final class SingleSampleMediaChunk extends BaseMediaChunk
BaseMediaChunk
for chunks consisting of a single raw sample.isMediaFormatFinal
chunkIndex, endTimeUs, startTimeUs
dataSource, dataSpec, format, NO_PARENT_ID, parentId, trigger, TRIGGER_ADAPTIVE, TRIGGER_CUSTOM_BASE, TRIGGER_INITIAL, TRIGGER_MANUAL, TRIGGER_TRICK_PLAY, TRIGGER_UNSPECIFIED, type, TYPE_CUSTOM_BASE, TYPE_DRM, TYPE_MANIFEST, TYPE_MEDIA, TYPE_MEDIA_INITIALIZATION, TYPE_UNSPECIFIED
Constructor and Description |
---|
SingleSampleMediaChunk(DataSource dataSource,
DataSpec dataSpec,
int trigger,
Format format,
long startTimeUs,
long endTimeUs,
int chunkIndex,
MediaFormat sampleFormat,
DrmInitData sampleDrmInitData,
int parentId) |
Modifier and Type | Method and Description |
---|---|
long |
bytesLoaded()
Gets the number of bytes that have been loaded.
|
void |
cancelLoad()
Cancels the load.
|
DrmInitData |
getDrmInitData()
Gets the
DrmInitData corresponding to the chunk. |
MediaFormat |
getMediaFormat()
Gets the
MediaFormat corresponding to the chunk. |
boolean |
isLoadCanceled()
Whether the load has been canceled.
|
void |
load()
Performs the load, returning on completion or cancelation.
|
getFirstSampleIndex, getOutput, init
getDurationUs, getNextChunkIndex
public SingleSampleMediaChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format, long startTimeUs, long endTimeUs, int chunkIndex, MediaFormat sampleFormat, DrmInitData sampleDrmInitData, int parentId)
dataSource
- A DataSource
for loading the data.dataSpec
- Defines the data to be loaded.trigger
- The reason for this chunk being selected.format
- The format of the stream to which this chunk belongs.startTimeUs
- The start time of the media contained by the chunk, in microseconds.endTimeUs
- The end time of the media contained by the chunk, in microseconds.chunkIndex
- The index of the chunk.sampleFormat
- The format of the sample.sampleDrmInitData
- The DrmInitData
for the sample. Null if the sample is not drm
protected.parentId
- Identifier for a parent from which this chunk originates.public long bytesLoaded()
Chunk
bytesLoaded
in class Chunk
public MediaFormat getMediaFormat()
BaseMediaChunk
MediaFormat
corresponding to the chunk.
See BaseMediaChunk.isMediaFormatFinal
for information about when this method is guaranteed to return
correct data.
getMediaFormat
in class BaseMediaChunk
MediaFormat
corresponding to this chunk.public DrmInitData getDrmInitData()
BaseMediaChunk
DrmInitData
corresponding to the chunk.
See BaseMediaChunk.isMediaFormatFinal
for information about when this method is guaranteed to return
correct data.
getDrmInitData
in class BaseMediaChunk
DrmInitData
corresponding to this chunk.public void cancelLoad()
Loader.Loadable
public boolean isLoadCanceled()
Loader.Loadable
public void load() throws IOException, InterruptedException
Loader.Loadable
IOException
InterruptedException