MetadataInputBuffer, SubtitleInputBuffer, VideoDecoderInputBufferpublic class DecoderInputBuffer extends Buffer
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
DecoderInputBuffer.BufferReplacementMode |
The buffer replacement mode.
|
static class |
DecoderInputBuffer.InsufficientCapacityException |
Thrown when an attempt is made to write into a
DecoderInputBuffer whose bufferReplacementMode is BUFFER_REPLACEMENT_MODE_DISABLED and who data
capacity is smaller than required. |
| Modifier and Type | Field | Description |
|---|---|---|
static int |
BUFFER_REPLACEMENT_MODE_DIRECT |
Allows buffer replacement using
ByteBuffer.allocateDirect(int). |
static int |
BUFFER_REPLACEMENT_MODE_DISABLED |
Disallows buffer replacement.
|
static int |
BUFFER_REPLACEMENT_MODE_NORMAL |
Allows buffer replacement using
ByteBuffer.allocate(int). |
CryptoInfo |
cryptoInfo |
CryptoInfo for encrypted data. |
ByteBuffer |
data |
The buffer's data, or
null if no data has been set. |
ByteBuffer |
supplementalData |
Supplemental data related to the buffer, if
Buffer.hasSupplementalData() returns true. |
long |
timeUs |
The time at which the sample should be presented.
|
boolean |
waitingForKeys |
Whether the last attempt to read a sample into this buffer failed due to not yet having the DRM
keys associated with the next sample.
|
| Constructor | Description |
|---|---|
DecoderInputBuffer(int bufferReplacementMode) |
Creates a new instance.
|
DecoderInputBuffer(int bufferReplacementMode,
int paddingSize) |
Creates a new instance.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
clear() |
Clears the buffer.
|
void |
ensureSpaceForWrite(int length) |
Ensures that
data is large enough to accommodate a write of a given length at its
current position. |
void |
flip() |
Flips
data and supplementalData in preparation for being queued to a decoder. |
boolean |
isEncrypted() |
Returns whether the
C.BUFFER_FLAG_ENCRYPTED flag is set. |
boolean |
isFlagsOnly() |
Returns whether the buffer is only able to hold flags, meaning
data is null and
its replacement mode is BUFFER_REPLACEMENT_MODE_DISABLED. |
static DecoderInputBuffer |
newFlagsOnlyInstance() |
Creates a new instance for which
isFlagsOnly() will return true. |
void |
resetSupplementalData(int length) |
Clears
supplementalData and ensures that it's large enough to accommodate
length bytes. |
addFlag, clearFlag, getFlag, hasSupplementalData, isDecodeOnly, isEndOfStream, isKeyFrame, setFlagspublic static final int BUFFER_REPLACEMENT_MODE_DISABLED
public static final int BUFFER_REPLACEMENT_MODE_NORMAL
ByteBuffer.allocate(int).public static final int BUFFER_REPLACEMENT_MODE_DIRECT
ByteBuffer.allocateDirect(int).public final CryptoInfo cryptoInfo
CryptoInfo for encrypted data.@Nullable public ByteBuffer data
null if no data has been set.public boolean waitingForKeys
public long timeUs
@Nullable public ByteBuffer supplementalData
Buffer.hasSupplementalData() returns true. If
present, the buffer is populated with supplemental data from position 0 to its limit.public DecoderInputBuffer(@BufferReplacementMode int bufferReplacementMode)
bufferReplacementMode - The DecoderInputBuffer.BufferReplacementMode replacement mode.public DecoderInputBuffer(@BufferReplacementMode int bufferReplacementMode, int paddingSize)
bufferReplacementMode - The DecoderInputBuffer.BufferReplacementMode replacement mode.paddingSize - If non-zero, ensureSpaceForWrite(int) will ensure that the buffer
is this number of bytes larger than the requested length. This can be useful for decoders
that consume data in fixed size blocks, for efficiency. Setting the padding size to the
decoder's fixed read size is necessary to prevent such a decoder from trying to read beyond
the end of the buffer.public static DecoderInputBuffer newFlagsOnlyInstance()
isFlagsOnly() will return true.@EnsuresNonNull("supplementalData")
public void resetSupplementalData(int length)
supplementalData and ensures that it's large enough to accommodate
length bytes.length - The length of the supplemental data that must be accommodated, in bytes.@EnsuresNonNull("data")
public void ensureSpaceForWrite(int length)
data is large enough to accommodate a write of a given length at its
current position.
If the capacity of data is sufficient this method does nothing. If the capacity is
insufficient then an attempt is made to replace data with a new ByteBuffer
whose capacity is sufficient. Data up to the current position is copied to the new buffer.
length - The length of the write that must be accommodated, in bytes.DecoderInputBuffer.InsufficientCapacityException - If there is insufficient capacity to accommodate the
write and bufferReplacementMode is BUFFER_REPLACEMENT_MODE_DISABLED.public final boolean isFlagsOnly()
data is null and
its replacement mode is BUFFER_REPLACEMENT_MODE_DISABLED.public final boolean isEncrypted()
C.BUFFER_FLAG_ENCRYPTED flag is set.public final void flip()
data and supplementalData in preparation for being queued to a decoder.Buffer.flip()