Class OpusDecoder
- java.lang.Object
-
- com.google.android.exoplayer2.decoder.SimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
-
- com.google.android.exoplayer2.ext.opus.OpusDecoder
-
- All Implemented Interfaces:
Decoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
@Deprecated public final class OpusDecoder extends SimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
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.Opus decoder.
-
-
Field Summary
Fields Modifier and Type Field Description int
channelCount
Deprecated.boolean
outputFloat
Deprecated.
-
Constructor Summary
Constructors Constructor Description OpusDecoder(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize, List<byte[]> initializationData, CryptoConfig cryptoConfig, boolean outputFloat)
Deprecated.Creates an Opus decoder.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected DecoderInputBuffer
createInputBuffer()
Deprecated.Creates a new input buffer.protected SimpleDecoderOutputBuffer
createOutputBuffer()
Deprecated.Creates a new output buffer.protected OpusDecoderException
createUnexpectedDecodeException(Throwable error)
Deprecated.Creates an exception to propagate for an unexpected decode error.protected OpusDecoderException
decode(DecoderInputBuffer inputBuffer, SimpleDecoderOutputBuffer outputBuffer, boolean reset)
Deprecated.Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.void
experimentalSetDiscardPaddingEnabled(boolean enabled)
Deprecated.Sets whether discard padding is enabled.String
getName()
Deprecated.Returns the name of the decoder.void
release()
Deprecated.Releases the decoder.-
Methods inherited from class com.google.android.exoplayer2.decoder.SimpleDecoder
dequeueInputBuffer, dequeueOutputBuffer, flush, queueInputBuffer, releaseOutputBuffer, setInitialInputBufferSize
-
-
-
-
Constructor Detail
-
OpusDecoder
public OpusDecoder(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize, List<byte[]> initializationData, @Nullable CryptoConfig cryptoConfig, boolean outputFloat) throws OpusDecoderException
Deprecated.Creates an Opus decoder.- Parameters:
numInputBuffers
- The number of input buffers.numOutputBuffers
- The number of output buffers.initialInputBufferSize
- The initial size of each input buffer.initializationData
- Codec-specific initialization data. The first element must contain an opus header. Optionally, the list may contain two additional buffers, which must contain the encoder delay and seek pre roll values in nanoseconds, encoded as longs.cryptoConfig
- TheCryptoConfig
object required for decoding encrypted content. May be null and can be ignored if decoder does not handle encrypted content.outputFloat
- Forces the decoder to output float PCM samples when set- Throws:
OpusDecoderException
- Thrown if an exception occurs when initializing the decoder.
-
-
Method Detail
-
experimentalSetDiscardPaddingEnabled
public void experimentalSetDiscardPaddingEnabled(boolean enabled)
Deprecated.Sets whether discard padding is enabled. When enabled, discard padding samples (provided as supplemental data on the input buffer) will be removed from the end of the decoder output.This method is experimental, and will be renamed or removed in a future release.
-
getName
public String getName()
Deprecated.Description copied from interface:Decoder
Returns the name of the decoder.- Returns:
- The name of the decoder.
-
createInputBuffer
protected DecoderInputBuffer createInputBuffer()
Deprecated.Description copied from class:SimpleDecoder
Creates a new input buffer.- Specified by:
createInputBuffer
in classSimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
-
createOutputBuffer
protected SimpleDecoderOutputBuffer createOutputBuffer()
Deprecated.Description copied from class:SimpleDecoder
Creates a new output buffer.- Specified by:
createOutputBuffer
in classSimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
-
createUnexpectedDecodeException
protected OpusDecoderException createUnexpectedDecodeException(Throwable error)
Deprecated.Description copied from class:SimpleDecoder
Creates an exception to propagate for an unexpected decode error.- Specified by:
createUnexpectedDecodeException
in classSimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
- Parameters:
error
- The unexpected decode error.- Returns:
- The exception to propagate.
-
decode
@Nullable protected OpusDecoderException decode(DecoderInputBuffer inputBuffer, SimpleDecoderOutputBuffer outputBuffer, boolean reset)
Deprecated.Description copied from class:SimpleDecoder
Decodes theinputBuffer
and stores any decoded output inoutputBuffer
.- Specified by:
decode
in classSimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
- 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.
-
release
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<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
- Overrides:
release
in classSimpleDecoder<DecoderInputBuffer,SimpleDecoderOutputBuffer,OpusDecoderException>
-
-