@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.
Files changed (145) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +59 -0
  3. package/dist/CaptionModes.d.ts +7 -0
  4. package/dist/CaptionModes.d.ts.map +1 -0
  5. package/dist/CaptionModes.js +2 -0
  6. package/dist/CaptionModes.js.map +1 -0
  7. package/dist/CaptionScreen.d.ts +80 -0
  8. package/dist/CaptionScreen.d.ts.map +1 -0
  9. package/dist/CaptionScreen.js +220 -0
  10. package/dist/CaptionScreen.js.map +1 -0
  11. package/dist/CaptionsLogger.d.ts +49 -0
  12. package/dist/CaptionsLogger.d.ts.map +1 -0
  13. package/dist/CaptionsLogger.js +56 -0
  14. package/dist/CaptionsLogger.js.map +1 -0
  15. package/dist/Channels.d.ts +7 -0
  16. package/dist/Channels.d.ts.map +1 -0
  17. package/dist/Channels.js +2 -0
  18. package/dist/Channels.js.map +1 -0
  19. package/dist/CmdHistory.d.ts +10 -0
  20. package/dist/CmdHistory.d.ts.map +1 -0
  21. package/dist/CmdHistory.js +2 -0
  22. package/dist/CmdHistory.js.map +1 -0
  23. package/dist/Cta608Channel.d.ts +88 -0
  24. package/dist/Cta608Channel.d.ts.map +1 -0
  25. package/dist/Cta608Channel.js +262 -0
  26. package/dist/Cta608Channel.js.map +1 -0
  27. package/dist/Cta608Parser.d.ts +115 -0
  28. package/dist/Cta608Parser.d.ts.map +1 -0
  29. package/dist/Cta608Parser.js +428 -0
  30. package/dist/Cta608Parser.js.map +1 -0
  31. package/dist/CueHandler.d.ts +12 -0
  32. package/dist/CueHandler.d.ts.map +1 -0
  33. package/dist/CueHandler.js +2 -0
  34. package/dist/CueHandler.js.map +1 -0
  35. package/dist/PACData.d.ts +13 -0
  36. package/dist/PACData.d.ts.map +1 -0
  37. package/dist/PACData.js +2 -0
  38. package/dist/PACData.js.map +1 -0
  39. package/dist/PenState.d.ts +56 -0
  40. package/dist/PenState.d.ts.map +1 -0
  41. package/dist/PenState.js +95 -0
  42. package/dist/PenState.js.map +1 -0
  43. package/dist/PenStyles.d.ts +13 -0
  44. package/dist/PenStyles.d.ts.map +1 -0
  45. package/dist/PenStyles.js +2 -0
  46. package/dist/PenStyles.js.map +1 -0
  47. package/dist/Row.d.ts +75 -0
  48. package/dist/Row.d.ts.map +1 -0
  49. package/dist/Row.js +174 -0
  50. package/dist/Row.js.map +1 -0
  51. package/dist/SccParser.d.ts +49 -0
  52. package/dist/SccParser.d.ts.map +1 -0
  53. package/dist/SccParser.js +99 -0
  54. package/dist/SccParser.js.map +1 -0
  55. package/dist/StyledUnicodeChar.d.ts +54 -0
  56. package/dist/StyledUnicodeChar.d.ts.map +1 -0
  57. package/dist/StyledUnicodeChar.js +71 -0
  58. package/dist/StyledUnicodeChar.js.map +1 -0
  59. package/dist/SupportedField.d.ts +7 -0
  60. package/dist/SupportedField.d.ts.map +1 -0
  61. package/dist/SupportedField.js +2 -0
  62. package/dist/SupportedField.js.map +1 -0
  63. package/dist/VerboseLevel.d.ts +22 -0
  64. package/dist/VerboseLevel.d.ts.map +1 -0
  65. package/dist/VerboseLevel.js +17 -0
  66. package/dist/VerboseLevel.js.map +1 -0
  67. package/dist/extractCta608Data.d.ts +11 -0
  68. package/dist/extractCta608Data.d.ts.map +1 -0
  69. package/dist/extractCta608Data.js +38 -0
  70. package/dist/extractCta608Data.js.map +1 -0
  71. package/dist/extractCta608DataFromSample.d.ts +12 -0
  72. package/dist/extractCta608DataFromSample.d.ts.map +1 -0
  73. package/dist/extractCta608DataFromSample.js +35 -0
  74. package/dist/extractCta608DataFromSample.js.map +1 -0
  75. package/dist/findCta608Nalus.d.ts +12 -0
  76. package/dist/findCta608Nalus.d.ts.map +1 -0
  77. package/dist/findCta608Nalus.js +60 -0
  78. package/dist/findCta608Nalus.js.map +1 -0
  79. package/dist/index.d.ts +22 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +16 -0
  82. package/dist/index.js.map +1 -0
  83. package/dist/tsconfig.tsbuildinfo +1 -0
  84. package/dist/tsdoc-metadata.json +11 -0
  85. package/dist/utils/NR_COLS.d.ts +2 -0
  86. package/dist/utils/NR_COLS.d.ts.map +1 -0
  87. package/dist/utils/NR_COLS.js +2 -0
  88. package/dist/utils/NR_COLS.js.map +1 -0
  89. package/dist/utils/NR_ROWS.d.ts +2 -0
  90. package/dist/utils/NR_ROWS.d.ts.map +1 -0
  91. package/dist/utils/NR_ROWS.js +2 -0
  92. package/dist/utils/NR_ROWS.js.map +1 -0
  93. package/dist/utils/backgroundColors.d.ts +2 -0
  94. package/dist/utils/backgroundColors.d.ts.map +1 -0
  95. package/dist/utils/backgroundColors.js +12 -0
  96. package/dist/utils/backgroundColors.js.map +1 -0
  97. package/dist/utils/createCmdHistory.d.ts +3 -0
  98. package/dist/utils/createCmdHistory.d.ts.map +1 -0
  99. package/dist/utils/createCmdHistory.js +7 -0
  100. package/dist/utils/createCmdHistory.js.map +1 -0
  101. package/dist/utils/getCharForByte.d.ts +2 -0
  102. package/dist/utils/getCharForByte.d.ts.map +1 -0
  103. package/dist/utils/getCharForByte.js +6 -0
  104. package/dist/utils/getCharForByte.js.map +1 -0
  105. package/dist/utils/hasCmdRepeated.d.ts +3 -0
  106. package/dist/utils/hasCmdRepeated.d.ts.map +1 -0
  107. package/dist/utils/hasCmdRepeated.js +4 -0
  108. package/dist/utils/hasCmdRepeated.js.map +1 -0
  109. package/dist/utils/index.d.ts +20 -0
  110. package/dist/utils/index.d.ts.map +1 -0
  111. package/dist/utils/index.js +20 -0
  112. package/dist/utils/index.js.map +1 -0
  113. package/dist/utils/numArrayToHexArray.d.ts +2 -0
  114. package/dist/utils/numArrayToHexArray.d.ts.map +1 -0
  115. package/dist/utils/numArrayToHexArray.js +9 -0
  116. package/dist/utils/numArrayToHexArray.js.map +1 -0
  117. package/dist/utils/rowsHighCh1.d.ts +4 -0
  118. package/dist/utils/rowsHighCh1.d.ts.map +1 -0
  119. package/dist/utils/rowsHighCh1.js +10 -0
  120. package/dist/utils/rowsHighCh1.js.map +1 -0
  121. package/dist/utils/rowsHighCh2.d.ts +4 -0
  122. package/dist/utils/rowsHighCh2.d.ts.map +1 -0
  123. package/dist/utils/rowsHighCh2.js +10 -0
  124. package/dist/utils/rowsHighCh2.js.map +1 -0
  125. package/dist/utils/rowsLowCh1.d.ts +4 -0
  126. package/dist/utils/rowsLowCh1.d.ts.map +1 -0
  127. package/dist/utils/rowsLowCh1.js +12 -0
  128. package/dist/utils/rowsLowCh1.js.map +1 -0
  129. package/dist/utils/rowsLowCh2.d.ts +4 -0
  130. package/dist/utils/rowsLowCh2.d.ts.map +1 -0
  131. package/dist/utils/rowsLowCh2.js +11 -0
  132. package/dist/utils/rowsLowCh2.js.map +1 -0
  133. package/dist/utils/seiHelpers.d.ts +7 -0
  134. package/dist/utils/seiHelpers.d.ts.map +1 -0
  135. package/dist/utils/seiHelpers.js +78 -0
  136. package/dist/utils/seiHelpers.js.map +1 -0
  137. package/dist/utils/setLastCmd.d.ts +3 -0
  138. package/dist/utils/setLastCmd.d.ts.map +1 -0
  139. package/dist/utils/setLastCmd.js +5 -0
  140. package/dist/utils/setLastCmd.js.map +1 -0
  141. package/dist/utils/specialCea608CharsCodes.d.ts +7 -0
  142. package/dist/utils/specialCea608CharsCodes.d.ts.map +1 -0
  143. package/dist/utils/specialCea608CharsCodes.js +103 -0
  144. package/dist/utils/specialCea608CharsCodes.js.map +1 -0
  145. package/package.json +80 -0
