@svta/cml-608 0.19.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/LICENSE +201 -0
- package/NOTICE +59 -0
- package/dist/CaptionModes.d.ts +7 -0
- package/dist/CaptionModes.d.ts.map +1 -0
- package/dist/CaptionModes.js +2 -0
- package/dist/CaptionModes.js.map +1 -0
- package/dist/CaptionScreen.d.ts +80 -0
- package/dist/CaptionScreen.d.ts.map +1 -0
- package/dist/CaptionScreen.js +220 -0
- package/dist/CaptionScreen.js.map +1 -0
- package/dist/CaptionsLogger.d.ts +49 -0
- package/dist/CaptionsLogger.d.ts.map +1 -0
- package/dist/CaptionsLogger.js +56 -0
- package/dist/CaptionsLogger.js.map +1 -0
- package/dist/Channels.d.ts +7 -0
- package/dist/Channels.d.ts.map +1 -0
- package/dist/Channels.js +2 -0
- package/dist/Channels.js.map +1 -0
- package/dist/CmdHistory.d.ts +10 -0
- package/dist/CmdHistory.d.ts.map +1 -0
- package/dist/CmdHistory.js +2 -0
- package/dist/CmdHistory.js.map +1 -0
- package/dist/Cta608Channel.d.ts +88 -0
- package/dist/Cta608Channel.d.ts.map +1 -0
- package/dist/Cta608Channel.js +262 -0
- package/dist/Cta608Channel.js.map +1 -0
- package/dist/Cta608Parser.d.ts +115 -0
- package/dist/Cta608Parser.d.ts.map +1 -0
- package/dist/Cta608Parser.js +428 -0
- package/dist/Cta608Parser.js.map +1 -0
- package/dist/CueHandler.d.ts +12 -0
- package/dist/CueHandler.d.ts.map +1 -0
- package/dist/CueHandler.js +2 -0
- package/dist/CueHandler.js.map +1 -0
- package/dist/PACData.d.ts +13 -0
- package/dist/PACData.d.ts.map +1 -0
- package/dist/PACData.js +2 -0
- package/dist/PACData.js.map +1 -0
- package/dist/PenState.d.ts +56 -0
- package/dist/PenState.d.ts.map +1 -0
- package/dist/PenState.js +95 -0
- package/dist/PenState.js.map +1 -0
- package/dist/PenStyles.d.ts +13 -0
- package/dist/PenStyles.d.ts.map +1 -0
- package/dist/PenStyles.js +2 -0
- package/dist/PenStyles.js.map +1 -0
- package/dist/Row.d.ts +75 -0
- package/dist/Row.d.ts.map +1 -0
- package/dist/Row.js +174 -0
- package/dist/Row.js.map +1 -0
- package/dist/SccParser.d.ts +49 -0
- package/dist/SccParser.d.ts.map +1 -0
- package/dist/SccParser.js +99 -0
- package/dist/SccParser.js.map +1 -0
- package/dist/StyledUnicodeChar.d.ts +54 -0
- package/dist/StyledUnicodeChar.d.ts.map +1 -0
- package/dist/StyledUnicodeChar.js +71 -0
- package/dist/StyledUnicodeChar.js.map +1 -0
- package/dist/SupportedField.d.ts +7 -0
- package/dist/SupportedField.d.ts.map +1 -0
- package/dist/SupportedField.js +2 -0
- package/dist/SupportedField.js.map +1 -0
- package/dist/VerboseLevel.d.ts +22 -0
- package/dist/VerboseLevel.d.ts.map +1 -0
- package/dist/VerboseLevel.js +17 -0
- package/dist/VerboseLevel.js.map +1 -0
- package/dist/extractCta608Data.d.ts +11 -0
- package/dist/extractCta608Data.d.ts.map +1 -0
- package/dist/extractCta608Data.js +38 -0
- package/dist/extractCta608Data.js.map +1 -0
- package/dist/extractCta608DataFromSample.d.ts +12 -0
- package/dist/extractCta608DataFromSample.d.ts.map +1 -0
- package/dist/extractCta608DataFromSample.js +35 -0
- package/dist/extractCta608DataFromSample.js.map +1 -0
- package/dist/findCta608Nalus.d.ts +12 -0
- package/dist/findCta608Nalus.d.ts.map +1 -0
- package/dist/findCta608Nalus.js +60 -0
- package/dist/findCta608Nalus.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/utils/NR_COLS.d.ts +2 -0
- package/dist/utils/NR_COLS.d.ts.map +1 -0
- package/dist/utils/NR_COLS.js +2 -0
- package/dist/utils/NR_COLS.js.map +1 -0
- package/dist/utils/NR_ROWS.d.ts +2 -0
- package/dist/utils/NR_ROWS.d.ts.map +1 -0
- package/dist/utils/NR_ROWS.js +2 -0
- package/dist/utils/NR_ROWS.js.map +1 -0
- package/dist/utils/backgroundColors.d.ts +2 -0
- package/dist/utils/backgroundColors.d.ts.map +1 -0
- package/dist/utils/backgroundColors.js +12 -0
- package/dist/utils/backgroundColors.js.map +1 -0
- package/dist/utils/createCmdHistory.d.ts +3 -0
- package/dist/utils/createCmdHistory.d.ts.map +1 -0
- package/dist/utils/createCmdHistory.js +7 -0
- package/dist/utils/createCmdHistory.js.map +1 -0
- package/dist/utils/getCharForByte.d.ts +2 -0
- package/dist/utils/getCharForByte.d.ts.map +1 -0
- package/dist/utils/getCharForByte.js +6 -0
- package/dist/utils/getCharForByte.js.map +1 -0
- package/dist/utils/hasCmdRepeated.d.ts +3 -0
- package/dist/utils/hasCmdRepeated.d.ts.map +1 -0
- package/dist/utils/hasCmdRepeated.js +4 -0
- package/dist/utils/hasCmdRepeated.js.map +1 -0
- package/dist/utils/index.d.ts +20 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +20 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/numArrayToHexArray.d.ts +2 -0
- package/dist/utils/numArrayToHexArray.d.ts.map +1 -0
- package/dist/utils/numArrayToHexArray.js +9 -0
- package/dist/utils/numArrayToHexArray.js.map +1 -0
- package/dist/utils/rowsHighCh1.d.ts +4 -0
- package/dist/utils/rowsHighCh1.d.ts.map +1 -0
- package/dist/utils/rowsHighCh1.js +10 -0
- package/dist/utils/rowsHighCh1.js.map +1 -0
- package/dist/utils/rowsHighCh2.d.ts +4 -0
- package/dist/utils/rowsHighCh2.d.ts.map +1 -0
- package/dist/utils/rowsHighCh2.js +10 -0
- package/dist/utils/rowsHighCh2.js.map +1 -0
- package/dist/utils/rowsLowCh1.d.ts +4 -0
- package/dist/utils/rowsLowCh1.d.ts.map +1 -0
- package/dist/utils/rowsLowCh1.js +12 -0
- package/dist/utils/rowsLowCh1.js.map +1 -0
- package/dist/utils/rowsLowCh2.d.ts +4 -0
- package/dist/utils/rowsLowCh2.d.ts.map +1 -0
- package/dist/utils/rowsLowCh2.js +11 -0
- package/dist/utils/rowsLowCh2.js.map +1 -0
- package/dist/utils/seiHelpers.d.ts +7 -0
- package/dist/utils/seiHelpers.d.ts.map +1 -0
- package/dist/utils/seiHelpers.js +78 -0
- package/dist/utils/seiHelpers.js.map +1 -0
- package/dist/utils/setLastCmd.d.ts +3 -0
- package/dist/utils/setLastCmd.d.ts.map +1 -0
- package/dist/utils/setLastCmd.js +5 -0
- package/dist/utils/setLastCmd.js.map +1 -0
- package/dist/utils/specialCea608CharsCodes.d.ts +7 -0
- package/dist/utils/specialCea608CharsCodes.d.ts.map +1 -0
- package/dist/utils/specialCea608CharsCodes.js +103 -0
- package/dist/utils/specialCea608CharsCodes.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,54 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 class StyledUnicodeChar {
|
|
45
|
+
constructor() {
|
|
46
|
+
this.uchar = ' ';
|
|
47
|
+
this.penState = new PenState();
|
|
48
|
+
}
|
|
49
|
+
reset() {
|
|
50
|
+
this.uchar = ' ';
|
|
51
|
+
this.penState.reset();
|
|
52
|
+
}
|
|
53
|
+
setChar(uchar, newPenState) {
|
|
54
|
+
this.uchar = uchar;
|
|
55
|
+
this.penState.copy(newPenState);
|
|
56
|
+
}
|
|
57
|
+
setPenState(newPenState) {
|
|
58
|
+
this.penState.copy(newPenState);
|
|
59
|
+
}
|
|
60
|
+
equals(other) {
|
|
61
|
+
return this.uchar === other.uchar && this.penState.equals(other.penState);
|
|
62
|
+
}
|
|
63
|
+
copy(newChar) {
|
|
64
|
+
this.uchar = newChar.uchar;
|
|
65
|
+
this.penState.copy(newChar.penState);
|
|
66
|
+
}
|
|
67
|
+
isEmpty() {
|
|
68
|
+
return this.uchar === ' ' && this.penState.isDefault();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=StyledUnicodeChar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyledUnicodeChar.js","sourceRoot":"","sources":["../src/StyledUnicodeChar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACC,UAAK,GAAW,GAAG,CAAC;QACpB,aAAQ,GAAa,IAAI,QAAQ,EAAE,CAAC;IA4BrC,CAAC;IA1BA,KAAK;QACJ,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED,OAAO,CAAC,KAAa,EAAE,WAAqB;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED,WAAW,CAAC,WAAqB;QAChC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,KAAwB;QAC9B,OAAO,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC,OAA0B;QAC9B,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAED,OAAO;QACN,OAAO,IAAI,CAAC,KAAK,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IACxD,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 { PenState } from './PenState.js';\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedField.d.ts","sourceRoot":"","sources":["../src/SupportedField.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedField.js","sourceRoot":"","sources":["../src/SupportedField.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * SupportedField\n *\n * @beta\n */\nexport type SupportedField = 1 | 3;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ValueOf } from '@svta/cml-utils/ValueOf.js';
|
|
2
|
+
/**
|
|
3
|
+
* Logging levels for the CTA-608 parser.
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @enum
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare const VerboseLevel: {
|
|
11
|
+
readonly ERROR: 0;
|
|
12
|
+
readonly TEXT: 1;
|
|
13
|
+
readonly WARNING: 2;
|
|
14
|
+
readonly INFO: 2;
|
|
15
|
+
readonly DEBUG: 3;
|
|
16
|
+
readonly DATA: 3;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @beta
|
|
20
|
+
*/
|
|
21
|
+
export type VerboseLevel = ValueOf<typeof VerboseLevel>;
|
|
22
|
+
//# sourceMappingURL=VerboseLevel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerboseLevel.d.ts","sourceRoot":"","sources":["../src/VerboseLevel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VerboseLevel.js","sourceRoot":"","sources":["../src/VerboseLevel.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;CACE,CAAC","sourcesContent":["import type { ValueOf } from '@svta/cml-utils/ValueOf.js';\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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract CTA-608 data from a DataView
|
|
3
|
+
*
|
|
4
|
+
* @param raw - The DataView to extract the data from
|
|
5
|
+
* @param cta608Range - The range of the CTA-608 data
|
|
6
|
+
* @returns The extracted CTA-608 data
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractCta608Data(raw: DataView, cta608Range: Array<number>): Array<Array<number>>;
|
|
11
|
+
//# sourceMappingURL=extractCta608Data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractCta608Data.d.ts","sourceRoot":"","sources":["../src/extractCta608Data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CA6BjG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extract CTA-608 data from a DataView
|
|
3
|
+
*
|
|
4
|
+
* @param raw - The DataView to extract the data from
|
|
5
|
+
* @param cta608Range - The range of the CTA-608 data
|
|
6
|
+
* @returns The extracted CTA-608 data
|
|
7
|
+
*
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export function extractCta608Data(raw, cta608Range) {
|
|
11
|
+
let pos = cta608Range[0];
|
|
12
|
+
const fieldData = [[], []];
|
|
13
|
+
pos += 8; // Skip the identifier up to userDataTypeCode
|
|
14
|
+
const ccCount = raw.getUint8(pos) & 31;
|
|
15
|
+
pos += 2; // Advance 1 and skip reserved byte
|
|
16
|
+
for (let i = 0; i < ccCount; i++) {
|
|
17
|
+
const byte = raw.getUint8(pos);
|
|
18
|
+
const ccValid = byte & 4;
|
|
19
|
+
const ccType = byte & 3;
|
|
20
|
+
pos++;
|
|
21
|
+
const ccData1 = raw.getUint8(pos); // Keep parity bit
|
|
22
|
+
pos++;
|
|
23
|
+
const ccData2 = raw.getUint8(pos); // Keep parity bit
|
|
24
|
+
pos++;
|
|
25
|
+
if (ccValid && ((ccData1 & 127) + (ccData2 & 127) !== 0)) { //Check validity and non-empty data
|
|
26
|
+
if (ccType === 0) {
|
|
27
|
+
fieldData[0].push(ccData1);
|
|
28
|
+
fieldData[0].push(ccData2);
|
|
29
|
+
}
|
|
30
|
+
else if (ccType === 1) {
|
|
31
|
+
fieldData[1].push(ccData1);
|
|
32
|
+
fieldData[1].push(ccData2);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return fieldData;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=extractCta608Data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractCta608Data.js","sourceRoot":"","sources":["../src/extractCta608Data.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAa,EAAE,WAA0B;IAC1E,IAAI,GAAG,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,SAAS,GAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAEvC,GAAG,IAAI,CAAC,CAAC,CAAC,6CAA6C;IACvD,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;IACvC,GAAG,IAAI,CAAC,CAAC,CAAC,mCAAmC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC;QACxB,GAAG,EAAE,CAAC;QACN,MAAM,OAAO,GAAW,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB;QAC7D,GAAG,EAAE,CAAC;QACN,MAAM,OAAO,GAAW,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,kBAAkB;QAC7D,GAAG,EAAE,CAAC;QACN,IAAI,OAAO,IAAI,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,mCAAmC;YAC9F,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBAClB,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC3B,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;iBACI,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBACvB,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC3B,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC5B,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["/**\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: Array<number>): Array<Array<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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts CEA-608 data from a given sample.
|
|
3
|
+
*
|
|
4
|
+
* @param raw - The DataView with media data
|
|
5
|
+
* @param startPos - The start position within the DataView
|
|
6
|
+
* @param sampleSize - The size of the sample in bytes
|
|
7
|
+
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractCta608DataFromSample(raw: DataView, startPos: number, sampleSize: number): number[][];
|
|
12
|
+
//# sourceMappingURL=extractCta608DataFromSample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractCta608DataFromSample.d.ts","sourceRoot":"","sources":["../src/extractCta608DataFromSample.ts"],"names":[],"mappings":"AAMA;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,CA0B3G"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getSeiData, isSeiNalUnitType, parseCta608DataFromSei, } from './utils/seiHelpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts CEA-608 data from a given sample.
|
|
4
|
+
*
|
|
5
|
+
* @param raw - The DataView with media data
|
|
6
|
+
* @param startPos - The start position within the DataView
|
|
7
|
+
* @param sampleSize - The size of the sample in bytes
|
|
8
|
+
* @returns fieldData array containing field 1 and field 2 data arrays
|
|
9
|
+
*
|
|
10
|
+
* @beta
|
|
11
|
+
*/
|
|
12
|
+
export function extractCta608DataFromSample(raw, startPos, sampleSize) {
|
|
13
|
+
let nalSize = 0;
|
|
14
|
+
let nalType = 0;
|
|
15
|
+
const fieldData = [[], []];
|
|
16
|
+
for (let cursor = startPos; cursor < startPos + sampleSize - 5; cursor++) {
|
|
17
|
+
nalSize = raw.getUint32(cursor);
|
|
18
|
+
nalType = raw.getUint8(cursor + 4) & 0x1F;
|
|
19
|
+
// Make sure that we don't go out of bounds
|
|
20
|
+
if (cursor + 5 + nalSize > startPos + sampleSize) {
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
// Only process Supplemental Enhancement Information (SEI) NAL units
|
|
24
|
+
if (isSeiNalUnitType(nalType)) {
|
|
25
|
+
if (cursor + 5 + nalSize <= raw.byteLength) {
|
|
26
|
+
const seiData = getSeiData(raw, cursor + 5, cursor + 5 + nalSize);
|
|
27
|
+
parseCta608DataFromSei(seiData, fieldData);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// Jump to the next NAL unit
|
|
31
|
+
cursor += nalSize + 3;
|
|
32
|
+
}
|
|
33
|
+
return fieldData;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=extractCta608DataFromSample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractCta608DataFromSample.js","sourceRoot":"","sources":["../src/extractCta608DataFromSample.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,sBAAsB,GACtB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,GAAa,EAAE,QAAgB,EAAE,UAAkB;IAC9F,IAAI,OAAO,GAAW,CAAC,CAAC;IACxB,IAAI,OAAO,GAAW,CAAC,CAAC;IACxB,MAAM,SAAS,GAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAEvC,KAAK,IAAI,MAAM,GAAG,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QAC1E,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;QAE1C,2CAA2C;QAC3C,IAAI,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,QAAQ,GAAG,UAAU,EAAE,CAAC;YAClD,MAAM;QACP,CAAC;QAED,oEAAoE;QACpE,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,IAAI,MAAM,GAAG,CAAC,GAAG,OAAO,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC;gBAClE,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC5C,CAAC;QACF,CAAC;QAED,4BAA4B;QAC5B,MAAM,IAAI,OAAO,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import {\n\tgetSeiData,\n\tisSeiNalUnitType,\n\tparseCta608DataFromSei,\n} from './utils/seiHelpers.js';\n\n/**\n * Extracts CEA-608 data from a given sample.\n *\n * @param raw - The DataView with media data\n * @param startPos - The start position within the DataView\n * @param sampleSize - The size of the sample in bytes\n * @returns fieldData array containing field 1 and field 2 data arrays\n *\n * @beta\n */\nexport function extractCta608DataFromSample(raw: DataView, startPos: number, sampleSize: number): number[][] {\n\tlet nalSize: number = 0;\n\tlet nalType: number = 0;\n\tconst fieldData: number[][] = [[], []];\n\n\tfor (let cursor = startPos; cursor < startPos + sampleSize - 5; cursor++) {\n\t\tnalSize = raw.getUint32(cursor);\n\t\tnalType = raw.getUint8(cursor + 4) & 0x1F;\n\n\t\t// Make sure that we don't go out of bounds\n\t\tif (cursor + 5 + nalSize > startPos + sampleSize) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Only process Supplemental Enhancement Information (SEI) NAL units\n\t\tif (isSeiNalUnitType(nalType)) {\n\t\t\tif (cursor + 5 + nalSize <= raw.byteLength) {\n\t\t\t\tconst seiData = getSeiData(raw, cursor + 5, cursor + 5 + nalSize);\n\t\t\t\tparseCta608DataFromSei(seiData, fieldData);\n\t\t\t}\n\t\t}\n\n\t\t// Jump to the next NAL unit\n\t\tcursor += nalSize + 3;\n\t}\n\treturn fieldData;\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find CTA-608 NAL units in a video stream
|
|
3
|
+
*
|
|
4
|
+
* @param raw - The DataView to extract the data from
|
|
5
|
+
* @param startPos - The start position of the data
|
|
6
|
+
* @param size - The size of the data
|
|
7
|
+
* @returns The extracted CTA-608 NAL units
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export declare function findCta608Nalus(raw: DataView, startPos: number, size: number): Array<Array<number>>;
|
|
12
|
+
//# sourceMappingURL=findCta608Nalus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCta608Nalus.d.ts","sourceRoot":"","sources":["../src/findCta608Nalus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAkDnG"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find CTA-608 NAL units in a video stream
|
|
3
|
+
*
|
|
4
|
+
* @param raw - The DataView to extract the data from
|
|
5
|
+
* @param startPos - The start position of the data
|
|
6
|
+
* @param size - The size of the data
|
|
7
|
+
* @returns The extracted CTA-608 NAL units
|
|
8
|
+
*
|
|
9
|
+
* @beta
|
|
10
|
+
*/
|
|
11
|
+
export function findCta608Nalus(raw, startPos, size) {
|
|
12
|
+
let nalSize = 0, cursor = startPos, nalType = 0;
|
|
13
|
+
const cta608NaluRanges = [];
|
|
14
|
+
// Check SEI data according to ANSI-SCTE 128
|
|
15
|
+
const isCTA608SEI = (payloadType, payloadSize, raw, pos) => {
|
|
16
|
+
if (payloadType !== 4 || payloadSize < 8) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const countryCode = raw.getUint8(pos);
|
|
20
|
+
const providerCode = raw.getUint16(pos + 1);
|
|
21
|
+
const userIdentifier = raw.getUint32(pos + 3);
|
|
22
|
+
const userDataTypeCode = raw.getUint8(pos + 7);
|
|
23
|
+
return countryCode == 181 && providerCode == 49 && userIdentifier == 1195456820 && userDataTypeCode == 3;
|
|
24
|
+
};
|
|
25
|
+
while (cursor < startPos + size) {
|
|
26
|
+
nalSize = raw.getUint32(cursor);
|
|
27
|
+
nalType = raw.getUint8(cursor + 4) & 31;
|
|
28
|
+
//console.log(time + " NAL " + nalType);
|
|
29
|
+
if (nalType === 6) {
|
|
30
|
+
// SEI NAL Unit. The NAL header is the first byte
|
|
31
|
+
//console.log("SEI NALU of size " + nalSize + " at time " + time);
|
|
32
|
+
let pos = cursor + 5;
|
|
33
|
+
let payloadType = -1;
|
|
34
|
+
while (pos < cursor + 4 + nalSize - 1) { // The last byte should be rbsp_trailing_bits
|
|
35
|
+
payloadType = 0;
|
|
36
|
+
let b = 255;
|
|
37
|
+
while (b === 255) {
|
|
38
|
+
b = raw.getUint8(pos);
|
|
39
|
+
payloadType += b;
|
|
40
|
+
pos++;
|
|
41
|
+
}
|
|
42
|
+
let payloadSize = 0;
|
|
43
|
+
b = 255;
|
|
44
|
+
while (b === 255) {
|
|
45
|
+
b = raw.getUint8(pos);
|
|
46
|
+
payloadSize += b;
|
|
47
|
+
pos++;
|
|
48
|
+
}
|
|
49
|
+
if (isCTA608SEI(payloadType, payloadSize, raw, pos)) {
|
|
50
|
+
//console.log("CTA608 SEI " + time + " " + payloadSize);
|
|
51
|
+
cta608NaluRanges.push([pos, payloadSize]);
|
|
52
|
+
}
|
|
53
|
+
pos += payloadSize;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
cursor += nalSize + 4;
|
|
57
|
+
}
|
|
58
|
+
return cta608NaluRanges;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=findCta608Nalus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findCta608Nalus.js","sourceRoot":"","sources":["../src/findCta608Nalus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,GAAa,EAAE,QAAgB,EAAE,IAAY;IAC5E,IAAI,OAAO,GAAG,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,GAAG,CAAC,CAAC;IAChD,MAAM,gBAAgB,GAAG,EAAE,CAAC;IAE5B,4CAA4C;IAC5C,MAAM,WAAW,GAAG,CAAC,WAAmB,EAAE,WAAmB,EAAE,GAAa,EAAE,GAAW,EAAE,EAAE;QAC5F,IAAI,WAAW,KAAK,CAAC,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,IAAI,CAAC;QACb,CAAC;QACD,MAAM,WAAW,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtC,MAAM,YAAY,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC5C,MAAM,cAAc,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC9C,MAAM,gBAAgB,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAC/C,OAAO,WAAW,IAAI,GAAG,IAAI,YAAY,IAAI,EAAE,IAAI,cAAc,IAAI,UAAU,IAAI,gBAAgB,IAAI,CAAC,CAAC;IAC1G,CAAC,CAAC;IAEF,OAAO,MAAM,GAAG,QAAQ,GAAG,IAAI,EAAE,CAAC;QACjC,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QACxC,yCAAyC;QACzC,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;YACnB,iDAAiD;YACjD,kEAAkE;YAClE,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,CAAC;YACrB,IAAI,WAAW,GAAG,CAAC,CAAC,CAAC;YACrB,OAAO,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,6CAA6C;gBACrF,WAAW,GAAG,CAAC,CAAC;gBAChB,IAAI,CAAC,GAAG,GAAG,CAAC;gBACZ,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;oBAClB,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;oBACtB,WAAW,IAAI,CAAC,CAAC;oBACjB,GAAG,EAAE,CAAC;gBACP,CAAC;gBACD,IAAI,WAAW,GAAG,CAAC,CAAC;gBACpB,CAAC,GAAG,GAAG,CAAC;gBACR,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;oBAClB,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;oBACtB,WAAW,IAAI,CAAC,CAAC;oBACjB,GAAG,EAAE,CAAC;gBACP,CAAC;gBACD,IAAI,WAAW,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;oBACrD,wDAAwD;oBACxD,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC;gBAC3C,CAAC;gBACD,GAAG,IAAI,WAAW,CAAC;YACpB,CAAC;QACF,CAAC;QACD,MAAM,IAAI,OAAO,GAAG,CAAC,CAAC;IACvB,CAAC;IACD,OAAO,gBAAgB,CAAC;AACzB,CAAC","sourcesContent":["/**\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): Array<Array<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"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CTA-608/CEA-608 closed captioning functionality.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export type * from './CaptionModes.js';
|
|
7
|
+
export * from './CaptionScreen.js';
|
|
8
|
+
export * from './CaptionsLogger.js';
|
|
9
|
+
export * from './Cta608Channel.js';
|
|
10
|
+
export * from './Cta608Parser.js';
|
|
11
|
+
export * from './CueHandler.js';
|
|
12
|
+
export * from './extractCta608Data.js';
|
|
13
|
+
export * from './findCta608Nalus.js';
|
|
14
|
+
export * from './PACData.js';
|
|
15
|
+
export * from './PenState.js';
|
|
16
|
+
export * from './PenStyles.js';
|
|
17
|
+
export * from './Row.js';
|
|
18
|
+
export * from './SccParser.js';
|
|
19
|
+
export * from './StyledUnicodeChar.js';
|
|
20
|
+
export * from './SupportedField.js';
|
|
21
|
+
export * from './VerboseLevel.js';
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,mBAAmB,mBAAmB,CAAC;AACvC,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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './CaptionScreen.js';
|
|
2
|
+
export * from './CaptionsLogger.js';
|
|
3
|
+
export * from './Cta608Channel.js';
|
|
4
|
+
export * from './Cta608Parser.js';
|
|
5
|
+
export * from './CueHandler.js';
|
|
6
|
+
export * from './extractCta608Data.js';
|
|
7
|
+
export * from './findCta608Nalus.js';
|
|
8
|
+
export * from './PACData.js';
|
|
9
|
+
export * from './PenState.js';
|
|
10
|
+
export * from './PenStyles.js';
|
|
11
|
+
export * from './Row.js';
|
|
12
|
+
export * from './SccParser.js';
|
|
13
|
+
export * from './StyledUnicodeChar.js';
|
|
14
|
+
export * from './SupportedField.js';
|
|
15
|
+
export * from './VerboseLevel.js';
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"]}
|