-
public interface DataSourceRepresents the source of input data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDataSource.ChunkRepresents a chunk of data.Can be used to read input from readTrack.
-
Method Summary
Modifier and Type Method Description abstract voidinitialize()abstract voiddeinitialize()abstract booleanisInitialized()abstract intgetOrientation()Metadata information. abstract Array<double>getLocation()Metadata information. abstract longgetDurationUs()Returns the video total duration in microseconds. abstract MediaFormatgetTrackFormat(@NonNull() TrackType type)Called before starting to inspect the input format for this track.Can return null if this media does not include this track type. abstract voidselectTrack(@NonNull() TrackType type)Called before starting, but after getTrackFormat,to select the given track. abstract longseekTo(long desiredPositionUs)Moves all selected tracks to the specified presentation time. abstract booleancanReadTrack(@NonNull() TrackType type)Returns true if we can read the given track at this point. abstract voidreadTrack(@NonNull() DataSource.Chunk chunk)Called to read contents for the current track type. abstract longgetPositionUs()Returns the current read position, between 0 and duration. abstract booleanisDrained()When this source has been totally read, it can return true here tonotify an end of input stream. abstract voidreleaseTrack(@NonNull() TrackType type)Called to release resources for a given track. -
-
Method Detail
-
initialize
abstract void initialize()
-
deinitialize
abstract void deinitialize()
-
isInitialized
abstract boolean isInitialized()
-
getOrientation
abstract int getOrientation()
Metadata information. Returns the video orientation, or 0.
-
getLocation
@Nullable() abstract Array<double> getLocation()
Metadata information. Returns the video location, or null.
-
getDurationUs
abstract long getDurationUs()
Returns the video total duration in microseconds.
-
getTrackFormat
@Nullable() abstract MediaFormat getTrackFormat(@NonNull() TrackType type)
Called before starting to inspect the input format for this track.Can return null if this media does not include this track type.
- Parameters:
type- track type
-
selectTrack
abstract void selectTrack(@NonNull() TrackType type)
Called before starting, but after getTrackFormat,to select the given track.
- Parameters:
type- track type
-
seekTo
abstract long seekTo(long desiredPositionUs)
Moves all selected tracks to the specified presentation time.The timestamp should be between 0 and getDurationUs.The actual timestamp might differ from the desired one because ofseeking constraints (e.g. seek to sync frames). It will typically be smallerbecause we use SEEK_TO_PREVIOUS_SYNC inthe default source.
- Parameters:
desiredPositionUs- requested timestamp
-
canReadTrack
abstract boolean canReadTrack(@NonNull() TrackType type)
Returns true if we can read the given track at this point.If true if returned, source should expect a readTrack call.
- Parameters:
type- track type
-
readTrack
abstract void readTrack(@NonNull() DataSource.Chunk chunk)
Called to read contents for the current track type.Contents should be put inside buffer, and theother chunk flags should be filled.
- Parameters:
chunk- output chunk
-
getPositionUs
abstract long getPositionUs()
Returns the current read position, between 0 and duration.
-
isDrained
abstract boolean isDrained()
When this source has been totally read, it can return true here tonotify an end of input stream.
-
releaseTrack
abstract void releaseTrack(@NonNull() TrackType type)
Called to release resources for a given track.
- Parameters:
type- track type
-
-
-
-