public class TrimDataSource extends DataSourceWrapper
DataSource that trims the inner source at both ends.DataSource.Chunk| Constructor and Description |
|---|
TrimDataSource(DataSource source,
long trimStartUs) |
TrimDataSource(DataSource source,
long trimStartUs,
long trimEndUs) |
| 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.
|
boolean |
isDrained()
When this source has been totally read, it can return true here to
notify an end of input stream.
|
void |
rewind()
Rewinds this source, moving it to its default state.
|
long |
seekTo(long durationUs)
Moves all selected tracks to the specified presentation time.
|
getLocation, getOrientation, getReadUs, getSource, getTrackFormat, readTrack, releaseTrack, selectTrackpublic TrimDataSource(@NonNull
DataSource source,
long trimStartUs)
public TrimDataSource(@NonNull
DataSource source,
long trimStartUs,
long trimEndUs)
public long getDurationUs()
DataSourcegetDurationUs in interface DataSourcegetDurationUs in class DataSourceWrapperpublic boolean canReadTrack(@NonNull
TrackType type)
DataSourceDataSource.readTrack(Chunk) call.canReadTrack in interface DataSourcecanReadTrack in class DataSourceWrappertype - track typepublic boolean isDrained()
DataSourceisDrained in interface DataSourceisDrained in class DataSourceWrapperpublic long seekTo(long durationUs)
DataSourceDataSource.getDurationUs().
The actual timestamp might differ from the desired one because of
seeking constraints (e.g. seek to sync frames).seekTo in interface DataSourceseekTo in class DataSourceWrapperdurationUs - requested timestamppublic void rewind()
DataSourceDataSource.getReadUs() should be 0
- DataSource.isDrained() should be false
- DataSource.readTrack(Chunk) should return the very first bytesrewind in interface DataSourcerewind in class DataSourceWrapper