hls.js 1.5.9-0.canary.10268 → 1.5.9-0.canary.10269

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/dist/hls.js CHANGED
@@ -637,7 +637,7 @@
637
637
  // Some browsers don't allow to use bind on console object anyway
638
638
  // fallback to default if needed
639
639
  try {
640
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10268");
640
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.9-0.canary.10269");
641
641
  } catch (e) {
642
642
  /* log fn threw an exception. All logger methods are no-ops. */
643
643
  return createLogger();
@@ -20724,11 +20724,7 @@
20724
20724
  * Utils
20725
20725
  */
20726
20726
  var getCharForByte = function getCharForByte(_byte) {
20727
- var charCode = _byte;
20728
- if (specialCea608CharsCodes.hasOwnProperty(_byte)) {
20729
- charCode = specialCea608CharsCodes[_byte];
20730
- }
20731
- return String.fromCharCode(charCode);
20727
+ return String.fromCharCode(specialCea608CharsCodes[_byte] || _byte);
20732
20728
  };
20733
20729
  var NR_ROWS = 15;
20734
20730
  var NR_COLS = 100;
@@ -21447,44 +21443,67 @@
21447
21443
  * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.
21448
21444
  */;
21449
21445
  _proto7.addData = function addData(time, byteList) {
21450
- var cmdFound;
21451
- var a;
21452
- var b;
21453
- var charsFound = false;
21446
+ var _this5 = this;
21454
21447
  this.logger.time = time;
21455
- for (var i = 0; i < byteList.length; i += 2) {
21456
- a = byteList[i] & 0x7f;
21457
- b = byteList[i + 1] & 0x7f;
21458
- if (a === 0 && b === 0) {
21459
- continue;
21460
- } else {
21461
- this.logger.log(3, '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')');
21462
- }
21463
- cmdFound = this.parseCmd(a, b);
21464
- if (!cmdFound) {
21465
- cmdFound = this.parseMidrow(a, b);
21466
- }
21467
- if (!cmdFound) {
21468
- cmdFound = this.parsePAC(a, b);
21469
- }
21470
- if (!cmdFound) {
21471
- cmdFound = this.parseBackgroundAttributes(a, b);
21472
- }
21473
- if (!cmdFound) {
21474
- charsFound = this.parseChars(a, b);
21475
- if (charsFound) {
21476
- var currChNr = this.currentChannel;
21477
- if (currChNr && currChNr > 0) {
21478
- var channel = this.channels[currChNr];
21479
- channel.insertChars(charsFound);
21480
- } else {
21481
- this.logger.log(2, 'No channel found yet. TEXT-MODE?');
21448
+ var _loop = function _loop(i) {
21449
+ var a = byteList[i] & 0x7f;
21450
+ var b = byteList[i + 1] & 0x7f;
21451
+ var cmdFound = false;
21452
+ var charsFound = null;
21453
+ if (a === 0 && b === 0) {
21454
+ return 0; // continue
21455
+ } else {
21456
+ _this5.logger.log(3, function () {
21457
+ return '[' + numArrayToHexArray([byteList[i], byteList[i + 1]]) + '] -> (' + numArrayToHexArray([a, b]) + ')';
21458
+ });
21459
+ }
21460
+ var cmdHistory = _this5.cmdHistory;
21461
+ var isControlCode = a >= 0x10 && a <= 0x1f;
21462
+ if (isControlCode) {
21463
+ // Skip redundant control codes
21464
+ if (hasCmdRepeated(a, b, cmdHistory)) {
21465
+ setLastCmd(null, null, cmdHistory);
21466
+ _this5.logger.log(3, function () {
21467
+ return 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped';
21468
+ });
21469
+ return 0; // continue
21470
+ }
21471
+ setLastCmd(a, b, _this5.cmdHistory);
21472
+ cmdFound = _this5.parseCmd(a, b);
21473
+ if (!cmdFound) {
21474
+ cmdFound = _this5.parseMidrow(a, b);
21475
+ }
21476
+ if (!cmdFound) {
21477
+ cmdFound = _this5.parsePAC(a, b);
21478
+ }
21479
+ if (!cmdFound) {
21480
+ cmdFound = _this5.parseBackgroundAttributes(a, b);
21481
+ }
21482
+ } else {
21483
+ setLastCmd(null, null, cmdHistory);
21484
+ }
21485
+ if (!cmdFound) {
21486
+ charsFound = _this5.parseChars(a, b);
21487
+ if (charsFound) {
21488
+ var currChNr = _this5.currentChannel;
21489
+ if (currChNr && currChNr > 0) {
21490
+ var channel = _this5.channels[currChNr];
21491
+ channel.insertChars(charsFound);
21492
+ } else {
21493
+ _this5.logger.log(2, 'No channel found yet. TEXT-MODE?');
21494
+ }
21482
21495
  }
21483
21496
  }
21484
- }
21485
- if (!cmdFound && !charsFound) {
21486
- this.logger.log(2, "Couldn't parse cleaned data " + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]));
21487
- }
21497
+ if (!cmdFound && !charsFound) {
21498
+ _this5.logger.log(2, function () {
21499
+ return "Couldn't parse cleaned data " + numArrayToHexArray([a, b]) + ' orig: ' + numArrayToHexArray([byteList[i], byteList[i + 1]]);
21500
+ });
21501
+ }
21502
+ },
21503
+ _ret;
21504
+ for (var i = 0; i < byteList.length; i += 2) {
21505
+ _ret = _loop(i);
21506
+ if (_ret === 0) continue;
21488
21507
  }
21489
21508
  }
21490
21509
 
@@ -21493,17 +21512,11 @@
21493
21512
  * @returns True if a command was found
21494
21513
  */;
21495
21514
  _proto7.parseCmd = function parseCmd(a, b) {
21496
- var cmdHistory = this.cmdHistory;
21497
21515
  var cond1 = (a === 0x14 || a === 0x1c || a === 0x15 || a === 0x1d) && b >= 0x20 && b <= 0x2f;
21498
21516
  var cond2 = (a === 0x17 || a === 0x1f) && b >= 0x21 && b <= 0x23;
21499
21517
  if (!(cond1 || cond2)) {
21500
21518
  return false;
21501
21519
  }
21502
- if (hasCmdRepeated(a, b, cmdHistory)) {
21503
- setLastCmd(null, null, cmdHistory);
21504
- this.logger.log(3, 'Repeated command (' + numArrayToHexArray([a, b]) + ') is dropped');
21505
- return true;
21506
- }
21507
21520
  var chNr = a === 0x14 || a === 0x15 || a === 0x17 ? 1 : 2;
21508
21521
  var channel = this.channels[chNr];
21509
21522
  if (a === 0x14 || a === 0x15 || a === 0x1c || a === 0x1d) {
@@ -21544,7 +21557,6 @@
21544
21557
  // a == 0x17 || a == 0x1F
21545
21558
  channel.ccTO(b - 0x20);
21546
21559
  }
21547
- setLastCmd(a, b, cmdHistory);
21548
21560
  this.currentChannel = chNr;
21549
21561
  return true;
21550
21562
  }
@@ -21569,7 +21581,9 @@
21569
21581
  return false;
21570
21582
  }
21571
21583
  channel.ccMIDROW(b);
21572
- this.logger.log(3, 'MIDROW (' + numArrayToHexArray([a, b]) + ')');
21584
+ this.logger.log(3, function () {
21585
+ return 'MIDROW (' + numArrayToHexArray([a, b]) + ')';
21586
+ });
21573
21587
  return true;
21574
21588
  }