@@ -0,0 +1,49 @@
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 { VerboseLevel } from './VerboseLevel.js';
39
+ /**
40
+ * CaptionsLogger. To be removed in the future.
41
+ *
42
+ * @beta
43
+ */
44
+ export declare class CaptionsLogger {
45
+ time: number | null;
46
+ verboseLevel: VerboseLevel;
47
+ log(severity: VerboseLevel, msg: string | (() => string)): void;
48
+ }
49
+ //# sourceMappingURL=CaptionsLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaptionsLogger.d.ts","sourceRoot":"","sources":["../src/CaptionsLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,cAAc;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC3B,YAAY,EAAE,YAAY,CAAsB;IAEvD,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI;CAM/D"}
@@ -0,0 +1,56 @@
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 { VerboseLevel } from './VerboseLevel.js';
39
+ /**
40
+ * CaptionsLogger. To be removed in the future.
41
+ *
42
+ * @beta
43
+ */
44
+ export class CaptionsLogger {
45
+ constructor() {
46
+ this.time = null;
47
+ this.verboseLevel = VerboseLevel.ERROR;
48
+ }
49
+ log(severity, msg) {
50
+ if (this.verboseLevel >= severity) {
51
+ const m = typeof msg === 'function' ? msg() : msg;
52
+ console.log(`${this.time} [${severity}] ${m}`);
53
+ }
54
+ }
55
+ }
56
+ //# sourceMappingURL=CaptionsLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CaptionsLogger.js","sourceRoot":"","sources":["../src/CaptionsLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAA3B;QACQ,SAAI,GAAkB,IAAI,CAAC;QAC3B,iBAAY,GAAiB,YAAY,CAAC,KAAK,CAAC;IAQxD,CAAC;IANA,GAAG,CAAC,QAAsB,EAAE,GAA4B;QACvD,IAAI,IAAI,CAAC,YAAY,IAAI,QAAQ,EAAE,CAAC;YACnC,MAAM,CAAC,GAAW,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;YAC1D,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ,KAAK,CAAC,EAAE,CAAC,CAAC;QAChD,CAAC;IACF,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 { VerboseLevel } from './VerboseLevel.js';\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"]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Channel number
3
+ *
4
+ * @beta
5
+ */
6
+ export type Channels = 0 | 1 | 2;
7
+ //# sourceMappingURL=Channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Channels.d.ts","sourceRoot":"","sources":["../src/Channels.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Channels.js","sourceRoot":"","sources":["../src/Channels.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Channel number\n *\n * @beta\n */\nexport type Channels = 0 | 1 | 2; // Will be 1 or 2 when parsing captions\n"]}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Command history for CTA-608.
3
+ *
4
+ * @beta
5
+ */
6
+ export type CmdHistory = {
7
+ a: number | null;
8
+ b: number | null;
9
+ };
10
+ //# sourceMappingURL=CmdHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CmdHistory.d.ts","sourceRoot":"","sources":["../src/CmdHistory.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACxB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CmdHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CmdHistory.js","sourceRoot":"","sources":["../src/CmdHistory.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Command history for CTA-608.\n *\n * @beta\n */\nexport type CmdHistory = {\n\ta: number | null;\n\tb: number | null;\n};\n"]}
@@ -0,0 +1,88 @@
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 type { CaptionModes } from './CaptionModes.js';
39
+ import { CaptionScreen } from './CaptionScreen.js';
40
+ import { CaptionsLogger } from './CaptionsLogger.js';
41
+ import type { CueHandler } from './CueHandler.js';
42
+ import type { PACData } from './PACData.js';
43
+ import type { PenStyles } from './PenStyles.js';
44
+ import type { Row } from './Row.js';
45
+ /**
46
+ * CTA-608 Channel
47
+ *
48
+ * @beta
49
+ */
50
+ export declare class Cta608Channel {
51
+ chNr: number;
52
+ outputFilter: CueHandler;
53
+ mode: CaptionModes;
54
+ displayedMemory: CaptionScreen;
55
+ nonDisplayedMemory: CaptionScreen;
56
+ lastOutputScreen: CaptionScreen;
57
+ currRollUpRow: Row;
58
+ writeScreen: CaptionScreen;
59
+ cueStartTime: number | null;
60
+ private logger;
61
+ constructor(channelNumber: number, outputFilter: CueHandler, logger?: CaptionsLogger);
62
+ reset(): void;
63
+ getHandler(): CueHandler;
64
+ setHandler(outputFilter: CueHandler): void;
65
+ setPAC(pacData: PACData): void;
66
+ setBkgData(bkgData: Partial<PenStyles>): void;
67
+ setMode(newMode: CaptionModes): void;
68
+ insertChars(chars: number[]): void;
69
+ ccRCL(): void;
70
+ ccBS(): void;
71
+ ccAOF(): void;
72
+ ccAON(): void;
73
+ ccDER(): void;
74
+ ccRU(nrRows: number | null): void;
75
+ ccFON(): void;
76
+ ccRDC(): void;
77
+ ccTR(): void;
78
+ ccRTD(): void;
79
+ ccEDM(): void;
80
+ ccCR(): void;
81
+ ccENM(): void;
82
+ ccEOC(): void;
83
+ ccTO(nrCols: number): void;
84
+ ccMIDROW(secondByte: number): void;
85
+ outputDataUpdate(dispatch?: boolean): void;
86
+ cueSplitAtTime(t: number): void;
87
+ }
88
+ //# sourceMappingURL=Cta608Channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cta608Channel.d.ts","sourceRoot":"","sources":["../src/Cta608Channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,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b,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAM1B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAyBlC,gBAAgB,CAAC,QAAQ,GAAE,OAAe,GAAG,IAAI;IA6BjD,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;CAW/B"}
@@ -0,0 +1,262 @@
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 { CaptionScreen } from './CaptionScreen.js';
39
+ import { CaptionsLogger } from './CaptionsLogger.js';
40
+ import { VerboseLevel } from './VerboseLevel.js';
41
+ import { NR_ROWS } from './utils/NR_ROWS.js';
42
+ /**
43
+ * CTA-608 Channel
44
+ *
45
+ * @beta
46
+ */
47
+ export class Cta608Channel {
48
+ constructor(channelNumber, outputFilter, logger = new CaptionsLogger()) {
49
+ this.chNr = channelNumber;
50
+ this.outputFilter = outputFilter;
51
+ this.mode = null;
52
+ this.displayedMemory = new CaptionScreen(logger);
53
+ this.nonDisplayedMemory = new CaptionScreen(logger);
54
+ this.lastOutputScreen = new CaptionScreen(logger);
55
+ this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];
56
+ this.writeScreen = this.displayedMemory;
57
+ this.mode = null;
58
+ this.cueStartTime = null; // Keeps track of where a cue started.
59
+ this.logger = logger;
60
+ this.logger.log(VerboseLevel.INFO, 'new Cea608Channel(' + this.chNr + ')');
61
+ }
62
+ reset() {
63
+ var _a, _b;
64
+ this.mode = null;
65
+ this.displayedMemory.reset();
66
+ this.nonDisplayedMemory.reset();
67
+ this.lastOutputScreen.reset();
68
+ (_b = (_a = this.outputFilter) === null || _a === void 0 ? void 0 : _a.reset) === null || _b === void 0 ? void 0 : _b.call(_a);
69
+ this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];
70
+ this.writeScreen = this.displayedMemory;
71
+ this.mode = null;
72
+ this.cueStartTime = null;
73
+ }
74
+ getHandler() {
75
+ return this.outputFilter;
76
+ }
77
+ setHandler(outputFilter) {
78
+ this.outputFilter = outputFilter;
79
+ }
80
+ setPAC(pacData) {
81
+ this.writeScreen.setPAC(pacData);
82
+ }
83
+ setBkgData(bkgData) {
84
+ this.writeScreen.setBkgData(bkgData);
85
+ }
86
+ setMode(newMode) {
87
+ if (newMode === this.mode) {
88
+ return;
89
+ }
90
+ this.mode = newMode;
91
+ this.logger.log(VerboseLevel.INFO, () => 'MODE=' + newMode);
92
+ if (this.mode === 'MODE_POP-ON') {
93
+ this.writeScreen = this.nonDisplayedMemory;
94
+ }
95
+ else {
96
+ this.writeScreen = this.displayedMemory;
97
+ this.writeScreen.reset();
98
+ }
99
+ if (this.mode !== 'MODE_ROLL-UP') {
100
+ this.displayedMemory.setRollUpRows(null);
101
+ this.nonDisplayedMemory.setRollUpRows(null);
102
+ }
103
+ this.mode = newMode;
104
+ }
105
+ insertChars(chars) {
106
+ for (let i = 0; i < chars.length; i++) {
107
+ this.writeScreen.insertChar(chars[i]);
108
+ }
109
+ const screen = this.writeScreen === this.displayedMemory ? 'DISP' : 'NON_DISP';
110
+ this.logger.log(VerboseLevel.INFO, () => screen + ': ' + this.writeScreen.getDisplayText(true));
111
+ if (this.mode === 'MODE_PAINT-ON' || this.mode === 'MODE_ROLL-UP') {
112
+ this.logger.log(VerboseLevel.TEXT, () => 'DISPLAYED: ' + this.displayedMemory.getDisplayText(true));
113
+ this.outputDataUpdate();
114
+ }
115
+ }
116
+ ccRCL() {
117
+ // Resume Caption Loading (switch mode to Pop On)
118
+ this.logger.log(VerboseLevel.INFO, 'RCL - Resume Caption Loading');
119
+ this.setMode('MODE_POP-ON');
120
+ }
121
+ ccBS() {
122
+ // BackSpace
123
+ this.logger.log(VerboseLevel.INFO, 'BS - BackSpace');
124
+ if (this.mode === 'MODE_TEXT') {
125
+ return;
126
+ }
127
+ this.writeScreen.backSpace();
128
+ if (this.writeScreen === this.displayedMemory) {
129
+ this.outputDataUpdate();
130
+ }
131
+ }
132
+ ccAOF() {
133
+ // Reserved (formerly Alarm Off)
134
+ }
135
+ ccAON() {
136
+ // Reserved (formerly Alarm On)
137
+ }
138
+ ccDER() {
139
+ // Delete to End of Row
140
+ this.logger.log(VerboseLevel.INFO, 'DER- Delete to End of Row');
141
+ this.writeScreen.clearToEndOfRow();
142
+ this.outputDataUpdate();
143
+ }
144
+ ccRU(nrRows) {
145
+ // Roll-Up Captions-2,3,or 4 Rows
146
+ this.logger.log(VerboseLevel.INFO, 'RU(' + nrRows + ') - Roll Up');
147
+ this.writeScreen = this.displayedMemory;
148
+ this.setMode('MODE_ROLL-UP');
149
+ this.writeScreen.setRollUpRows(nrRows);
150
+ }
151
+ ccFON() {
152
+ // Flash On
153
+ this.logger.log(VerboseLevel.INFO, 'FON - Flash On');
154
+ this.writeScreen.setPen({ flash: true });
155
+ }
156
+ ccRDC() {
157
+ // Resume Direct Captioning (switch mode to PaintOn)
158
+ this.logger.log(VerboseLevel.INFO, 'RDC - Resume Direct Captioning');
159
+ this.setMode('MODE_PAINT-ON');
160
+ }
161
+ ccTR() {
162
+ // Text Restart in text mode (not supported, however)
163
+ this.logger.log(VerboseLevel.INFO, 'TR');
164
+ this.setMode('MODE_TEXT');
165
+ }
166
+ ccRTD() {
167
+ // Resume Text Display in Text mode (not supported, however)
168
+ this.logger.log(VerboseLevel.INFO, 'RTD');
169
+ this.setMode('MODE_TEXT');
170
+ }
171
+ ccEDM() {
172
+ // Erase Displayed Memory
173
+ this.logger.log(VerboseLevel.INFO, 'EDM - Erase Displayed Memory');
174
+ this.displayedMemory.reset();
175
+ this.outputDataUpdate(true);
176
+ }
177
+ ccCR() {
178
+ // Carriage Return
179
+ this.logger.log(VerboseLevel.INFO, 'CR - Carriage Return');
180
+ this.writeScreen.rollUp();
181
+ this.outputDataUpdate(true);
182
+ }
183
+ ccENM() {
184
+ // Erase Non-Displayed Memory
185
+ this.logger.log(VerboseLevel.INFO, 'ENM - Erase Non-displayed Memory');
186
+ this.nonDisplayedMemory.reset();
187
+ }
188
+ ccEOC() {
189
+ // End of Caption (Flip Memories)
190
+ this.logger.log(VerboseLevel.INFO, 'EOC - End Of Caption');
191
+ if (this.mode === 'MODE_POP-ON') {
192
+ const tmp = this.displayedMemory;
193
+ this.displayedMemory = this.nonDisplayedMemory;
194
+ this.nonDisplayedMemory = tmp;
195
+ this.writeScreen = this.nonDisplayedMemory;
196
+ this.logger.log(VerboseLevel.TEXT, () => 'DISP: ' + this.displayedMemory.getDisplayText());
197
+ }
198
+ this.outputDataUpdate(true);
199
+ }
200
+ ccTO(nrCols) {
201
+ // Tab Offset 1,2, or 3 columns
202
+ this.logger.log(VerboseLevel.INFO, 'TO(' + nrCols + ') - Tab Offset');
203
+ this.writeScreen.moveCursor(nrCols);
204
+ }
205
+ ccMIDROW(secondByte) {
206
+ // Parse MIDROW command
207
+ const styles = { flash: false };
208
+ styles.underline = secondByte % 2 === 1;
209
+ styles.italics = secondByte >= 0x2e;
210
+ if (!styles.italics) {
211
+ const colorIndex = Math.floor(secondByte / 2) - 0x10;
212
+ const colors = [
213
+ 'white',
214
+ 'green',
215
+ 'blue',
216
+ 'cyan',
217
+ 'red',
218
+ 'yellow',
219
+ 'magenta',
220
+ ];
221
+ styles.foreground = colors[colorIndex];
222
+ }
223
+ else {
224
+ styles.foreground = 'white';
225
+ }
226
+ this.logger.log(VerboseLevel.INFO, 'MIDROW: ' + JSON.stringify(styles));
227
+ this.writeScreen.setPen(styles);
228
+ }
229
+ outputDataUpdate(dispatch = false) {
230
+ const time = this.logger.time;
231
+ if (time === null) {
232
+ return;
233
+ }
234
+ if (this.outputFilter) {
235
+ if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {
236
+ // Start of a new cue
237
+ this.cueStartTime = time;
238
+ }
239
+ else {
240
+ if (!this.displayedMemory.equals(this.lastOutputScreen)) {
241
+ this.outputFilter.newCue(this.cueStartTime, time, this.lastOutputScreen);
242
+ if (dispatch && this.outputFilter.dispatchCue) {
243
+ this.outputFilter.dispatchCue();
244
+ }
245
+ this.cueStartTime = this.displayedMemory.isEmpty() ? null : time;
246
+ }
247
+ }
248
+ this.lastOutputScreen.copy(this.displayedMemory);
249
+ }
250
+ }
251
+ cueSplitAtTime(t) {
252
+ if (this.outputFilter) {
253
+ if (!this.displayedMemory.isEmpty()) {
254
+ if (this.outputFilter.newCue) {
255
+ this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);
256
+ }
257
+ this.cueStartTime = t;
258
+ }
259
+ }
260
+ }
261
+ }
262
+ //# sourceMappingURL=Cta608Channel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cta608Channel.js","sourceRoot":"","sources":["../src/Cta608Channel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAazB,YACC,aAAqB,EACrB,YAAwB,EACxB,SAAyB,IAAI,cAAc,EAAE;QAE7C,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAC1B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,eAAe,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACjD,IAAI,CAAC,kBAAkB,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,CAAC,gBAAgB,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,aAAa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gB,CAAC,EAAE,CAAC;oBACzD,IAAI,CAAC,YAAY,CAAC,MAAM,CACvB,IAAI,CAAC,YAAa,EAClB,IAAI,EACJ,IAAI,CAAC,gBAAgB,CACrB,CAAC;oBACF,IAAI,QAAQ,IAAI,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;wBAC/C,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;oBACjC,CAAC;oBAED,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAClE,CAAC;YACF,CAAC;YACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED,cAAc,CAAC,CAAS;QACvB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,EAAE,CAAC;gBACrC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;oBAC9B,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,YAAa,EAAE,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;gBACvE,CAAC;gBAED,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;YACvB,CAAC;QACF,CAAC;IACF,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 { CaptionModes } from './CaptionModes.js';\nimport { CaptionScreen } from './CaptionScreen.js';\nimport { CaptionsLogger } from './CaptionsLogger.js';\nimport type { CueHandler } from './CueHandler.js';\nimport type { PACData } from './PACData.js';\nimport type { PenStyles } from './PenStyles.js';\nimport type { Row } from './Row.js';\nimport { VerboseLevel } from './VerboseLevel.js';\nimport { NR_ROWS } from './utils/NR_ROWS.js';\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 (let i = 0; i < chars.length; i++) {\n\t\t\tthis.writeScreen.insertChar(chars[i]);\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\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\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"]}