DecoderInputBuffer
@UnstableApi
public class DecoderInputBuffer extends Buffer
Holds input for a decoder.
Summary
Nested types |
|---|
@DocumentedThe buffer replacement mode. |
public final class DecoderInputBuffer.InsufficientCapacityException extends IllegalStateExceptionThrown when an attempt is made to write into a |
Constants |
|
|---|---|
static final int |
Allows buffer replacement using |
static final int |
Disallows buffer replacement. |
static final int |
Allows buffer replacement using |
Public fields |
|
|---|---|
final CryptoInfo |
|
@Nullable ByteBuffer |
The buffer's data, or |
@Nullable Format |
The |
@Nullable ByteBuffer |
Supplemental data related to the buffer, if |
long |
The time at which the sample should be presented. |
boolean |
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. |
Public constructors |
|---|
DecoderInputBuffer(Creates a new instance. |
DecoderInputBuffer(Creates a new instance. |
Public methods |
|
|---|---|
void |
clear()Clears the buffer. |
void |
@EnsuresNonNull(value = "data")Ensures that |
final void |
flip()Flips |
final boolean |
Returns whether the |
static DecoderInputBuffer |
Returns a new instance that's not able to hold any data. |
void |
@EnsuresNonNull(value = "supplementalData")Clears |
Inherited methods |
||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Constants
BUFFER_REPLACEMENT_MODE_DIRECT
public static final int BUFFER_REPLACEMENT_MODE_DIRECT = 2
Allows buffer replacement using allocateDirect.
BUFFER_REPLACEMENT_MODE_DISABLED
public static final int BUFFER_REPLACEMENT_MODE_DISABLED = 0
Disallows buffer replacement.
BUFFER_REPLACEMENT_MODE_NORMAL
public static final int BUFFER_REPLACEMENT_MODE_NORMAL = 1
Allows buffer replacement using allocate.
Public fields
supplementalData
public @Nullable ByteBuffer supplementalData
Supplemental data related to the buffer, if hasSupplementalData returns true. If present, the buffer is populated with supplemental data from position 0 to its limit.
waitingForKeys
public 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.
Public constructors
DecoderInputBuffer
public DecoderInputBuffer(
@DecoderInputBuffer.BufferReplacementMode int bufferReplacementMode
)
Creates a new instance.
| Parameters | |
|---|---|
@DecoderInputBuffer.BufferReplacementMode int bufferReplacementMode |
The |
DecoderInputBuffer
public DecoderInputBuffer(
@DecoderInputBuffer.BufferReplacementMode int bufferReplacementMode,
int paddingSize
)
Creates a new instance.
| Parameters | |
|---|---|
@DecoderInputBuffer.BufferReplacementMode int bufferReplacementMode |
The |
int paddingSize |
If non-zero, |
Public methods
ensureSpaceForWrite
@EnsuresNonNull(value = "data")
public void ensureSpaceForWrite(int length)
Ensures that 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.
| Parameters | |
|---|---|
int length |
The length of the write that must be accommodated, in bytes. |
| Throws | |
|---|---|
androidx.media3.decoder.DecoderInputBuffer.InsufficientCapacityException |
If there is insufficient capacity to accommodate the write and |
flip
public final void flip()
Flips data and supplementalData in preparation for being queued to a decoder.
| See also | |
|---|---|
flip |
isEncrypted
public final boolean isEncrypted()
Returns whether the BUFFER_FLAG_ENCRYPTED flag is set.
newNoDataInstance
public static DecoderInputBuffer newNoDataInstance()
Returns a new instance that's not able to hold any data.
resetSupplementalData
@EnsuresNonNull(value = "supplementalData")
public void resetSupplementalData(int length)
Clears supplementalData and ensures that it's large enough to accommodate
length bytes.
| Parameters | |
|---|---|
int length |
The length of the supplemental data that must be accommodated, in bytes. |