21575
21589
  return false;
@@ -21581,16 +21595,11 @@
21581
21595
  */;
21582
21596
  _proto7.parsePAC = function parsePAC(a, b) {
21583
21597
  var row;
21584
- var cmdHistory = this.cmdHistory;
21585
21598
  var case1 = (a >= 0x11 && a <= 0x17 || a >= 0x19 && a <= 0x1f) && b >= 0x40 && b <= 0x7f;
21586
21599
  var case2 = (a === 0x10 || a === 0x18) && b >= 0x40 && b <= 0x5f;
21587
21600
  if (!(case1 || case2)) {
21588
21601
  return false;
21589
21602
  }
21590
- if (hasCmdRepeated(a, b, cmdHistory)) {
21591
- setLastCmd(null, null, cmdHistory);
21592
- return true; // Repeated commands are dropped (once)
21593
- }
21594
21603
  var chNr = a <= 0x17 ? 1 : 2;
21595
21604
  if (b >= 0x40 && b <= 0x5f) {
21596
21605
  row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];
@@ -21603,7 +21612,6 @@
21603
21612
  return false;
21604
21613
  }
21605
21614
  channel.setPAC(this.interpretPAC(row, b));
21606
- setLastCmd(a, b, cmdHistory);
21607
21615
  this.currentChannel = chNr;
