Back to Exoplayer

OpusUtil (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/audio/OpusUtil.html

latest5.4 KB
Original Source

Package com.google.android.exoplayer2.audio

Class OpusUtil


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public classOpusUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")

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.

Utility methods for handling Opus audio streams.

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | MAX_BYTES_PER_SECOND | Deprecated.

Maximum achievable Opus bitrate. | | static int | SAMPLE_RATE | Deprecated.

Opus streams are always 48000 Hz. |

Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static List<byte[]> | buildInitializationData​(byte[] header) | Deprecated.

Builds codec initialization data from an Opus Identification Header. | | static int | getChannelCount​(byte[] header) | Deprecated.

Parses the channel count from an Opus Identification Header. | | static long | getPacketDurationUs​(byte[] buffer) | Deprecated.

Returns the duration of the given audio packet. | | static int | parseOggPacketAudioSampleCount​(ByteBuffer buffer) | Deprecated.

Returns the number of audio samples in the given Ogg encapuslated Opus packet. | | static int | parseOggPacketForPreAudioSampleByteCount​(ByteBuffer buffer) | Deprecated.

Calculate the offset from the start of the buffer to audio sample Ogg packets. | | static int | parsePacketAudioSampleCount​(ByteBuffer buffer) | Deprecated.

Returns the number of audio samples in the given audio packet. |

- 

Methods inherited from class java.lang.Object

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

Field Detail

- 

SAMPLE_RATE

public static final int SAMPLE_RATE

Deprecated.

Opus streams are always 48000 Hz. See Also:Constant Field Values

- 

MAX_BYTES_PER_SECOND

public static final int MAX_BYTES_PER_SECOND

Deprecated.

Maximum achievable Opus bitrate. See Also:Constant Field Values

Method Detail

- 

getChannelCount

public static int getChannelCount​(byte[] header)

Deprecated.

Parses the channel count from an Opus Identification Header. Parameters:header - An Opus Identification Header, as defined by RFC 7845.Returns:The parsed channel count.

- 

buildInitializationData

public static[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<byte[]> buildInitializationData​(byte[] header)

Deprecated.

Builds codec initialization data from an Opus Identification Header. Parameters:header - An Opus Identification Header, as defined by RFC 7845.Returns:Codec initialization data suitable for an Opus MediaCodec.

- 

parseOggPacketAudioSampleCount

public static int parseOggPacketAudioSampleCount​([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer)

Deprecated.

Returns the number of audio samples in the given Ogg encapuslated Opus packet.

The buffer's position is not modified.

Parameters:buffer - The audio packet.Returns:Returns the number of audio samples in the packet.

- 

parseOggPacketForPreAudioSampleByteCount

public static int parseOggPacketForPreAudioSampleByteCount​([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer)

Deprecated.

Calculate the offset from the start of the buffer to audio sample Ogg packets. Parameters:buffer - containing the Ogg Encapsulated Opus audio bitstream.Returns:the offset before the Ogg packet containing audio samples.

- 

parsePacketAudioSampleCount

public static int parsePacketAudioSampleCount​([ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")buffer)

Deprecated.

Returns the number of audio samples in the given audio packet.

The buffer's position is not modified.

Parameters:buffer - The audio packet.Returns:Returns the number of audio samples in the packet.

- 

getPacketDurationUs

public static long getPacketDurationUs​(byte[] buffer)

Deprecated.

Returns the duration of the given audio packet. Parameters:buffer - The audio packet.Returns:Returns the duration of the given audio packet, in microseconds.