Class: shaka.util.Obu

Methods

normalizeTsObu_(datanon-null) → {Array<!Uint8Array>}

Turns one escaped ts_open_bitstream_unit() payload, with its start code already stripped, into the pieces of the equivalent low overhead OBU. Returns null if the OBU header cannot be read.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Array<!Uint8Array>

parseAv1(datanon-null) → {Array<shaka.util.Obu.Unit>}

Splits an AV1 temporal unit into its OBUs.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Array<shaka.util.Obu.Unit>

parseAv1Ts(datanon-null) → {Uint8Array}

Converts an AV1 access unit carried in MPEG-2 TS into the low overhead bitstream format, which is what both parseAv1() and an `av01` sample expect. Returns null when the access unit cannot be read. MPEG-2 TS does not carry the low overhead format directly: each OBU is wrapped in a ts_open_bitstream_unit(), which prefixes it with a 0x000001 start code and escapes the byte sequences that would emulate one, in the same way H.264 does. On top of that, obu_size is only recommended there, not required, so an OBU that relies on the start code to delimit it has to get its size field back before anything else can read it.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Uint8Array

parseIamf(datanon-null) → {Array<shaka.util.Obu.Unit>}

Splits a sequence of IAMF OBUs.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Array<shaka.util.Obu.Unit>

readLeb128(datanon-null, offset) → {?{value: number, size: number}}

Reads an unsigned leb128() at the given offset. Returns null if the value is truncated or malformed, in which case the rest of the data cannot be trusted either.
Parameters:
Name Type Description
data Uint8Array
offset number
Source:
Returns:
Type
?{value: number, size: number}

unescapeTsObu_(datanon-null) → {Uint8Array}

Removes the emulation prevention bytes from one escaped OBU. Returns the input untouched when there are none, which is the common case.
Parameters:
Name Type Description
data Uint8Array
Source:
Returns:
Type
Uint8Array

writeLeb128_(value) → {Uint8Array}

Encodes a value as an unsigned leb128().
Parameters:
Name Type Description
value number
Source:
Returns:
Type
Uint8Array

Type Definitions

Unit

One Open Bitstream Unit. `data` is the OBU payload alone, with the header and every field that precedes the payload already skipped; `fullData` also covers the header, which is what an `av1C` configOBUs entry needs. `type` is the obu_type field, whose meaning depends on the format the OBU was parsed from.
Type:
  • {type: number, data: !Uint8Array, fullData: !Uint8Array}
Source: