public interface SampleStream
Modifier and Type | Method and Description |
---|---|
boolean |
isReady()
Returns whether data is available to be read.
|
void |
maybeThrowError()
Throws an error that's preventing data from being read.
|
int |
readData(FormatHolder formatHolder,
DecoderInputBuffer buffer)
Attempts to read from the stream.
|
void |
skipToKeyframeBefore(long timeUs)
Attempts to skip to the keyframe before the specified time.
|
boolean isReady()
Note: If the stream has ended then a buffer with the end of stream flag can always be read from
readData(FormatHolder, DecoderInputBuffer)
. Hence an ended stream is always ready.
void maybeThrowError() throws IOException
IOException
- The underlying error.int readData(FormatHolder formatHolder, DecoderInputBuffer buffer)
formatHolder
- A FormatHolder
to populate in the case of reading a format.buffer
- A DecoderInputBuffer
to populate in the case of reading a sample or the
end of the stream. If the end of the stream has been reached, the
C.BUFFER_FLAG_END_OF_STREAM
flag will be set on the buffer.C.RESULT_NOTHING_READ
, C.RESULT_FORMAT_READ
or
C.RESULT_BUFFER_READ
.void skipToKeyframeBefore(long timeUs)
timeUs
- The specified time.