Back to Exoplayer

VorbisUtil (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/extractor/VorbisUtil.html

latest9.8 KB
Original Source

Package com.google.android.exoplayer2.extractor

Class VorbisUtil


[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classVorbisUtilextends[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 parsing Vorbis streams.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static class | VorbisUtil.CommentHeader | Deprecated.

Vorbis comment header. | | static class | VorbisUtil.Mode | Deprecated.

Vorbis setup header modes. | | static class | VorbisUtil.VorbisIdHeader | Deprecated.

Vorbis identification header. |

Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static int | iLog​(int x) | Deprecated.

Returns ilog(x), which is the index of the highest set bit in x. | | static Metadata | parseVorbisComments​(List<String> vorbisComments) | Deprecated.

Builds a Metadata instance from a list of Vorbis Comments. | | static VorbisUtil.CommentHeader | readVorbisCommentHeader​(ParsableByteArray headerData) | Deprecated.

Reads a Vorbis comment header. | | static VorbisUtil.CommentHeader | readVorbisCommentHeader​(ParsableByteArray headerData, boolean hasMetadataHeader, boolean hasFramingBit) | Deprecated.

Reads a Vorbis comment header. | | static VorbisUtil.VorbisIdHeader | readVorbisIdentificationHeader​(ParsableByteArray headerData) | Deprecated.

Reads a Vorbis identification header from headerData. | | static VorbisUtil.Mode[] | readVorbisModes​(ParsableByteArray headerData, int channels) | Deprecated.

This method reads the modes which are located at the very end of the Vorbis setup header. | | static boolean | verifyVorbisHeaderCapturePattern​(int headerType, ParsableByteArray header, boolean quiet) | Deprecated.

Verifies whether the next bytes in header are a Vorbis header of the given headerType. |

- 

Methods inherited from class java.lang.Object

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

Method Detail

- 

iLog

public static int iLog​(int x)

Deprecated.

Returns ilog(x), which is the index of the highest set bit in x.

See the Vorbis spec

Parameters:x - the value of which the ilog should be calculated.Returns:ilog(x)

- 

readVorbisIdentificationHeader

public static[VorbisUtil.VorbisIdHeader](VorbisUtil.VorbisIdHeader.html "class in com.google.android.exoplayer2.extractor")readVorbisIdentificationHeader​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")headerData)
                                                                throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")

Deprecated.

Reads a Vorbis identification header from headerData.

See the Vorbis spec/Identification header

Parameters:headerData - a ParsableByteArray wrapping the header data.Returns:a VorbisUtil.VorbisIdHeader with meta data.Throws:ParserException - thrown if invalid capture pattern is detected.

- 

readVorbisCommentHeader

public static[VorbisUtil.CommentHeader](VorbisUtil.CommentHeader.html "class in com.google.android.exoplayer2.extractor")readVorbisCommentHeader​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")headerData)
                                                        throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")

Deprecated.

Reads a Vorbis comment header.

See the Vorbis spec/Comment header

Parameters:headerData - A ParsableByteArray wrapping the header data.Returns:A VorbisUtil.CommentHeader with all the comments.Throws:ParserException - If an error occurs parsing the comment header.

- 

readVorbisCommentHeader

public static[VorbisUtil.CommentHeader](VorbisUtil.CommentHeader.html "class in com.google.android.exoplayer2.extractor")readVorbisCommentHeader​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")headerData,
                                                               boolean hasMetadataHeader,
                                                               boolean hasFramingBit)
                                                        throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")

Deprecated.

Reads a Vorbis comment header.

The data provided may not contain the Vorbis metadata common header and the framing bit.

See the Vorbis spec/Comment header

Parameters:headerData - A ParsableByteArray wrapping the header data.hasMetadataHeader - Whether the headerData contains a Vorbis metadata common header preceding the comment header.hasFramingBit - Whether the headerData contains a framing bit.Returns:A VorbisUtil.CommentHeader with all the comments.Throws:ParserException - If an error occurs parsing the comment header.

- 

parseVorbisComments

@Nullable
public static[Metadata](../metadata/Metadata.html "class in com.google.android.exoplayer2.metadata")parseVorbisComments​([List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")> vorbisComments)

Deprecated.

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:vorbisComments - The raw input of comments, as a key-value pair KEY=VAL.Returns:The fully parsed Metadata instance. Null if no vorbis comments could be parsed.

- 

verifyVorbisHeaderCapturePattern

public static boolean verifyVorbisHeaderCapturePattern​(int headerType,[ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")header,
                                                       boolean quiet)
                                                throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")

Deprecated.

Verifies whether the next bytes in header are a Vorbis header of the given headerType. Parameters:headerType - the type of the header expected.header - the alleged header bytes.quiet - if true no exceptions are thrown. Instead false is returned.Returns:the number of bytes read.Throws:ParserException - thrown if header type or capture pattern is not as expected.

- 

readVorbisModes

public static[VorbisUtil.Mode](VorbisUtil.Mode.html "class in com.google.android.exoplayer2.extractor")[] readVorbisModes​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")headerData,
                                                int channels)
                                         throws[ParserException](../ParserException.html "class in com.google.android.exoplayer2")

Deprecated.

This method reads the modes which are located at the very end of the Vorbis setup header. That's why we need to partially decode or at least read the entire setup header to know where to start reading the modes.

See the Vorbis spec/Setup header

Parameters:headerData - a ParsableByteArray containing setup header data.channels - the number of channels.Returns:an array of VorbisUtil.Modes.Throws:ParserException - thrown if bit stream is invalid.