@svta/cml-608 1.1.0 → 1.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/CaptionModes.ts","../src/VerboseLevel.ts","../src/CaptionsLogger.ts","../src/PACData.ts","../src/PenStyles.ts","../src/PenState.ts","../src/StyledUnicodeChar.ts","../src/Row.ts","../src/CaptionScreen.ts","../src/CueHandler.ts","../src/Cta608Channel.ts","../src/SupportedField.ts","../src/Cta608Parser.ts","../src/extractCta608Data.ts","../src/extractCta608DataFromAv1Sample.ts","../src/extractCta608DataFromSample.ts","../src/findCta608Nalus.ts","../src/SccParser.ts"],"sourcesContent":[],"mappings":";;;;;;;AAKA;;KAAY,YAAA;;;;;AAAZ;;;;ACKA;AAYA;cAZa;;;ECmCb,SAAa,OAAA,EAAA,CAAA;;;;ACxCb,CAAA;;;;ACAY,KHiBA,YAAA,GAAe,OGjBf,CAAA,OHiB8B,YGjB9B,CAAA;;;;;;;;;AG8CC,cLNA,cAAA,CKMA;EACE,IAAA,EAAA,MAAA,GAAA,IAAA;EAOM,YAAA,ELZC,YKYD;EAON,GAAA,CAAA,QAAA,ELjBA,YKiBA,EAAA,GAAA,EAAA,MAAA,GAAA,CAAA,GAAA,GAAA,MAAA,CAAA,CAAA,EAAA,IAAA;;;;;;;AP7Df;;KGAY,OAAA;;EFKZ,MAAa,EAAA,MAAA,GAAA,IAAA;EAYb,KAAY,EAAA,MAAA,GAAA,IAAA;;;;;;;;;ADjBZ;;KIAY,SAAA;;EHKZ,SAAa,EAAA,OAAA;EAYb,OAAY,EAAA,OAAA;;;;;;;;;;;;AM6BC,cFNA,QAAA,CEMA;EACE,UAAA,EAAA,MAAA;EAOM,SAAA,EAAA,OAAA;EAON,OAAA,EAAA,OAAA;EASF,UAAA,EAAA,MAAA;EA0HiB,KAAA,EAAA,OAAA;EAAR,KAAA,CAAA,CAAA,EAAA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A,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,CAAA,EAAA,MAAA,EAAA,EAAA;;;;;;ALvDnB;;;;ACKA;AAYA;;iBcNgB,2BAAA,MAAiC;;;;;;AfXjD;;;;ACKA;AAYA;;iBeVgB,eAAA,MAAqB;;;;;;AhBPrC;;;;ACKA;AAYA;;;;ACuBA;;;;ACxCA;;;;ACAA;;;;ACwCA;;;;;;;;;ACAA;;AASqC,cWlBxB,SAAA,CXkBwB;EAKX,SAAA,EAAA,OAAA;EAIX,aAAA,EAAA,MAAA;EAIA,SAAA,EAAA,GAAA;EAAA,KAAA,EAAA,MAAA,GAAA,GAAA;;;;EChBf,aAAa,CAAA,OAAA,EAAA,MAAA,CAAA,EAAA,MAAA;EACE,eAAA,CAAA,CAAA,EAAA,OAAA;EAOM,QAAA,CAAA,CAAA,EAAA,MAAA,GAAA,GAAA;EAON,cAAA,CAAA,CAAA,EAAA,MAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/CaptionModes.ts","../src/VerboseLevel.ts","../src/CaptionsLogger.ts","../src/PACData.ts","../src/PenStyles.ts","../src/PenState.ts","../src/StyledUnicodeChar.ts","../src/Row.ts","../src/CaptionScreen.ts","../src/CueHandler.ts","../src/Cta608Channel.ts","../src/SupportedField.ts","../src/Cta608Parser.ts","../src/extractCta608Data.ts","../src/extractCta608DataFromAv1Sample.ts","../src/extractCta608DataFromSample.ts","../src/findCta608Nalus.ts","../src/SccParser.ts"],"mappings":";;;;;;;KAKY;;;;;;;;;;;qBCKC;WACZ;WACA;WACA;WACA;WACA;WACA;;;;;YAMW,eAAe,eAAe;;;;;;;;qBCuB7B;EACZ;EACA,cAAqB;EAErB,IAAI,UAAU,cAAc;;;;;;;;;YC5CjB;EACX;EACA;EACA;EACA;EACA;;;;;;;;;YCLW;EACX;EACA;EACA;EACA;EACA;;;;;;;;;qBCmCY;EACZ;EACA;EACA;EACA;EACA;EAEA;EAQA,UAAU,QAAQ,QAAQ;EAe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A;EAER,YAAY,OAAO,gBAAgB,WAAW;;;;;;;EAe9C,QAAQ,qBAAqB;;;;;;;;UAqGrB;;;;;;;;UAgFA;;;;;;;;UAuCA;;;;;;;;UAqCA;;;;;;;;UA+CA;;;;;;;;UAuDA;;;;EAiCR;;;;EAaA,eAAe;;;;;;;;;;;;;wBC9dA,kBAAkB,KAAK,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBCiBjC,+BAA+B,KAAK,UAAU,kBAAkB;;;;;;;;;;;;;wBCZhE,4BAA4B,KAAK,UAAU,kBAAkB;;;;;;;;;;;;;wBCJ7D,gBAAgB,KAAK,UAAU,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBCwBpD;EACZ;EACA;EACA;EACA;EAEA,YAAY,gBAAgB;EAK5B,MAAM;EAuBN,cAAc;EAoBd,cAAc;EAWd;EAIA;EAIA"}
package/dist/index.js CHANGED
@@ -15,10 +15,46 @@ const VerboseLevel = {
15
15
  DEBUG: 3,
16
16
  DATA: 3
17
17
  };
