@UnstableApi
public final class VorbisUtil


Utility methods for parsing Vorbis streams.

Summary

Public methods

static @Nullable ImmutableIntArray

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

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

Builds a Metadata instance from a list of Vorbis Comments.

static ImmutableList<byte[]>
parseVorbisCsdFromEsdsInitializationData(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 Metadata instance from a list of Vorbis Comments.

METADATA_BLOCK_PICTURE comments will be transformed into PictureFrame entries. All others will be transformed into VorbisComment entries.

Parameters
List<String> vorbisComments

The raw input of comments, as a key-value pair KEY=VAL.

Returns
@Nullable 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
ImmutableList<byte[]>

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