Constructor
new MatroskaIndexParser()
- Source:
Methods
getElementLength(data, expectedId) → {number}
Reads the total length of a top-level element (header included) from its
first bytes. The caller can use this to fetch precisely the element with
one more range request.
Parameters:
- Source:
Returns:
-
Type
-
number
getInitEndOffset(header, tracknon-null) → {number}
Gets the last byte of the initialization segment of a track. That is the
beginning of the file, up to the end of the TrackEntry of the track (and of
the Info, which holds the timecode scale, should it come later). Nothing
that follows is needed to tell what the track is.
Besides being small, this makes the initialization segment of each track a
different byte range, which is how the StreamingEngine knows it has to
append it again when the track changes.
Parameters:
- Source:
Returns:
The offset of the last byte, inclusive.
-
Type
-
number
parseAudioSettings_(audionon-null, tracknon-null)
Parameters:
- Source:
parseBlockAdditionMapping_(mappingnon-null, tracknon-null)
Reads a BlockAdditionMapping, which says what the additional data of the
blocks, or the extra data of the track, is. The one that is looked for is
the Dolby Vision configuration.
Parameters:
- Source:
parseChapterAtom_(atomnon-null, resultnon-null)
Parameters:
- Source:
Parses a complete Chapters element fetched with a byte range request.
Only the first edition is read: Shaka's chapter API has no notion of
edition selection.
Parameters:
| Name |
Type |
Description |
data |
BufferSource
|
|
- Source:
Returns:
-
Type
-
Array<shaka.mkv.MatroskaIndexParser.Chapter>
parseContentEncodings_(encodingsnon-null, tracknon-null)
Reads the ContentEncodings of a track. The only encoding that can be
undone without a decompressor or a key is header stripping, in which the
muxer removed a common prefix from every frame.
Parameters:
- Source:
Parses a complete Cues element fetched with a byte range request.
Parameters:
| Name |
Type |
Description |
data |
BufferSource
|
|
segmentOffset |
number
|
|
timecodeScale |
number
|
|
- Source:
Returns:
-
Type
-
Array<shaka.mkv.MatroskaIndexParser.CuePoint>
Parses the beginning of a file. The data does not need to contain the
whole header: everything up to the first Cluster (or up to the first
element the data cuts short) is read, and if that element is the list of
tracks, the complete tracks that precede the cut.
Parameters:
| Name |
Type |
Description |
data |
BufferSource
|
Bytes beginning at offset zero in the file. |
- Source:
Returns:
-
Type
-
shaka.mkv.MatroskaIndexParser.Header
parseInfo_(infonon-null) → {{timecodeScale: number, unscaledDuration: ?number}}
Parameters:
- Source:
Returns:
-
Type
-
{timecodeScale: number, unscaledDuration: ?number}
parseSeekHead_(seekHeadnon-null, segmentOffset, header, seekPositionsnon-null)
Parameters:
- Source:
parseVideoSettings_(videonon-null, tracknon-null)
Parameters:
- Source:
Type Definitions
Chapter
Type:
-
{start: number, end: ?number, title: string, language: string}
- Source:
CuePoint
Type:
-
{time: number, track: number, offset: number}
Properties:
| Name |
Type |
Description |
time |
number
|
CueTime in seconds. |
track |
number
|
CueTrack. |
offset |
number
|
Absolute file offset of the Cluster the CuePoint refers to. |
- Source:
Type:
-
{segmentOffset: number, cuesOffset: ?number, chaptersOffset: ?number, infoEndOffset: ?number, mediaEndOffset: ?number, duration: ?number, timecodeScale: number, tracks: !Array<!shaka.mkv.MatroskaIndexParser.Track>, firstClusterOffset: ?number}
Properties:
| Name |
Type |
Attributes |
Description |
segmentOffset |
number
|
|
Absolute file offset of the first byte of the Segment's data. |
cuesOffset |
number
|
<nullable>
|
Absolute file offset of the Cues element. |
chaptersOffset |
number
|
<nullable>
|
Absolute file offset of the Chapters element. |
infoEndOffset |
number
|
<nullable>
|
Absolute file offset of the byte after the Info element. |
mediaEndOffset |
number
|
<nullable>
|
Absolute file offset where the Clusters end, if known. |
duration |
number
|
<nullable>
|
Duration in seconds. |
timecodeScale |
number
|
|
Nanoseconds per timecode tick. |
firstClusterOffset |
number
|
<nullable>
|
Absolute file offset of the first Cluster; null while it has not been
reached in the data. |
- Source:
Track
Type:
-
{offset: number, size: number, number: number, type: number, codecId: string, codecPrivate: ?Uint8Array, codecDelay: ?number, language: string, name: string, enabled: boolean, isDefault: boolean, forced: boolean, hearingImpaired: boolean, visualImpaired: boolean, original: boolean, commentary: boolean, width: ?number, height: ?number, displayWidth: ?number, displayHeight: ?number, transferCharacteristics: ?number, channels: ?number, sampleRate: ?number, outputSampleRate: ?number, defaultDuration: ?number, strippedHeader: ?Uint8Array, unsupportedEncoding: boolean, dolbyVisionConfig: ?Uint8Array}
Properties:
| Name |
Type |
Attributes |
Description |
offset |
number
|
|
Absolute file offset of the TrackEntry element. |
size |
number
|
|
Size in bytes of the whole TrackEntry element, header included. |
number |
number
|
|
TrackNumber: what the blocks of the track refer to. |
type |
number
|
|
TrackType; see shaka.mkv.TrackType. |
codecDelay |
number
|
<nullable>
|
CodecDelay in seconds. |
defaultDuration |
number
|
<nullable>
|
DefaultDuration (the frame duration) in seconds. |
transferCharacteristics |
number
|
<nullable>
|
Video Colour transfer characteristics (H.273 values). |
strippedHeader |
Uint8Array
|
<nullable>
|
The prefix to put back in front of every frame, when the track uses header
stripping. |
unsupportedEncoding |
boolean
|
|
True when the track is compressed or encrypted in a way that cannot be
undone. |
dolbyVisionConfig |
Uint8Array
|
<nullable>
|
The Dolby Vision configuration record (the payload of dvcC or dvvC). |
- Source: