public final class ChunkSampleStream.EmbeddedSampleStream extends java.lang.Object implements SampleStream
SampleStream embedded in a ChunkSampleStream.| Modifier and Type | Field and Description |
|---|---|
ChunkSampleStream<T> |
parent |
| Constructor and Description |
|---|
EmbeddedSampleStream(ChunkSampleStream<T> parent,
SampleQueue sampleQueue,
int index) |
| 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,
boolean formatRequired)
Attempts to read from the stream.
|
void |
release() |
int |
skipData(long positionUs)
Attempts to skip to the keyframe before the specified position, or to the end of the stream if
positionUs is beyond it. |
public final ChunkSampleStream<T extends ChunkSource> parent
public EmbeddedSampleStream(ChunkSampleStream<T> parent, SampleQueue sampleQueue, int index)
public boolean isReady()
SampleStream
Note: If the stream has ended then a buffer with the end of stream flag can always be read from
SampleStream.readData(FormatHolder, DecoderInputBuffer, boolean). Hence an ended stream is always
ready.
isReady in interface SampleStreampublic int skipData(long positionUs)
SampleStreampositionUs is beyond it.skipData in interface SampleStreampositionUs - The specified time.public void maybeThrowError()
throws java.io.IOException
SampleStreammaybeThrowError in interface SampleStreamjava.io.IOException - The underlying error.public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer, boolean formatRequired)
SampleStream
If the stream has ended then C.BUFFER_FLAG_END_OF_STREAM flag is set on buffer
and C.RESULT_BUFFER_READ is returned. Else if no data is available then
C.RESULT_NOTHING_READ is returned. Else if the format of the media is changing or if
formatRequired is set then formatHolder is populated and
C.RESULT_FORMAT_READ is returned. Else buffer is populated and
C.RESULT_BUFFER_READ is returned.
readData in interface SampleStreamformatHolder - 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.formatRequired - Whether the caller requires that the format of the stream be read even if
it's not changing. A sample will never be read if set to true, however it is still possible
for the end of stream or nothing to be read.C.RESULT_NOTHING_READ, C.RESULT_FORMAT_READ or
C.RESULT_BUFFER_READ.public void release()