Back to Exoplayer

OpusDecoder (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/ext/opus/OpusDecoder.html

latest9.4 KB
Original Source

Package com.google.android.exoplayer2.ext.opus

Class OpusDecoder


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classOpusDecoderextends[SimpleDecoder](../../decoder/SimpleDecoder.html "class in com.google.android.exoplayer2.decoder")<[DecoderInputBuffer](../../decoder/DecoderInputBuffer.html "class in com.google.android.exoplayer2.decoder"),​[SimpleDecoderOutputBuffer](../../decoder/SimpleDecoderOutputBuffer.html "class in com.google.android.exoplayer2.decoder"),​[OpusDecoderException](OpusDecoderException.html "class in com.google.android.exoplayer2.ext.opus")>

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 the inputBuffer and stores any decoded output in outputBuffer. | | 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

- 

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

- 

outputFloat

public final boolean outputFloat

Deprecated.

- 

channelCount

public final int channelCount

Deprecated.

Constructor Detail

- 

OpusDecoder

public OpusDecoder​(int numInputBuffers,
                   int numOutputBuffers,
                   int initialInputBufferSize,[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<byte[]> initializationData,
                   @Nullable[CryptoConfig](../../decoder/CryptoConfig.html "interface in com.google.android.exoplayer2.decoder")cryptoConfig,
                   boolean outputFloat)
            throws[OpusDecoderException](OpusDecoderException.html "class in com.google.android.exoplayer2.ext.opus")

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 - The CryptoConfig 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 setThrows: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](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getName()

Deprecated.

Description copied from interface: Decoder

Returns the name of the decoder. Returns:The name of the decoder.

- 

createInputBuffer

protected[DecoderInputBuffer](../../decoder/DecoderInputBuffer.html "class in com.google.android.exoplayer2.decoder")createInputBuffer()

Deprecated.

Description copied from class: SimpleDecoder

Creates a new input buffer. Specified by:createInputBuffer in class SimpleDecoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>

- 

createOutputBuffer

protected[SimpleDecoderOutputBuffer](../../decoder/SimpleDecoderOutputBuffer.html "class in com.google.android.exoplayer2.decoder")createOutputBuffer()

Deprecated.

Description copied from class: SimpleDecoder

Creates a new output buffer. Specified by:createOutputBuffer in class SimpleDecoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>

- 

createUnexpectedDecodeException

protected[OpusDecoderException](OpusDecoderException.html "class in com.google.android.exoplayer2.ext.opus")createUnexpectedDecodeException​([Throwable](https://developer.android.com/reference/java/lang/Throwable.html "class or interface in java.lang")error)

Deprecated.

Description copied from class: SimpleDecoder

Creates an exception to propagate for an unexpected decode error. Specified by:createUnexpectedDecodeException in class SimpleDecoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>Parameters:error - The unexpected decode error.Returns:The exception to propagate.

- 

decode

@Nullable
protected[OpusDecoderException](OpusDecoderException.html "class in com.google.android.exoplayer2.ext.opus")decode​([DecoderInputBuffer](../../decoder/DecoderInputBuffer.html "class in com.google.android.exoplayer2.decoder")inputBuffer,[SimpleDecoderOutputBuffer](../../decoder/SimpleDecoderOutputBuffer.html "class in com.google.android.exoplayer2.decoder")outputBuffer,
                                      boolean reset)

Deprecated.

Description copied from class: SimpleDecoder

Decodes the inputBuffer and stores any decoded output in outputBuffer. Specified by:decode in class SimpleDecoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>Parameters: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.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 interface Decoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>Overrides:release in class SimpleDecoder<DecoderInputBuffer,​SimpleDecoderOutputBuffer,​OpusDecoderException>