@UnstableApi
public final class Id3Decoder extends SimpleMetadataDecoder


Decodes ID3 tags.

Summary

Nested types

public interface Id3Decoder.FramePredicate

A predicate for determining whether individual frames should be decoded.

Constants

static final int

Length of an ID3 tag header.

static final int
ID3_TAG = 4801587

The first three bytes of a well formed ID3 tag header.

static final Id3Decoder.FramePredicate

A predicate that indicates no frames should be decoded.

Public constructors

Public methods

@Nullable Metadata
decode(byte[] data, int size)

Decodes ID3 tags.

Protected methods

@Nullable Metadata
decode(MetadataInputBuffer inputBuffer, ByteBuffer buffer)

Called by decode after input buffer validation has been performed.

Inherited methods

From androidx.media3.extractor.metadata.SimpleMetadataDecoder
final @Nullable Metadata

Decodes a Metadata element from the provided input buffer.

Constants

ID3_HEADER_LENGTH

public static final int ID3_HEADER_LENGTH = 10

Length of an ID3 tag header.

ID3_TAG

public static final int ID3_TAG = 4801587

The first three bytes of a well formed ID3 tag header.

NO_FRAMES_PREDICATE

public static final Id3Decoder.FramePredicate NO_FRAMES_PREDICATE

A predicate that indicates no frames should be decoded.

Public constructors

Id3Decoder

public Id3Decoder()

Id3Decoder

public Id3Decoder(@Nullable Id3Decoder.FramePredicate framePredicate)
Parameters
@Nullable Id3Decoder.FramePredicate framePredicate

Determines which frames are decoded. May be null to decode all frames.

Public methods

decode

public @Nullable Metadata decode(byte[] data, int size)

Decodes ID3 tags.

Parameters
byte[] data

The bytes to decode ID3 tags from.

int size

Amount of bytes in data to read.

Returns
@Nullable Metadata

A Metadata object containing the decoded ID3 tags, or null if the data could not be decoded.

Protected methods

decode

protected @Nullable Metadata decode(MetadataInputBuffer inputBuffer, ByteBuffer buffer)

Called by decode after input buffer validation has been performed.

Parameters
MetadataInputBuffer inputBuffer

The input buffer to decode.

ByteBuffer buffer

The input buffer's data buffer, for convenience. Validation by decode guarantees that hasArray, position and arrayOffset are true, 0 and 0 respectively.

Returns
@Nullable Metadata

The decoded metadata object, or null if the metadata could not be decoded.