-
- All Implemented Interfaces:
-
com.otaliastudios.transcoder.source.DataSource
public class TrimDataSource extends DataSourceWrapper
A DataSource that trims the inner source at both ends.
-
-
Constructor Summary
Constructors Constructor Description TrimDataSource(DataSource source, long trimStartUs)TrimDataSource(DataSource source, long trimStartUs, long trimEndUs)
-
Method Summary
Modifier and Type Method Description booleanisInitialized()voiddeinitialize()voidinitialize()longgetDurationUs()Returns the video total duration in microseconds. longgetPositionUs()Returns the current read position, between 0 and duration. booleancanReadTrack(@NonNull() TrackType type)Returns true if we can read the given track at this point. booleanisDrained()When this source has been totally read, it can return true here tonotify an end of input stream. longseekTo(long desiredPositionUs)Moves all selected tracks to the specified presentation time. -
Methods inherited from class com.otaliastudios.transcoder.source.DataSourceWrapper
getLocation, getOrientation, getTrackFormat, readTrack, releaseTrack, selectTrack -
Methods inherited from class com.otaliastudios.transcoder.source.DataSource
readTrack -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
TrimDataSource
TrimDataSource(DataSource source, long trimStartUs)
-
TrimDataSource
TrimDataSource(DataSource source, long trimStartUs, long trimEndUs)
-
-
Method Detail
-
isInitialized
boolean isInitialized()
-
deinitialize
void deinitialize()
-
initialize
void initialize()
-
getDurationUs
long getDurationUs()
Returns the video total duration in microseconds.
-
getPositionUs
long getPositionUs()
Returns the current read position, between 0 and duration.
-
canReadTrack
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
-
isDrained
boolean isDrained()
When this source has been totally read, it can return true here tonotify an end of input stream.
-
seekTo
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
-
-
-
-