Class: shaka.text.SsaTextParser

Members

COMMENT_ :RegExp

A comment.
Type:
  • RegExp
Source:

DRAWING_ :RegExp

The tag that turns the text of an event into commands to draw a shape.
Type:
  • RegExp
Source:

KEY_VALUE_ :RegExp

A line that has a key, a colon and a value, such as Style: Default,Arial.
Type:
  • RegExp
Source:

SECTION_EVENTS_ :string

@const
Type:
  • string
Source:

SECTION_HEADER_ :RegExp

The line that starts a section, such as [V4+ Styles].
Type:
  • RegExp
Source:

SECTION_SCRIPT_INFO_ :string

The names of the sections that are read, in lower case.
Type:
  • string
Source:

SECTION_V4_PLUS_STYLES_ :string

@const
Type:
  • string
Source:

SECTION_V4_STYLES_ :string

@const
Type:
  • string
Source:

TIME_ :RegExp

A time: 0:00:01.1, 0:00:01.18 or 0:00:01.180.
Type:
  • RegExp
Source:

Methods

addStyle_(cue, stylenon-null, isV4Plus)

Adds the properties of a style that a cue has.
Parameters:
Name Type Description
cue shaka.text.Cue
style Object<string, string>
isV4Plus boolean
Source:

isSet_(value) → {boolean}

Tells whether a flag of a style is set. Styles write flags as -1 (set) and 0 (not set).
Parameters:
Name Type Description
value string | undefined
Source:
Returns:
Type
boolean

makeCue_(eventnon-null, stylesnon-null, isV4Plus) → {shaka.text.Cue}

Parameters:
Name Type Description
event Object<string, string> The values of a Dialogue line.
styles Array<!Object<string, string>>
isV4Plus boolean
Source:
Returns:
Type
shaka.text.Cue

parseAlignment_(value, isV4Plus) → {?{displayAlign: shaka.text.Cue.displayAlign, textAlign: shaka.text.Cue.textAlign}}

Reads the alignment of a style. ASS (V4+) numbers the nine positions like the keys of a numeric keypad, from the bottom left. SSA (V4) has its own numbers: 1 to 3 at the bottom, 5 to 7 at the top and 9 to 11 in the middle, and left, center and right in each.
Parameters:
Name Type Description
value string | undefined
isV4Plus boolean
Source:
Returns:
Type
?{displayAlign: shaka.text.Cue.displayAlign, textAlign: shaka.text.Cue.textAlign}

parseColor_(colorString) → {string}

Reads a color. It is a number in hexadecimal (&HAABBGGRR) or in decimal, with the bytes in the order alpha, blue, green and red, and its alpha is the other way around: 0xFF is transparent.
Parameters:
Name Type Description
colorString string
Source:
Returns:
A CSS color.
Type
string

parseTable_(linesnon-null, kind) → {Array<!Object<string, string>>}

Reads the lines of a section that are a table: a Format line, which names the columns, and the lines of a kind (Style, Dialogue) that have the values.
Parameters:
Name Type Description
lines Array<string>
kind string
Source:
Returns:
The values of each row by the name of their column.
Type
Array<!Object<string, string>>

parseTime_(string) → {number}

Reads a time: H:MM:SS.cc, with one to three digits after the dot.
Parameters:
Name Type Description
string string | undefined
Source:
Returns:
The time in seconds.
Type
number

splitFirst(text, separator, count) → {Array<string>}

Splits a string in at most |count| parts by a separator, the last of which has what is left. Some formats have the commas of the text of the last field among the ones that separate the fields.
Parameters:
Name Type Description
text string
separator string
count number
Source:
Returns:
Type
Array<string>

splitSections_(text) → {Array<!Array>}

Splits a file in its sections: the lines that follow each [Name] line.
Parameters:
Name Type Description
text string
Source:
Returns:
Pairs of a name and its lines.
Type
Array<!Array>

parseInit(datanon-null)

Parse an initialization segment. Some formats do not have init segments so this won't always be called.
Parameters:
Name Type Description
data Uint8Array The data that makes up the init segment.
Implements:
Source:

parseMedia(datanon-null, timeContext, urinullable, imagesnon-null) → {Array<!shaka.text.Cue>}

Parse a media segment and return the cues that make up the segment.
Parameters:
Name Type Attributes Description
data Uint8Array The next section of buffer.
timeContext shaka.extern.TextParser.TimeContext The time information that should be used to adjust the times values for each cue.
uri string | undefined <nullable>
The media uri.
images Array<string>
Implements:
Source:
Returns:
Type
Array<!shaka.text.Cue>

setManifestType(manifestType)

Notifies the manifest type.
Parameters:
Name Type Description
manifestType string
Implements:
Source: