protected static interface BinarySearchSeeker.TimestampSeeker
| Modifier and Type | Method and Description |
|---|---|
BinarySearchSeeker.TimestampSearchResult |
searchForTimestamp(ExtractorInput input,
long targetTimestamp,
BinarySearchSeeker.OutputFrameHolder outputFrameHolder)
Searches for a given timestamp from the input.
|
BinarySearchSeeker.TimestampSearchResult searchForTimestamp(ExtractorInput input, long targetTimestamp, BinarySearchSeeker.OutputFrameHolder outputFrameHolder) throws java.io.IOException, java.lang.InterruptedException
Given a target timestamp and an input stream, this seeker will try to read up to a range
of searchRangeBytes bytes from that input, look for all available timestamps from all
frames in that range, compare those with the target timestamp, and return one of the BinarySearchSeeker.TimestampSearchResult.
input - The ExtractorInput from which data should be read.targetTimestamp - The target timestamp that we are looking for.outputFrameHolder - If BinarySearchSeeker.TimestampSearchResult.RESULT_TARGET_TIMESTAMP_FOUND is
returned, this holder may be updated to hold the extracted frame that contains the target
frame/sample associated with the target timestamp.BinarySearchSeeker.TimestampSearchResult, that includes a BinarySearchSeeker.TimestampSearchResult.result
value, and other necessary info:
BinarySearchSeeker.TimestampSearchResult.RESULT_NO_TIMESTAMP is returned if there is no
timestamp in the reading range.
BinarySearchSeeker.TimestampSearchResult.RESULT_POSITION_UNDERESTIMATED is returned if all
timestamps in the range are smaller than the target timestamp.
BinarySearchSeeker.TimestampSearchResult.RESULT_POSITION_OVERESTIMATED is returned if all
timestamps in the range are larger than the target timestamp.
BinarySearchSeeker.TimestampSearchResult.RESULT_TARGET_TIMESTAMP_FOUND is returned if this
seeker can find a timestamp that it deems close enough to the given target.
java.io.IOException - If an error occurred reading from the input.java.lang.InterruptedException - If the thread was interrupted.