public interface DataSource
| Modifier and Type | Interface and Description |
|---|---|
static class |
DataSource.Chunk
Represents a chunk of data.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canReadTrack(TrackType type)
Returns true if we can read the given track at this point.
|
long |
getDurationUs()
Returns the video total duration in microseconds.
|
double[] |
getLocation()
Metadata information.
|
int |
getOrientation()
Metadata information.
|
long |
getReadUs()
Returns the total number of microseconds that have been read until now.
|
android.media.MediaFormat |
getTrackFormat(TrackType type)
Called before starting to inspect the input format for this track.
|
boolean |
isDrained()
When this source has been totally read, it can return true here to
notify an end of input stream.
|
void |
readTrack(DataSource.Chunk chunk)
Called to read contents for the current track type.
|
void |
releaseTrack(TrackType type)
Called to release resources for a given track.
|
void |
rewind()
Rewinds this source, moving it to its default state.
|
long |
seekTo(long desiredTimestampUs)
Moves all selected tracks to the specified presentation time.
|
void |
selectTrack(TrackType type)
Called before starting, but after
getTrackFormat(TrackType),
to select the given track. |
int getOrientation()
@Nullable double[] getLocation()
long getDurationUs()
@Nullable
android.media.MediaFormat getTrackFormat(@NonNull
TrackType type)
type - track typevoid selectTrack(@NonNull
TrackType type)
getTrackFormat(TrackType),
to select the given track.type - track typelong seekTo(long desiredTimestampUs)
getDurationUs().
The actual timestamp might differ from the desired one because of
seeking constraints (e.g. seek to sync frames).desiredTimestampUs - requested timestampboolean canReadTrack(@NonNull
TrackType type)
readTrack(Chunk) call.type - track typevoid readTrack(@NonNull
DataSource.Chunk chunk)
DataSource.Chunk.buffer, and the
other chunk flags should be filled.chunk - output chunklong getReadUs()
boolean isDrained()
void releaseTrack(@NonNull
TrackType type)
type - track typevoid rewind()
getReadUs() should be 0
- isDrained() should be false
- readTrack(Chunk) should return the very first bytes