@svta/cml-608 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/dist/index.d.ts +406 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1173 -15
- package/dist/index.js.map +1 -1
- package/package.json +4 -28
- package/NOTICE +0 -59
- package/dist/CaptionModes.d.ts +0 -7
- package/dist/CaptionModes.d.ts.map +0 -1
- package/dist/CaptionModes.js +0 -2
- package/dist/CaptionModes.js.map +0 -1
- package/dist/CaptionScreen.d.ts +0 -80
- package/dist/CaptionScreen.d.ts.map +0 -1
- package/dist/CaptionScreen.js +0 -220
- package/dist/CaptionScreen.js.map +0 -1
- package/dist/CaptionsLogger.d.ts +0 -49
- package/dist/CaptionsLogger.d.ts.map +0 -1
- package/dist/CaptionsLogger.js +0 -56
- package/dist/CaptionsLogger.js.map +0 -1
- package/dist/Channels.d.ts +0 -7
- package/dist/Channels.d.ts.map +0 -1
- package/dist/Channels.js +0 -2
- package/dist/Channels.js.map +0 -1
- package/dist/CmdHistory.d.ts +0 -10
- package/dist/CmdHistory.d.ts.map +0 -1
- package/dist/CmdHistory.js +0 -2
- package/dist/CmdHistory.js.map +0 -1
- package/dist/Cta608Channel.d.ts +0 -88
- package/dist/Cta608Channel.d.ts.map +0 -1
- package/dist/Cta608Channel.js +0 -262
- package/dist/Cta608Channel.js.map +0 -1
- package/dist/Cta608Parser.d.ts +0 -115
- package/dist/Cta608Parser.d.ts.map +0 -1
- package/dist/Cta608Parser.js +0 -428
- package/dist/Cta608Parser.js.map +0 -1
- package/dist/CueHandler.d.ts +0 -12
- package/dist/CueHandler.d.ts.map +0 -1
- package/dist/CueHandler.js +0 -2
- package/dist/CueHandler.js.map +0 -1
- package/dist/PACData.d.ts +0 -13
- package/dist/PACData.d.ts.map +0 -1
- package/dist/PACData.js +0 -2
- package/dist/PACData.js.map +0 -1
- package/dist/PenState.d.ts +0 -56
- package/dist/PenState.d.ts.map +0 -1
- package/dist/PenState.js +0 -95
- package/dist/PenState.js.map +0 -1
- package/dist/PenStyles.d.ts +0 -13
- package/dist/PenStyles.d.ts.map +0 -1
- package/dist/PenStyles.js +0 -2
- package/dist/PenStyles.js.map +0 -1
- package/dist/Row.d.ts +0 -75
- package/dist/Row.d.ts.map +0 -1
- package/dist/Row.js +0 -174
- package/dist/Row.js.map +0 -1
- package/dist/SccParser.d.ts +0 -49
- package/dist/SccParser.d.ts.map +0 -1
- package/dist/SccParser.js +0 -99
- package/dist/SccParser.js.map +0 -1
- package/dist/StyledUnicodeChar.d.ts +0 -54
- package/dist/StyledUnicodeChar.d.ts.map +0 -1
- package/dist/StyledUnicodeChar.js +0 -71
- package/dist/StyledUnicodeChar.js.map +0 -1
- package/dist/SupportedField.d.ts +0 -7
- package/dist/SupportedField.d.ts.map +0 -1
- package/dist/SupportedField.js +0 -2
- package/dist/SupportedField.js.map +0 -1
- package/dist/VerboseLevel.d.ts +0 -22
- package/dist/VerboseLevel.d.ts.map +0 -1
- package/dist/VerboseLevel.js +0 -17
- package/dist/VerboseLevel.js.map +0 -1
- package/dist/extractCta608Data.d.ts +0 -11
- package/dist/extractCta608Data.d.ts.map +0 -1
- package/dist/extractCta608Data.js +0 -38
- package/dist/extractCta608Data.js.map +0 -1
- package/dist/extractCta608DataFromSample.d.ts +0 -12
- package/dist/extractCta608DataFromSample.d.ts.map +0 -1
- package/dist/extractCta608DataFromSample.js +0 -35
- package/dist/extractCta608DataFromSample.js.map +0 -1
- package/dist/findCta608Nalus.d.ts +0 -12
- package/dist/findCta608Nalus.d.ts.map +0 -1
- package/dist/findCta608Nalus.js +0 -60
- package/dist/findCta608Nalus.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/utils/NR_COLS.d.ts +0 -2
- package/dist/utils/NR_COLS.d.ts.map +0 -1
- package/dist/utils/NR_COLS.js +0 -2
- package/dist/utils/NR_COLS.js.map +0 -1
- package/dist/utils/NR_ROWS.d.ts +0 -2
- package/dist/utils/NR_ROWS.d.ts.map +0 -1
- package/dist/utils/NR_ROWS.js +0 -2
- package/dist/utils/NR_ROWS.js.map +0 -1
- package/dist/utils/backgroundColors.d.ts +0 -2
- package/dist/utils/backgroundColors.d.ts.map +0 -1
- package/dist/utils/backgroundColors.js +0 -12
- package/dist/utils/backgroundColors.js.map +0 -1
- package/dist/utils/createCmdHistory.d.ts +0 -3
- package/dist/utils/createCmdHistory.d.ts.map +0 -1
- package/dist/utils/createCmdHistory.js +0 -7
- package/dist/utils/createCmdHistory.js.map +0 -1
- package/dist/utils/getCharForByte.d.ts +0 -2
- package/dist/utils/getCharForByte.d.ts.map +0 -1
- package/dist/utils/getCharForByte.js +0 -6
- package/dist/utils/getCharForByte.js.map +0 -1
- package/dist/utils/hasCmdRepeated.d.ts +0 -3
- package/dist/utils/hasCmdRepeated.d.ts.map +0 -1
- package/dist/utils/hasCmdRepeated.js +0 -4
- package/dist/utils/hasCmdRepeated.js.map +0 -1
- package/dist/utils/index.d.ts +0 -20
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/numArrayToHexArray.d.ts +0 -2
- package/dist/utils/numArrayToHexArray.d.ts.map +0 -1
- package/dist/utils/numArrayToHexArray.js +0 -9
- package/dist/utils/numArrayToHexArray.js.map +0 -1
- package/dist/utils/rowsHighCh1.d.ts +0 -4
- package/dist/utils/rowsHighCh1.d.ts.map +0 -1
- package/dist/utils/rowsHighCh1.js +0 -10
- package/dist/utils/rowsHighCh1.js.map +0 -1
- package/dist/utils/rowsHighCh2.d.ts +0 -4
- package/dist/utils/rowsHighCh2.d.ts.map +0 -1
- package/dist/utils/rowsHighCh2.js +0 -10
- package/dist/utils/rowsHighCh2.js.map +0 -1
- package/dist/utils/rowsLowCh1.d.ts +0 -4
- package/dist/utils/rowsLowCh1.d.ts.map +0 -1
- package/dist/utils/rowsLowCh1.js +0 -12
- package/dist/utils/rowsLowCh1.js.map +0 -1
- package/dist/utils/rowsLowCh2.d.ts +0 -4
- package/dist/utils/rowsLowCh2.d.ts.map +0 -1
- package/dist/utils/rowsLowCh2.js +0 -11
- package/dist/utils/rowsLowCh2.js.map +0 -1
- package/dist/utils/seiHelpers.d.ts +0 -7
- package/dist/utils/seiHelpers.d.ts.map +0 -1
- package/dist/utils/seiHelpers.js +0 -78
- package/dist/utils/seiHelpers.js.map +0 -1
- package/dist/utils/setLastCmd.d.ts +0 -3
- package/dist/utils/setLastCmd.d.ts.map +0 -1
- package/dist/utils/setLastCmd.js +0 -5
- package/dist/utils/setLastCmd.js.map +0 -1
- package/dist/utils/specialCea608CharsCodes.d.ts +0 -7
- package/dist/utils/specialCea608CharsCodes.d.ts.map +0 -1
- package/dist/utils/specialCea608CharsCodes.js +0 -103
- package/dist/utils/specialCea608CharsCodes.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC","sourcesContent":["/**\n * CTA-608/CEA-608 closed captioning functionality.\n *\n * @packageDocumentation\n */\nexport type * from './CaptionModes.js';\nexport * from './CaptionScreen.js';\nexport * from './CaptionsLogger.js';\nexport * from './Cta608Channel.js';\nexport * from './Cta608Parser.js';\nexport * from './CueHandler.js';\nexport * from './extractCta608Data.js';\nexport * from './findCta608Nalus.js';\nexport * from './PACData.js';\nexport * from './PenState.js';\nexport * from './PenStyles.js';\nexport * from './Row.js';\nexport * from './SccParser.js';\nexport * from './StyledUnicodeChar.js';\nexport * from './SupportedField.js';\nexport * from './VerboseLevel.js';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["m: string","specialCea608CharsCodes: Record<number, number>","i: number","chars: string[]","styles: PenStyles","displayText: string[]","styles: Partial<PenStyles>","backgroundColors: string[]","hexArray: string[]","rowsHighCh1: Record<number, number>","rowsHighCh2: Record<number, number>","rowsLowCh1: Record<number, number>","rowsLowCh2: Record<number, number>","cmdFound: boolean","charsFound: number[] | null","chNr: number","row: number","chNr: Channels","pacData: PACData","channelNr: Channels","charCodes: number[]","charCode1: number | null","oneCode: number","index: number","bkgData: Partial<PenStyles>","fieldData: number[][]","ccData1: number","ccData2: number","raw","ceaData: number[]"],"sources":["../src/VerboseLevel.ts","../src/CaptionsLogger.ts","../src/PenState.ts","../src/StyledUnicodeChar.ts","../src/utils/NR_COLS.ts","../src/utils/specialCea608CharsCodes.ts","../src/utils/getCharForByte.ts","../src/Row.ts","../src/utils/NR_ROWS.ts","../src/CaptionScreen.ts","../src/Cta608Channel.ts","../src/utils/backgroundColors.ts","../src/utils/createCmdHistory.ts","../src/utils/hasCmdRepeated.ts","../src/utils/numArrayToHexArray.ts","../src/utils/rowsHighCh1.ts","../src/utils/rowsHighCh2.ts","../src/utils/rowsLowCh1.ts","../src/utils/rowsLowCh2.ts","../src/utils/setLastCmd.ts","../src/Cta608Parser.ts","../src/extractCta608Data.ts","../src/findCta608Nalus.ts","../src/SccParser.ts"],"sourcesContent":["import type { ValueOf } from '@svta/cml-utils'\n\n/**\n * Logging levels for the CTA-608 parser.\n *\n *\n * @enum\n *\n * @beta\n */\nexport const VerboseLevel = {\n\tERROR: 0,\n\tTEXT: 1,\n\tWARNING: 2,\n\tINFO: 2,\n\tDEBUG: 3,\n\tDATA: 3,\n} as const\n\n/**\n * @beta\n */\nexport type VerboseLevel = ValueOf<typeof VerboseLevel>;\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { VerboseLevel } from './VerboseLevel.ts'\n\n/**\n * CaptionsLogger. To be removed in the future.\n *\n * @beta\n */\nexport class CaptionsLogger {\n\tpublic time: number | null = null\n\tpublic verboseLevel: VerboseLevel = VerboseLevel.ERROR\n\n\tlog(severity: VerboseLevel, msg: string | (() => string)): void {\n\t\tif (this.verboseLevel >= severity) {\n\t\t\tconst m: string = typeof msg === 'function' ? msg() : msg\n\t\t\tconsole.log(`${this.time} [${severity}] ${m}`)\n\t\t}\n\t}\n}\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { PenStyles } from './PenStyles.ts'\n\n/**\n * Pen state.\n *\n * @beta\n */\nexport class PenState {\n\tpublic foreground: string = 'white'\n\tpublic underline: boolean = false\n\tpublic italics: boolean = false\n\tpublic background: string = 'black'\n\tpublic flash: boolean = false\n\n\treset(): void {\n\t\tthis.foreground = 'white'\n\t\tthis.underline = false\n\t\tthis.italics = false\n\t\tthis.background = 'black'\n\t\tthis.flash = false\n\t}\n\n\tsetStyles(styles: Partial<PenStyles>): void {\n\t\tconst attribs = [\n\t\t\t'foreground',\n\t\t\t'underline',\n\t\t\t'italics',\n\t\t\t'background',\n\t\t\t'flash',\n\t\t]\n\t\tfor (const style of attribs) {\n\t\t\tif (Object.prototype.hasOwnProperty.call(styles, style)) {\n\t\t\t\t(this as any)[style] = (styles as any)[style]\n\t\t\t}\n\t\t}\n\t}\n\n\tisDefault(): boolean {\n\t\treturn (\n\t\t\tthis.foreground === 'white' &&\n\t\t\t!this.underline &&\n\t\t\t!this.italics &&\n\t\t\tthis.background === 'black' &&\n\t\t\t!this.flash\n\t\t)\n\t}\n\n\tequals(other: PenState): boolean {\n\t\treturn (\n\t\t\tthis.foreground === other.foreground &&\n\t\t\tthis.underline === other.underline &&\n\t\t\tthis.italics === other.italics &&\n\t\t\tthis.background === other.background &&\n\t\t\tthis.flash === other.flash\n\t\t)\n\t}\n\n\tcopy(newPenState: PenState): void {\n\t\tthis.foreground = newPenState.foreground\n\t\tthis.underline = newPenState.underline\n\t\tthis.italics = newPenState.italics\n\t\tthis.background = newPenState.background\n\t\tthis.flash = newPenState.flash\n\t}\n}\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { PenState } from './PenState.ts'\n\n/**\n * Unicode character with styling and background.\n *\n * @beta\n */\nexport class StyledUnicodeChar {\n\tuchar: string = ' '\n\tpenState: PenState = new PenState()\n\n\treset(): void {\n\t\tthis.uchar = ' '\n\t\tthis.penState.reset()\n\t}\n\n\tsetChar(uchar: string, newPenState: PenState): void {\n\t\tthis.uchar = uchar\n\t\tthis.penState.copy(newPenState)\n\t}\n\n\tsetPenState(newPenState: PenState): void {\n\t\tthis.penState.copy(newPenState)\n\t}\n\n\tequals(other: StyledUnicodeChar): boolean {\n\t\treturn this.uchar === other.uchar && this.penState.equals(other.penState)\n\t}\n\n\tcopy(newChar: StyledUnicodeChar): void {\n\t\tthis.uchar = newChar.uchar\n\t\tthis.penState.copy(newChar.penState)\n\t}\n\n\tisEmpty(): boolean {\n\t\treturn this.uchar === ' ' && this.penState.isDefault()\n\t}\n}\n","export const NR_COLS = 100\n","/**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\nexport const specialCea608CharsCodes: Record<number, number> = {\n\t42: 225, // lowercase a, acute accent\n\t92: 233, // lowercase e, acute accent\n\t94: 237, // lowercase i, acute accent\n\t95: 243, // lowercase o, acute accent\n\t96: 250, // lowercase u, acute accent\n\t123: 231, // lowercase c with cedilla\n\t124: 247, // division symbol\n\t125: 209, // uppercase N tilde\n\t126: 241, // lowercase n tilde\n\t127: 9608, // Full block\n\n\n\n\t// THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n\t// THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n\t// THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n\t128: 174, // Registered symbol (R)\n\t129: 176, // degree sign\n\t130: 189, // 1/2 symbolOutputFilter\n\t131: 191, // Inverted (open) question mark\n\t132: 8482, // Trademark symbol (TM)\n\t133: 162, // Cents symbol\n\t134: 163, // Pounds sterling\n\t135: 9834, // Music 8'th note\n\t136: 224, // lowercase a, grave accent\n\t137: 32, // transparent space (regular)\n\t138: 232, // lowercase e, grave accent\n\t139: 226, // lowercase a, circumflex accent\n\t140: 234, // lowercase e, circumflex accent\n\t141: 238, // lowercase i, circumflex accent\n\t142: 244, // lowercase o, circumflex accent\n\t143: 251, // lowercase u, circumflex accent\n\n\n\t// THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n\t// THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n\t144: 193, // capital letter A with acute\n\t145: 201, // capital letter E with acute\n\t146: 211, // capital letter O with acute\n\t147: 218, // capital letter U with acute\n\t148: 220, // capital letter U with diaresis\n\t149: 252, // lowercase letter U with diaeresis\n\t150: 8216, // opening single quote\n\t151: 161, // inverted exclamation mark\n\t152: 42, // asterisk\n\t153: 8217, // closing single quote\n\t154: 9473, // box drawings heavy horizontal\n\t155: 169, // copyright sign\n\t156: 8480, // Service mark\n\t157: 8226, // (round) bullet\n\t158: 8220, // Left double quotation mark\n\t159: 8221, // Right double quotation mark\n\t160: 192, // uppercase A, grave accent\n\t161: 194, // uppercase A, circumflex\n\t162: 199, // uppercase C with cedilla\n\t163: 200, // uppercase E, grave accent\n\t164: 202, // uppercase E, circumflex\n\t165: 203, // capital letter E with diaresis\n\t166: 235, // lowercase letter e with diaresis\n\t167: 206, // uppercase I, circumflex\n\t168: 207, // uppercase I, with diaresis\n\t169: 239, // lowercase i, with diaresis\n\t170: 212, // uppercase O, circumflex\n\t171: 217, // uppercase U, grave accent\n\t172: 249, // lowercase u, grave accent\n\t173: 219, // uppercase U, circumflex\n\t174: 171, // left-pointing double angle quotation mark\n\t175: 187, // right-pointing double angle quotation mark\n\n\n\t// THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n\t// THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n\t176: 195, // Uppercase A, tilde\n\t177: 227, // Lowercase a, tilde\n\t178: 205, // Uppercase I, acute accent\n\t179: 204, // Uppercase I, grave accent\n\t180: 236, // Lowercase i, grave accent\n\t181: 210, // Uppercase O, grave accent\n\t182: 242, // Lowercase o, grave accent\n\t183: 213, // Uppercase O, tilde\n\t184: 245, // Lowercase o, tilde\n\t185: 123, // Open curly brace\n\t186: 125, // Closing curly brace\n\t187: 92, // Backslash\n\t188: 94, // Caret\n\t189: 95, // Underscore\n\t190: 124, // Pipe (vertical line)\n\t191: 8764, // Tilde operator\n\t192: 196, // Uppercase A, umlaut\n\t193: 228, // Lowercase A, umlaut\n\t194: 214, // Uppercase O, umlaut\n\t195: 246, // Lowercase o, umlaut\n\t196: 223, // Esszett (sharp S)\n\t197: 165, // Yen symbolOutputFilter\n\t198: 164, // Generic currency sign\n\t199: 9475, // Box drawings heavy vertical\n\t200: 197, // Uppercase A, ring\n\t201: 229, // Lowercase A, ring\n\t202: 216, // Uppercase O, stroke\n\t203: 248, // Lowercase o, strok\n\t204: 9487, // Box drawings heavy down and right\n\t205: 9491, // Box drawings heavy down and left\n\t206: 9495, // Box drawings heavy up and right\n\t207: 9499, // Box drawings heavy up and left\n}\n","import { specialCea608CharsCodes } from './specialCea608CharsCodes.ts'\n\nexport function getCharForByte(byte: number): string {\n\treturn String.fromCharCode(specialCea608CharsCodes[byte] || byte)\n};\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { CaptionsLogger } from './CaptionsLogger.ts'\nimport { PenState } from './PenState.ts'\nimport type { PenStyles } from './PenStyles.ts'\nimport { StyledUnicodeChar } from './StyledUnicodeChar.ts'\nimport { VerboseLevel } from './VerboseLevel.ts'\nimport { NR_COLS } from './utils/NR_COLS.ts'\nimport { getCharForByte } from './utils/getCharForByte.ts'\n\n/**\n * CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n *\n * @beta\n */\nexport class Row {\n\tpublic chars: StyledUnicodeChar[] = []\n\tpublic cueStartTime: number | null = null\n\n\tprivate pos: number = 0\n\tprivate currPenState: PenState = new PenState()\n\tprivate logger: CaptionsLogger\n\n\tconstructor(logger: CaptionsLogger = new CaptionsLogger()) {\n\t\tfor (let i = 0; i < NR_COLS; i++) {\n\t\t\tthis.chars.push(new StyledUnicodeChar())\n\t\t}\n\t\tthis.logger = logger\n\t}\n\n\tequals(other: Row): boolean {\n\t\tfor (let i = 0; i < NR_COLS; i++) {\n\t\t\tif (!this.chars[i].equals(other.chars[i])) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\n\tcopy(other: Row): void {\n\t\tfor (let i = 0; i < NR_COLS; i++) {\n\t\t\tthis.chars[i].copy(other.chars[i])\n\t\t}\n\t}\n\n\tisEmpty(): boolean {\n\t\tlet empty = true\n\t\tfor (let i = 0; i < NR_COLS; i++) {\n\t\t\tif (!this.chars[i].isEmpty()) {\n\t\t\t\tempty = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn empty\n\t}\n\n\t/**\n\t * Set the cursor to a valid column.\n\t */\n\tsetCursor(absPos: number): void {\n\t\tif (this.pos !== absPos) {\n\t\t\tthis.pos = absPos\n\t\t}\n\n\t\tif (this.pos < 0) {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t'Negative cursor position ' + this.pos,\n\t\t\t)\n\t\t\tthis.pos = 0\n\t\t}\n\t\telse if (this.pos > NR_COLS) {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t'Too large cursor position ' + this.pos,\n\t\t\t)\n\t\t\tthis.pos = NR_COLS\n\t\t}\n\t}\n\n\t/**\n\t * Move the cursor relative to current position.\n\t */\n\tmoveCursor(relPos: number): void {\n\t\tconst newPos = this.pos + relPos\n\t\tif (relPos > 1) {\n\t\t\tfor (let i = this.pos + 1; i < newPos + 1; i++) {\n\t\t\t\tthis.chars[i].setPenState(this.currPenState)\n\t\t\t}\n\t\t}\n\t\tthis.setCursor(newPos)\n\t}\n\n\t/**\n\t * Backspace, move one step back and clear character.\n\t */\n\tbackSpace(): void {\n\t\tthis.moveCursor(-1)\n\t\tthis.chars[this.pos].setChar(' ', this.currPenState)\n\t}\n\n\tinsertChar(byte: number): void {\n\t\tif (byte >= 0x90) {\n\t\t\t// Extended char\n\t\t\tthis.backSpace()\n\t\t}\n\t\tconst char = getCharForByte(byte)\n\t\tif (this.pos >= NR_COLS) {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.ERROR,\n\t\t\t\t() =>\n\t\t\t\t\t'Cannot insert ' +\n\t\t\t\t\tbyte.toString(16) +\n\t\t\t\t\t' (' +\n\t\t\t\t\tchar +\n\t\t\t\t\t') at position ' +\n\t\t\t\t\tthis.pos +\n\t\t\t\t\t'. Skipping it!',\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\tthis.chars[this.pos].setChar(char, this.currPenState)\n\t\tthis.moveCursor(1)\n\t}\n\n\tclearFromPos(startPos: number): void {\n\t\tlet i: number\n\t\tfor (i = startPos; i < NR_COLS; i++) {\n\t\t\tthis.chars[i].reset()\n\t\t}\n\t}\n\n\tclear(): void {\n\t\tthis.clearFromPos(0)\n\t\tthis.pos = 0\n\t\tthis.currPenState.reset()\n\t}\n\n\tclearToEndOfRow(): void {\n\t\tthis.clearFromPos(this.pos)\n\t}\n\n\tgetTextString(): string {\n\t\tconst chars: string[] = []\n\t\tlet empty = true\n\t\tfor (let i = 0; i < NR_COLS; i++) {\n\t\t\tconst char = this.chars[i].uchar\n\t\t\tif (char !== ' ') {\n\t\t\t\tempty = false\n\t\t\t}\n\n\t\t\tchars.push(char)\n\t\t}\n\t\tif (empty) {\n\t\t\treturn ''\n\t\t}\n\t\telse {\n\t\t\treturn chars.join('')\n\t\t}\n\t}\n\n\tsetPenStyles(styles: Partial<PenStyles>): void {\n\t\tthis.currPenState.setStyles(styles)\n\t\tconst currChar = this.chars[this.pos]\n\t\tcurrChar.setPenState(this.currPenState)\n\t}\n}\n","export const NR_ROWS = 15\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { CaptionsLogger } from './CaptionsLogger.ts'\nimport type { PACData } from './PACData.ts'\nimport type { PenStyles } from './PenStyles.ts'\nimport { Row } from './Row.ts'\nimport { NR_ROWS } from './utils/NR_ROWS.ts'\nimport { VerboseLevel } from './VerboseLevel.ts'\n\n/**\n * Keep a CTA-608 screen of 32x15 styled characters\n *\n * @beta\n */\nexport class CaptionScreen {\n\trows: Row[] = []\n\tprivate currRow: number = NR_ROWS - 1\n\tprivate nrRollUpRows: number | null = null\n\tprivate lastOutputScreen: CaptionScreen | null = null\n\tprivate logger: CaptionsLogger\n\n\tconstructor(logger: CaptionsLogger = new CaptionsLogger()) {\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tthis.rows.push(new Row(logger))\n\t\t}\n\t\tthis.logger = logger\n\t}\n\n\treset(): void {\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tthis.rows[i].clear()\n\t\t}\n\t\tthis.currRow = NR_ROWS - 1\n\t}\n\n\tequals(other: CaptionScreen): boolean {\n\t\tlet equal = true\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tif (!this.rows[i].equals(other.rows[i])) {\n\t\t\t\tequal = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn equal\n\t}\n\n\tcopy(other: CaptionScreen): void {\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tthis.rows[i].copy(other.rows[i])\n\t\t}\n\t}\n\n\tisEmpty(): boolean {\n\t\tlet empty = true\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tif (!this.rows[i].isEmpty()) {\n\t\t\t\tempty = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn empty\n\t}\n\n\tbackSpace(): void {\n\t\tconst row = this.rows[this.currRow]\n\t\trow.backSpace()\n\t}\n\n\tclearToEndOfRow(): void {\n\t\tconst row = this.rows[this.currRow]\n\t\trow.clearToEndOfRow()\n\t}\n\n\t/**\n\t * Insert a character (without styling) in the current row.\n\t */\n\tinsertChar(char: number): void {\n\t\tconst row = this.rows[this.currRow]\n\t\trow.insertChar(char)\n\t}\n\n\tsetPen(styles: Partial<PenStyles>): void {\n\t\tconst row = this.rows[this.currRow]\n\t\trow.setPenStyles(styles)\n\t}\n\n\tmoveCursor(relPos: number): void {\n\t\tconst row = this.rows[this.currRow]\n\t\trow.moveCursor(relPos)\n\t}\n\n\tsetCursor(absPos: number): void {\n\t\tthis.logger.log(VerboseLevel.INFO, 'setCursor: ' + absPos)\n\t\tconst row = this.rows[this.currRow]\n\t\trow.setCursor(absPos)\n\t}\n\n\tsetPAC(pacData: PACData): void {\n\t\tthis.logger.log(\n\t\t\tVerboseLevel.INFO,\n\t\t\t() => 'pacData = ' + JSON.stringify(pacData),\n\t\t)\n\t\tlet newRow = pacData.row - 1\n\t\tif (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n\t\t\tnewRow = this.nrRollUpRows - 1\n\t\t}\n\n\t\t// Make sure this only affects Roll-up Captions by checking this.nrRollUpRows\n\t\tif (this.nrRollUpRows && this.currRow !== newRow) {\n\t\t\t// clear all rows first\n\t\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\t\tthis.rows[i].clear()\n\t\t\t}\n\n\t\t\t// Copy this.nrRollUpRows rows from lastOutputScreen and place it in the newRow location\n\t\t\t// topRowIndex - the start of rows to copy (inclusive index)\n\t\t\tconst topRowIndex = this.currRow + 1 - this.nrRollUpRows\n\t\t\t// We only copy if the last position was already shown.\n\t\t\t// We use the cueStartTime value to check this.\n\t\t\tconst lastOutputScreen = this.lastOutputScreen\n\t\t\tif (lastOutputScreen) {\n\t\t\t\tconst prevLineTime = lastOutputScreen.rows[topRowIndex].cueStartTime\n\t\t\t\tconst time = this.logger.time\n\t\t\t\tif (prevLineTime !== null && time !== null && prevLineTime < time) {\n\t\t\t\t\tfor (let i = 0; i < this.nrRollUpRows; i++) {\n\t\t\t\t\t\tthis.rows[newRow - this.nrRollUpRows + i + 1].copy(\n\t\t\t\t\t\t\tlastOutputScreen.rows[topRowIndex + i],\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.currRow = newRow\n\t\tconst row = this.rows[this.currRow]\n\t\tif (pacData.indent !== null) {\n\t\t\tconst indent = pacData.indent\n\t\t\tconst prevPos = Math.max(indent - 1, 0)\n\t\t\trow.setCursor(pacData.indent)\n\t\t\tpacData.color = row.chars[prevPos].penState.foreground\n\t\t}\n\t\tconst styles: PenStyles = {\n\t\t\tforeground: pacData.color,\n\t\t\tunderline: pacData.underline,\n\t\t\titalics: pacData.italics,\n\t\t\tbackground: 'black',\n\t\t\tflash: false,\n\t\t}\n\t\tthis.setPen(styles)\n\t}\n\n\t/**\n\t * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n\t */\n\tsetBkgData(bkgData: Partial<PenStyles>): void {\n\t\tthis.logger.log(\n\t\t\tVerboseLevel.INFO,\n\t\t\t() => 'bkgData = ' + JSON.stringify(bkgData),\n\t\t)\n\t\tthis.backSpace()\n\t\tthis.setPen(bkgData)\n\t\tthis.insertChar(0x20) // Space\n\t}\n\n\tsetRollUpRows(nrRows: number | null): void {\n\t\tthis.nrRollUpRows = nrRows\n\t}\n\n\trollUp(): void {\n\t\tif (this.nrRollUpRows === null) {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t'roll_up but nrRollUpRows not set yet',\n\t\t\t)\n\t\t\treturn // Not properly setup\n\t\t}\n\t\tthis.logger.log(VerboseLevel.TEXT, () => this.getDisplayText())\n\t\tconst topRowIndex = this.currRow + 1 - this.nrRollUpRows\n\t\tconst topRow = this.rows.splice(topRowIndex, 1)[0]\n\t\ttopRow.clear()\n\t\tthis.rows.splice(this.currRow, 0, topRow)\n\t\tthis.logger.log(VerboseLevel.INFO, 'Rolling up')\n\t}\n\n\t/**\n\t * Get all non-empty rows with as unicode text.\n\t */\n\tgetDisplayText(asOneRow?: boolean): string {\n\t\tasOneRow = asOneRow || false\n\t\tconst displayText: string[] = []\n\t\tlet text = ''\n\t\tlet rowNr = -1\n\t\tfor (let i = 0; i < NR_ROWS; i++) {\n\t\t\tconst rowText = this.rows[i].getTextString()\n\t\t\tif (rowText) {\n\t\t\t\trowNr = i + 1\n\t\t\t\tif (asOneRow) {\n\t\t\t\t\tdisplayText.push('Row ' + rowNr + \": '\" + rowText + \"'\")\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdisplayText.push(rowText.trim())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (displayText.length > 0) {\n\t\t\tif (asOneRow) {\n\t\t\t\ttext = '[' + displayText.join(' | ') + ']'\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttext = displayText.join('\\n')\n\t\t\t}\n\t\t}\n\t\treturn text\n\t}\n\n\tgetTextAndFormat(): Row[] {\n\t\treturn this.rows\n\t}\n}\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport type { CaptionModes } from './CaptionModes.ts'\nimport { CaptionScreen } from './CaptionScreen.ts'\nimport { CaptionsLogger } from './CaptionsLogger.ts'\nimport type { CueHandler } from './CueHandler.ts'\nimport type { PACData } from './PACData.ts'\nimport type { PenStyles } from './PenStyles.ts'\nimport type { Row } from './Row.ts'\nimport { VerboseLevel } from './VerboseLevel.ts'\nimport { NR_ROWS } from './utils/NR_ROWS.ts'\n\n/**\n * CTA-608 Channel\n *\n * @beta\n */\nexport class Cta608Channel {\n\tchNr: number\n\toutputFilter: CueHandler\n\tmode: CaptionModes\n\tdisplayedMemory: CaptionScreen\n\tnonDisplayedMemory: CaptionScreen\n\tlastOutputScreen: CaptionScreen\n\tcurrRollUpRow: Row\n\twriteScreen: CaptionScreen\n\tcueStartTime: number | null\n\n\tprivate logger: CaptionsLogger\n\n\tconstructor(\n\t\tchannelNumber: number,\n\t\toutputFilter: CueHandler,\n\t\tlogger: CaptionsLogger = new CaptionsLogger(),\n\t) {\n\t\tthis.chNr = channelNumber\n\t\tthis.outputFilter = outputFilter\n\t\tthis.mode = null\n\t\tthis.displayedMemory = new CaptionScreen(logger)\n\t\tthis.nonDisplayedMemory = new CaptionScreen(logger)\n\t\tthis.lastOutputScreen = new CaptionScreen(logger)\n\t\tthis.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1]\n\t\tthis.writeScreen = this.displayedMemory\n\t\tthis.mode = null\n\t\tthis.cueStartTime = null // Keeps track of where a cue started.\n\t\tthis.logger = logger\n\n\t\tthis.logger.log(VerboseLevel.INFO, 'new Cea608Channel(' + this.chNr + ')')\n\t}\n\n\treset(): void {\n\t\tthis.mode = null\n\t\tthis.displayedMemory.reset()\n\t\tthis.nonDisplayedMemory.reset()\n\t\tthis.lastOutputScreen.reset()\n\t\tthis.outputFilter?.reset?.()\n\t\tthis.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1]\n\t\tthis.writeScreen = this.displayedMemory\n\t\tthis.mode = null\n\t\tthis.cueStartTime = null\n\t}\n\n\tgetHandler(): CueHandler {\n\t\treturn this.outputFilter\n\t}\n\n\tsetHandler(outputFilter: CueHandler): void {\n\t\tthis.outputFilter = outputFilter\n\t}\n\n\tsetPAC(pacData: PACData): void {\n\t\tthis.writeScreen.setPAC(pacData)\n\t}\n\n\tsetBkgData(bkgData: Partial<PenStyles>): void {\n\t\tthis.writeScreen.setBkgData(bkgData)\n\t}\n\n\tsetMode(newMode: CaptionModes): void {\n\t\tif (newMode === this.mode) {\n\t\t\treturn\n\t\t}\n\n\t\tthis.mode = newMode\n\t\tthis.logger.log(VerboseLevel.INFO, () => 'MODE=' + newMode)\n\t\tif (this.mode === 'MODE_POP-ON') {\n\t\t\tthis.writeScreen = this.nonDisplayedMemory\n\t\t}\n\t\telse {\n\t\t\tthis.writeScreen = this.displayedMemory\n\t\t\tthis.writeScreen.reset()\n\t\t}\n\t\tif (this.mode !== 'MODE_ROLL-UP') {\n\t\t\tthis.displayedMemory.setRollUpRows(null)\n\t\t\tthis.nonDisplayedMemory.setRollUpRows(null)\n\t\t}\n\t\tthis.mode = newMode\n\t}\n\n\tinsertChars(chars: number[]): void {\n\t\tfor (const char of chars) {\n\t\t\tthis.writeScreen.insertChar(char)\n\t\t}\n\n\t\tconst screen =\n\t\t\tthis.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP'\n\t\tthis.logger.log(\n\t\t\tVerboseLevel.INFO,\n\t\t\t() => screen + ': ' + this.writeScreen.getDisplayText(true),\n\t\t)\n\t\tif (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.TEXT,\n\t\t\t\t() => 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true),\n\t\t\t)\n\t\t\tthis.outputDataUpdate()\n\t\t}\n\t}\n\n\tccRCL(): void {\n\t\t// Resume Caption Loading (switch mode to Pop On)\n\t\tthis.logger.log(VerboseLevel.INFO, 'RCL - Resume Caption Loading')\n\t\tthis.setMode('MODE_POP-ON')\n\t}\n\n\tccBS(): void {\n\t\t// BackSpace\n\t\tthis.logger.log(VerboseLevel.INFO, 'BS - BackSpace')\n\t\tif (this.mode === 'MODE_TEXT') {\n\t\t\treturn\n\t\t}\n\n\t\tthis.writeScreen.backSpace()\n\t\tif (this.writeScreen === this.displayedMemory) {\n\t\t\tthis.outputDataUpdate()\n\t\t}\n\t}\n\n\tccAOF(): void {\n\t\t// Reserved (formerly Alarm Off)\n\t}\n\n\tccAON(): void {\n\t\t// Reserved (formerly Alarm On)\n\t}\n\n\tccDER(): void {\n\t\t// Delete to End of Row\n\t\tthis.logger.log(VerboseLevel.INFO, 'DER- Delete to End of Row')\n\t\tthis.writeScreen.clearToEndOfRow()\n\t\tthis.outputDataUpdate()\n\t}\n\n\tccRU(nrRows: number | null): void {\n\t\t// Roll-Up Captions-2,3,or 4 Rows\n\t\tthis.logger.log(VerboseLevel.INFO, 'RU(' + nrRows + ') - Roll Up')\n\t\tthis.writeScreen = this.displayedMemory\n\t\tthis.setMode('MODE_ROLL-UP')\n\t\tthis.writeScreen.setRollUpRows(nrRows)\n\t}\n\n\tccFON(): void {\n\t\t// Flash On\n\t\tthis.logger.log(VerboseLevel.INFO, 'FON - Flash On')\n\t\tthis.writeScreen.setPen({ flash: true })\n\t}\n\n\tccRDC(): void {\n\t\t// Resume Direct Captioning (switch mode to PaintOn)\n\t\tthis.logger.log(VerboseLevel.INFO, 'RDC - Resume Direct Captioning')\n\t\tthis.setMode('MODE_PAINT-ON')\n\t}\n\n\tccTR(): void {\n\t\t// Text Restart in text mode (not supported, however)\n\t\tthis.logger.log(VerboseLevel.INFO, 'TR')\n\t\tthis.setMode('MODE_TEXT')\n\t}\n\n\tccRTD(): void {\n\t\t// Resume Text Display in Text mode (not supported, however)\n\t\tthis.logger.log(VerboseLevel.INFO, 'RTD')\n\t\tthis.setMode('MODE_TEXT')\n\t}\n\n\tccEDM(): void {\n\t\t// Erase Displayed Memory\n\t\tthis.logger.log(VerboseLevel.INFO, 'EDM - Erase Displayed Memory')\n\t\tthis.displayedMemory.reset()\n\t\tthis.outputDataUpdate(true)\n\t}\n\n\tccCR(): void {\n\t\t// Carriage Return\n\t\tthis.logger.log(VerboseLevel.INFO, 'CR - Carriage Return')\n\t\tthis.writeScreen.rollUp()\n\t\tthis.outputDataUpdate(true)\n\t}\n\n\tccENM(): void {\n\t\t// Erase Non-Displayed Memory\n\t\tthis.logger.log(VerboseLevel.INFO, 'ENM - Erase Non-displayed Memory')\n\t\tthis.nonDisplayedMemory.reset()\n\t}\n\n\tccEOC(): void {\n\t\t// End of Caption (Flip Memories)\n\t\tthis.logger.log(VerboseLevel.INFO, 'EOC - End Of Caption')\n\t\tif (this.mode === 'MODE_POP-ON') {\n\t\t\tconst tmp = this.displayedMemory\n\t\t\tthis.displayedMemory = this.nonDisplayedMemory\n\t\t\tthis.nonDisplayedMemory = tmp\n\t\t\tthis.writeScreen = this.nonDisplayedMemory\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.TEXT,\n\t\t\t\t() => 'DISP: ' + this.displayedMemory.getDisplayText(),\n\t\t\t)\n\t\t}\n\t\tthis.outputDataUpdate(true)\n\t}\n\n\tccTO(nrCols: number): void {\n\t\t// Tab Offset 1,2, or 3 columns\n\t\tthis.logger.log(VerboseLevel.INFO, 'TO(' + nrCols + ') - Tab Offset')\n\t\tthis.writeScreen.moveCursor(nrCols)\n\t}\n\n\tccMIDROW(secondByte: number): void {\n\t\t// Parse MIDROW command\n\t\tconst styles: Partial<PenStyles> = { flash: false }\n\t\tstyles.underline = secondByte % 2 === 1\n\t\tstyles.italics = secondByte >= 0x2e\n\t\tif (!styles.italics) {\n\t\t\tconst colorIndex = Math.floor(secondByte / 2) - 0x10\n\t\t\tconst colors = [\n\t\t\t\t'white',\n\t\t\t\t'green',\n\t\t\t\t'blue',\n\t\t\t\t'cyan',\n\t\t\t\t'red',\n\t\t\t\t'yellow',\n\t\t\t\t'magenta',\n\t\t\t]\n\t\t\tstyles.foreground = colors[colorIndex]\n\t\t}\n\t\telse {\n\t\t\tstyles.foreground = 'white'\n\t\t}\n\t\tthis.logger.log(VerboseLevel.INFO, 'MIDROW: ' + JSON.stringify(styles))\n\t\tthis.writeScreen.setPen(styles)\n\t}\n\n\toutputDataUpdate(dispatch: boolean = false): void {\n\t\tconst time = this.logger.time\n\t\tif (time === null) {\n\t\t\treturn\n\t\t}\n\n\t\tif (this.outputFilter) {\n\t\t\tif (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n\t\t\t\t// Start of a new cue\n\t\t\t\tthis.cueStartTime = time\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!this.displayedMemory.equals(this.lastOutputScreen)) {\n\t\t\t\t\tthis.outputFilter.newCue(\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\t\tthis.cueStartTime!,\n\t\t\t\t\t\ttime,\n\t\t\t\t\t\tthis.lastOutputScreen,\n\t\t\t\t\t)\n\t\t\t\t\tif (dispatch && this.outputFilter.dispatchCue) {\n\t\t\t\t\t\tthis.outputFilter.dispatchCue()\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.cueStartTime = this.displayedMemory.isEmpty() ? null : time\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.lastOutputScreen.copy(this.displayedMemory)\n\t\t}\n\t}\n\n\tcueSplitAtTime(t: number): void {\n\t\tif (this.outputFilter) {\n\t\t\tif (!this.displayedMemory.isEmpty()) {\n\t\t\t\tif (this.outputFilter.newCue) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tthis.outputFilter.newCue(this.cueStartTime!, t, this.displayedMemory)\n\t\t\t\t}\n\n\t\t\t\tthis.cueStartTime = t\n\t\t\t}\n\t\t}\n\t}\n}\n","export const backgroundColors: string[] = [\n\t'white',\n\t'green',\n\t'blue',\n\t'cyan',\n\t'red',\n\t'yellow',\n\t'magenta',\n\t'black',\n\t'transparent',\n]\n","import type { CmdHistory } from '../CmdHistory.ts'\n\nexport function createCmdHistory(): CmdHistory {\n\treturn {\n\t\ta: null,\n\t\tb: null,\n\t}\n}\n","import type { CmdHistory } from '../CmdHistory.ts'\n\nexport function hasCmdRepeated(a: number, b: number, cmdHistory: CmdHistory): boolean {\n\treturn cmdHistory.a === a && cmdHistory.b === b\n}\n","export function numArrayToHexArray(numArray: number[]): string[] {\n\tconst hexArray: string[] = []\n\tfor (const num of numArray) {\n\t\thexArray.push(num.toString(16))\n\t}\n\n\treturn hexArray\n};\n","export const rowsHighCh1: Record<number, number> = {\n\t17: 2,\n\t18: 4,\n\t21: 6,\n\t22: 8,\n\t23: 10,\n\t19: 13,\n\t20: 15,\n}\n","export const rowsHighCh2: Record<number, number> = {\n\t25: 2,\n\t26: 4,\n\t29: 6,\n\t30: 8,\n\t31: 10,\n\t27: 13,\n\t28: 15,\n}\n","// Tables to look up row from PAC data\n\nexport const rowsLowCh1: Record<number, number> = {\n\t17: 1,\n\t18: 3,\n\t21: 5,\n\t22: 7,\n\t23: 9,\n\t16: 11,\n\t19: 12,\n\t20: 14,\n}\n","export const rowsLowCh2: Record<number, number> = {\n\t25: 1,\n\t26: 3,\n\t29: 5,\n\t30: 7,\n\t31: 9,\n\t24: 11,\n\t27: 12,\n\t28: 14,\n}\n","import type { CmdHistory } from '../CmdHistory.ts'\n\nexport function setLastCmd(\n\ta: number | null,\n\tb: number | null,\n\tcmdHistory: CmdHistory,\n): void {\n\tcmdHistory.a = a\n\tcmdHistory.b = b\n}\n","/**\n *\n * This code was ported from the dash.js project at:\n * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js\n * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2\n *\n * The original copyright appears below:\n *\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nimport { CaptionsLogger } from './CaptionsLogger.ts'\nimport type { Channels } from './Channels.ts'\nimport type { CmdHistory } from './CmdHistory.ts'\nimport { Cta608Channel } from './Cta608Channel.ts'\nimport type { PACData } from './PACData.ts'\nimport type { PenStyles } from './PenStyles.ts'\nimport type { SupportedField } from './SupportedField.ts'\nimport { VerboseLevel } from './VerboseLevel.ts'\nimport { backgroundColors } from './utils/backgroundColors.ts'\nimport { createCmdHistory } from './utils/createCmdHistory.ts'\nimport { getCharForByte } from './utils/getCharForByte.ts'\nimport { hasCmdRepeated } from './utils/hasCmdRepeated.ts'\nimport { numArrayToHexArray } from './utils/numArrayToHexArray.ts'\nimport { rowsHighCh1 } from './utils/rowsHighCh1.ts'\nimport { rowsHighCh2 } from './utils/rowsHighCh2.ts'\nimport { rowsLowCh1 } from './utils/rowsLowCh1.ts'\nimport { rowsLowCh2 } from './utils/rowsLowCh2.ts'\nimport { setLastCmd } from './utils/setLastCmd.ts'\n\n/**\n * CEA-608 caption parser.\n *\n * @beta\n */\nexport class Cta608Parser {\n\tprivate channels: (Cta608Channel | null)[]\n\tprivate currentChannel: Channels = 0\n\tprivate cmdHistory: CmdHistory = createCmdHistory()\n\tprivate logger: CaptionsLogger\n\tprivate lastTime: number | null = null\n\n\tconstructor(field: SupportedField, out1: any, out2: any) {\n\t\tconst logger = (this.logger = new CaptionsLogger())\n\t\tthis.channels = [\n\t\t\tnull,\n\t\t\tnew Cta608Channel(field, out1, logger),\n\t\t\tnew Cta608Channel(field + 1, out2, logger),\n\t\t]\n\t}\n\n\t/**\n\t * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n\t *\n\t * @param time - The time in milliseconds\n\t * @param byteList - The list of bytes\n\t */\n\taddData(time: number | null, byteList: number[]): void {\n\t\tthis.lastTime = time\n\t\tthis.logger.time = time\n\n\t\tfor (let i = 0; i < byteList.length; i += 2) {\n\t\t\tconst a = byteList[i] & 0x7f\n\t\t\tconst b = byteList[i + 1] & 0x7f\n\t\t\tlet cmdFound: boolean = false\n\t\t\tlet charsFound: number[] | null = null\n\n\t\t\tif (this.lastTime !== null) {\n\t\t\t\ttime = this.lastTime + 0.5 * i * 1001 / 30000\n\t\t\t\tthis.logger.time = time\n\t\t\t}\n\n\t\t\tif (a === 0 && b === 0) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.logger.log(\n\t\t\t\t\tVerboseLevel.DATA,\n\t\t\t\t\t() =>\n\t\t\t\t\t\t'[' +\n\t\t\t\t\t\tnumArrayToHexArray([byteList[i], byteList[i + 1]]) +\n\t\t\t\t\t\t'] -> (' +\n\t\t\t\t\t\tnumArrayToHexArray([a, b]) +\n\t\t\t\t\t\t')',\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tconst cmdHistory = this.cmdHistory\n\t\t\tconst isControlCode = a >= 0x10 && a <= 0x1f\n\t\t\tif (isControlCode) {\n\t\t\t\t// Skip redundant control codes\n\t\t\t\tif (hasCmdRepeated(a, b, cmdHistory)) {\n\t\t\t\t\tsetLastCmd(null, null, cmdHistory)\n\t\t\t\t\tthis.logger.log(\n\t\t\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t'Repeated command (' +\n\t\t\t\t\t\t\tnumArrayToHexArray([a, b]) +\n\t\t\t\t\t\t\t') is dropped',\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsetLastCmd(a, b, this.cmdHistory)\n\n\t\t\t\tcmdFound = this.parseCmd(a, b)\n\n\t\t\t\tif (!cmdFound) {\n\t\t\t\t\tcmdFound = this.parseMidrow(a, b)\n\t\t\t\t}\n\n\t\t\t\tif (!cmdFound) {\n\t\t\t\t\tcmdFound = this.parsePAC(a, b)\n\t\t\t\t}\n\n\t\t\t\tif (!cmdFound) {\n\t\t\t\t\tcmdFound = this.parseBackgroundAttributes(a, b)\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tsetLastCmd(null, null, cmdHistory)\n\t\t\t}\n\n\t\t\tif (!cmdFound) {\n\t\t\t\tcharsFound = this.parseChars(a, b)\n\t\t\t\tif (charsFound.length) {\n\t\t\t\t\tconst currChNr = this.currentChannel\n\t\t\t\t\tif (currChNr && currChNr > 0) {\n\t\t\t\t\t\tconst channel = this.channels[currChNr] as Cta608Channel\n\t\t\t\t\t\tchannel.insertChars(charsFound)\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tthis.logger.log(\n\t\t\t\t\t\t\tVerboseLevel.WARNING,\n\t\t\t\t\t\t\t'No channel found yet. TEXT-MODE?',\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!cmdFound && !charsFound) {\n\t\t\t\tthis.logger.log(\n\t\t\t\t\tVerboseLevel.WARNING,\n\t\t\t\t\t() =>\n\t\t\t\t\t\t\"Couldn't parse cleaned data \" +\n\t\t\t\t\t\tnumArrayToHexArray([a, b]) +\n\t\t\t\t\t\t' orig: ' +\n\t\t\t\t\t\tnumArrayToHexArray([byteList[i], byteList[i + 1]]),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Parse Command.\n\t *\n\t * @param a - The first byte\n\t * @param b - The second byte\n\t * @returns True if a command was found\n\t */\n\tprivate parseCmd(a: number, b: number): boolean {\n\n\t\tconst cond1 =\n\t\t\t(a === 0x14 || a === 0x1c || a === 0x15 || a === 0x1d) &&\n\t\t\tb >= 0x20 &&\n\t\t\tb <= 0x2f\n\t\tconst cond2 = (a === 0x17 || a === 0x1f) && b >= 0x21 && b <= 0x23\n\t\tif (!(cond1 || cond2)) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst chNr = a === 0x14 || a === 0x15 || a === 0x17 ? 1 : 2\n\t\tconst channel = this.channels[chNr] as Cta608Channel\n\n\t\tif (a === 0x14 || a === 0x15 || a === 0x1c || a === 0x1d) {\n\t\t\tif (b === 0x20) {\n\t\t\t\tchannel.ccRCL()\n\t\t\t}\n\t\t\telse if (b === 0x21) {\n\t\t\t\tchannel.ccBS()\n\t\t\t}\n\t\t\telse if (b === 0x22) {\n\t\t\t\tchannel.ccAOF()\n\t\t\t}\n\t\t\telse if (b === 0x23) {\n\t\t\t\tchannel.ccAON()\n\t\t\t}\n\t\t\telse if (b === 0x24) {\n\t\t\t\tchannel.ccDER()\n\t\t\t}\n\t\t\telse if (b === 0x25) {\n\t\t\t\tchannel.ccRU(2)\n\t\t\t}\n\t\t\telse if (b === 0x26) {\n\t\t\t\tchannel.ccRU(3)\n\t\t\t}\n\t\t\telse if (b === 0x27) {\n\t\t\t\tchannel.ccRU(4)\n\t\t\t}\n\t\t\telse if (b === 0x28) {\n\t\t\t\tchannel.ccFON()\n\t\t\t}\n\t\t\telse if (b === 0x29) {\n\t\t\t\tchannel.ccRDC()\n\t\t\t}\n\t\t\telse if (b === 0x2a) {\n\t\t\t\tchannel.ccTR()\n\t\t\t}\n\t\t\telse if (b === 0x2b) {\n\t\t\t\tchannel.ccRTD()\n\t\t\t}\n\t\t\telse if (b === 0x2c) {\n\t\t\t\tchannel.ccEDM()\n\t\t\t}\n\t\t\telse if (b === 0x2d) {\n\t\t\t\tchannel.ccCR()\n\t\t\t}\n\t\t\telse if (b === 0x2e) {\n\t\t\t\tchannel.ccENM()\n\t\t\t}\n\t\t\telse if (b === 0x2f) {\n\t\t\t\tchannel.ccEOC()\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// a == 0x17 || a == 0x1F\n\t\t\tchannel.ccTO(b - 0x20)\n\t\t}\n\n\t\tthis.currentChannel = chNr\n\t\treturn true\n\t}\n\n\t/**\n\t * Parse midrow styling command\n\t *\n\t * @param a - The first byte\n\t * @param b - The second byte\n\t * @returns `true` if midrow styling command was found\n\t */\n\tprivate parseMidrow(a: number, b: number): boolean {\n\t\tlet chNr: number = 0\n\n\t\tif ((a === 0x11 || a === 0x19) && b >= 0x20 && b <= 0x2f) {\n\t\t\tif (a === 0x11) {\n\t\t\t\tchNr = 1\n\t\t\t}\n\t\t\telse {\n\t\t\t\tchNr = 2\n\t\t\t}\n\n\t\t\tif (chNr !== this.currentChannel) {\n\t\t\t\tthis.logger.log(\n\t\t\t\t\tVerboseLevel.ERROR,\n\t\t\t\t\t'Mismatch channel in midrow parsing',\n\t\t\t\t)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst channel = this.channels[chNr]\n\t\t\tif (!channel) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tchannel.ccMIDROW(b)\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t() => 'MIDROW (' + numArrayToHexArray([a, b]) + ')',\n\t\t\t)\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\n\t/**\n\t * Parse Preable Access Codes (Table 53).\n\t *\n\t * @param a - The first byte\n\t * @param b - The second byte\n\t * @returns A Boolean that tells if PAC found\n\t */\n\tprivate parsePAC(a: number, b: number): boolean {\n\t\tlet row: number\n\n\t\tconst case1 =\n\t\t\t((a >= 0x11 && a <= 0x17) || (a >= 0x19 && a <= 0x1f)) &&\n\t\t\tb >= 0x40 &&\n\t\t\tb <= 0x7f\n\t\tconst case2 = (a === 0x10 || a === 0x18) && b >= 0x40 && b <= 0x5f\n\t\tif (!(case1 || case2)) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst chNr: Channels = a <= 0x17 ? 1 : 2\n\n\t\tif (b >= 0x40 && b <= 0x5f) {\n\t\t\trow = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a]\n\t\t}\n\t\telse {\n\t\t\t// 0x60 <= b <= 0x7F\n\t\t\trow = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a]\n\t\t}\n\t\tconst channel = this.channels[chNr]\n\t\tif (!channel) {\n\t\t\treturn false\n\t\t}\n\t\tchannel.setPAC(this.interpretPAC(row, b))\n\t\tthis.currentChannel = chNr\n\t\treturn true\n\t}\n\n\t/**\n\t * Interpret the second byte of the pac, and return the information.\n\t *\n\t * @param row - The row number\n\t * @param byte - The second byte\n\t * @returns pacData with style parameters\n\t */\n\tprivate interpretPAC(row: number, byte: number): PACData {\n\t\tlet pacIndex\n\t\tconst pacData: PACData = {\n\t\t\tcolor: null,\n\t\t\titalics: false,\n\t\t\tindent: null,\n\t\t\tunderline: false,\n\t\t\trow: row,\n\t\t}\n\n\t\tif (byte > 0x5f) {\n\t\t\tpacIndex = byte - 0x60\n\t\t}\n\t\telse {\n\t\t\tpacIndex = byte - 0x40\n\t\t}\n\n\t\tpacData.underline = (pacIndex & 1) === 1\n\t\tif (pacIndex <= 0xd) {\n\t\t\tpacData.color = [\n\t\t\t\t'white',\n\t\t\t\t'green',\n\t\t\t\t'blue',\n\t\t\t\t'cyan',\n\t\t\t\t'red',\n\t\t\t\t'yellow',\n\t\t\t\t'magenta',\n\t\t\t\t'white',\n\t\t\t][Math.floor(pacIndex / 2)]\n\t\t}\n\t\telse if (pacIndex <= 0xf) {\n\t\t\tpacData.italics = true\n\t\t\tpacData.color = 'white'\n\t\t}\n\t\telse {\n\t\t\tpacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4\n\t\t}\n\t\treturn pacData // Note that row has zero offset. The spec uses 1.\n\t}\n\n\t/**\n\t * Parse characters.\n\t *\n\t * @param a - The first byte\n\t * @param b - The second byte\n\t * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n\t */\n\tprivate parseChars(a: number, b: number): number[] {\n\t\tlet channelNr: Channels\n\t\tlet charCodes: number[] = []\n\t\tlet charCode1: number | null = null\n\n\t\tif (a >= 0x19) {\n\t\t\tchannelNr = 2\n\t\t\tcharCode1 = a - 8\n\t\t}\n\t\telse {\n\t\t\tchannelNr = 1\n\t\t\tcharCode1 = a\n\t\t}\n\t\tif (charCode1 >= 0x11 && charCode1 <= 0x13) {\n\t\t\t// Special character\n\t\t\tlet oneCode: number\n\t\t\tif (charCode1 === 0x11) {\n\t\t\t\toneCode = b + 0x50\n\t\t\t}\n\t\t\telse if (charCode1 === 0x12) {\n\t\t\t\toneCode = b + 0x70\n\t\t\t}\n\t\t\telse {\n\t\t\t\toneCode = b + 0x90\n\t\t\t}\n\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.INFO,\n\t\t\t\t() =>\n\t\t\t\t\t\"Special char '\" +\n\t\t\t\t\tgetCharForByte(oneCode) +\n\t\t\t\t\t\"' in channel \" +\n\t\t\t\t\tchannelNr,\n\t\t\t)\n\t\t\tcharCodes = [oneCode]\n\t\t}\n\t\telse if (a >= 0x20 && a <= 0x7f) {\n\t\t\tcharCodes = b === 0 ? [a] : [a, b]\n\t\t}\n\t\tif (charCodes) {\n\t\t\tthis.logger.log(\n\t\t\t\tVerboseLevel.DEBUG,\n\t\t\t\t() => 'Char codes = ' + numArrayToHexArray(charCodes).join(','),\n\t\t\t)\n\t\t}\n\t\treturn charCodes\n\t}\n\n\t/**\n\t * Parse extended background attributes as well as new foreground color black.\n\t *\n\t * @param a - The first byte\n\t * @param b - The second byte\n\t * @returns True if background attributes are found\n\t */\n\tprivate parseBackgroundAttributes(a: number, b: number): boolean {\n\t\tconst case1 = (a === 0x10 || a === 0x18) && b >= 0x20 && b <= 0x2f\n\t\tconst case2 = (a === 0x17 || a === 0x1f) && b >= 0x2d && b <= 0x2f\n\t\tif (!(case1 || case2)) {\n\t\t\treturn false\n\t\t}\n\t\tlet index: number\n\t\tconst bkgData: Partial<PenStyles> = {}\n\t\tif (a === 0x10 || a === 0x18) {\n\t\t\tindex = Math.floor((b - 0x20) / 2)\n\t\t\tbkgData.background = backgroundColors[index]\n\t\t\tif (b % 2 === 1) {\n\t\t\t\tbkgData.background = bkgData.background + '_semi'\n\t\t\t}\n\t\t}\n\t\telse if (b === 0x2d) {\n\t\t\tbkgData.background = 'transparent'\n\t\t}\n\t\telse {\n\t\t\tbkgData.foreground = 'black'\n\t\t\tif (b === 0x2f) {\n\t\t\t\tbkgData.underline = true\n\t\t\t}\n\t\t}\n\t\tconst chNr: Channels = a <= 0x17 ? 1 : 2\n\t\tconst channel: Cta608Channel = this.channels[chNr] as Cta608Channel\n\t\tchannel.setBkgData(bkgData)\n\t\treturn true\n\t}\n\n\t/**\n\t * Reset state of parser and its channels.\n\t */\n\treset(): void {\n\t\tfor (let i = 0; i < Object.keys(this.channels).length; i++) {\n\t\t\tconst channel = this.channels[i]\n\t\t\tif (channel) {\n\t\t\t\tchannel.reset()\n\t\t\t}\n\t\t}\n\t\tsetLastCmd(null, null, this.cmdHistory)\n\t}\n\n\t/**\n\t * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n\t */\n\tcueSplitAtTime(t: number): void {\n\t\tfor (const channel of this.channels) {\n\t\t\tif (channel) {\n\t\t\t\tchannel.cueSplitAtTime(t)\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * Extract CTA-608 data from a DataView\n *\n * @param raw - The DataView to extract the data from\n * @param cta608Range - The range of the CTA-608 data\n * @returns The extracted CTA-608 data\n *\n * @beta\n */\nexport function extractCta608Data(raw: DataView, cta608Range: number[]): number[][] {\n\tlet pos = cta608Range[0]\n\tconst fieldData: number[][] = [[], []]\n\n\tpos += 8 // Skip the identifier up to userDataTypeCode\n\tconst ccCount = raw.getUint8(pos) & 31\n\tpos += 2 // Advance 1 and skip reserved byte\n\n\tfor (let i = 0; i < ccCount; i++) {\n\t\tconst byte = raw.getUint8(pos)\n\t\tconst ccValid = byte & 4\n\t\tconst ccType = byte & 3\n\t\tpos++\n\t\tconst ccData1: number = raw.getUint8(pos) // Keep parity bit\n\t\tpos++\n\t\tconst ccData2: number = raw.getUint8(pos) // Keep parity bit\n\t\tpos++\n\t\tif (ccValid && ((ccData1 & 127) + (ccData2 & 127) !== 0)) { //Check validity and non-empty data\n\t\t\tif (ccType === 0) {\n\t\t\t\tfieldData[0].push(ccData1)\n\t\t\t\tfieldData[0].push(ccData2)\n\t\t\t}\n\t\t\telse if (ccType === 1) {\n\t\t\t\tfieldData[1].push(ccData1)\n\t\t\t\tfieldData[1].push(ccData2)\n\t\t\t}\n\t\t}\n\t}\n\treturn fieldData\n}\n","/**\n * Find CTA-608 NAL units in a video stream\n *\n * @param raw - The DataView to extract the data from\n * @param startPos - The start position of the data\n * @param size - The size of the data\n * @returns The extracted CTA-608 NAL units\n *\n * @beta\n */\nexport function findCta608Nalus(raw: DataView, startPos: number, size: number): number[][] {\n\tlet nalSize = 0, cursor = startPos, nalType = 0\n\tconst cta608NaluRanges = []\n\n\t// Check SEI data according to ANSI-SCTE 128\n\tconst isCTA608SEI = (payloadType: number, payloadSize: number, raw: DataView, pos: number) => {\n\t\tif (payloadType !== 4 || payloadSize < 8) {\n\t\t\treturn null\n\t\t}\n\t\tconst countryCode = raw.getUint8(pos)\n\t\tconst providerCode = raw.getUint16(pos + 1)\n\t\tconst userIdentifier = raw.getUint32(pos + 3)\n\t\tconst userDataTypeCode = raw.getUint8(pos + 7)\n\t\treturn countryCode == 181 && providerCode == 49 && userIdentifier == 1195456820 && userDataTypeCode == 3\n\t}\n\n\twhile (cursor < startPos + size) {\n\t\tnalSize = raw.getUint32(cursor)\n\t\tnalType = raw.getUint8(cursor + 4) & 31\n\t\t//console.log(time + \" NAL \" + nalType);\n\t\tif (nalType === 6) {\n\t\t\t// SEI NAL Unit. The NAL header is the first byte\n\t\t\t//console.log(\"SEI NALU of size \" + nalSize + \" at time \" + time);\n\t\t\tlet pos = cursor + 5\n\t\t\tlet payloadType = -1\n\t\t\twhile (pos < cursor + 4 + nalSize - 1) { // The last byte should be rbsp_trailing_bits\n\t\t\t\tpayloadType = 0\n\t\t\t\tlet b = 255\n\t\t\t\twhile (b === 255) {\n\t\t\t\t\tb = raw.getUint8(pos)\n\t\t\t\t\tpayloadType += b\n\t\t\t\t\tpos++\n\t\t\t\t}\n\t\t\t\tlet payloadSize = 0\n\t\t\t\tb = 255\n\t\t\t\twhile (b === 255) {\n\t\t\t\t\tb = raw.getUint8(pos)\n\t\t\t\t\tpayloadSize += b\n\t\t\t\t\tpos++\n\t\t\t\t}\n\t\t\t\tif (isCTA608SEI(payloadType, payloadSize, raw, pos)) {\n\t\t\t\t\t//console.log(\"CTA608 SEI \" + time + \" \" + payloadSize);\n\t\t\t\t\tcta608NaluRanges.push([pos, payloadSize])\n\t\t\t\t}\n\t\t\t\tpos += payloadSize\n\t\t\t}\n\t\t}\n\t\tcursor += nalSize + 4\n\t}\n\treturn cta608NaluRanges\n}\n","/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * SCC Parser\n *\n * @beta\n */\nexport class SccParser {\n\thasHeader: boolean = false\n\tnrLinesParsed: number = 0\n\tprocessor: any\n\tfield: number | any\n\n\tconstructor(processor: any, field: number | any = 1) {\n\t\tthis.processor = processor\n\t\tthis.field = field\n\t}\n\n\tparse(text: string): void {\n\t\tconst lines = text.split(/\\r?\\n/)\n\t\tthis.nrLinesParsed = 0\n\n\t\tif (lines[0] === 'Scenarist_SCC V1.0') {\n\t\t\tthis.hasHeader = true\n\t\t\tthis.nrLinesParsed++\n\t\t}\n\n\t\tfor (let l = 1; l < lines.length; l += 2) {\n\t\t\tif (lines[l] !== '') {\n\t\t\t\tbreak // Every second line should be empty\n\t\t\t}\n\t\t\tthis.nrLinesParsed++\n\t\t\tconst lineData = this.parseDataLine(lines[l + 1])\n\t\t\tif (lineData === null) {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tthis.nrLinesParsed++\n\t\t\tthis.processor.addData(lineData[0], lineData[1])\n\t\t}\n\t}\n\n\tparseDataLine(line: string): [number, number[]] | null {\n\t\tif (!line) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst lineParts = line.split(/\\s+/)\n\t\tconst timeData = lineParts[0]\n\t\tconst ceaData: number[] = []\n\n\t\tfor (let i = 1; i < lineParts.length; i++) {\n\t\t\tconst fourHexChars = lineParts[i]\n\t\t\tconst a = parseInt(fourHexChars.substring(0, 2), 16)\n\t\t\tconst b = parseInt(fourHexChars.substring(2, 4), 16)\n\t\t\tceaData.push(a, b)\n\t\t}\n\n\t\tconst time = this.timeConverter(timeData)\n\t\treturn [time, ceaData]\n\t}\n\n\ttimeConverter(smpteTs: string): number {\n\t\tconst parts = smpteTs.split(':')\n\t\tif (parts.length === 3) {\n\t\t\tconst lastParts = parts[2].split(';')\n\t\t\tparts[2] = lastParts[0]\n\t\t\tconst frames = parseInt(lastParts[1], 10)\n\t\t\treturn (30 * (60 * (60 * parseInt(parts[0], 10) + parseInt(parts[1], 10)) + parseInt(parts[2], 10)) + frames) * 1001 / 30000\n\t\t}\n\t\treturn 0 // in case if format is incorrect\n\t}\n\n\tgetHeaderStatus(): boolean {\n\t\treturn this.hasHeader\n\t}\n\n\tgetField(): number | any {\n\t\treturn this.field\n\t}\n\n\tgetLinesParsed(): number {\n\t\treturn this.nrLinesParsed\n\t}\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,eAAe;CAC3B,OAAO;CACP,MAAM;CACN,SAAS;CACT,MAAM;CACN,OAAO;CACP,MAAM;CACN;;;;;;;;;AC4BD,IAAa,iBAAb,MAA4B;;cACE;sBACO,aAAa;;CAEjD,IAAI,UAAwB,KAAoC;AAC/D,MAAI,KAAK,gBAAgB,UAAU;GAClC,MAAMA,IAAY,OAAO,QAAQ,aAAa,KAAK,GAAG;AACtD,WAAQ,IAAI,GAAG,KAAK,KAAK,IAAI,SAAS,IAAI,IAAI;;;;;;;;;;;;ACPjD,IAAa,WAAb,MAAsB;;oBACO;mBACA;iBACF;oBACE;eACJ;;CAEx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AQ,MAAM,IAAI;AAChC,MAAI,MAAM,WAAW,GAAG;GACvB,MAAM,YAAY,MAAM,GAAG,MAAM,IAAI;AACrC,SAAM,KAAK,UAAU;GACrB,MAAM,SAAS,SAAS,UAAU,IAAI,GAAG;AACzC,WAAQ,MAAM,MAAM,KAAK,SAAS,MAAM,IAAI,GAAG,GAAG,SAAS,MAAM,IAAI,GAAG,IAAI,SAAS,MAAM,IAAI,GAAG,IAAI,UAAU,OAAO;;AAExH,SAAO;;CAGR,kBAA2B;AAC1B,SAAO,KAAK;;CAGb,WAAyB;AACxB,SAAO,KAAK;;CAGb,iBAAyB;AACxB,SAAO,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svta/cml-608",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "CTA-608/CEA-608 closed captioning functionality",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"homepage": "https://github.com/streaming-video-technology-alliance/common-media-library",
|
|
7
|
+
"homepage": "https://github.com/streaming-video-technology-alliance/common-media-library/tree/main/libs/608",
|
|
8
8
|
"authors": "Casey Occhialini <1508707+littlespex@users.noreply.github.com>",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -28,24 +28,6 @@
|
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"import": "./dist/index.js",
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
|
-
},
|
|
32
|
-
"./*.js": {
|
|
33
|
-
"types": "./dist/*.d.ts",
|
|
34
|
-
"import": "./dist/*.js",
|
|
35
|
-
"default": "./dist/*.js"
|
|
36
|
-
},
|
|
37
|
-
"./*": {
|
|
38
|
-
"types": "./dist/*.d.ts",
|
|
39
|
-
"import": "./dist/*.js",
|
|
40
|
-
"default": "./dist/*.js"
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"typesVersions": {
|
|
44
|
-
"*": {
|
|
45
|
-
"*": [
|
|
46
|
-
"dist/*",
|
|
47
|
-
"dist/cjs/*"
|
|
48
|
-
]
|
|
49
31
|
}
|
|
50
32
|
},
|
|
51
33
|
"keywords": [
|
|
@@ -58,11 +40,8 @@
|
|
|
58
40
|
"subtitles"
|
|
59
41
|
],
|
|
60
42
|
"scripts": {
|
|
61
|
-
"build": "
|
|
62
|
-
"
|
|
63
|
-
"test": "node --no-warnings --test **/*.test.ts",
|
|
64
|
-
"prepublishOnly": "npm run build",
|
|
65
|
-
"pub": "npm publish --provenance --access public"
|
|
43
|
+
"build": "node ../../scripts/build.ts",
|
|
44
|
+
"test": "node ../../scripts/test.ts"
|
|
66
45
|
},
|
|
67
46
|
"engines": {
|
|
68
47
|
"node": ">=20"
|
|
@@ -73,8 +52,5 @@
|
|
|
73
52
|
"version": ">=24",
|
|
74
53
|
"onFail": "error"
|
|
75
54
|
}
|
|
76
|
-
},
|
|
77
|
-
"dependencies": {
|
|
78
|
-
"@svta/cml-cta": "*"
|
|
79
55
|
}
|
|
80
56
|
}
|
package/NOTICE
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
Streaming Video Technology Alliance Common Media Library Copyright (c) 2023
|
|
2
|
-
Streaming Video Technology Alliance
|
|
3
|
-
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Contains code derived from the `hls.js` library (https://github.com/video-dev/hls.js/)
|
|
7
|
-
|
|
8
|
-
```
|
|
9
|
-
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
|
|
10
|
-
|
|
11
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
you may not use this file except in compliance with the License.
|
|
13
|
-
You may obtain a copy of the License at
|
|
14
|
-
|
|
15
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
|
|
17
|
-
Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
See the License for the specific language governing permissions and
|
|
21
|
-
limitations under the License.
|
|
22
|
-
|
|
23
|
-
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
|
|
24
|
-
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
|
|
25
|
-
|
|
26
|
-
That work is also covered by the Apache 2 License, following copyright:
|
|
27
|
-
Copyright (c) 2013-2015 Brightcove
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
31
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
32
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
33
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
34
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
35
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
36
|
-
THE SOFTWARE.
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
Contains code derived from the `dash.js` library (https://github.com/Dash-Industry-Forum/dash.js/)
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
# dash.js BSD License Agreement
|
|
45
|
-
|
|
46
|
-
The copyright in this software is being made available under the BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license.
|
|
47
|
-
|
|
48
|
-
**Copyright (c) 2015, Dash Industry Forum.
|
|
49
|
-
**All rights reserved.**
|
|
50
|
-
|
|
51
|
-
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
52
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
53
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
54
|
-
* Neither the name of the Dash Industry Forum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
55
|
-
|
|
56
|
-
**THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.**
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
---
|
package/dist/CaptionModes.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaptionModes.d.ts","sourceRoot":"","sources":["../src/CaptionModes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GACxC,aAAa,GACb,eAAe,GACf,WAAW,GACX,IAAI,CAAC"}
|
package/dist/CaptionModes.js
DELETED
package/dist/CaptionModes.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaptionModes.js","sourceRoot":"","sources":["../src/CaptionModes.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * The different caption modes that can be used.\n *\n * @beta\n */\nexport type CaptionModes = 'MODE_ROLL-UP' |\n\t'MODE_POP-ON' |\n\t'MODE_PAINT-ON' |\n\t'MODE_TEXT' |\n\tnull;\n"]}
|
package/dist/CaptionScreen.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* This code was ported from the dash.js project at:
|
|
4
|
-
* https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
|
|
5
|
-
* https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
|
|
6
|
-
*
|
|
7
|
-
* The original copyright appears below:
|
|
8
|
-
*
|
|
9
|
-
* The copyright in this software is being made available under the BSD License,
|
|
10
|
-
* included below. This software may be subject to other third party and contributor
|
|
11
|
-
* rights, including patent rights, and no such rights are granted under this license.
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) 2015-2016, DASH Industry Forum.
|
|
14
|
-
* All rights reserved.
|
|
15
|
-
*
|
|
16
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
|
17
|
-
* are permitted provided that the following conditions are met:
|
|
18
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
19
|
-
* list of conditions and the following disclaimer.
|
|
20
|
-
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
21
|
-
* this list of conditions and the following disclaimer in the documentation and/or
|
|
22
|
-
* other materials provided with the distribution.
|
|
23
|
-
* 2. Neither the name of Dash Industry Forum nor the names of its
|
|
24
|
-
* contributors may be used to endorse or promote products derived from this software
|
|
25
|
-
* without specific prior written permission.
|
|
26
|
-
*
|
|
27
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
|
|
28
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
29
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
30
|
-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
31
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
32
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
33
|
-
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
34
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
35
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
36
|
-
* POSSIBILITY OF SUCH DAMAGE.
|
|
37
|
-
*/
|
|
38
|
-
import { CaptionsLogger } from './CaptionsLogger.js';
|
|
39
|
-
import type { PACData } from './PACData.js';
|
|
40
|
-
import type { PenStyles } from './PenStyles.js';
|
|
41
|
-
import { Row } from './Row.js';
|
|
42
|
-
/**
|
|
43
|
-
* Keep a CTA-608 screen of 32x15 styled characters
|
|
44
|
-
*
|
|
45
|
-
* @beta
|
|
46
|
-
*/
|
|
47
|
-
export declare class CaptionScreen {
|
|
48
|
-
rows: Row[];
|
|
49
|
-
private currRow;
|
|
50
|
-
private nrRollUpRows;
|
|
51
|
-
private lastOutputScreen;
|
|
52
|
-
private logger;
|
|
53
|
-
constructor(logger?: CaptionsLogger);
|
|
54
|
-
reset(): void;
|
|
55
|
-
equals(other: CaptionScreen): boolean;
|
|
56
|
-
copy(other: CaptionScreen): void;
|
|
57
|
-
isEmpty(): boolean;
|
|
58
|
-
backSpace(): void;
|
|
59
|
-
clearToEndOfRow(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Insert a character (without styling) in the current row.
|
|
62
|
-
*/
|
|
63
|
-
insertChar(char: number): void;
|
|
64
|
-
setPen(styles: Partial<PenStyles>): void;
|
|
65
|
-
moveCursor(relPos: number): void;
|
|
66
|
-
setCursor(absPos: number): void;
|
|
67
|
-
setPAC(pacData: PACData): void;
|
|
68
|
-
/**
|
|
69
|
-
* Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).
|
|
70
|
-
*/
|
|
71
|
-
setBkgData(bkgData: Partial<PenStyles>): void;
|
|
72
|
-
setRollUpRows(nrRows: number | null): void;
|
|
73
|
-
rollUp(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Get all non-empty rows with as unicode text.
|
|
76
|
-
*/
|
|
77
|
-
getDisplayText(asOneRow?: boolean): string;
|
|
78
|
-
getTextAndFormat(): Row[];
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=CaptionScreen.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CaptionScreen.d.ts","sourceRoot":"","sources":["../src/CaptionScreen.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAI/B;;;;GAIG;AACH,qBAAa,aAAa;IACzB,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,gBAAgB,CAA8B;IACtD,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,GAAE,cAAqC;IAOzD,KAAK,IAAI,IAAI;IA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