@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/PenState.js
DELETED
|
@@ -1,95 +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
|
-
/**
|
|
39
|
-
* Pen state.
|
|
40
|
-
*
|
|
41
|
-
* @beta
|
|
42
|
-
*/
|
|
43
|
-
export class PenState {
|
|
44
|
-
constructor() {
|
|
45
|
-
this.foreground = 'white';
|
|
46
|
-
this.underline = false;
|
|
47
|
-
this.italics = false;
|
|
48
|
-
this.background = 'black';
|
|
49
|
-
this.flash = false;
|
|
50
|
-
}
|
|
51
|
-
reset() {
|
|
52
|
-
this.foreground = 'white';
|
|
53
|
-
this.underline = false;
|
|
54
|
-
this.italics = false;
|
|
55
|
-
this.background = 'black';
|
|
56
|
-
this.flash = false;
|
|
57
|
-
}
|
|
58
|
-
setStyles(styles) {
|
|
59
|
-
const attribs = [
|
|
60
|
-
'foreground',
|
|
61
|
-
'underline',
|
|
62
|
-
'italics',
|
|
63
|
-
'background',
|
|
64
|
-
'flash',
|
|
65
|
-
];
|
|
66
|
-
for (let i = 0; i < attribs.length; i++) {
|
|
67
|
-
const style = attribs[i];
|
|
68
|
-
if (Object.prototype.hasOwnProperty.call(styles, style)) {
|
|
69
|
-
this[style] = styles[style];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
isDefault() {
|
|
74
|
-
return (this.foreground === 'white' &&
|
|
75
|
-
!this.underline &&
|
|
76
|
-
!this.italics &&
|
|
77
|
-
this.background === 'black' &&
|
|
78
|
-
!this.flash);
|
|
79
|
-
}
|
|
80
|
-
equals(other) {
|
|
81
|
-
return (this.foreground === other.foreground &&
|
|
82
|
-
this.underline === other.underline &&
|
|
83
|
-
this.italics === other.italics &&
|
|
84
|
-
this.background === other.background &&
|
|
85
|
-
this.flash === other.flash);
|
|
86
|
-
}
|
|
87
|
-
copy(newPenState) {
|
|
88
|
-
this.foreground = newPenState.foreground;
|
|
89
|
-
this.underline = newPenState.underline;
|
|
90
|
-
this.italics = newPenState.italics;
|
|
91
|
-
this.background = newPenState.background;
|
|
92
|
-
this.flash = newPenState.flash;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=PenState.js.map
|
package/dist/PenState.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PenState.js","sourceRoot":"","sources":["../src/PenState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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AAS,KAAK,KAAK,CAAC,SAAS;YAClC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;YAC9B,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU;YACpC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAC1B,CAAC;IACH,CAAC;IAED,IAAI,CAAC,WAAqB;QACzB,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC;IAChC,CAAC;CACD","sourcesContent":["/**\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.js';\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 (let i = 0; i < attribs.length; i++) {\n\t\t\tconst style = attribs[i];\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"]}
|
package/dist/PenStyles.d.ts
DELETED
package/dist/PenStyles.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PenStyles.d.ts","sourceRoot":"","sources":["../src/PenStyles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG;IACvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;CACf,CAAC"}
|
package/dist/PenStyles.js
DELETED
package/dist/PenStyles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PenStyles.js","sourceRoot":"","sources":["../src/PenStyles.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * PenStyles\n *\n * @beta\n */\nexport type PenStyles = {\n\tforeground: string | null;\n\tunderline: boolean;\n\titalics: boolean;\n\tbackground: string;\n\tflash: boolean;\n};\n"]}
|
package/dist/Row.d.ts
DELETED
|
@@ -1,75 +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 { PenStyles } from './PenStyles.js';
|
|
40
|
-
import { StyledUnicodeChar } from './StyledUnicodeChar.js';
|
|
41
|
-
/**
|
|
42
|
-
* CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
|
|
43
|
-
*
|
|
44
|
-
* @beta
|
|
45
|
-
*/
|
|
46
|
-
export declare class Row {
|
|
47
|
-
chars: StyledUnicodeChar[];
|
|
48
|
-
cueStartTime: number | null;
|
|
49
|
-
private pos;
|
|
50
|
-
private currPenState;
|
|
51
|
-
private logger;
|
|
52
|
-
constructor(logger?: CaptionsLogger);
|
|
53
|
-
equals(other: Row): boolean;
|
|
54
|
-
copy(other: Row): void;
|
|
55
|
-
isEmpty(): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Set the cursor to a valid column.
|
|
58
|
-
*/
|
|
59
|
-
setCursor(absPos: number): void;
|
|
60
|
-
/**
|
|
61
|
-
* Move the cursor relative to current position.
|
|
62
|
-
*/
|
|
63
|
-
moveCursor(relPos: number): void;
|
|
64
|
-
/**
|
|
65
|
-
* Backspace, move one step back and clear character.
|
|
66
|
-
*/
|
|
67
|
-
backSpace(): void;
|
|
68
|
-
insertChar(byte: number): void;
|
|
69
|
-
clearFromPos(startPos: number): void;
|
|
70
|
-
clear(): void;
|
|
71
|
-
clearToEndOfRow(): void;
|
|
72
|
-
getTextString(): string;
|
|
73
|
-
setPenStyles(styles: Partial<PenStyles>): void;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=Row.d.ts.map
|
package/dist/Row.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../src/Row.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAK3D;;;;GAIG;AACH,qBAAa,GAAG;IACR,KAAK,EAAE,iBAAiB,EAAE,CAAM;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAE1C,OAAO,CAAC,GAAG,CAAa;IACxB,OAAO,CAAC,YAAY,CAA4B;IAChD,OAAO,CAAC,MAAM,CAAiB;gBAEnB,MAAM,GAAE,cAAqC;IAOzD,MAAM,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO;IAS3B,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI;IAMtB,OAAO,IAAI,OAAO;IAWlB;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAqB/B;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUhC;;OAEG;IACH,SAAS,IAAI,IAAI;IAKjB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAwB9B,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAOpC,KAAK,IAAI,IAAI;IAMb,eAAe,IAAI,IAAI;IAIvB,aAAa,IAAI,MAAM;IAmBvB,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,IAAI;CAK9C"}
|
package/dist/Row.js
DELETED
|
@@ -1,174 +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 { PenState } from './PenState.js';
|
|
40
|
-
import { StyledUnicodeChar } from './StyledUnicodeChar.js';
|
|
41
|
-
import { VerboseLevel } from './VerboseLevel.js';
|
|
42
|
-
import { NR_COLS } from './utils/NR_COLS.js';
|
|
43
|
-
import { getCharForByte } from './utils/getCharForByte.js';
|
|
44
|
-
/**
|
|
45
|
-
* CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
|
|
46
|
-
*
|
|
47
|
-
* @beta
|
|
48
|
-
*/
|
|
49
|
-
export class Row {
|
|
50
|
-
constructor(logger = new CaptionsLogger()) {
|
|
51
|
-
this.chars = [];
|
|
52
|
-
this.cueStartTime = null;
|
|
53
|
-
this.pos = 0;
|
|
54
|
-
this.currPenState = new PenState();
|
|
55
|
-
for (let i = 0; i < NR_COLS; i++) {
|
|
56
|
-
this.chars.push(new StyledUnicodeChar());
|
|
57
|
-
}
|
|
58
|
-
this.logger = logger;
|
|
59
|
-
}
|
|
60
|
-
equals(other) {
|
|
61
|
-
for (let i = 0; i < NR_COLS; i++) {
|
|
62
|
-
if (!this.chars[i].equals(other.chars[i])) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
copy(other) {
|
|
69
|
-
for (let i = 0; i < NR_COLS; i++) {
|
|
70
|
-
this.chars[i].copy(other.chars[i]);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
isEmpty() {
|
|
74
|
-
let empty = true;
|
|
75
|
-
for (let i = 0; i < NR_COLS; i++) {
|
|
76
|
-
if (!this.chars[i].isEmpty()) {
|
|
77
|
-
empty = false;
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return empty;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Set the cursor to a valid column.
|
|
85
|
-
*/
|
|
86
|
-
setCursor(absPos) {
|
|
87
|
-
if (this.pos !== absPos) {
|
|
88
|
-
this.pos = absPos;
|
|
89
|
-
}
|
|
90
|
-
if (this.pos < 0) {
|
|
91
|
-
this.logger.log(VerboseLevel.DEBUG, 'Negative cursor position ' + this.pos);
|
|
92
|
-
this.pos = 0;
|
|
93
|
-
}
|
|
94
|
-
else if (this.pos > NR_COLS) {
|
|
95
|
-
this.logger.log(VerboseLevel.DEBUG, 'Too large cursor position ' + this.pos);
|
|
96
|
-
this.pos = NR_COLS;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Move the cursor relative to current position.
|
|
101
|
-
*/
|
|
102
|
-
moveCursor(relPos) {
|
|
103
|
-
const newPos = this.pos + relPos;
|
|
104
|
-
if (relPos > 1) {
|
|
105
|
-
for (let i = this.pos + 1; i < newPos + 1; i++) {
|
|
106
|
-
this.chars[i].setPenState(this.currPenState);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
this.setCursor(newPos);
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Backspace, move one step back and clear character.
|
|
113
|
-
*/
|
|
114
|
-
backSpace() {
|
|
115
|
-
this.moveCursor(-1);
|
|
116
|
-
this.chars[this.pos].setChar(' ', this.currPenState);
|
|
117
|
-
}
|
|
118
|
-
insertChar(byte) {
|
|
119
|
-
if (byte >= 0x90) {
|
|
120
|
-
// Extended char
|
|
121
|
-
this.backSpace();
|
|
122
|
-
}
|
|
123
|
-
const char = getCharForByte(byte);
|
|
124
|
-
if (this.pos >= NR_COLS) {
|
|
125
|
-
this.logger.log(VerboseLevel.ERROR, () => 'Cannot insert ' +
|
|
126
|
-
byte.toString(16) +
|
|
127
|
-
' (' +
|
|
128
|
-
char +
|
|
129
|
-
') at position ' +
|
|
130
|
-
this.pos +
|
|
131
|
-
'. Skipping it!');
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
this.chars[this.pos].setChar(char, this.currPenState);
|
|
135
|
-
this.moveCursor(1);
|
|
136
|
-
}
|
|
137
|
-
clearFromPos(startPos) {
|
|
138
|
-
let i;
|
|
139
|
-
for (i = startPos; i < NR_COLS; i++) {
|
|
140
|
-
this.chars[i].reset();
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
clear() {
|
|
144
|
-
this.clearFromPos(0);
|
|
145
|
-
this.pos = 0;
|
|
146
|
-
this.currPenState.reset();
|
|
147
|
-
}
|
|
148
|
-
clearToEndOfRow() {
|
|
149
|
-
this.clearFromPos(this.pos);
|
|
150
|
-
}
|
|
151
|
-
getTextString() {
|
|
152
|
-
const chars = [];
|
|
153
|
-
let empty = true;
|
|
154
|
-
for (let i = 0; i < NR_COLS; i++) {
|
|
155
|
-
const char = this.chars[i].uchar;
|
|
156
|
-
if (char !== ' ') {
|
|
157
|
-
empty = false;
|
|
158
|
-
}
|
|
159
|
-
chars.push(char);
|
|
160
|
-
}
|
|
161
|
-
if (empty) {
|
|
162
|
-
return '';
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
return chars.join('');
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
setPenStyles(styles) {
|
|
169
|
-
this.currPenState.setStyles(styles);
|
|
170
|
-
const currChar = this.chars[this.pos];
|
|
171
|
-
currChar.setPenState(this.currPenState);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
//# sourceMappingURL=Row.js.map
|
package/dist/Row.js.map
DELETED
|
@@ -1 +0,0 @@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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.js';\nimport { PenState } from './PenState.js';\nimport type { PenStyles } from './PenStyles.js';\nimport { StyledUnicodeChar } from './StyledUnicodeChar.js';\nimport { VerboseLevel } from './VerboseLevel.js';\nimport { NR_COLS } from './utils/NR_COLS.js';\nimport { getCharForByte } from './utils/getCharForByte.js';\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"]}
|
package/dist/SccParser.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The copyright in this software is being made available under the BSD License,
|
|
3
|
-
* included below. This software may be subject to other third party and contributor
|
|
4
|
-
* rights, including patent rights, and no such rights are granted under this license.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2015-2016, DASH Industry Forum.
|
|
7
|
-
* All rights reserved.
|
|
8
|
-
*
|
|
9
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
|
10
|
-
* are permitted provided that the following conditions are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
12
|
-
* list of conditions and the following disclaimer.
|
|
13
|
-
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
-
* this list of conditions and the following disclaimer in the documentation and/or
|
|
15
|
-
* other materials provided with the distribution.
|
|
16
|
-
* 2. Neither the name of Dash Industry Forum nor the names of its
|
|
17
|
-
* contributors may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
|
|
21
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
22
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
23
|
-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
24
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
25
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
26
|
-
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
27
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
28
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
29
|
-
* POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* SCC Parser
|
|
33
|
-
*
|
|
34
|
-
* @beta
|
|
35
|
-
*/
|
|
36
|
-
export declare class SccParser {
|
|
37
|
-
hasHeader: boolean;
|
|
38
|
-
nrLinesParsed: number;
|
|
39
|
-
processor: any;
|
|
40
|
-
field: number | any;
|
|
41
|
-
constructor(processor: any, field?: number | any);
|
|
42
|
-
parse(text: string): void;
|
|
43
|
-
parseDataLine(line: string): [number, number[]] | null;
|
|
44
|
-
timeConverter(smpteTs: string): number;
|
|
45
|
-
getHeaderStatus(): boolean;
|
|
46
|
-
getField(): number | any;
|
|
47
|
-
getLinesParsed(): number;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=SccParser.d.ts.map
|
package/dist/SccParser.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SccParser.d.ts","sourceRoot":"","sources":["../src/SccParser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;GAIG;AACH,qBAAa,SAAS;IACrB,SAAS,EAAE,OAAO,CAAS;IAC3B,aAAa,EAAE,MAAM,CAAK;IAC1B,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;gBAER,SAAS,EAAE,GAAG,EAAE,KAAK,GAAE,MAAM,GAAG,GAAO;IAKnD,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAuBzB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI;IAoBtD,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAWtC,eAAe,IAAI,OAAO;IAI1B,QAAQ,IAAI,MAAM,GAAG,GAAG;IAIxB,cAAc,IAAI,MAAM;CAGxB"}
|
package/dist/SccParser.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The copyright in this software is being made available under the BSD License,
|
|
3
|
-
* included below. This software may be subject to other third party and contributor
|
|
4
|
-
* rights, including patent rights, and no such rights are granted under this license.
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2015-2016, DASH Industry Forum.
|
|
7
|
-
* All rights reserved.
|
|
8
|
-
*
|
|
9
|
-
* Redistribution and use in source and binary forms, with or without modification,
|
|
10
|
-
* are permitted provided that the following conditions are met:
|
|
11
|
-
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
12
|
-
* list of conditions and the following disclaimer.
|
|
13
|
-
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
14
|
-
* this list of conditions and the following disclaimer in the documentation and/or
|
|
15
|
-
* other materials provided with the distribution.
|
|
16
|
-
* 2. Neither the name of Dash Industry Forum nor the names of its
|
|
17
|
-
* contributors may be used to endorse or promote products derived from this software
|
|
18
|
-
* without specific prior written permission.
|
|
19
|
-
*
|
|
20
|
-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
|
|
21
|
-
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
22
|
-
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
23
|
-
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
24
|
-
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
25
|
-
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
26
|
-
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
27
|
-
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
28
|
-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
29
|
-
* POSSIBILITY OF SUCH DAMAGE.
|
|
30
|
-
*/
|
|
31
|
-
/**
|
|
32
|
-
* SCC Parser
|
|
33
|
-
*
|
|
34
|
-
* @beta
|
|
35
|
-
*/
|
|
36
|
-
export class SccParser {
|
|
37
|
-
constructor(processor, field = 1) {
|
|
38
|
-
this.hasHeader = false;
|
|
39
|
-
this.nrLinesParsed = 0;
|
|
40
|
-
this.processor = processor;
|
|
41
|
-
this.field = field;
|
|
42
|
-
}
|
|
43
|
-
parse(text) {
|
|
44
|
-
const lines = text.split(/\r?\n/);
|
|
45
|
-
this.nrLinesParsed = 0;
|
|
46
|
-
if (lines[0] === 'Scenarist_SCC V1.0') {
|
|
47
|
-
this.hasHeader = true;
|
|
48
|
-
this.nrLinesParsed++;
|
|
49
|
-
}
|
|
50
|
-
for (let l = 1; l < lines.length; l += 2) {
|
|
51
|
-
if (lines[l] !== '') {
|
|
52
|
-
break; // Every second line should be empty
|
|
53
|
-
}
|
|
54
|
-
this.nrLinesParsed++;
|
|
55
|
-
const lineData = this.parseDataLine(lines[l + 1]);
|
|
56
|
-
if (lineData === null) {
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
this.nrLinesParsed++;
|
|
60
|
-
this.processor.addData(lineData[0], lineData[1]);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
parseDataLine(line) {
|
|
64
|
-
if (!line) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const lineParts = line.split(/\s+/);
|
|
68
|
-
const timeData = lineParts[0];
|
|
69
|
-
const ceaData = [];
|
|
70
|
-
for (let i = 1; i < lineParts.length; i++) {
|
|
71
|
-
const fourHexChars = lineParts[i];
|
|
72
|
-
const a = parseInt(fourHexChars.substring(0, 2), 16);
|
|
73
|
-
const b = parseInt(fourHexChars.substring(2, 4), 16);
|
|
74
|
-
ceaData.push(a, b);
|
|
75
|
-
}
|
|
76
|
-
const time = this.timeConverter(timeData);
|
|
77
|
-
return [time, ceaData];
|
|
78
|
-
}
|
|
79
|
-
timeConverter(smpteTs) {
|
|
80
|
-
const parts = smpteTs.split(':');
|
|
81
|
-
if (parts.length === 3) {
|
|
82
|
-
const lastParts = parts[2].split(';');
|
|
83
|
-
parts[2] = lastParts[0];
|
|
84
|
-
const frames = parseInt(lastParts[1], 10);
|
|
85
|
-
return (30 * (60 * (60 * parseInt(parts[0], 10) + parseInt(parts[1], 10)) + parseInt(parts[2], 10)) + frames) * 1001 / 30000;
|
|
86
|
-
}
|
|
87
|
-
return 0; // in case if format is incorrect
|
|
88
|
-
}
|
|
89
|
-
getHeaderStatus() {
|
|
90
|
-
return this.hasHeader;
|
|
91
|
-
}
|
|
92
|
-
getField() {
|
|
93
|
-
return this.field;
|
|
94
|
-
}
|
|
95
|
-
getLinesParsed() {
|
|
96
|
-
return this.nrLinesParsed;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=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,EAAE,EAAE,CAAC,CAAC;YAC1C,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;QAC9H,CAAC;QACD,OAAO,CAAC,CAAC,CAAE,iCAAiC;IAC7C,CAAC;IAED,eAAe;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,cAAc;QACb,OAAO,IAAI,CAAC,aAAa,CAAC;IAC3B,CAAC;CACD","sourcesContent":["/**\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"]}
|
|
@@ -1,54 +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 { PenState } from './PenState.js';
|
|
39
|
-
/**
|
|
40
|
-
* Unicode character with styling and background.
|
|
41
|
-
*
|
|
42
|
-
* @beta
|
|
43
|
-
*/
|
|
44
|
-
export declare class StyledUnicodeChar {
|
|
45
|
-
uchar: string;
|
|
46
|
-
penState: PenState;
|
|
47
|
-
reset(): void;
|
|
48
|
-
setChar(uchar: string, newPenState: PenState): void;
|
|
49
|
-
setPenState(newPenState: PenState): void;
|
|
50
|
-
equals(other: StyledUnicodeChar): boolean;
|
|
51
|
-
copy(newChar: StyledUnicodeChar): void;
|
|
52
|
-
isEmpty(): boolean;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=StyledUnicodeChar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StyledUnicodeChar.d.ts","sourceRoot":"","sources":["../src/StyledUnicodeChar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;GAIG;AACH,qBAAa,iBAAiB;IAC7B,KAAK,EAAE,MAAM,CAAO;IACpB,QAAQ,EAAE,QAAQ,CAAkB;IAEpC,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,IAAI;IAKnD,WAAW,CAAC,WAAW,EAAE,QAAQ,GAAG,IAAI;IAIxC,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO;IAIzC,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAKtC,OAAO,IAAI,OAAO;CAGlB"}
|