Class ChunkSampleStream.EmbeddedSampleStream
- java.lang.Object
-
- com.google.android.exoplayer2.source.chunk.ChunkSampleStream.EmbeddedSampleStream
-
- All Implemented Interfaces:
SampleStream
- Enclosing class:
- ChunkSampleStream<T extends ChunkSource>
public final class ChunkSampleStream.EmbeddedSampleStream extends Object implements SampleStream
ASampleStream
embedded in aChunkSampleStream
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.SampleStream
SampleStream.ReadDataResult, SampleStream.ReadFlags
-
-
Field Summary
Fields Modifier and Type Field Description ChunkSampleStream<T>
parent
-
Fields inherited from interface com.google.android.exoplayer2.source.SampleStream
FLAG_OMIT_SAMPLE_DATA, FLAG_PEEK, FLAG_REQUIRE_FORMAT
-
-
Constructor Summary
Constructors Constructor Description EmbeddedSampleStream(ChunkSampleStream<T> parent, SampleQueue sampleQueue, int index)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int readFlags)
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 ifpositionUs
is beyond it.
-
-
-
Field Detail
-
parent
public final ChunkSampleStream<T extends ChunkSource> parent
-
-
Constructor Detail
-
EmbeddedSampleStream
public EmbeddedSampleStream(ChunkSampleStream<T> parent, SampleQueue sampleQueue, int index)
-
-
Method Detail
-
isReady
public boolean isReady()
Description copied from interface:SampleStream
Returns whether data is available to be read.Note: If the stream has ended then a buffer with the end of stream flag can always be read from
SampleStream.readData(com.google.android.exoplayer2.FormatHolder, com.google.android.exoplayer2.decoder.DecoderInputBuffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int)
. Hence an ended stream is always ready.- Specified by:
isReady
in interfaceSampleStream
- Returns:
- Whether data is available to be read.
-
skipData
public int skipData(long positionUs)
Description copied from interface:SampleStream
Attempts to skip to the keyframe before the specified position, or to the end of the stream ifpositionUs
is beyond it.- Specified by:
skipData
in interfaceSampleStream
- Parameters:
positionUs
- The specified time.- Returns:
- The number of samples that were skipped.
-
maybeThrowError
public void maybeThrowError()
Description copied from interface:SampleStream
Throws an error that's preventing data from being read. Does nothing if no such error exists.- Specified by:
maybeThrowError
in interfaceSampleStream
-
readData
public int readData(FormatHolder formatHolder, DecoderInputBuffer buffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int readFlags)
Description copied from interface:SampleStream
Attempts to read from the stream.If the stream has ended then
C.BUFFER_FLAG_END_OF_STREAM
flag is set onbuffer
andC.RESULT_BUFFER_READ
is returned. Else if no data is available thenC.RESULT_NOTHING_READ
is returned. Else if the format of the media is changing or ifformatRequired
is set thenformatHolder
is populated andC.RESULT_FORMAT_READ
is returned. Elsebuffer
is populated andC.RESULT_BUFFER_READ
is returned.- Specified by:
readData
in interfaceSampleStream
- Parameters:
formatHolder
- AFormatHolder
to populate in the case of reading a format.buffer
- ADecoderInputBuffer
to populate in the case of reading a sample or the end of the stream. If the end of the stream has been reached, theC.BUFFER_FLAG_END_OF_STREAM
flag will be set on the buffer.readFlags
- Flags controlling the behavior of this read operation.- Returns:
- The
result
of the read operation.
-
release
public void release()
-
-