ContainerMediaChunk
@UnstableApi
public class ContainerMediaChunk extends BaseMediaChunk
A BaseMediaChunk that uses an Extractor to decode sample data.
Summary
Public fields |
|
|---|---|
long |
Public constructors |
|---|
ContainerMediaChunk( |
Public methods |
|
|---|---|
final void |
Cancels the load. |
long |
Returns the next chunk index or |
final long |
Returns the next position to load in the chunk on a |
final boolean |
Returns whether the current chunk's load has been canceled from |
boolean |
Returns whether the chunk has been fully loaded. |
final void |
load()Performs the load, returning on completion or cancellation. |
Protected methods |
|
|---|---|
ChunkExtractor.TrackOutputProvider |
getTrackOutputProvider(BaseMediaChunkOutput baseMediaChunkOutput)Returns the |
void |
Method that is called to signal that a |
Inherited fields |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||
|
||||||||||||||||||
|
Inherited methods |
||||||
|---|---|---|---|---|---|---|
|
||||||
Public fields
Public constructors
ContainerMediaChunk
public ContainerMediaChunk(
DataSource dataSource,
DataSpec dataSpec,
Format trackFormat,
@C.SelectionReason int trackSelectionReason,
@Nullable Object trackSelectionData,
long startTimeUs,
long endTimeUs,
long clippedStartTimeUs,
long clippedEndTimeUs,
long chunkIndex,
int chunkCount,
long sampleOffsetUs,
ChunkExtractor chunkExtractor
)
| Parameters | |
|---|---|
DataSource dataSource |
The source from which the data should be loaded. |
DataSpec dataSpec |
Defines the data to be loaded. |
Format trackFormat |
See |
@C.SelectionReason int trackSelectionReason |
See |
@Nullable Object trackSelectionData |
See |
long startTimeUs |
The start time of the media contained by the chunk, in microseconds. |
long endTimeUs |
The end time of the media contained by the chunk, in microseconds. |
long clippedStartTimeUs |
The time in the chunk from which output will begin, or |
long clippedEndTimeUs |
The time in the chunk from which output will end, or |
long chunkIndex |
The index of the chunk, or |
int chunkCount |
The number of chunks in the underlying media that are spanned by this instance. Normally equal to one, but may be larger if multiple chunks as defined by the underlying media are being merged into a single load. |
long sampleOffsetUs |
An offset to add to the sample timestamps parsed by the extractor. |
ChunkExtractor chunkExtractor |
A wrapped extractor to use for parsing the data. |
Public methods
cancelLoad
public final void cancelLoad()
Cancels the load.
Loadable implementations should ensure that a currently executing load call will exit reasonably quickly after this method is called. The load call may exit either by returning or by throwing an IOException.
If there is a currently executing load call, then the thread on which that call is being made will be interrupted immediately after the call to this method. Hence implementations do not need to (and should not attempt to) interrupt the loading thread themselves.
Although the loading thread will be interrupted, Loadable implementations should not use the interrupted status of the loading thread in load to determine whether the load has been canceled. This approach is not robust [Internal ref: b/79223737]. Instead, implementations should use their own flag to signal cancelation (for example, using AtomicBoolean).
getNextChunkIndex
public long getNextChunkIndex()
Returns the next chunk index or INDEX_UNSET if it is not known.
getNextLoadPosition
public final long getNextLoadPosition()
Returns the next position to load in the chunk on a load.
isLoadCanceled
public final boolean isLoadCanceled()
Returns whether the current chunk's load has been canceled from cancelLoad.
load
public final void load()
Performs the load, returning on completion or cancellation.
| Throws | |
|---|---|
java.io.IOException |
If the input could not be loaded. |
Protected methods
getTrackOutputProvider
protected ChunkExtractor.TrackOutputProvider getTrackOutputProvider(BaseMediaChunkOutput baseMediaChunkOutput)
Returns the TrackOutputProvider to be used by the wrapped extractor.
| Parameters | |
|---|---|
BaseMediaChunkOutput baseMediaChunkOutput |
The |
| Returns | |
|---|---|
ChunkExtractor.TrackOutputProvider |
A |
onLoadEnded
@ForOverride
protected void onLoadEnded()
Method that is called to signal that a load has concluded. This is called in both successful and error scenarios before the DataSource is closed.