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 forDecoders that use their own decode thread and decode each input buffer immediately into a corresponding output buffer.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleDecoder(I[] inputBuffers, O[] outputBuffers)Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract IcreateInputBuffer()Deprecated.Creates a new input buffer.protected abstract OcreateOutputBuffer()Deprecated.Creates a new output buffer.protected abstract EcreateUnexpectedDecodeException(Throwable error)Deprecated.Creates an exception to propagate for an unexpected decode error.protected abstract Edecode(I inputBuffer, O outputBuffer, boolean reset)Deprecated.Decodes theinputBufferand stores any decoded output inoutputBuffer.IdequeueInputBuffer()Deprecated.Dequeues the next input buffer to be filled and queued to the decoder.OdequeueOutputBuffer()Deprecated.Dequeues the next output buffer from the decoder.voidflush()Deprecated.Flushes the decoder.voidqueueInputBuffer(I inputBuffer)Deprecated.Queues an input buffer to the decoder.voidrelease()Deprecated.Releases the decoder.protected voidreleaseOutputBuffer(O outputBuffer)Deprecated.Releases an output buffer back to the decoder.protected voidsetInitialInputBufferSize(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:DecoderDequeues the next input buffer to be filled and queued to the decoder.- Specified by:
dequeueInputBufferin 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:DecoderQueues an input buffer to the decoder.- Specified by:
queueInputBufferin 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:DecoderDequeues the next output buffer from the decoder.- Specified by:
dequeueOutputBufferin 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:DecoderFlushes 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:
flushin interfaceDecoder<I extends DecoderInputBuffer,O extends DecoderOutputBuffer,E extends DecoderException>
-
release
@CallSuper public void release()
Deprecated.Description copied from interface:DecoderReleases the decoder. Must be called when the decoder is no longer needed.- Specified by:
releasein 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 theinputBufferand stores any decoded output inoutputBuffer.- Parameters:
inputBuffer- The buffer to decode.outputBuffer- The output buffer to store decoded data. The flagC.BUFFER_FLAG_DECODE_ONLYwill 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.
-
-