Class BinarySearchSeeker
- java.lang.Object
-
- com.google.android.exoplayer2.extractor.BinarySearchSeeker
-
@Deprecated public abstract class BinarySearchSeeker extends Object
Deprecated.com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.A seeker that supports seeking within a stream by searching for the target frame using binary search.This seeker operates on a stream that contains multiple frames (or samples). Each frame is associated with some kind of timestamps, such as stream time, or frame indices. Given a target seek time, the seeker will find the corresponding target timestamp, and perform a search operation within the stream to identify the target frame and return the byte position in the stream of the target frame.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBinarySearchSeeker.BinarySearchSeekMapDeprecated.ASeekMapimplementation that returns the estimated byte location fromBinarySearchSeeker.SeekOperationParams.calculateNextSearchBytePosition(long, long, long, long, long, long)for eachBinarySearchSeeker.BinarySearchSeekMap.getSeekPoints(long)query.static classBinarySearchSeeker.DefaultSeekTimestampConverterDeprecated.ABinarySearchSeeker.SeekTimestampConverterimplementation that returns the seek time itself as the timestamp for a seek time position.protected static classBinarySearchSeeker.SeekOperationParamsDeprecated.Contains parameters for a pending seek operation byBinarySearchSeeker.protected static interfaceBinarySearchSeeker.SeekTimestampConverterDeprecated.A converter that converts seek time in stream time into target timestamp for theBinarySearchSeeker.static classBinarySearchSeeker.TimestampSearchResultDeprecated.Represents possible search results forBinarySearchSeeker.TimestampSeeker.searchForTimestamp(ExtractorInput, long).protected static interfaceBinarySearchSeeker.TimestampSeekerDeprecated.A seeker that looks for a given timestamp from an input.
-
Field Summary
Fields Modifier and Type Field Description protected BinarySearchSeeker.BinarySearchSeekMapseekMapDeprecated.protected BinarySearchSeeker.SeekOperationParamsseekOperationParamsDeprecated.protected BinarySearchSeeker.TimestampSeekertimestampSeekerDeprecated.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBinarySearchSeeker(BinarySearchSeeker.SeekTimestampConverter seekTimestampConverter, BinarySearchSeeker.TimestampSeeker timestampSeeker, long durationUs, long floorTimePosition, long ceilingTimePosition, long floorBytePosition, long ceilingBytePosition, long approxBytesPerFrame, int minimumSearchRange)Deprecated.Constructs an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected BinarySearchSeeker.SeekOperationParamscreateSeekParamsForTargetTimeUs(long timeUs)Deprecated.SeekMapgetSeekMap()Deprecated.Returns the seek map for the stream.inthandlePendingSeek(ExtractorInput input, PositionHolder seekPositionHolder)Deprecated.Continues to handle the pending seek operation.booleanisSeeking()Deprecated.Returns whether the last operation set bysetSeekTargetUs(long)is still pending.protected voidmarkSeekOperationFinished(boolean foundTargetFrame, long resultPosition)Deprecated.protected voidonSeekOperationFinished(boolean foundTargetFrame, long resultPosition)Deprecated.protected intseekToPosition(ExtractorInput input, long position, PositionHolder seekPositionHolder)Deprecated.voidsetSeekTargetUs(long timeUs)Deprecated.Sets the target time in microseconds within the stream to seek to.protected booleanskipInputUntilPosition(ExtractorInput input, long position)Deprecated.
-
-
-
Field Detail
-
seekMap
protected final BinarySearchSeeker.BinarySearchSeekMap seekMap
Deprecated.
-
timestampSeeker
protected final BinarySearchSeeker.TimestampSeeker timestampSeeker
Deprecated.
-
seekOperationParams
@Nullable protected BinarySearchSeeker.SeekOperationParams seekOperationParams
Deprecated.
-
-
Constructor Detail
-
BinarySearchSeeker
protected BinarySearchSeeker(BinarySearchSeeker.SeekTimestampConverter seekTimestampConverter, BinarySearchSeeker.TimestampSeeker timestampSeeker, long durationUs, long floorTimePosition, long ceilingTimePosition, long floorBytePosition, long ceilingBytePosition, long approxBytesPerFrame, int minimumSearchRange)
Deprecated.Constructs an instance.- Parameters:
seekTimestampConverter- TheBinarySearchSeeker.SeekTimestampConverterthat converts seek time in stream time into target timestamp.timestampSeeker- ABinarySearchSeeker.TimestampSeekerthat will be used to search for timestamps within the stream.durationUs- The duration of the stream in microseconds.floorTimePosition- The minimum timestamp value (inclusive) in the stream.ceilingTimePosition- The minimum timestamp value (exclusive) in the stream.floorBytePosition- The starting position of the frame with minimum timestamp value (inclusive) in the stream.ceilingBytePosition- The position after the frame with maximum timestamp value in the stream.approxBytesPerFrame- Approximated bytes per frame.minimumSearchRange- The minimum byte range that this binary seeker will operate on. If the remaining search range is smaller than this value, the search will stop, and the seeker will return the position at the floor of the range as the result.
-
-
Method Detail
-
getSeekMap
public final SeekMap getSeekMap()
Deprecated.Returns the seek map for the stream.
-
setSeekTargetUs
public final void setSeekTargetUs(long timeUs)
Deprecated.Sets the target time in microseconds within the stream to seek to.- Parameters:
timeUs- The target time in microseconds within the stream.
-
isSeeking
public final boolean isSeeking()
Deprecated.Returns whether the last operation set bysetSeekTargetUs(long)is still pending.
-
handlePendingSeek
public int handlePendingSeek(ExtractorInput input, PositionHolder seekPositionHolder) throws IOException
Deprecated.Continues to handle the pending seek operation. Returns one of theRESULT_values fromExtractor.- Parameters:
input- TheExtractorInputfrom which data should be read.seekPositionHolder- IfExtractor.RESULT_SEEKis returned, this holder is updated to hold the position of the required seek.- Returns:
- One of the
RESULT_values defined inExtractor. - Throws:
IOException- If an error occurred reading from the input.
-
createSeekParamsForTargetTimeUs
protected BinarySearchSeeker.SeekOperationParams createSeekParamsForTargetTimeUs(long timeUs)
Deprecated.
-
markSeekOperationFinished
protected final void markSeekOperationFinished(boolean foundTargetFrame, long resultPosition)Deprecated.
-
onSeekOperationFinished
protected void onSeekOperationFinished(boolean foundTargetFrame, long resultPosition)Deprecated.
-
skipInputUntilPosition
protected final boolean skipInputUntilPosition(ExtractorInput input, long position) throws IOException
Deprecated.- Throws:
IOException
-
seekToPosition
protected final int seekToPosition(ExtractorInput input, long position, PositionHolder seekPositionHolder)
Deprecated.
-
-