Class: shaka.cea.Cea608DataChannel

Constructor

new Cea608DataChannel(fieldNum, channelNum)

Parameters:
Name Type Description
fieldNum number Field number.
channelNum number Channel number.
Source:

Members

BG_COLORS :Array.<string>

Type:
  • Array.<string>
Source:

CaptionType :number

Caption type.
Type:
  • number
Source:

MiscCmd_ :number

Command codes.
Type:
  • number
Properties:
Name Value Type Description
RCL 32 number
BS 33 number
AOD 34 number
AON 35 number
DER 36 number
RU2 37 number
RU3 38 number
RU4 39 number
FON 40 number
RDC 41 number
TR 42 number
RTD 43 number
EDM 44 number
CR 45 number
ENM 46 number
EOC 47 number
Source:

TEXT_COLORS :Array.<string>

Type:
  • Array.<string>
Source:

curbuf_ :shaka.cea.Cea608Memory

Points to current buffer.
Type:
Source:

displayedMemory_ :shaka.cea.Cea608Memory

Displayed memory.
Type:
Source:

lastcp_ :number

Last control pair, 16 bits representing byte 1 and byte 2
Type:
  • number
Source:

nonDisplayedMemory_ :shaka.cea.Cea608Memory

Non-displayed memory.
Type:
Source:

prevEndTime_ :number

End time of the previous caption, serves as start time of next caption.
Type:
  • number
Source:

text_ :shaka.cea.Cea608Memory

Text buffer for CEA-608 "text mode". Although, we don't emit text mode. So, this buffer serves as a no-op placeholder, just in case we receive captions that toggle text mode.
Type:
Source:

Methods

isControlCode(b1) → {boolean}

Checks if the data contains a control code.
Parameters:
Name Type Description
b1 number Byte 1.
Source:
Returns:
Type
boolean

controlBackgroundAttribute_(b1, b2)

Background attribute control code handler.
Parameters:
Name Type Description
b1 number Byte #1
b2 number Byte #2.
Source:

controlBs_()

Handles BS - BackSpace.
Source:

controlCr_(pts) → {shaka.cea.ICaptionDecoder.ClosedCaption}

Handles CR - Carriage Return (Start new row). CR only affects scroll windows (Rollup and Text modes). Any currently buffered line needs to be emitted, along with a window scroll action.
Parameters:
Name Type Description
pts number in seconds.
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

controlEdm_(pts) → {shaka.cea.ICaptionDecoder.ClosedCaption}

Handles EDM - Erase Displayed Mem Mode check: EDM affects all captioning modes (but not Text mode);
Parameters:
Name Type Description
pts number
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

controlEnm_()

Handles ENM - Erase Nondisplayed Mem
Source:

controlEoc_(pts) → {shaka.cea.ICaptionDecoder.ClosedCaption}

Handles EOC - End Of Caption (flip mem) This forces Pop-On mode, and swaps the displayed and nondisplayed memories.
Parameters:
Name Type Description
pts number
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

controlFon_()

Handles flash on.
Source:

controlMidrow_(b2)

Mid-Row control code handler.
Parameters:
Name Type Description
b2 number Byte #2.
Source:

controlMiscellaneous_(ccPacketnon-null) → {shaka.cea.ICaptionDecoder.ClosedCaption}

The Cea608DataChannel control methods implement all CC control operations.
Parameters:
Name Type Description
ccPacket shaka.cea.Cea608DataChannel.Cea608Packet
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

controlPac_(b1, b2)

PAC - Preamble Address Code. b1 is of the form |P|0|0|1|C|0|ROW| b2 is of the form |P|1|N|ATTRIBUTE|U|
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:

controlRcl_()

Handles RCL - Resume Caption Loading Initiates Pop-On style captioning. No need to force anything out upon entering Pop-On mode because it does not affect the current display.
Source:

controlRdc_(pts)

Handles RDC - Resume Direct Captions. Initiates Paint-On captioning mode. RDC does not affect current display, so nothing needs to be forced out yet.
Parameters:
Name Type Description
pts number in seconds
Source:

controlRtd_()

Handles RTD - Resume Text Display. Resumes text mode. No need to force anything out, because Text Mode doesn't affect current display. Also, this decoder does not emit Text Mode anyway.
Source:

controlRu_(scrollSize, pts) → {shaka.cea.ICaptionDecoder.ClosedCaption}

Handles RU2, RU3, RU4 - Roll-Up, N rows. If in TEXT, POPON or PAINTON, any displayed captions are erased. This means must force emit entire display buffer.
Parameters:
Name Type Description
scrollSize number New scroll window size.
pts number
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

controlTr_()

Handles TR - Text Restart. Clears text buffer and resumes Text Mode.
Source:

handleBasicNorthAmericanChar(b1, b2)

Handles a Basic North American byte pair.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:

handleControlCode(ccPacketnon-null) → {shaka.cea.ICaptionDecoder.ClosedCaption}

Decodes control code. Three types of control codes: Preamble Address Codes, Mid-Row Codes, and Miscellaneous Control Codes.
Parameters:
Name Type Description
ccPacket shaka.cea.Cea608DataChannel.Cea608Packet
Source:
Returns:
Type
shaka.cea.ICaptionDecoder.ClosedCaption

handleExtendedWesternEuropeanChar_(b1, b2)

Handles an Extended Western European byte pair.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:

isBackgroundAttribute_(b1, b2) → {boolean}

Checks if this is a background attribute control code.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

isExtendedWesternEuropeanChar_(b1, b2) → {boolean}

Checks if the character is in the Extended Western European char. set.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

isMidrowStyleChange_(b1, b2) → {boolean}

Checks if this is a Midrow style change control code.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

isMiscellaneous_(b1, b2) → {boolean}

Checks if this is a Miscellaneous control code.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

isPAC_(b1, b2) → {boolean}

Checks if this is a PAC control code.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

isSpecialNorthAmericanChar_(b1, b2) → {boolean}

Checks if the character is in the Special North American char. set.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Type
boolean

pacToRow_(b1, b2) → {number}

Gets the row index from a Preamble Address Code byte pair.
Parameters:
Name Type Description
b1 number Byte 1.
b2 number Byte 2.
Source:
Returns:
Row index.
Type
number

reset()

Resets channel state.
Source:

Type Definitions

Cea608Packet

CEA closed captions packet.
Type:
  • {pts: number, type: number, ccData1: number, ccData2: number, order: number}
Properties:
Name Type Description
pts number Presentation timestamp (in second) at which this packet was received.
type number Type of the packet. Either 0 or 1, representing the CEA-608 field.
ccData1 number CEA-608 byte 1.
ccData2 number CEA-608 byte 2.
order number A number indicating the order this packet was received in a sequence of packets. Used to break ties in a stable sorting algorithm
Source:

Style

Style associated with a cue.
Type:
  • {textColor: ?string, backgroundColor: ?string, italics: ?boolean, underline: ?boolean}
Source: