public abstract class Chunk extends Object implements Loader.Loadable
Loader.Loadable
implementations that load chunks of data required
for the playback of streams.Modifier and Type | Field and Description |
---|---|
protected StatsDataSource |
dataSource |
DataSpec |
dataSpec
The
DataSpec that defines the data to be loaded. |
long |
endTimeUs
The end time of the media contained by the chunk, or
C.TIME_UNSET if the data being
loaded does not contain media samples. |
long |
startTimeUs
The start time of the media contained by the chunk, or
C.TIME_UNSET if the data
being loaded does not contain media samples. |
Format |
trackFormat
The format of the track to which this chunk belongs, or null if the chunk does not belong to
a track.
|
Object |
trackSelectionData
Optional data associated with the selection of the track to which this chunk belongs.
|
int |
trackSelectionReason
One of the
C SELECTION_REASON_* constants if the chunk belongs to a track. |
int |
type
The type of the chunk.
|
Constructor and Description |
---|
Chunk(DataSource dataSource,
DataSpec dataSpec,
int type,
Format trackFormat,
int trackSelectionReason,
Object trackSelectionData,
long startTimeUs,
long endTimeUs) |
Modifier and Type | Method and Description |
---|---|
long |
bytesLoaded()
Returns the number of bytes that have been loaded.
|
long |
getDurationUs()
Returns the duration of the chunk in microseconds.
|
Map<String,List<String>> |
getResponseHeaders()
Returns the response headers associated with the last
DataSource.open(com.google.android.exoplayer2.upstream.DataSpec) call. |
Uri |
getUri()
Returns the
Uri associated with the last DataSource.open(com.google.android.exoplayer2.upstream.DataSpec) call. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cancelLoad, load
public final int type
DATA_TYPE_*
constants defined in C
. For
reporting only.public final Format trackFormat
public final int trackSelectionReason
C
SELECTION_REASON_*
constants if the chunk belongs to a track.
C.SELECTION_REASON_UNKNOWN
if the chunk does not belong to a track.@Nullable public final Object trackSelectionData
public final long startTimeUs
C.TIME_UNSET
if the data
being loaded does not contain media samples.public final long endTimeUs
C.TIME_UNSET
if the data being
loaded does not contain media samples.protected final StatsDataSource dataSource
public Chunk(DataSource dataSource, DataSpec dataSpec, int type, Format trackFormat, int trackSelectionReason, @Nullable Object trackSelectionData, long startTimeUs, long endTimeUs)
dataSource
- The source from which the data should be loaded.dataSpec
- Defines the data to be loaded.type
- See type
.trackFormat
- See trackFormat
.trackSelectionReason
- See trackSelectionReason
.trackSelectionData
- See trackSelectionData
.startTimeUs
- See startTimeUs
.endTimeUs
- See endTimeUs
.public final long getDurationUs()
public final long bytesLoaded()
public final Uri getUri()
Uri
associated with the last DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)
call. If redirection
occurred, this is the redirected uri. Must only be called after the load completed, failed, or
was canceled.DataSource.getUri()
public final Map<String,List<String>> getResponseHeaders()
DataSource.open(com.google.android.exoplayer2.upstream.DataSpec)
call. Must only
be called after the load completed, failed, or was canceled.DataSource.getResponseHeaders()