21608
21616
  return true;
21609
21617
  }
@@ -21663,15 +21671,17 @@
21663
21671
  } else {
21664
21672
  oneCode = b + 0x90;
21665
21673
  }
21666
- this.logger.log(2, "Special char '" + getCharForByte(oneCode) + "' in channel " + channelNr);
21674
+ this.logger.log(2, function () {
21675
+ return "Special char '" + getCharForByte(oneCode) + "' in channel " + channelNr;
21676
+ });
21667
21677
  charCodes = [oneCode];
21668
21678
  } else if (a >= 0x20 && a <= 0x7f) {
21669
21679
  charCodes = b === 0 ? [a] : [a, b];
21670
21680
  }
21671
21681
  if (charCodes) {
21672
- var hexCodes = numArrayToHexArray(charCodes);
21673
- this.logger.log(3, 'Char codes = ' + hexCodes.join(','));
21674
- setLastCmd(a, b, this.cmdHistory);
21682
+ this.logger.log(3, function () {
21683
+ return 'Char codes = ' + numArrayToHexArray(charCodes).join(',');
21684
+ });
21675
21685
  }
21676
21686
  return charCodes;
21677
21687
  }
@@ -21705,7 +21715,6 @@
21705
21715
  var chNr = a <= 0x17 ? 1 : 2;
21706
21716
  var channel = this.channels[chNr];
21707
21717
  channel.setBkgData(bkgData);
21708
- setLastCmd(a, b, this.cmdHistory);
21709
21718
  return true;
21710
21719
  }
21711
21720
 
@@ -21719,7 +21728,7 @@
21719
21728
  channel.reset();
21720
21729
  }
21721
21730
  }
21722
- this.cmdHistory = createCmdHistory();
21731
+ setLastCmd(null, null, this.cmdHistory);
21723
21732
  }
21724
21733
 
21725
21734
  /**
@@ -23208,16 +23217,15 @@
23208
23217
  var cea608Parser1 = this.cea608Parser1,
23209
23218
  cea608Parser2 = this.cea608Parser2,
23210
23219
  lastSn = this.lastSn;
23211
- if (!cea608Parser1 || !cea608Parser2) {
23212
- return;
23213
- }
23214
23220
  var _data$frag = data.frag,
23215
23221
  cc = _data$frag.cc,
23216
23222
  sn = _data$frag.sn;
23217
23223
  var partIndex = (_data$part$index = (_data$part = data.part) == null ? void 0 : _data$part.index) != null ? _data$part$index : -1;
23218
- if (!(sn === lastSn + 1 || sn === lastSn && partIndex === this.lastPartIndex + 1 || cc === this.lastCc)) {
23219
- cea608Parser1.reset();
23220
- cea608Parser2.reset();
23224
+ if (cea608Parser1 && cea608Parser2) {
23225
+ if (sn !== lastSn + 1 || sn === lastSn && partIndex !== this.lastPartIndex + 1 || cc !== this.lastCc) {
23226
+ cea608Parser1.reset();
23227
+ cea608Parser2.reset();
23228
+ }
23221
23229
  }
23222
23230
  this.lastCc = cc;
23223
23231
  this.lastSn = sn;
@@ -30520,7 +30528,7 @@
30520
30528
  * Get the video-dev/hls.js package version.
30521
30529
  */
30522
30530
  function get() {
30523
- return "1.5.9-0.canary.10268";
30531
+ return "1.5.9-0.canary.10269";
30524
30532
  }
30525
30533
  }, {
30526
30534
  key: "Events",