InitializationChunk
@UnstableApi
public final class InitializationChunk extends Chunk
| java.lang.Object | ||
| ↳ | androidx.media3.exoplayer.source.chunk.Chunk | |
| ↳ | androidx.media3.exoplayer.source.chunk.InitializationChunk |
A Chunk that uses an Extractor to decode initialization data for single track.
Summary
Public fields |
|
|---|---|
@Nullable ChunkIndex |
Public constructors |
|---|
InitializationChunk( |
Public methods |
|
|---|---|
void |
Cancels the load. |
@Nullable ChunkIndex |
Returns the |
void |
init(ChunkExtractor.TrackOutputProvider trackOutputProvider)Initializes the chunk for loading, setting a |
void |
load()Performs the load, returning on completion or cancellation. |
Inherited fields |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
|---|
Public fields
Public constructors
InitializationChunk
public InitializationChunk(
DataSource dataSource,
DataSpec dataSpec,
Format trackFormat,
@C.SelectionReason int trackSelectionReason,
@Nullable Object trackSelectionData,
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 |
ChunkExtractor chunkExtractor |
A wrapped extractor to use for parsing the initialization data. |
Public methods
cancelLoad
public 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).
getChunkIndex
public @Nullable ChunkIndex getChunkIndex()
Returns the ChunkIndex obtained from the initialization chunk, or null if a ChunkIndex has not been obtained.
init
public void init(ChunkExtractor.TrackOutputProvider trackOutputProvider)
Initializes the chunk for loading, setting a TrackOutputProvider for track outputs to which formats will be written as they are loaded.
| Parameters | |
|---|---|
ChunkExtractor.TrackOutputProvider trackOutputProvider |
The |
load
public void load()
Performs the load, returning on completion or cancellation.
| Throws | |
|---|---|
java.io.IOException |
If the input could not be loaded. |