public abstract class BaseMediaChunk extends MediaChunk
MediaChunk
, for chunks that contain a single track.
Loaded samples are output to a DefaultTrackOutput
.
Modifier and Type | Field and Description |
---|---|
boolean |
isMediaFormatFinal
Whether
getMediaFormat() and getDrmInitData() can be called at any time to
obtain the chunk's media format and drm initialization data. |
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 |
---|
BaseMediaChunk(DataSource dataSource,
DataSpec dataSpec,
int trigger,
Format format,
long startTimeUs,
long endTimeUs,
int chunkIndex,
boolean isMediaFormatFinal,
int parentId) |
Modifier and Type | Method and Description |
---|---|
abstract DrmInitData |
getDrmInitData()
Gets the
DrmInitData corresponding to the chunk. |
int |
getFirstSampleIndex()
Returns the index of the first sample in the output that was passed to
init(DefaultTrackOutput) that will originate from this chunk. |
abstract MediaFormat |
getMediaFormat()
Gets the
MediaFormat corresponding to the chunk. |
protected DefaultTrackOutput |
getOutput()
Returns the output most recently passed to
init(DefaultTrackOutput) . |
void |
init(DefaultTrackOutput output)
Initializes the chunk for loading, setting the
DefaultTrackOutput that will receive
samples as they are loaded. |
getDurationUs, getNextChunkIndex
bytesLoaded
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelLoad, isLoadCanceled, load
public final boolean isMediaFormatFinal
getMediaFormat()
and getDrmInitData()
can be called at any time to
obtain the chunk's media format and drm initialization data. If false, these methods are only
guaranteed to return correct data after the first sample data has been output from the chunk.public BaseMediaChunk(DataSource dataSource, DataSpec dataSpec, int trigger, Format format, long startTimeUs, long endTimeUs, int chunkIndex, boolean isMediaFormatFinal, 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.isMediaFormatFinal
- True if getMediaFormat()
and getDrmInitData()
can
be called at any time to obtain the media format and drm initialization data. False if
these methods are only guaranteed to return correct data after the first sample data has
been output from the chunk.parentId
- Identifier for a parent from which this chunk originates.public void init(DefaultTrackOutput output)
DefaultTrackOutput
that will receive
samples as they are loaded.output
- The output that will receive the loaded samples.public final int getFirstSampleIndex()
init(DefaultTrackOutput)
that will originate from this chunk.public abstract MediaFormat getMediaFormat()
MediaFormat
corresponding to the chunk.
See isMediaFormatFinal
for information about when this method is guaranteed to return
correct data.
MediaFormat
corresponding to this chunk.public abstract DrmInitData getDrmInitData()
DrmInitData
corresponding to the chunk.
See isMediaFormatFinal
for information about when this method is guaranteed to return
correct data.
DrmInitData
corresponding to this chunk.protected final DefaultTrackOutput getOutput()
init(DefaultTrackOutput)
.