public class DecoderInputBuffer extends Buffer
Modifier and Type | Class and Description |
---|---|
static interface |
DecoderInputBuffer.BufferReplacementMode
The buffer replacement mode, which may disable replacement.
|
Modifier and Type | Field and 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. |
java.nio.ByteBuffer |
data
The buffer's data, or
null if no data has been set. |
long |
timeUs
The time at which the sample should be presented.
|
Constructor and Description |
---|
DecoderInputBuffer(int bufferReplacementMode) |
Modifier and Type | Method and 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 in preparation for being queued to a decoder. |
boolean |
isEncrypted()
Returns whether the
C.BUFFER_FLAG_ENCRYPTED flag is set. |
addFlag, clearFlag, getFlag, isDecodeOnly, isEndOfStream, isKeyFrame, setFlags
public 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.public java.nio.ByteBuffer data
null
if no data has been set.public long timeUs
public DecoderInputBuffer(int bufferReplacementMode)
bufferReplacementMode
- Determines the behavior of ensureSpaceForWrite(int)
. One
of BUFFER_REPLACEMENT_MODE_DISABLED
, BUFFER_REPLACEMENT_MODE_NORMAL
and
BUFFER_REPLACEMENT_MODE_DIRECT
.public void ensureSpaceForWrite(int length) throws java.lang.IllegalStateException
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.java.lang.IllegalStateException
- If there is insufficient capacity to accommodate the write and
the buffer replacement mode of the holder is BUFFER_REPLACEMENT_MODE_DISABLED
.public final boolean isEncrypted()
C.BUFFER_FLAG_ENCRYPTED
flag is set.public final void flip()
data
in preparation for being queued to a decoder.Buffer.flip()