Class: shaka.util.Id3Utils

A set of Id3Utils utility functions.

Constructor

new Id3Utils()

A set of Id3Utils utility functions.

Source:

Members

LATIN1_encoding :number

ISO-8859-1 / Latin-1 encoding byte.
Type:
  • number
Source:

UTF8_encoding :number

UTF-8 encoding byte.
Type:
  • number
Source:

UTF16BE_encoding :number

UTF-16BE without BOM encoding byte.
Type:
  • number
Source:

UTF16BOM_encoding :number

UTF-16 with BOM encoding byte.
Type:
  • number
Source:

Methods

decodeFrame_(frame) → {shaka.extern.MetadataFrame}

Parameters:
Name Type Description
frame shaka.extern.MetadataRawFrame
Source:
Returns:
Type
shaka.extern.MetadataFrame

decodeString_(datanon-null, encoding) → {string}

Decodes a string from raw bytes using the given ID3 encoding indicator. ID3v2 encoding values: 0x00 = ISO-8859-1 (Latin-1) 0x01 = UTF-16 with BOM (FF FE = LE, FE FF = BE) 0x02 = UTF-16BE without BOM 0x03 = UTF-8
Parameters:
Name Type Description
data Uint8Array
encoding number
Source:
Returns:
Type
string

findNull_(data, encoding, offsetopt) → {number}

Finds the byte index of the null terminator in `data` starting from `offset`, respecting the terminator width for the given encoding. For UTF-16 encodings the search steps in two-byte increments so it never straddles a surrogate pair or misidentifies a code-unit as a terminator.
Parameters:
Name Type Attributes Default Description
data Uint8Array
encoding number
offset number <optional>
0
Source:
Returns:
Byte index of the null terminator, or -1 if not found.
Type
number

getFrameData_(data, version) → {shaka.extern.MetadataRawFrame}

Parameters:
Name Type Description
data Uint8Array
version number ID3v2 major version (3 = v2.3, 4 = v2.4)
Source:
Returns:
Type
shaka.extern.MetadataRawFrame

getID3Data(id3Data, offsetopt) → {Uint8Array}

Returns any adjacent ID3 tags found in data starting at offset, as one block of data
Parameters:
Name Type Attributes Default Description
id3Data Uint8Array The ID3 data containing one or more ID3 tags
offset number <optional>
0 The offset at which to start searching
Source:
Returns:
Type
Uint8Array

getID3Frames(id3Data) → {Array<shaka.extern.MetadataFrame>}

Returns an array of ID3 frames found in all the ID3 tags in the id3Data
Parameters:
Name Type Description
id3Data Uint8Array The ID3 data containing one or more ID3 tags
Source:
Returns:
Type
Array<shaka.extern.MetadataFrame>

getID3v1Frames(data) → {Array<!shaka.extern.MetadataFrame>}

Returns metadata frames found in ID3v1 tags.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Array<!shaka.extern.MetadataFrame>

isFooter_(data, offset) → {boolean}

Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
boolean

isHeader_(data, offset) → {boolean}

Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
boolean

nullTermSize_(encoding) → {number}

Returns the byte width of the null terminator for a given encoding. UTF-16 encodings use a two-byte null; all others use a single byte.
Parameters:
Name Type Description
encoding number
Source:
Returns:
Type
number

readSize_(data, offset) → {number}

Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
number

readSizeBE_(data, offset) → {number}

Reads a 32-bit big-endian integer from `data` at `offset`. Used for ID3v2.3 frame sizes, which are plain big-endian (not syncsafe).
Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
number