Decoder<I,O,E>FlacDecoder, Gav1Decoder, OpusDecoder, SimpleSubtitleDecoder, VpxDecoderpublic abstract class SimpleDecoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException> extends Object implements Decoder<I,O,E>
Decoders that use their own decode thread and decode each input buffer
immediately into a corresponding output buffer.| Modifier | Constructor | Description |
|---|---|---|
protected |
SimpleDecoder(I[] inputBuffers,
O[] outputBuffers) |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract I |
createInputBuffer() |
Creates a new input buffer.
|
protected abstract O |
createOutputBuffer() |
Creates a new output buffer.
|
protected abstract E |
createUnexpectedDecodeException(Throwable error) |
Creates an exception to propagate for an unexpected decode error.
|
protected abstract E |
decode(I inputBuffer,
O outputBuffer,
boolean reset) |
Decodes the
inputBuffer and stores any decoded output in outputBuffer. |
I |
dequeueInputBuffer() |
Dequeues the next input buffer to be filled and queued to the decoder.
|
O |
dequeueOutputBuffer() |
Dequeues the next output buffer from the decoder.
|
void |
flush() |
Flushes the decoder.
|
void |
queueInputBuffer(I inputBuffer) |
Queues an input buffer to the decoder.
|
void |
release() |
Releases the decoder.
|
protected void |
releaseOutputBuffer(O outputBuffer) |
Releases an output buffer back to the decoder.
|
protected void |
setInitialInputBufferSize(int size) |
Sets the initial size of each input buffer.
|
protected final void setInitialInputBufferSize(int size)
This method should only be called before the decoder is used (i.e. before the first call to
dequeueInputBuffer().
size - The required input buffer size.@Nullable public final I dequeueInputBuffer() throws E extends DecoderException
DecoderdequeueInputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException>E - If a decoder error has occurred.E extends DecoderExceptionpublic final void queueInputBuffer(I inputBuffer) throws E extends DecoderException
DecoderqueueInputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException>inputBuffer - The input buffer.E - If a decoder error has occurred.E extends DecoderException@Nullable public final O dequeueOutputBuffer() throws E extends DecoderException
DecoderdequeueOutputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException>E - If a decoder error has occurred.E extends DecoderException@CallSuper protected void releaseOutputBuffer(O outputBuffer)
outputBuffer - The output buffer being released.public final void flush()
Decoderflush in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException>@CallSuper public void release()
Decoderrelease in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends DecoderException>protected abstract I createInputBuffer()
protected abstract O createOutputBuffer()
protected abstract E createUnexpectedDecodeException(Throwable error)
error - The unexpected decode error.@Nullable protected abstract E decode(I inputBuffer, O outputBuffer, boolean reset)
inputBuffer and stores any decoded output in outputBuffer.inputBuffer - The buffer to decode.outputBuffer - The output buffer to store decoded data. The flag C.BUFFER_FLAG_DECODE_ONLY will be set if the same flag is set on inputBuffer, but
may be set/unset as required. If the flag is set when the call returns then the output
buffer will not be made available to dequeue. The output buffer may not have been populated
in this case.reset - Whether the decoder must be reset before decoding.