Class SimpleDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
- java.lang.Object
-
- com.google.android.exoplayer2.decoder.SimpleDecoder<I,O,E>
-
- All Implemented Interfaces:
Decoder<I,O,E>
- Direct Known Subclasses:
FlacDecoder
,Gav1Decoder
,OpusDecoder
,SimpleSubtitleDecoder
,VpxDecoder
@Deprecated public abstract class SimpleDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException> extends Object implements Decoder<I,O,E>
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.Base class forDecoder
s that use their own decode thread and decode each input buffer immediately into a corresponding output buffer.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleDecoder(I[] inputBuffers, O[] outputBuffers)
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract I
createInputBuffer()
Deprecated.Creates a new input buffer.protected abstract O
createOutputBuffer()
Deprecated.Creates a new output buffer.protected abstract E
createUnexpectedDecodeException(Throwable error)
Deprecated.Creates an exception to propagate for an unexpected decode error.protected abstract E
decode(I inputBuffer, O outputBuffer, boolean reset)
Deprecated.Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.I
dequeueInputBuffer()
Deprecated.Dequeues the next input buffer to be filled and queued to the decoder.O
dequeueOutputBuffer()
Deprecated.Dequeues the next output buffer from the decoder.void
flush()
Deprecated.Flushes the decoder.void
queueInputBuffer(I inputBuffer)
Deprecated.Queues an input buffer to the decoder.void
release()
Deprecated.Releases the decoder.protected void
releaseOutputBuffer(O outputBuffer)
Deprecated.Releases an output buffer back to the decoder.protected void
setInitialInputBufferSize(int size)
Deprecated.Sets the initial size of each input buffer.
-
-
-
Method Detail
-
setInitialInputBufferSize
protected final void setInitialInputBufferSize(int size)
Deprecated.Sets the initial size of each input buffer.This method should only be called before the decoder is used (i.e. before the first call to
dequeueInputBuffer()
.- Parameters:
size
- The required input buffer size.
-
dequeueInputBuffer
@Nullable public final I dequeueInputBuffer() throws E extends DecoderException
Deprecated.Description copied from interface:Decoder
Dequeues the next input buffer to be filled and queued to the decoder.- Specified by:
dequeueInputBuffer
in interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
- Returns:
- The input buffer, which will have been cleared, or null if a buffer isn't available.
- Throws:
E
- If a decoder error has occurred.E extends DecoderException
-
queueInputBuffer
public final void queueInputBuffer(I inputBuffer) throws E extends DecoderException
Deprecated.Description copied from interface:Decoder
Queues an input buffer to the decoder.- Specified by:
queueInputBuffer
in interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
- Parameters:
inputBuffer
- The input buffer.- Throws:
E
- If a decoder error has occurred.E extends DecoderException
-
dequeueOutputBuffer
@Nullable public final O dequeueOutputBuffer() throws E extends DecoderException
Deprecated.Description copied from interface:Decoder
Dequeues the next output buffer from the decoder.- Specified by:
dequeueOutputBuffer
in interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
- Returns:
- The output buffer, or null if an output buffer isn't available.
- Throws:
E
- If a decoder error has occurred.E extends DecoderException
-
releaseOutputBuffer
@CallSuper protected void releaseOutputBuffer(O outputBuffer)
Deprecated.Releases an output buffer back to the decoder.- Parameters:
outputBuffer
- The output buffer being released.
-
flush
public final void flush()
Deprecated.Description copied from interface:Decoder
Flushes the decoder. Ownership of dequeued input buffers is returned to the decoder. The caller is still responsible for releasing any dequeued output buffers.- Specified by:
flush
in interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
-
release
@CallSuper public void release()
Deprecated.Description copied from interface:Decoder
Releases the decoder. Must be called when the decoder is no longer needed.- Specified by:
release
in interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
-
createInputBuffer
protected abstract I createInputBuffer()
Deprecated.Creates a new input buffer.
-
createOutputBuffer
protected abstract O createOutputBuffer()
Deprecated.Creates a new output buffer.
-
createUnexpectedDecodeException
protected abstract E createUnexpectedDecodeException(Throwable error)
Deprecated.Creates an exception to propagate for an unexpected decode error.- Parameters:
error
- The unexpected decode error.- Returns:
- The exception to propagate.
-
decode
@Nullable protected abstract E decode(I inputBuffer, O outputBuffer, boolean reset)
Deprecated.Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.- Parameters:
inputBuffer
- The buffer to decode.outputBuffer
- The output buffer to store decoded data. The flagC.BUFFER_FLAG_DECODE_ONLY
will be set if the same flag is set oninputBuffer
, 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.- Returns:
- A decoder exception if an error occurred, or null if decoding was successful.
-
-