Constructor
new Vorbis()
Members
BLOCK_SIZES_OFFSET_ :number
Offset of the block sizes in the identification header: the packet type, the
6 bytes of 'vorbis', the version (4), the channels (1), the sample rate (4)
and the three bitrates (12).
Type:
- number
- Source:
HEADER_COUNT_MINUS_ONE_ :number
The number of headers in the codec configuration of Matroska, minus one: the
identification, the comment and the setup headers.
Type:
- number
- Source:
MAX_MODES_ :number
The most modes a stream can have, as the count is 6 bits.
Type:
- number
- Source:
MODE_BITS_ :number
The size of a mode: block flag (1 bit), window type (16), transform type
(16) and mapping (8).
Type:
- number
- Source:
MODE_COUNT_BITS_ :number
The size of the field that holds the number of modes, minus one.
Type:
- number
- Source:
PACKET_TYPE_IDENTIFICATION_ :number
The type of an identification header packet.
Type:
- number
- Source:
XIPH_RUN_CONTINUES_ :number
In Xiph lacing a byte of 255 means that the size goes on in the next byte.
Type:
- number
- Source:
Methods
getAdvance(windowSize, nextWindowSize) → {number}
Gets the samples between the start of a packet and the start of the next:
a quarter of each of their windows, as consecutive windows overlap by half
of the smaller one.
Parameters:
| Name | Type | Description |
|---|---|---|
windowSize |
number | |
nextWindowSize |
number |
- Source:
Returns:
- Type
- number
getWindowSize(info, packetnon-null) → {number}
Gets the size of the window of an audio packet.
Parameters:
| Name | Type | Description |
|---|---|---|
info |
shaka.codec.Vorbis.Info | |
packet |
Uint8Array |
- Source:
Returns:
The size in samples, or 0 if the packet is not audio.
- Type
- number
parseHeaders(codecPrivatenon-null) → {shaka.codec.Vorbis.Info}
Reads the window sizes and the modes from the headers of a stream.
Parameters:
| Name | Type | Description |
|---|---|---|
codecPrivate |
Uint8Array | The three headers (identification, comment and setup) with the Xiph lacing that Matroska uses: the number of headers minus one, the sizes of all but the last, and the headers. |
- Source:
Returns:
parseModes_(setupnon-null) → {Array<number>}
Finds the modes at the end of the setup header. Every mode is 41 bits (a
block flag, a window type and a transform type that are 0, and a mapping),
and they are followed only by the framing bit, so they can be found from
the end, without decoding the codebooks, floors and residues that come
before them.
Parameters:
| Name | Type | Description |
|---|---|---|
setup |
Uint8Array |
- Source:
Returns:
The block flag of each mode.
- Type
- Array<number>
splitHeaders_(codecPrivatenon-null) → {Array<!Uint8Array>}
Parameters:
| Name | Type | Description |
|---|---|---|
codecPrivate |
Uint8Array |
- Source:
Returns:
The headers, or null if it is not what a
Matroska track writes.
- Type
- Array<!Uint8Array>
Type Definitions
Info
Type:
- {blockSizes: !Array<number>, modeBlockFlags: !Array<number>, modeBits: number}
Properties:
| Name | Type | Description |
|---|---|---|
blockSizes |
Array<number> | The size in samples of the small and of the large window. |
modeBlockFlags |
Array<number> | For each mode, whether it uses the large window (1) or the small (0). |
modeBits |
number | The number of bits that write the mode in a packet. |
- Source: