# 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
public final class VorbisUtil
```

<br />

*** ** * ** ***

Utility methods for parsing Vorbis streams.

## Summary

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

## Public methods

### getVorbisToAndroidChannelLayoutMapping

```
public static @Nullable ImmutableIntArray getVorbisToAndroidChannelLayoutMapping(int channelCount)
```

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

```
public static @Nullable Metadata parseVorbisComments(List<String> vorbisComments)
```

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

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> vorbisComments` | The raw input of comments, as a key-value pair KEY=VAL. |

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

### parseVorbisCsdFromEsdsInitializationData

```
public static ImmutableList<byte[]> parseVorbisCsdFromEsdsInitializationData(byte[] initializationData)
```

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

| Parameters |
|---|---|
| `byte[] initializationData` | The initialization data from the ESDS box. |

| Returns |
|---|---|
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/collect/ImmutableList.html<byte[]>` | Codec-specific data for configuring a media codec for decoding Vorbis. |