# VorbisUtil

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/VorbisUtil.java+class:androidx.media3.extractor.VorbisUtil)

*** ** * ** ***

<br />

```
@UnstableApi
class VorbisUtil
```

<br />

*** ** * ** ***

Utility methods for parsing Vorbis streams.

## Summary

| ### Public functions |
|---|---|
| `java-static https://guava.dev/releases/snapshot-android/api/docs/com/google/common/primitives/ImmutableIntArray.html?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/VorbisUtil#getVorbisToAndroidChannelLayoutMapping(int)(channelCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the mapping from VORBIS channel layout to the channel layout expected by Android, or null if the mapping is unchanged. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata?` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/VorbisUtil#parseVorbisComments(java.util.List<java.lang.String>)(vorbisComments: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!)` Builds a `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata` instance from a list of Vorbis Comments. |
| `java-static https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/VorbisUtil#parseVorbisCsdFromEsdsInitializationData(byte[])( initializationData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>! )` Returns codec-specific data for configuring a media codec for decoding Vorbis. |

## Public functions

### getVorbisToAndroidChannelLayoutMapping

```
java-static fun getVorbisToAndroidChannelLayoutMapping(channelCount: Int): ImmutableIntArray?
```

Returns the mapping from VORBIS channel layout to the channel layout expected by Android, or null if the mapping is unchanged.

See https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810004.3.9 and https://developer.android.com/reference/android/media/AudioFormat#channelMask.

### parseVorbisComments

```
java-static fun parseVorbisComments(vorbisComments: (Mutable)List<String!>!): Metadata?
```

Builds a `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata` instance from a list of Vorbis Comments.

METADATA_BLOCK_PICTURE comments will be transformed into `https://developer.android.com/reference/kotlin/androidx/media3/extractor/metadata/flac/PictureFrame` entries. All others will be transformed into `https://developer.android.com/reference/kotlin/androidx/media3/extractor/metadata/vorbis/VorbisComment` entries.

| Parameters |
|---|---|
| `vorbisComments: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | The raw input of comments, as a key-value pair KEY=VAL. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/Metadata?` | The fully parsed Metadata instance. Null if no vorbis comments could be parsed. |

### parseVorbisCsdFromEsdsInitializationData

```
java-static fun parseVorbisCsdFromEsdsInitializationData(
    initializationData: ByteArray<Byte>!
): ImmutableList<Array<Byte>!>!
```

Returns codec-specific data for configuring a media codec for decoding Vorbis.

| Parameters |
|---|---|
| `initializationData: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!` | The initialization data from the ESDS box. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>!` | Codec-specific data for configuring a media codec for decoding Vorbis. |