ebml.js 4.0.1 → 4.1.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/dist/ebml.js +347 -301
- package/dist/ebml.js.map +1 -1
- package/dist/ebml.min.js +4 -4
- package/dist/ebml.min.js.map +1 -1
- package/dist/ebml.min.node.js +1 -1
- package/dist/ebml.min.node.js.map +1 -1
- package/dist/ebml.node.js +347 -301
- package/dist/ebml.node.js.map +1 -1
- package/package.json +1 -1
- package/src/decoder.js +347 -301
package/dist/ebml.js
CHANGED
|
@@ -6417,307 +6417,353 @@ module.exports = { debugLog }
|
|
|
6417
6417
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
6418
6418
|
|
|
6419
6419
|
/* provided dependency */ var Buffer = __webpack_require__(287)["Buffer"];
|
|
6420
|
-
const { Transform } = __webpack_require__(310);
|
|
6421
|
-
const tools = __webpack_require__(327);
|
|
6422
|
-
const schema = __webpack_require__(261);
|
|
6423
|
-
const { debugLog } = __webpack_require__(224);
|
|
6424
|
-
|
|
6425
|
-
const debug = debugLog('ebml:decoder');
|
|
6426
|
-
|
|
6427
|
-
const STATE_TAG = 1;
|
|
6428
|
-
const STATE_SIZE = 2;
|
|
6429
|
-
const STATE_CONTENT = 3;
|
|
6430
|
-
|
|
6431
|
-
class EbmlDecoder extends Transform {
|
|
6432
|
-
/**
|
|
6433
|
-
* @property
|
|
6434
|
-
* @private
|
|
6435
|
-
* @type {Buffer}
|
|
6436
|
-
*/
|
|
6437
|
-
mBuffer = null;
|
|
6438
|
-
|
|
6439
|
-
/**
|
|
6440
|
-
* @private
|
|
6441
|
-
* @property
|
|
6442
|
-
* @readonly
|
|
6443
|
-
*/
|
|
6444
|
-
mTagStack = [];
|
|
6445
|
-
|
|
6446
|
-
/**
|
|
6447
|
-
* @property
|
|
6448
|
-
* @private
|
|
6449
|
-
* @type {Number}
|
|
6450
|
-
*/
|
|
6451
|
-
mState = STATE_TAG;
|
|
6452
|
-
|
|
6453
|
-
/**
|
|
6454
|
-
* @property
|
|
6455
|
-
* @private
|
|
6456
|
-
* @type {Number}
|
|
6457
|
-
*/
|
|
6458
|
-
mCursor = 0;
|
|
6459
|
-
|
|
6460
|
-
/**
|
|
6461
|
-
* @property
|
|
6462
|
-
* @private
|
|
6463
|
-
* @type {Number}
|
|
6464
|
-
*/
|
|
6465
|
-
mTotal = 0;
|
|
6466
|
-
|
|
6467
|
-
/**
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
}
|
|
6478
|
-
|
|
6479
|
-
get
|
|
6480
|
-
return this.
|
|
6481
|
-
}
|
|
6482
|
-
|
|
6483
|
-
get
|
|
6484
|
-
return this.
|
|
6485
|
-
}
|
|
6486
|
-
|
|
6487
|
-
get
|
|
6488
|
-
return this.
|
|
6489
|
-
}
|
|
6490
|
-
|
|
6491
|
-
get
|
|
6492
|
-
return this.
|
|
6493
|
-
}
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
this.
|
|
6497
|
-
}
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
set
|
|
6511
|
-
this.
|
|
6512
|
-
}
|
|
6513
|
-
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
}
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
}
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
return false
|
|
6579
|
-
}
|
|
6580
|
-
|
|
6581
|
-
const
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
this.
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
if
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6627
|
-
|
|
6628
|
-
|
|
6629
|
-
|
|
6630
|
-
|
|
6631
|
-
|
|
6632
|
-
|
|
6633
|
-
|
|
6634
|
-
|
|
6635
|
-
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
|
|
6641
|
-
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
}
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6420
|
+
const { Transform } = __webpack_require__(310);
|
|
6421
|
+
const tools = __webpack_require__(327);
|
|
6422
|
+
const schema = __webpack_require__(261);
|
|
6423
|
+
const { debugLog } = __webpack_require__(224);
|
|
6424
|
+
|
|
6425
|
+
const debug = debugLog('ebml:decoder');
|
|
6426
|
+
|
|
6427
|
+
const STATE_TAG = 1;
|
|
6428
|
+
const STATE_SIZE = 2;
|
|
6429
|
+
const STATE_CONTENT = 3;
|
|
6430
|
+
|
|
6431
|
+
class EbmlDecoder extends Transform {
|
|
6432
|
+
/**
|
|
6433
|
+
* @property
|
|
6434
|
+
* @private
|
|
6435
|
+
* @type {Buffer}
|
|
6436
|
+
*/
|
|
6437
|
+
mBuffer = null;
|
|
6438
|
+
|
|
6439
|
+
/**
|
|
6440
|
+
* @private
|
|
6441
|
+
* @property
|
|
6442
|
+
* @readonly
|
|
6443
|
+
*/
|
|
6444
|
+
mTagStack = [];
|
|
6445
|
+
|
|
6446
|
+
/**
|
|
6447
|
+
* @property
|
|
6448
|
+
* @private
|
|
6449
|
+
* @type {Number}
|
|
6450
|
+
*/
|
|
6451
|
+
mState = STATE_TAG;
|
|
6452
|
+
|
|
6453
|
+
/**
|
|
6454
|
+
* @property
|
|
6455
|
+
* @private
|
|
6456
|
+
* @type {Number}
|
|
6457
|
+
*/
|
|
6458
|
+
mCursor = 0;
|
|
6459
|
+
|
|
6460
|
+
/**
|
|
6461
|
+
* @property
|
|
6462
|
+
* @private
|
|
6463
|
+
* @type {Number}
|
|
6464
|
+
*/
|
|
6465
|
+
mTotal = 0;
|
|
6466
|
+
|
|
6467
|
+
/** @private */
|
|
6468
|
+
mIsLive = false
|
|
6469
|
+
|
|
6470
|
+
/**
|
|
6471
|
+
* @constructor
|
|
6472
|
+
* @param {{ isLive?: boolean }} options The options to be passed along to the super class
|
|
6473
|
+
*/
|
|
6474
|
+
constructor(options = {}) {
|
|
6475
|
+
super({ ...options, readableObjectMode: true });
|
|
6476
|
+
this.mIsLive = options ? options.isLive : false
|
|
6477
|
+
}
|
|
6478
|
+
|
|
6479
|
+
get isLive() {
|
|
6480
|
+
return this.mIsLive;
|
|
6481
|
+
}
|
|
6482
|
+
|
|
6483
|
+
get buffer() {
|
|
6484
|
+
return this.mBuffer;
|
|
6485
|
+
}
|
|
6486
|
+
|
|
6487
|
+
get cursor() {
|
|
6488
|
+
return this.mCursor;
|
|
6489
|
+
}
|
|
6490
|
+
|
|
6491
|
+
get state() {
|
|
6492
|
+
return this.mState;
|
|
6493
|
+
}
|
|
6494
|
+
|
|
6495
|
+
get tagStack() {
|
|
6496
|
+
return this.mTagStack;
|
|
6497
|
+
}
|
|
6498
|
+
|
|
6499
|
+
get total() {
|
|
6500
|
+
return this.mTotal;
|
|
6501
|
+
}
|
|
6502
|
+
|
|
6503
|
+
set buffer(buffer) {
|
|
6504
|
+
this.mBuffer = buffer;
|
|
6505
|
+
}
|
|
6506
|
+
|
|
6507
|
+
/**
|
|
6508
|
+
* @param {number} cursor
|
|
6509
|
+
*/
|
|
6510
|
+
set cursor(cursor) {
|
|
6511
|
+
this.mCursor = cursor;
|
|
6512
|
+
}
|
|
6513
|
+
|
|
6514
|
+
set state(state) {
|
|
6515
|
+
this.mState = state;
|
|
6516
|
+
}
|
|
6517
|
+
|
|
6518
|
+
set total(total) {
|
|
6519
|
+
this.mTotal = total;
|
|
6520
|
+
}
|
|
6521
|
+
|
|
6522
|
+
_transform(chunk, enc, done) {
|
|
6523
|
+
if (!this.buffer) {
|
|
6524
|
+
this.buffer = Buffer.from(chunk);
|
|
6525
|
+
} else {
|
|
6526
|
+
this.buffer = tools.concatenate(this.buffer, Buffer.from(chunk));
|
|
6527
|
+
}
|
|
6528
|
+
|
|
6529
|
+
while (this.cursor < this.buffer.length) {
|
|
6530
|
+
if (this.state === STATE_TAG && !this.readTag()) {
|
|
6531
|
+
break;
|
|
6532
|
+
}
|
|
6533
|
+
if (this.state === STATE_SIZE && !this.readSize()) {
|
|
6534
|
+
break;
|
|
6535
|
+
}
|
|
6536
|
+
if (this.state === STATE_CONTENT && !this.readContent()) {
|
|
6537
|
+
break;
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
|
|
6541
|
+
done();
|
|
6542
|
+
}
|
|
6543
|
+
|
|
6544
|
+
static getSchemaInfo(tag) {
|
|
6545
|
+
if (Number.isInteger(tag) && schema.has(tag)) {
|
|
6546
|
+
return schema.get(tag);
|
|
6547
|
+
}
|
|
6548
|
+
const tagStr = `0x${tag.toString(16).toUpperCase()}`
|
|
6549
|
+
const unknown = {
|
|
6550
|
+
type: null,
|
|
6551
|
+
name: `unknown-${tagStr}`,
|
|
6552
|
+
description: `${tagStr}`,
|
|
6553
|
+
level: -1,
|
|
6554
|
+
minver: -1,
|
|
6555
|
+
multiple: false,
|
|
6556
|
+
webm: false,
|
|
6557
|
+
};
|
|
6558
|
+
schema.set(tag, unknown)
|
|
6559
|
+
console.warn('[SCHEMA]', 'unknown tag:', tagStr)
|
|
6560
|
+
return unknown
|
|
6561
|
+
}
|
|
6562
|
+
|
|
6563
|
+
readTag() {
|
|
6564
|
+
/* istanbul ignore if */
|
|
6565
|
+
if (debug.enabled) {
|
|
6566
|
+
debug('parsing tag');
|
|
6567
|
+
}
|
|
6568
|
+
|
|
6569
|
+
if (this.cursor >= this.buffer.length) {
|
|
6570
|
+
/* istanbul ignore if */
|
|
6571
|
+
if (debug.enabled) {
|
|
6572
|
+
debug('waiting for more data');
|
|
6573
|
+
}
|
|
6574
|
+
return false;
|
|
6575
|
+
}
|
|
6576
|
+
|
|
6577
|
+
if (this.isLive && !this.findTagStart()) {
|
|
6578
|
+
return false
|
|
6579
|
+
}
|
|
6580
|
+
|
|
6581
|
+
const start = this.total;
|
|
6582
|
+
const tag = tools.readVint(this.buffer, this.cursor);
|
|
6583
|
+
|
|
6584
|
+
if (tag == null) {
|
|
6585
|
+
/* istanbul ignore if */
|
|
6586
|
+
if (debug.enabled) {
|
|
6587
|
+
debug('waiting for more data');
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
return false;
|
|
6591
|
+
}
|
|
6592
|
+
|
|
6593
|
+
const tagStr = tools.readHexString(
|
|
6594
|
+
this.buffer,
|
|
6595
|
+
this.cursor,
|
|
6596
|
+
this.cursor + tag.length,
|
|
6597
|
+
);
|
|
6598
|
+
const tagNum = Number.parseInt(tagStr, 16);
|
|
6599
|
+
this.cursor += tag.length;
|
|
6600
|
+
this.total += tag.length;
|
|
6601
|
+
this.state = STATE_SIZE;
|
|
6602
|
+
|
|
6603
|
+
const tagObj = {
|
|
6604
|
+
tag: tag.value,
|
|
6605
|
+
tagStr,
|
|
6606
|
+
type: EbmlDecoder.getSchemaInfo(tagNum).type,
|
|
6607
|
+
name: EbmlDecoder.getSchemaInfo(tagNum).name,
|
|
6608
|
+
start,
|
|
6609
|
+
end: start + tag.length,
|
|
6610
|
+
};
|
|
6611
|
+
|
|
6612
|
+
this.tagStack.push(tagObj);
|
|
6613
|
+
/* istanbul ignore if */
|
|
6614
|
+
if (debug.enabled) {
|
|
6615
|
+
debug(`read tag: ${tagStr}`);
|
|
6616
|
+
}
|
|
6617
|
+
|
|
6618
|
+
return true;
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6621
|
+
/** @private */
|
|
6622
|
+
findTagStart() {
|
|
6623
|
+
while (this.cursor < this.buffer.length) {
|
|
6624
|
+
try {
|
|
6625
|
+
const tag = tools.readVint(this.buffer, this.cursor);
|
|
6626
|
+
if (tag == null) {
|
|
6627
|
+
return false
|
|
6628
|
+
}
|
|
6629
|
+
const tagStr = tools.readHexString(
|
|
6630
|
+
this.buffer,
|
|
6631
|
+
this.cursor,
|
|
6632
|
+
this.cursor + tag.length,
|
|
6633
|
+
);
|
|
6634
|
+
const tagNum = Number.parseInt(tagStr, 16);
|
|
6635
|
+
const tagName = EbmlDecoder.getSchemaInfo(tagNum).name
|
|
6636
|
+
if (tagName && tagName.startsWith('unknown')) {
|
|
6637
|
+
this.cursor += 1
|
|
6638
|
+
continue
|
|
6639
|
+
}
|
|
6640
|
+
if (this.cursor > 0 && !this.total) {
|
|
6641
|
+
this.buffer = this.buffer.subarray(this.cursor)
|
|
6642
|
+
this.cursor = 0
|
|
6643
|
+
}
|
|
6644
|
+
return true
|
|
6645
|
+
} catch (e) {
|
|
6646
|
+
if (!e.message.startsWith('Unrepresentable length')) {
|
|
6647
|
+
throw e
|
|
6648
|
+
}
|
|
6649
|
+
this.cursor += 1
|
|
6650
|
+
}
|
|
6651
|
+
}
|
|
6652
|
+
return false
|
|
6653
|
+
}
|
|
6654
|
+
|
|
6655
|
+
readSize() {
|
|
6656
|
+
const tagObj = this.tagStack[this.tagStack.length - 1];
|
|
6657
|
+
|
|
6658
|
+
/* istanbul ignore if */
|
|
6659
|
+
if (debug.enabled) {
|
|
6660
|
+
debug(`parsing size for tag: ${tagObj.tagStr}`);
|
|
6661
|
+
}
|
|
6662
|
+
|
|
6663
|
+
if (this.cursor >= this.buffer.length) {
|
|
6664
|
+
/* istanbul ignore if */
|
|
6665
|
+
if (debug.enabled) {
|
|
6666
|
+
debug('waiting for more data');
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6669
|
+
return false;
|
|
6670
|
+
}
|
|
6671
|
+
|
|
6672
|
+
const size = tools.readVint(this.buffer, this.cursor);
|
|
6673
|
+
|
|
6674
|
+
if (size == null) {
|
|
6675
|
+
/* istanbul ignore if */
|
|
6676
|
+
if (debug.enabled) {
|
|
6677
|
+
debug('waiting for more data');
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6680
|
+
return false;
|
|
6681
|
+
}
|
|
6682
|
+
|
|
6683
|
+
this.cursor += size.length;
|
|
6684
|
+
this.total += size.length;
|
|
6685
|
+
this.state = STATE_CONTENT;
|
|
6686
|
+
tagObj.dataSize = size.value;
|
|
6687
|
+
|
|
6688
|
+
// unknown size
|
|
6689
|
+
if (size.value === -1) {
|
|
6690
|
+
tagObj.end = -1;
|
|
6691
|
+
} else {
|
|
6692
|
+
tagObj.end += size.value + size.length;
|
|
6693
|
+
}
|
|
6694
|
+
/* istanbul ignore if */
|
|
6695
|
+
if (debug.enabled) {
|
|
6696
|
+
debug(`read size: ${size.value}`);
|
|
6697
|
+
}
|
|
6698
|
+
|
|
6699
|
+
return true;
|
|
6700
|
+
}
|
|
6701
|
+
|
|
6702
|
+
readContent() {
|
|
6703
|
+
const { tagStr, type, dataSize, ...rest } = this.tagStack[this.tagStack.length - 1];
|
|
6704
|
+
|
|
6705
|
+
/* istanbul ignore if */
|
|
6706
|
+
if (debug.enabled) {
|
|
6707
|
+
debug(`parsing content for tag: ${tagStr}`);
|
|
6708
|
+
}
|
|
6709
|
+
|
|
6710
|
+
if (type === 'm') {
|
|
6711
|
+
/* istanbul ignore if */
|
|
6712
|
+
if (debug.enabled) {
|
|
6713
|
+
debug('content should be tags');
|
|
6714
|
+
}
|
|
6715
|
+
this.push(['start', { tagStr, type, dataSize, ...rest }]);
|
|
6716
|
+
this.state = STATE_TAG;
|
|
6717
|
+
|
|
6718
|
+
return true;
|
|
6719
|
+
}
|
|
6720
|
+
|
|
6721
|
+
if (this.buffer.length < this.cursor + dataSize) {
|
|
6722
|
+
/* istanbul ignore if */
|
|
6723
|
+
if (debug.enabled) {
|
|
6724
|
+
debug(`got: ${this.buffer.length}`);
|
|
6725
|
+
debug(`need: ${this.cursor + dataSize}`);
|
|
6726
|
+
debug('waiting for more data');
|
|
6727
|
+
}
|
|
6728
|
+
|
|
6729
|
+
return false;
|
|
6730
|
+
}
|
|
6731
|
+
|
|
6732
|
+
const data = this.buffer.subarray(this.cursor, this.cursor + dataSize);
|
|
6733
|
+
this.total += dataSize;
|
|
6734
|
+
this.state = STATE_TAG;
|
|
6735
|
+
this.buffer = this.buffer.subarray(this.cursor + dataSize);
|
|
6736
|
+
this.cursor = 0;
|
|
6737
|
+
|
|
6738
|
+
this.tagStack.pop(); // remove the object from the stack
|
|
6739
|
+
|
|
6740
|
+
this.push([
|
|
6741
|
+
'tag',
|
|
6742
|
+
tools.readDataFromTag(
|
|
6743
|
+
{ tagStr, type, dataSize, ...rest },
|
|
6744
|
+
Buffer.from(data),
|
|
6745
|
+
),
|
|
6746
|
+
]);
|
|
6747
|
+
|
|
6748
|
+
while (this.tagStack.length > 0) {
|
|
6749
|
+
const topEle = this.tagStack[this.tagStack.length - 1];
|
|
6750
|
+
if (this.total < topEle.end) {
|
|
6751
|
+
break;
|
|
6752
|
+
}
|
|
6753
|
+
this.push(['end', topEle]);
|
|
6754
|
+
this.tagStack.pop();
|
|
6755
|
+
}
|
|
6756
|
+
|
|
6757
|
+
/* istanbul ignore if */
|
|
6758
|
+
if (debug.enabled) {
|
|
6759
|
+
debug(`read data: ${data.toString('hex')}`);
|
|
6760
|
+
}
|
|
6761
|
+
|
|
6762
|
+
return true;
|
|
6763
|
+
}
|
|
6764
|
+
}
|
|
6765
|
+
|
|
6766
|
+
module.exports = EbmlDecoder
|
|
6721
6767
|
|
|
6722
6768
|
|
|
6723
6769
|
/***/ },
|