Interface SampleStream
-
- All Known Implementing Classes:
ChunkSampleStream
,ChunkSampleStream.EmbeddedSampleStream
,EmptySampleStream
,FakeSampleStream
@Deprecated public interface SampleStream
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 stream of media samples (and associated format information).
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SampleStream.ReadDataResult
Deprecated.static interface
SampleStream.ReadFlags
Deprecated.
-
Field Summary
Fields Modifier and Type Field Description static int
FLAG_OMIT_SAMPLE_DATA
Deprecated.Specifies thatDecoderInputBuffer.data
,DecoderInputBuffer.supplementalData
andDecoderInputBuffer.cryptoInfo
should not be populated when reading a sample buffer.static int
FLAG_PEEK
Deprecated.Specifies that the read position should not be advanced if a sample buffer is read.static int
FLAG_REQUIRE_FORMAT
Deprecated.Specifies that if a sample buffer would normally be read next, the format of the stream should be read instead.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description boolean
isReady()
Deprecated.Returns whether data is available to be read.void
maybeThrowError()
Deprecated.Throws an error that's preventing data from being read.@com.google.android.exoplayer2.source.SampleStream.ReadDataResult int
readData(FormatHolder formatHolder, DecoderInputBuffer buffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int readFlags)
Deprecated.Attempts to read from the stream.int
skipData(long positionUs)
Deprecated.Attempts to skip to the keyframe before the specified position, or to the end of the stream ifpositionUs
is beyond it.
-
-
-
Field Detail
-
FLAG_PEEK
static final int FLAG_PEEK
Deprecated.Specifies that the read position should not be advanced if a sample buffer is read.- See Also:
- Constant Field Values
-
FLAG_REQUIRE_FORMAT
static final int FLAG_REQUIRE_FORMAT
Deprecated.Specifies that if a sample buffer would normally be read next, the format of the stream should be read instead. In detail, the effect of this flag is as follows:- If a sample buffer would be read were the flag not set, then the stream format will be read instead.
- If nothing would be read were the flag not set, then the stream format will be read if it's known. If the stream format is not known then behavior is unchanged.
- If an end of stream buffer would be read were the flag not set, then behavior is unchanged.
- See Also:
- Constant Field Values
-
FLAG_OMIT_SAMPLE_DATA
static final int FLAG_OMIT_SAMPLE_DATA
Deprecated.Specifies thatDecoderInputBuffer.data
,DecoderInputBuffer.supplementalData
andDecoderInputBuffer.cryptoInfo
should not be populated when reading a sample buffer.This flag is useful for efficiently reading or (when combined with
FLAG_PEEK
) peeking sample metadata. It can also be used for efficiency by a caller wishing to skip a sample buffer.- See Also:
- Constant Field Values
-
-
Method Detail
-
isReady
boolean isReady()
Deprecated.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
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.- Returns:
- Whether data is available to be read.
-
maybeThrowError
void maybeThrowError() throws IOException
Deprecated.Throws an error that's preventing data from being read. Does nothing if no such error exists.- Throws:
IOException
- The underlying error.
-
readData
@com.google.android.exoplayer2.source.SampleStream.ReadDataResult int readData(FormatHolder formatHolder, DecoderInputBuffer buffer, @com.google.android.exoplayer2.source.SampleStream.ReadFlags int readFlags)
Deprecated.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.- 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. - Throws:
DecoderInputBuffer.InsufficientCapacityException
- If thebuffer
has insufficient capacity to hold the data of a sample being read. The buffertimestamp
and flags are populated if this exception is thrown, but the read position is not advanced.
-
skipData
int skipData(long positionUs)
Deprecated.Attempts to skip to the keyframe before the specified position, or to the end of the stream ifpositionUs
is beyond it.- Parameters:
positionUs
- The specified time.- Returns:
- The number of samples that were skipped.
-
-