18
-
19
18
  //#endregion
20
19
  //#region src/CaptionsLogger.ts
21
20
  /**
21
+ *
22
+ * This code was ported from the dash.js project at:
23
+ * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
24
+ * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
25
+ *
26
+ * The original copyright appears below:
27
+ *
28
+ * The copyright in this software is being made available under the BSD License,
29
+ * included below. This software may be subject to other third party and contributor
30
+ * rights, including patent rights, and no such rights are granted under this license.
31
+ *
32
+ * Copyright (c) 2015-2016, DASH Industry Forum.
33
+ * All rights reserved.
34
+ *
35
+ * Redistribution and use in source and binary forms, with or without modification,
36
+ * are permitted provided that the following conditions are met:
37
+ * 1. Redistributions of source code must retain the above copyright notice, this
38
+ * list of conditions and the following disclaimer.
39
+ * * Redistributions in binary form must reproduce the above copyright notice,
40
+ * this list of conditions and the following disclaimer in the documentation and/or
41
+ * other materials provided with the distribution.
42
+ * 2. Neither the name of Dash Industry Forum nor the names of its
43
+ * contributors may be used to endorse or promote products derived from this software
44
+ * without specific prior written permission.
45
+ *
46
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
47
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
48
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
50
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
51
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
52
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
55
+ * POSSIBILITY OF SUCH DAMAGE.
56
+ */
57
+ /**
22
58
  * CaptionsLogger. To be removed in the future.
23
59
  *
24
60
  * @public
@@ -35,7 +71,6 @@ var CaptionsLogger = class {
35
71
  }
36
72
  }
37
73
  };
38
-
39
74
  //#endregion
40
75
  //#region src/PenState.ts
41
76
  /**
@@ -81,10 +116,46 @@ var PenState = class {
81
116
  this.flash = newPenState.flash;
82
117
  }
83
118
  };
84
-
85
119
  //#endregion
86
120
  //#region src/StyledUnicodeChar.ts
87
121
  /**
122
+ *
123
+ * This code was ported from the dash.js project at:
124
+ * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
125
+ * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
126
+ *
127
+ * The original copyright appears below:
128
+ *
129
+ * The copyright in this software is being made available under the BSD License,
130
+ * included below. This software may be subject to other third party and contributor
131
+ * rights, including patent rights, and no such rights are granted under this license.
132
+ *
133
+ * Copyright (c) 2015-2016, DASH Industry Forum.
134
+ * All rights reserved.
135
+ *
136
+ * Redistribution and use in source and binary forms, with or without modification,
137
+ * are permitted provided that the following conditions are met:
138
+ * 1. Redistributions of source code must retain the above copyright notice, this
139
+ * list of conditions and the following disclaimer.
140
+ * * Redistributions in binary form must reproduce the above copyright notice,
141
+ * this list of conditions and the following disclaimer in the documentation and/or
142
+ * other materials provided with the distribution.
143
+ * 2. Neither the name of Dash Industry Forum nor the names of its
144
+ * contributors may be used to endorse or promote products derived from this software
145
+ * without specific prior written permission.
146
+ *
147
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
148
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
149
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
150
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
151
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
152
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
153
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
154
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
155
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
156
+ * POSSIBILITY OF SUCH DAMAGE.
157
+ */
158
+ /**
88
159
  * Unicode character with styling and background.
89
160
  *
90
161
  * @public
@@ -116,11 +187,6 @@ var StyledUnicodeChar = class {
116
187
  return this.uchar === " " && this.penState.isDefault();
117
188
  }
118
189
  };
119
-
120
- //#endregion
121
- //#region src/utils/NR_COLS.ts
122
- const NR_COLS = 100;
123
-
124
190
  //#endregion
125
191
  //#region src/utils/specialCea608CharsCodes.ts
126
192
  /**
@@ -218,16 +284,51 @@ const specialCea608CharsCodes = {
218
284
  206: 9495,
219
285
  207: 9499
220
286
  };
221
-
222
287
  //#endregion
223
288
  //#region src/utils/getCharForByte.ts
224
289
  function getCharForByte(byte) {
225
290
  return String.fromCharCode(specialCea608CharsCodes[byte] || byte);
226
291
  }
227
-
228
292
  //#endregion
229
293
  //#region src/Row.ts
230
294
  /**
295
+ *
296
+ * This code was ported from the dash.js project at:
297
+ * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
298
+ * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
299
+ *
300
+ * The original copyright appears below:
301
+ *
302
+ * The copyright in this software is being made available under the BSD License,
303
+ * included below. This software may be subject to other third party and contributor
304
+ * rights, including patent rights, and no such rights are granted under this license.
305
+ *
306
+ * Copyright (c) 2015-2016, DASH Industry Forum.
307
+ * All rights reserved.
308
+ *
309
+ * Redistribution and use in source and binary forms, with or without modification,
310
+ * are permitted provided that the following conditions are met:
311
+ * 1. Redistributions of source code must retain the above copyright notice, this
312
+ * list of conditions and the following disclaimer.
313
+ * * Redistributions in binary form must reproduce the above copyright notice,
314
+ * this list of conditions and the following disclaimer in the documentation and/or
315
+ * other materials provided with the distribution.
316
+ * 2. Neither the name of Dash Industry Forum nor the names of its
317
+ * contributors may be used to endorse or promote products derived from this software
318
+ * without specific prior written permission.
319
+ *
320
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
321
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
322
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
323
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
324
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
325
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
326
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
327
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
328
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
329
+ * POSSIBILITY OF SUCH DAMAGE.
330
+ */
331
+ /**
231
332
  * CTA-608 row consisting of NR_COLS instances of StyledUnicodeChar.
232
333
  *
233
334
  * @public
@@ -238,19 +339,19 @@ var Row = class {
238
339
  this.cueStartTime = null;
239
340
  this.pos = 0;
240
341
  this.currPenState = new PenState();
241
- for (let i = 0; i < NR_COLS; i++) this.chars.push(new StyledUnicodeChar());
342
+ for (let i = 0; i < 100; i++) this.chars.push(new StyledUnicodeChar());
242
343
  this.logger = logger;
243
344
  }
244
345
  equals(other) {
245
- for (let i = 0; i < NR_COLS; i++) if (!this.chars[i].equals(other.chars[i])) return false;
346
+ for (let i = 0; i < 100; i++) if (!this.chars[i].equals(other.chars[i])) return false;
246
347
  return true;
247
348
  }
248
349
  copy(other) {
249
- for (let i = 0; i < NR_COLS; i++) this.chars[i].copy(other.chars[i]);
350
+ for (let i = 0; i < 100; i++) this.chars[i].copy(other.chars[i]);
250
351
  }
251
352
  isEmpty() {
252
353
  let empty = true;
253
- for (let i = 0; i < NR_COLS; i++) if (!this.chars[i].isEmpty()) {
354
+ for (let i = 0; i < 100; i++) if (!this.chars[i].isEmpty()) {
254
355
  empty = false;
255
356
  break;
256
357
  }
@@ -264,9 +365,9 @@ var Row = class {
264
365
  if (this.pos < 0) {
265
366
  this.logger.log(VerboseLevel.DEBUG, "Negative cursor position " + this.pos);
266
367
  this.pos = 0;
267
- } else if (this.pos > NR_COLS) {
368
+ } else if (this.pos > 100) {
268
369
  this.logger.log(VerboseLevel.DEBUG, "Too large cursor position " + this.pos);
269
- this.pos = NR_COLS;
370
+ this.pos = 100;
270
371
  }
271
372
  }
272
373
  /**
@@ -287,7 +388,7 @@ var Row = class {
287
388
  insertChar(byte) {
288
389
  if (byte >= 144) this.backSpace();
289
390
  const char = getCharForByte(byte);
290
- if (this.pos >= NR_COLS) {
391
+ if (this.pos >= 100) {
291
392
  this.logger.log(VerboseLevel.ERROR, () => "Cannot insert " + byte.toString(16) + " (" + char + ") at position " + this.pos + ". Skipping it!");
292
393
  return;
293
394
  }
@@ -296,7 +397,7 @@ var Row = class {
296
397
  }
297
398
  clearFromPos(startPos) {
298
399
  let i;
299
- for (i = startPos; i < NR_COLS; i++) this.chars[i].reset();
400
+ for (i = startPos; i < 100; i++) this.chars[i].reset();
300
401
  }
301
402
  clear() {
302
403
  this.clearFromPos(0);
@@ -309,7 +410,7 @@ var Row = class {
309
410
  getTextString() {
310
411
  const chars = [];
311
412
  let empty = true;
312
- for (let i = 0; i < NR_COLS; i++) {
413
+ for (let i = 0; i < 100; i++) {
313
414
  const char = this.chars[i].uchar;
314
415
  if (char !== " ") empty = false;
315
416
  chars.push(char);
@@ -322,14 +423,46 @@ var Row = class {
322
423
  this.chars[this.pos].setPenState(this.currPenState);
323
424
  }
324
425
  };
325
-
326
- //#endregion
327
- //#region src/utils/NR_ROWS.ts
328
- const NR_ROWS = 15;
329
-
330
426
  //#endregion
331
427
  //#region src/CaptionScreen.ts
332
428
  /**
429
+ *
430
+ * This code was ported from the dash.js project at:
431
+ * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
432
+ * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
433
+ *
434
+ * The original copyright appears below:
435
+ *
436
+ * The copyright in this software is being made available under the BSD License,
437
+ * included below. This software may be subject to other third party and contributor
438
+ * rights, including patent rights, and no such rights are granted under this license.
439
+ *
440
+ * Copyright (c) 2015-2016, DASH Industry Forum.
441
+ * All rights reserved.
442
+ *
443
+ * Redistribution and use in source and binary forms, with or without modification,
444
+ * are permitted provided that the following conditions are met:
445
+ * 1. Redistributions of source code must retain the above copyright notice, this
446
+ * list of conditions and the following disclaimer.
447
+ * * Redistributions in binary form must reproduce the above copyright notice,
448
+ * this list of conditions and the following disclaimer in the documentation and/or
449
+ * other materials provided with the distribution.
450
+ * 2. Neither the name of Dash Industry Forum nor the names of its
451
+ * contributors may be used to endorse or promote products derived from this software
452
+ * without specific prior written permission.
453
+ *
454
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
455
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
456
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
457
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
458
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
459
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
460
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
461
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
462
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
463
+ * POSSIBILITY OF SUCH DAMAGE.
464
+ */
465
+ /**
333
466
  * Keep a CTA-608 screen of 32x15 styled characters
334
467
  *
335
468
  * @public
@@ -337,30 +470,30 @@ const NR_ROWS = 15;
337
470
  var CaptionScreen = class {
338
471
  constructor(logger = new CaptionsLogger()) {
339
472
  this.rows = [];
340
- this.currRow = NR_ROWS - 1;
473
+ this.currRow = 14;
341
474
  this.nrRollUpRows = null;
342
475
  this.lastOutputScreen = null;
343
- for (let i = 0; i < NR_ROWS; i++) this.rows.push(new Row(logger));
476
+ for (let i = 0; i < 15; i++) this.rows.push(new Row(logger));
344
477
  this.logger = logger;
345
478
  }
346
479
  reset() {
347
- for (let i = 0; i < NR_ROWS; i++) this.rows[i].clear();
348
- this.currRow = NR_ROWS - 1;
480
+ for (let i = 0; i < 15; i++) this.rows[i].clear();
481
+ this.currRow = 14;
349
482
  }
350
483
  equals(other) {
351
484
  let equal = true;
352
- for (let i = 0; i < NR_ROWS; i++) if (!this.rows[i].equals(other.rows[i])) {
485
+ for (let i = 0; i < 15; i++) if (!this.rows[i].equals(other.rows[i])) {
353
486
  equal = false;
354
487
  break;
355
488
  }
356
489
  return equal;
357
490
  }
358
491
  copy(other) {
359
- for (let i = 0; i < NR_ROWS; i++) this.rows[i].copy(other.rows[i]);
492
+ for (let i = 0; i < 15; i++) this.rows[i].copy(other.rows[i]);
360
493
  }
361
494
  isEmpty() {
362
495
  let empty = true;
363
- for (let i = 0; i < NR_ROWS; i++) if (!this.rows[i].isEmpty()) {
496
+ for (let i = 0; i < 15; i++) if (!this.rows[i].isEmpty()) {
364
497
  empty = false;
365
498
  break;
366
499
  }
@@ -393,7 +526,7 @@ var CaptionScreen = class {
393
526
  let newRow = pacData.row - 1;
394
527
  if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) newRow = this.nrRollUpRows - 1;
395
528
  if (this.nrRollUpRows && this.currRow !== newRow) {
396
- for (let i = 0; i < NR_ROWS; i++) this.rows[i].clear();
529
+ for (let i = 0; i < 15; i++) this.rows[i].clear();
397
530
  const topRowIndex = this.currRow + 1 - this.nrRollUpRows;
398
531
  const lastOutputScreen = this.lastOutputScreen;
399
532
  if (lastOutputScreen) {
@@ -451,7 +584,7 @@ var CaptionScreen = class {
451
584
  const displayText = [];
452
585
  let text = "";
453
586
  let rowNr = -1;
454
- for (let i = 0; i < NR_ROWS; i++) {
587
+ for (let i = 0; i < 15; i++) {
455
588
  const rowText = this.rows[i].getTextString();
456
589
  if (rowText) {
457
590
  rowNr = i + 1;
@@ -459,15 +592,16 @@ var CaptionScreen = class {
459
592
  else displayText.push(rowText.trim());
460
593
  }
461
594
  }
462
- if (displayText.length > 0) if (asOneRow) text = "[" + displayText.join(" | ") + "]";
463
- else text = displayText.join("\n");
595
+ if (displayText.length > 0) {
596
+ if (asOneRow) text = "[" + displayText.join(" | ") + "]";
597
+ else text = displayText.join("\n");
598
+ }
464
599
  return text;
465
600
  }
466
601
  getTextAndFormat() {
467
602
  return this.rows;
468
603
  }
469
604
  };
470
-
471
605
  //#endregion
472
606
  //#region src/Cta608Channel.ts
473
607
  /**
@@ -483,7 +617,7 @@ var Cta608Channel = class {
483
617
  this.displayedMemory = new CaptionScreen(logger);
484
618
  this.nonDisplayedMemory = new CaptionScreen(logger);
485
619
  this.lastOutputScreen = new CaptionScreen(logger);
486
- this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];
620
+ this.currRollUpRow = this.displayedMemory.rows[14];
487
621
  this.writeScreen = this.displayedMemory;
488
622
  this.mode = null;
489
623
  this.cueStartTime = null;
@@ -496,7 +630,7 @@ var Cta608Channel = class {
496
630
  this.nonDisplayedMemory.reset();
497
631
  this.lastOutputScreen.reset();
498
632
  this.outputFilter?.reset?.();
499
- this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];
633
+ this.currRollUpRow = this.displayedMemory.rows[14];
500
634
  this.writeScreen = this.displayedMemory;
501
635
  this.mode = null;
502
636
  this.cueStartTime = null;
@@ -645,7 +779,6 @@ var Cta608Channel = class {
645
779
  }
646
780
  }
647
781
  };
648
-
649
782
  //#endregion
650
783
  //#region src/utils/backgroundColors.ts
651
784
  const backgroundColors = [
@@ -659,7 +792,6 @@ const backgroundColors = [
659
792
  "black",
660
793
  "transparent"
661
794
  ];
662
-
663
795
  //#endregion
664
796
  //#region src/utils/createCmdHistory.ts
665
797
  function createCmdHistory() {
@@ -668,13 +800,11 @@ function createCmdHistory() {
668
800
  b: null
669
801
  };
670
802
  }
671
-
672
803
  //#endregion
673
804
  //#region src/utils/hasCmdRepeated.ts
674
805
  function hasCmdRepeated(a, b, cmdHistory) {
675
806
  return cmdHistory.a === a && cmdHistory.b === b;
676
807
  }
677
-
678
808
  //#endregion
679
809
  //#region src/utils/numArrayToHexArray.ts
680
810
  function numArrayToHexArray(numArray) {
@@ -682,7 +812,6 @@ function numArrayToHexArray(numArray) {
682
812
  for (const num of numArray) hexArray.push(num.toString(16));
683
813
  return hexArray;
684
814
  }
685
-
686
815
  //#endregion
687
816
  //#region src/utils/rowsHighCh1.ts
688
817
  const rowsHighCh1 = {
@@ -694,7 +823,6 @@ const rowsHighCh1 = {
694
823
  19: 13,
695
824
  20: 15
696
825
  };
697
-
698
826
  //#endregion
699
827
  //#region src/utils/rowsHighCh2.ts
700
828
  const rowsHighCh2 = {
@@ -706,7 +834,6 @@ const rowsHighCh2 = {
706
834
  27: 13,
707
835
  28: 15
708
836
  };
709
-
710
837
  //#endregion
711
838
  //#region src/utils/rowsLowCh1.ts
712
839
  const rowsLowCh1 = {
@@ -719,7 +846,6 @@ const rowsLowCh1 = {
719
846
  19: 12,
720
847
  20: 14
721
848
  };
722
-
723
849
  //#endregion
724
850
  //#region src/utils/rowsLowCh2.ts
725
851
  const rowsLowCh2 = {
@@ -732,17 +858,52 @@ const rowsLowCh2 = {
732
858
  27: 12,
733
859
  28: 14
734
860
  };
735
-
736
861
  //#endregion
737
862
  //#region src/utils/setLastCmd.ts
738
863
  function setLastCmd(a, b, cmdHistory) {
739
864
  cmdHistory.a = a;
740
865
  cmdHistory.b = b;
741
866
  }
742
-
743
867
  //#endregion
744
868
  //#region src/Cta608Parser.ts
745
869
  /**
870
+ *
871
+ * This code was ported from the dash.js project at:
872
+ * https://github.com/Dash-Industry-Forum/dash.js/blob/development/externals/cea608-parser.js
873
+ * https://github.com/Dash-Industry-Forum/dash.js/commit/8269b26a761e0853bb21d78780ed945144ecdd4d#diff-71bc295a2d6b6b7093a1d3290d53a4b2
874
+ *
875
+ * The original copyright appears below:
876
+ *
877
+ * The copyright in this software is being made available under the BSD License,
878
+ * included below. This software may be subject to other third party and contributor
879
+ * rights, including patent rights, and no such rights are granted under this license.
880
+ *
881
+ * Copyright (c) 2015-2016, DASH Industry Forum.
882
+ * All rights reserved.
883
+ *
884
+ * Redistribution and use in source and binary forms, with or without modification,
885
+ * are permitted provided that the following conditions are met:
886
+ * 1. Redistributions of source code must retain the above copyright notice, this
887
+ * list of conditions and the following disclaimer.
888
+ * * Redistributions in binary form must reproduce the above copyright notice,
889
+ * this list of conditions and the following disclaimer in the documentation and/or
890
+ * other materials provided with the distribution.
891
+ * 2. Neither the name of Dash Industry Forum nor the names of its
892
+ * contributors may be used to endorse or promote products derived from this software
893
+ * without specific prior written permission.
894
+ *
895
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY
896
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
897
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
898
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
899
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
900
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
901
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
902
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
903
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
904
+ * POSSIBILITY OF SUCH DAMAGE.
905
+ */
906
+ /**
746
907
  * CEA-608 caption parser.
747
908
  *
748
909
  * @public
@@ -983,7 +1144,6 @@ var Cta608Parser = class {
983
1144
  for (const channel of this.channels) if (channel) channel.cueSplitAtTime(t);
984
1145
  }
985
1146
  };
986
-
987
1147
  //#endregion
988
1148
  //#region src/utils/parseCcData.ts
989
1149
  function isCCType(type) {
@@ -1024,7 +1184,6 @@ function parseCcData(raw, pos, endPos, fieldData) {
1024
1184
  if (isNonEmptyCCData(ccData1, ccData2)) fieldData[ccType].push(ccData1, ccData2);
1025
1185
  }
1026
1186
  }
1027
-
1028
1187
  //#endregion
1029
1188
  //#region src/extractCta608Data.ts
1030
1189
  /**
@@ -1041,7 +1200,6 @@ function extractCta608Data(raw, cta608Range) {
1041
1200
  parseCcData(raw, cta608Range[0] + 8, cta608Range[0] + cta608Range[1], fieldData);
1042
1201
  return fieldData;
1043
1202
  }
1044
-
1045
1203
  //#endregion
1046
1204
  //#region src/utils/isCta608UserData.ts
1047
1205
  /**
@@ -1061,7 +1219,6 @@ function extractCta608Data(raw, cta608Range) {
1061
1219
  function isCta608UserData(raw, pos) {
1062
1220
  return raw.getUint8(pos) === 181 && raw.getUint16(pos + 1) === 49 && raw.getUint32(pos + 3) === 1195456820 && raw.getUint8(pos + 7) === 3;
1063
1221
  }
1064
-
1065
1222
  //#endregion
1066
1223
  //#region src/utils/obuHelpers.ts
1067
1224
  /**
@@ -1156,7 +1313,6 @@ function parseCta608DataFromMetadataObu(raw, pos, endPos, fieldData) {
1156
1313
  if (userDataStart + 10 > endPos || !isCta608UserData(raw, userDataStart)) return;
1157
1314
  parseCcData(raw, userDataStart + 8, endPos, fieldData);
1158
1315
  }
1159
-
1160
1316
  //#endregion
1161
1317
  //#region src/extractCta608DataFromAv1Sample.ts
1162
1318
  /**
@@ -1197,7 +1353,6 @@ function extractCta608DataFromAv1Sample(raw, startPos, sampleSize) {
1197
1353
  }
1198
1354
  return fieldData;
1199
1355
  }
1200
-
1201
1356
  //#endregion
1202
1357
  //#region src/utils/seiHelpers.ts
1203
1358
  function getSeiData(raw, startPos, endPos) {
@@ -1282,7 +1437,6 @@ function parseCta608DataFromSei(sei, fieldData) {
1282
1437
  cursor += payloadSize;
1283
1438
  }
1284
1439
  }
1285
-
1286
1440
  //#endregion
1287
1441
  //#region src/extractCta608DataFromSample.ts
1288
1442
  /**
@@ -1311,7 +1465,6 @@ function extractCta608DataFromSample(raw, startPos, sampleSize) {
1311
1465
  }
1312
1466
  return fieldData;
1313
1467
  }
1314
-
1315
1468
  //#endregion
1316
1469
  //#region src/findCta608Nalus.ts
1317
1470
  /**
@@ -1327,12 +1480,12 @@ function extractCta608DataFromSample(raw, startPos, sampleSize) {
1327
1480
  function findCta608Nalus(raw, startPos, size) {
1328
1481
  let nalSize = 0, cursor = startPos;
1329
1482
  const cta608NaluRanges = [];
1330
- const isCTA608SEI = (payloadType, payloadSize, raw$1, pos) => {
1483
+ const isCTA608SEI = (payloadType, payloadSize, raw, pos) => {
1331
1484
  if (payloadType !== 4 || payloadSize < 8) return null;
1332
- const countryCode = raw$1.getUint8(pos);
1333
- const providerCode = raw$1.getUint16(pos + 1);
1334
- const userIdentifier = raw$1.getUint32(pos + 3);
1335
- const userDataTypeCode = raw$1.getUint8(pos + 7);
1485
+ const countryCode = raw.getUint8(pos);
1486
+ const providerCode = raw.getUint16(pos + 1);
1487
+ const userIdentifier = raw.getUint32(pos + 3);
1488
+ const userDataTypeCode = raw.getUint8(pos + 7);
1336
1489
  return countryCode == 181 && providerCode == 49 && userIdentifier == 1195456820 && userDataTypeCode == 3;
1337
1490
  };
1338
1491
  while (cursor < startPos + size) {
@@ -1364,7 +1517,6 @@ function findCta608Nalus(raw, startPos, size) {
1364
1517
  }
1365
1518
  return cta608NaluRanges;
1366
1519
  }
1367
-
1368
1520
  //#endregion
1369
1521
  //#region src/SccParser.ts
1370
1522
  /**
@@ -1458,7 +1610,7 @@ var SccParser = class {
1458
1610
  return this.nrLinesParsed;
1459
1611
  }
1460
1612
  };
1461
-
1462
1613
  //#endregion
1463
1614
  export { CaptionScreen, CaptionsLogger, Cta608Channel, Cta608Parser, PenState, Row, SccParser, StyledUnicodeChar, VerboseLevel, extractCta608Data, extractCta608DataFromAv1Sample, extractCta608DataFromSample, findCta608Nalus };
1615
+
1464
1616
  //# sourceMappingURL=index.js.map