@remotion/media-parser 4.0.332 → 4.0.333
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/containers/iso-base-media/base-media-box.d.ts +2 -1
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.d.ts +1 -1
- package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +3 -0
- package/dist/containers/iso-base-media/mdat/calculate-jump-marks.js +19 -26
- package/dist/containers/iso-base-media/process-box.js +21 -14
- package/dist/containers/iso-base-media/stsd/samples.js +2 -0
- package/dist/containers/iso-base-media/stsd/vpcc.d.ts +19 -0
- package/dist/containers/iso-base-media/stsd/vpcc.js +42 -0
- package/dist/containers/mp3/parse-packet-header.js +1 -4
- package/dist/containers/wav/parse-wav.js +1 -1
- package/dist/esm/index.mjs +108 -47
- package/dist/esm/worker-server-entry.mjs +107 -46
- package/dist/esm/worker-web-entry.mjs +107 -46
- package/dist/get-sample-aspect-ratio.d.ts +2 -0
- package/dist/get-sample-aspect-ratio.js +13 -1
- package/dist/get-video-codec.js +6 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -3966,6 +3966,17 @@ var getAvccBox = (trakBox) => {
|
|
|
3966
3966
|
}
|
|
3967
3967
|
return avccBox;
|
|
3968
3968
|
};
|
|
3969
|
+
var getVpccBox = (trakBox) => {
|
|
3970
|
+
const videoConfig = getStsdVideoConfig(trakBox);
|
|
3971
|
+
if (!videoConfig) {
|
|
3972
|
+
return null;
|
|
3973
|
+
}
|
|
3974
|
+
const vpccBox = videoConfig.descriptors.find((c) => c.type === "vpcc-box");
|
|
3975
|
+
if (!vpccBox || vpccBox.type !== "vpcc-box") {
|
|
3976
|
+
return null;
|
|
3977
|
+
}
|
|
3978
|
+
return vpccBox;
|
|
3979
|
+
};
|
|
3969
3980
|
var getAv1CBox = (trakBox) => {
|
|
3970
3981
|
const videoConfig = getStsdVideoConfig(trakBox);
|
|
3971
3982
|
if (!videoConfig) {
|
|
@@ -4123,21 +4134,25 @@ var getIsoBmColrConfig = (trakBox) => {
|
|
|
4123
4134
|
var getVideoCodecString = (trakBox) => {
|
|
4124
4135
|
const videoSample = getStsdVideoConfig(trakBox);
|
|
4125
4136
|
const avccBox = getAvccBox(trakBox);
|
|
4126
|
-
const hvccBox = getHvccBox(trakBox);
|
|
4127
|
-
const av1cBox = getAv1CBox(trakBox);
|
|
4128
4137
|
if (!videoSample) {
|
|
4129
4138
|
return null;
|
|
4130
4139
|
}
|
|
4131
4140
|
if (avccBox) {
|
|
4132
4141
|
return `${videoSample.format}.${avccBox.configurationString}`;
|
|
4133
4142
|
}
|
|
4143
|
+
const hvccBox = getHvccBox(trakBox);
|
|
4134
4144
|
if (hvccBox) {
|
|
4135
4145
|
return `${videoSample.format}.${hvccBox.configurationString}`;
|
|
4136
4146
|
}
|
|
4147
|
+
const av1cBox = getAv1CBox(trakBox);
|
|
4137
4148
|
if (av1cBox) {
|
|
4138
4149
|
const colrAtom = getColrBox(videoSample);
|
|
4139
4150
|
return parseAv1PrivateData(av1cBox.privateData, colrAtom);
|
|
4140
4151
|
}
|
|
4152
|
+
const vpccBox = getVpccBox(trakBox);
|
|
4153
|
+
if (vpccBox) {
|
|
4154
|
+
return `${videoSample.format}.${vpccBox.codecString}`;
|
|
4155
|
+
}
|
|
4141
4156
|
return videoSample.format;
|
|
4142
4157
|
};
|
|
4143
4158
|
|
|
@@ -4193,6 +4208,9 @@ var getVideoCodecFromIsoTrak = (trakBox) => {
|
|
|
4193
4208
|
if (videoSample.format === "av01") {
|
|
4194
4209
|
return "av1";
|
|
4195
4210
|
}
|
|
4211
|
+
if (videoSample.format === "vp09") {
|
|
4212
|
+
return "vp9";
|
|
4213
|
+
}
|
|
4196
4214
|
if (videoSample.format === "ap4h") {
|
|
4197
4215
|
return "prores";
|
|
4198
4216
|
}
|
|
@@ -5170,6 +5188,53 @@ var parseStts = ({
|
|
|
5170
5188
|
};
|
|
5171
5189
|
};
|
|
5172
5190
|
|
|
5191
|
+
// src/containers/iso-base-media/stsd/vpcc.ts
|
|
5192
|
+
var getvp09ConfigurationString = ({
|
|
5193
|
+
profile,
|
|
5194
|
+
level,
|
|
5195
|
+
bitDepth: bitDepth2
|
|
5196
|
+
}) => {
|
|
5197
|
+
return `${String(profile).padStart(2, "0")}.${String(level).padStart(2, "0")}.${String(bitDepth2).padStart(2, "0")}`;
|
|
5198
|
+
};
|
|
5199
|
+
var parseVpcc = ({
|
|
5200
|
+
data,
|
|
5201
|
+
size
|
|
5202
|
+
}) => {
|
|
5203
|
+
const box = data.startBox(size - 8);
|
|
5204
|
+
const confVersion = data.getUint8();
|
|
5205
|
+
if (confVersion !== 1) {
|
|
5206
|
+
throw new Error(`Unsupported AVCC version ${confVersion}`);
|
|
5207
|
+
}
|
|
5208
|
+
data.discard(3);
|
|
5209
|
+
const profile = data.getUint8();
|
|
5210
|
+
const level = data.getUint8();
|
|
5211
|
+
data.startReadingBits();
|
|
5212
|
+
const bitDepth2 = data.getBits(4);
|
|
5213
|
+
const chromaSubsampling = data.getBits(3);
|
|
5214
|
+
const videoFullRangeFlag = data.getBits(1);
|
|
5215
|
+
const videoColorPrimaries = data.getBits(8);
|
|
5216
|
+
const videoTransferCharacteristics = data.getBits(8);
|
|
5217
|
+
const videoMatrixCoefficients = data.getBits(8);
|
|
5218
|
+
data.stopReadingBits();
|
|
5219
|
+
const codecInitializationDataSize = data.getUint16();
|
|
5220
|
+
const codecInitializationData = data.getSlice(codecInitializationDataSize);
|
|
5221
|
+
box.expectNoMoreBytes();
|
|
5222
|
+
return {
|
|
5223
|
+
type: "vpcc-box",
|
|
5224
|
+
profile,
|
|
5225
|
+
level,
|
|
5226
|
+
bitDepth: bitDepth2,
|
|
5227
|
+
chromaSubsampling,
|
|
5228
|
+
videoFullRangeFlag,
|
|
5229
|
+
videoColorPrimaries,
|
|
5230
|
+
videoTransferCharacteristics,
|
|
5231
|
+
videoMatrixCoefficients,
|
|
5232
|
+
codecInitializationDataSize,
|
|
5233
|
+
codecInitializationData,
|
|
5234
|
+
codecString: getvp09ConfigurationString({ profile, level, bitDepth: bitDepth2 })
|
|
5235
|
+
};
|
|
5236
|
+
};
|
|
5237
|
+
|
|
5173
5238
|
// src/containers/iso-base-media/tfdt.ts
|
|
5174
5239
|
var parseTfdt = ({
|
|
5175
5240
|
iterator,
|
|
@@ -5497,7 +5562,7 @@ var processBox = async ({
|
|
|
5497
5562
|
if (boxType === "stsz") {
|
|
5498
5563
|
return {
|
|
5499
5564
|
type: "box",
|
|
5500
|
-
box:
|
|
5565
|
+
box: parseStsz({
|
|
5501
5566
|
iterator,
|
|
5502
5567
|
offset: fileOffset,
|
|
5503
5568
|
size: boxSize
|
|
@@ -5507,7 +5572,7 @@ var processBox = async ({
|
|
|
5507
5572
|
if (boxType === "stco" || boxType === "co64") {
|
|
5508
5573
|
return {
|
|
5509
5574
|
type: "box",
|
|
5510
|
-
box:
|
|
5575
|
+
box: parseStco({
|
|
5511
5576
|
iterator,
|
|
5512
5577
|
offset: fileOffset,
|
|
5513
5578
|
size: boxSize,
|
|
@@ -5518,7 +5583,7 @@ var processBox = async ({
|
|
|
5518
5583
|
if (boxType === "pasp") {
|
|
5519
5584
|
return {
|
|
5520
5585
|
type: "box",
|
|
5521
|
-
box:
|
|
5586
|
+
box: parsePasp({
|
|
5522
5587
|
iterator,
|
|
5523
5588
|
offset: fileOffset,
|
|
5524
5589
|
size: boxSize
|
|
@@ -5528,7 +5593,7 @@ var processBox = async ({
|
|
|
5528
5593
|
if (boxType === "stss") {
|
|
5529
5594
|
return {
|
|
5530
5595
|
type: "box",
|
|
5531
|
-
box:
|
|
5596
|
+
box: parseStss({
|
|
5532
5597
|
iterator,
|
|
5533
5598
|
offset: fileOffset,
|
|
5534
5599
|
boxSize
|
|
@@ -5538,7 +5603,7 @@ var processBox = async ({
|
|
|
5538
5603
|
if (boxType === "ctts") {
|
|
5539
5604
|
return {
|
|
5540
5605
|
type: "box",
|
|
5541
|
-
box:
|
|
5606
|
+
box: parseCtts({
|
|
5542
5607
|
iterator,
|
|
5543
5608
|
offset: fileOffset,
|
|
5544
5609
|
size: boxSize
|
|
@@ -5548,7 +5613,7 @@ var processBox = async ({
|
|
|
5548
5613
|
if (boxType === "stsc") {
|
|
5549
5614
|
return {
|
|
5550
5615
|
type: "box",
|
|
5551
|
-
box:
|
|
5616
|
+
box: parseStsc({
|
|
5552
5617
|
iterator,
|
|
5553
5618
|
offset: fileOffset,
|
|
5554
5619
|
size: boxSize
|
|
@@ -5667,7 +5732,7 @@ var processBox = async ({
|
|
|
5667
5732
|
if (boxType === "stts") {
|
|
5668
5733
|
return {
|
|
5669
5734
|
type: "box",
|
|
5670
|
-
box:
|
|
5735
|
+
box: parseStts({
|
|
5671
5736
|
data: iterator,
|
|
5672
5737
|
size: boxSize,
|
|
5673
5738
|
fileOffset
|
|
@@ -5677,16 +5742,22 @@ var processBox = async ({
|
|
|
5677
5742
|
if (boxType === "avcC") {
|
|
5678
5743
|
return {
|
|
5679
5744
|
type: "box",
|
|
5680
|
-
box:
|
|
5745
|
+
box: parseAvcc({
|
|
5681
5746
|
data: iterator,
|
|
5682
5747
|
size: boxSize
|
|
5683
5748
|
})
|
|
5684
5749
|
};
|
|
5685
5750
|
}
|
|
5751
|
+
if (boxType === "vpcC") {
|
|
5752
|
+
return {
|
|
5753
|
+
type: "box",
|
|
5754
|
+
box: parseVpcc({ data: iterator, size: boxSize })
|
|
5755
|
+
};
|
|
5756
|
+
}
|
|
5686
5757
|
if (boxType === "av1C") {
|
|
5687
5758
|
return {
|
|
5688
5759
|
type: "box",
|
|
5689
|
-
box:
|
|
5760
|
+
box: parseAv1C({
|
|
5690
5761
|
data: iterator,
|
|
5691
5762
|
size: boxSize
|
|
5692
5763
|
})
|
|
@@ -5695,7 +5766,7 @@ var processBox = async ({
|
|
|
5695
5766
|
if (boxType === "hvcC") {
|
|
5696
5767
|
return {
|
|
5697
5768
|
type: "box",
|
|
5698
|
-
box:
|
|
5769
|
+
box: parseHvcc({
|
|
5699
5770
|
data: iterator,
|
|
5700
5771
|
size: boxSize,
|
|
5701
5772
|
offset: fileOffset
|
|
@@ -5705,7 +5776,7 @@ var processBox = async ({
|
|
|
5705
5776
|
if (boxType === "tfhd") {
|
|
5706
5777
|
return {
|
|
5707
5778
|
type: "box",
|
|
5708
|
-
box:
|
|
5779
|
+
box: getTfhd({
|
|
5709
5780
|
iterator,
|
|
5710
5781
|
offset: fileOffset,
|
|
5711
5782
|
size: boxSize
|
|
@@ -5715,7 +5786,7 @@ var processBox = async ({
|
|
|
5715
5786
|
if (boxType === "mdhd") {
|
|
5716
5787
|
return {
|
|
5717
5788
|
type: "box",
|
|
5718
|
-
box:
|
|
5789
|
+
box: parseMdhd({
|
|
5719
5790
|
data: iterator,
|
|
5720
5791
|
size: boxSize,
|
|
5721
5792
|
fileOffset
|
|
@@ -5725,7 +5796,7 @@ var processBox = async ({
|
|
|
5725
5796
|
if (boxType === "esds") {
|
|
5726
5797
|
return {
|
|
5727
5798
|
type: "box",
|
|
5728
|
-
box:
|
|
5799
|
+
box: parseEsds({
|
|
5729
5800
|
data: iterator,
|
|
5730
5801
|
size: boxSize,
|
|
5731
5802
|
fileOffset
|
|
@@ -5735,7 +5806,7 @@ var processBox = async ({
|
|
|
5735
5806
|
if (boxType === "trex") {
|
|
5736
5807
|
return {
|
|
5737
5808
|
type: "box",
|
|
5738
|
-
box:
|
|
5809
|
+
box: parseTrex({ iterator, offset: fileOffset, size: boxSize })
|
|
5739
5810
|
};
|
|
5740
5811
|
}
|
|
5741
5812
|
if (boxType === "moof") {
|
|
@@ -5834,7 +5905,9 @@ var videoTags = [
|
|
|
5834
5905
|
"hvc1",
|
|
5835
5906
|
"hev1",
|
|
5836
5907
|
"ap4h",
|
|
5837
|
-
"av01"
|
|
5908
|
+
"av01",
|
|
5909
|
+
"vp08",
|
|
5910
|
+
"vp09"
|
|
5838
5911
|
];
|
|
5839
5912
|
var audioTags = [
|
|
5840
5913
|
0,
|
|
@@ -11686,6 +11759,13 @@ var findBestJump = ({
|
|
|
11686
11759
|
const minProgress = Math.min(...Object.values(progresses));
|
|
11687
11760
|
const trackNumberWithLowestProgress = Object.entries(progresses).find(([, progress]) => progress === minProgress)?.[0];
|
|
11688
11761
|
const firstSampleAboveMinProgress = offsetsSorted.findIndex((offset) => sampleMap.get(offset).track.trackId === Number(trackNumberWithLowestProgress) && !visited.has(getKey(sampleMap.get(offset))));
|
|
11762
|
+
if (firstSampleAboveMinProgress === -1) {
|
|
11763
|
+
const backup = offsetsSorted.findIndex((offset) => !visited.has(getKey(sampleMap.get(offset))));
|
|
11764
|
+
if (backup === -1) {
|
|
11765
|
+
throw new Error("this should not happen");
|
|
11766
|
+
}
|
|
11767
|
+
return backup;
|
|
11768
|
+
}
|
|
11689
11769
|
return firstSampleAboveMinProgress;
|
|
11690
11770
|
};
|
|
11691
11771
|
var calculateJumpMarks = ({
|
|
@@ -11701,12 +11781,10 @@ var calculateJumpMarks = ({
|
|
|
11701
11781
|
const jumpMarks = [];
|
|
11702
11782
|
let indexToVisit = 0;
|
|
11703
11783
|
const visited = new Set;
|
|
11704
|
-
let rollOverToProcess = false;
|
|
11705
11784
|
const increaseIndex = () => {
|
|
11706
11785
|
indexToVisit++;
|
|
11707
11786
|
if (indexToVisit >= offsetsSorted.length) {
|
|
11708
|
-
|
|
11709
|
-
indexToVisit = 0;
|
|
11787
|
+
throw new Error("should not roll over, should jump");
|
|
11710
11788
|
}
|
|
11711
11789
|
};
|
|
11712
11790
|
let lastVisitedSample = null;
|
|
@@ -11720,6 +11798,10 @@ var calculateJumpMarks = ({
|
|
|
11720
11798
|
afterSampleWithOffset: lastVisitedSample.samplePosition.offset,
|
|
11721
11799
|
jumpToOffset: offsetsSorted[firstSampleAboveMinProgress]
|
|
11722
11800
|
};
|
|
11801
|
+
if (firstSampleAboveMinProgress === offsetsSorted.indexOf(lastVisitedSample.samplePosition.offset) + 1) {
|
|
11802
|
+
indexToVisit = firstSampleAboveMinProgress;
|
|
11803
|
+
return;
|
|
11804
|
+
}
|
|
11723
11805
|
indexToVisit = firstSampleAboveMinProgress;
|
|
11724
11806
|
jumpMarks.push(jumpMark);
|
|
11725
11807
|
};
|
|
@@ -11739,17 +11821,7 @@ var calculateJumpMarks = ({
|
|
|
11739
11821
|
visited,
|
|
11740
11822
|
progresses
|
|
11741
11823
|
});
|
|
11742
|
-
|
|
11743
|
-
addJumpMark({ firstSampleAboveMinProgress });
|
|
11744
|
-
indexToVisit = firstSampleAboveMinProgress;
|
|
11745
|
-
} else {
|
|
11746
|
-
while (true) {
|
|
11747
|
-
increaseIndex();
|
|
11748
|
-
if (!visited.has(getKey(sampleMap.get(offsetsSorted[indexToVisit])))) {
|
|
11749
|
-
break;
|
|
11750
|
-
}
|
|
11751
|
-
}
|
|
11752
|
-
}
|
|
11824
|
+
addJumpMark({ firstSampleAboveMinProgress });
|
|
11753
11825
|
};
|
|
11754
11826
|
while (true) {
|
|
11755
11827
|
const currentSamplePosition = sampleMap.get(offsetsSorted[indexToVisit]);
|
|
@@ -11759,16 +11831,6 @@ var calculateJumpMarks = ({
|
|
|
11759
11831
|
continue;
|
|
11760
11832
|
}
|
|
11761
11833
|
visited.add(sampleKey);
|
|
11762
|
-
if (rollOverToProcess) {
|
|
11763
|
-
if (!lastVisitedSample) {
|
|
11764
|
-
throw new Error("no last visited sample");
|
|
11765
|
-
}
|
|
11766
|
-
jumpMarks.push({
|
|
11767
|
-
afterSampleWithOffset: lastVisitedSample.samplePosition.offset,
|
|
11768
|
-
jumpToOffset: currentSamplePosition.samplePosition.offset
|
|
11769
|
-
});
|
|
11770
|
-
rollOverToProcess = false;
|
|
11771
|
-
}
|
|
11772
11834
|
lastVisitedSample = currentSamplePosition;
|
|
11773
11835
|
if (visited.size === offsetsSorted.length) {
|
|
11774
11836
|
addFinalJumpIfNecessary();
|
|
@@ -11786,6 +11848,8 @@ var calculateJumpMarks = ({
|
|
|
11786
11848
|
}
|
|
11787
11849
|
if (spread > MAX_SPREAD_IN_SECONDS) {
|
|
11788
11850
|
considerJump();
|
|
11851
|
+
} else if (indexToVisit === offsetsSorted.length - 1) {
|
|
11852
|
+
considerJump();
|
|
11789
11853
|
} else {
|
|
11790
11854
|
increaseIndex();
|
|
11791
11855
|
}
|
|
@@ -13416,10 +13480,7 @@ var innerParseMp3PacketHeader = (iterator) => {
|
|
|
13416
13480
|
throw new Error("Expected Layer I, II or III");
|
|
13417
13481
|
}
|
|
13418
13482
|
const layer = layerBits === 3 ? 1 : layerBits === 2 ? 2 : 3;
|
|
13419
|
-
|
|
13420
|
-
if (protectionBit !== 1) {
|
|
13421
|
-
throw new Error("Does not support CRC yet");
|
|
13422
|
-
}
|
|
13483
|
+
iterator.getBits(1);
|
|
13423
13484
|
const bitrateIndex = iterator.getBits(4);
|
|
13424
13485
|
const bitrateInKbit = getBitrateKB({
|
|
13425
13486
|
bits: bitrateIndex,
|
|
@@ -15523,7 +15584,7 @@ var parseWav = (state) => {
|
|
|
15523
15584
|
if (type === "id3") {
|
|
15524
15585
|
return parseId32({ state });
|
|
15525
15586
|
}
|
|
15526
|
-
if (type === "junk" || type === "fllr") {
|
|
15587
|
+
if (type === "junk" || type === "fllr" || type === "bext") {
|
|
15527
15588
|
return parseJunk({ state });
|
|
15528
15589
|
}
|
|
15529
15590
|
if (type === "fact") {
|
|
@@ -18176,7 +18237,7 @@ var downloadAndParseMedia = async (options) => {
|
|
|
18176
18237
|
return returnValue;
|
|
18177
18238
|
};
|
|
18178
18239
|
// src/version.ts
|
|
18179
|
-
var VERSION = "4.0.
|
|
18240
|
+
var VERSION = "4.0.333";
|
|
18180
18241
|
|
|
18181
18242
|
// src/index.ts
|
|
18182
18243
|
var MediaParserInternals = {
|
|
@@ -1331,6 +1331,17 @@ var getAvccBox = (trakBox) => {
|
|
|
1331
1331
|
}
|
|
1332
1332
|
return avccBox;
|
|
1333
1333
|
};
|
|
1334
|
+
var getVpccBox = (trakBox) => {
|
|
1335
|
+
const videoConfig = getStsdVideoConfig(trakBox);
|
|
1336
|
+
if (!videoConfig) {
|
|
1337
|
+
return null;
|
|
1338
|
+
}
|
|
1339
|
+
const vpccBox = videoConfig.descriptors.find((c) => c.type === "vpcc-box");
|
|
1340
|
+
if (!vpccBox || vpccBox.type !== "vpcc-box") {
|
|
1341
|
+
return null;
|
|
1342
|
+
}
|
|
1343
|
+
return vpccBox;
|
|
1344
|
+
};
|
|
1334
1345
|
var getAv1CBox = (trakBox) => {
|
|
1335
1346
|
const videoConfig = getStsdVideoConfig(trakBox);
|
|
1336
1347
|
if (!videoConfig) {
|
|
@@ -3156,21 +3167,25 @@ var getIsoBmColrConfig = (trakBox) => {
|
|
|
3156
3167
|
var getVideoCodecString = (trakBox) => {
|
|
3157
3168
|
const videoSample = getStsdVideoConfig(trakBox);
|
|
3158
3169
|
const avccBox = getAvccBox(trakBox);
|
|
3159
|
-
const hvccBox = getHvccBox(trakBox);
|
|
3160
|
-
const av1cBox = getAv1CBox(trakBox);
|
|
3161
3170
|
if (!videoSample) {
|
|
3162
3171
|
return null;
|
|
3163
3172
|
}
|
|
3164
3173
|
if (avccBox) {
|
|
3165
3174
|
return `${videoSample.format}.${avccBox.configurationString}`;
|
|
3166
3175
|
}
|
|
3176
|
+
const hvccBox = getHvccBox(trakBox);
|
|
3167
3177
|
if (hvccBox) {
|
|
3168
3178
|
return `${videoSample.format}.${hvccBox.configurationString}`;
|
|
3169
3179
|
}
|
|
3180
|
+
const av1cBox = getAv1CBox(trakBox);
|
|
3170
3181
|
if (av1cBox) {
|
|
3171
3182
|
const colrAtom = getColrBox(videoSample);
|
|
3172
3183
|
return parseAv1PrivateData(av1cBox.privateData, colrAtom);
|
|
3173
3184
|
}
|
|
3185
|
+
const vpccBox = getVpccBox(trakBox);
|
|
3186
|
+
if (vpccBox) {
|
|
3187
|
+
return `${videoSample.format}.${vpccBox.codecString}`;
|
|
3188
|
+
}
|
|
3174
3189
|
return videoSample.format;
|
|
3175
3190
|
};
|
|
3176
3191
|
|
|
@@ -3390,6 +3405,9 @@ var getVideoCodecFromIsoTrak = (trakBox) => {
|
|
|
3390
3405
|
if (videoSample.format === "av01") {
|
|
3391
3406
|
return "av1";
|
|
3392
3407
|
}
|
|
3408
|
+
if (videoSample.format === "vp09") {
|
|
3409
|
+
return "vp9";
|
|
3410
|
+
}
|
|
3393
3411
|
if (videoSample.format === "ap4h") {
|
|
3394
3412
|
return "prores";
|
|
3395
3413
|
}
|
|
@@ -10654,7 +10672,9 @@ var videoTags = [
|
|
|
10654
10672
|
"hvc1",
|
|
10655
10673
|
"hev1",
|
|
10656
10674
|
"ap4h",
|
|
10657
|
-
"av01"
|
|
10675
|
+
"av01",
|
|
10676
|
+
"vp08",
|
|
10677
|
+
"vp09"
|
|
10658
10678
|
];
|
|
10659
10679
|
var audioTags = [
|
|
10660
10680
|
0,
|
|
@@ -11053,6 +11073,53 @@ var parseStts = ({
|
|
|
11053
11073
|
};
|
|
11054
11074
|
};
|
|
11055
11075
|
|
|
11076
|
+
// src/containers/iso-base-media/stsd/vpcc.ts
|
|
11077
|
+
var getvp09ConfigurationString = ({
|
|
11078
|
+
profile,
|
|
11079
|
+
level,
|
|
11080
|
+
bitDepth: bitDepth2
|
|
11081
|
+
}) => {
|
|
11082
|
+
return `${String(profile).padStart(2, "0")}.${String(level).padStart(2, "0")}.${String(bitDepth2).padStart(2, "0")}`;
|
|
11083
|
+
};
|
|
11084
|
+
var parseVpcc = ({
|
|
11085
|
+
data,
|
|
11086
|
+
size
|
|
11087
|
+
}) => {
|
|
11088
|
+
const box = data.startBox(size - 8);
|
|
11089
|
+
const confVersion = data.getUint8();
|
|
11090
|
+
if (confVersion !== 1) {
|
|
11091
|
+
throw new Error(`Unsupported AVCC version ${confVersion}`);
|
|
11092
|
+
}
|
|
11093
|
+
data.discard(3);
|
|
11094
|
+
const profile = data.getUint8();
|
|
11095
|
+
const level = data.getUint8();
|
|
11096
|
+
data.startReadingBits();
|
|
11097
|
+
const bitDepth2 = data.getBits(4);
|
|
11098
|
+
const chromaSubsampling = data.getBits(3);
|
|
11099
|
+
const videoFullRangeFlag = data.getBits(1);
|
|
11100
|
+
const videoColorPrimaries = data.getBits(8);
|
|
11101
|
+
const videoTransferCharacteristics = data.getBits(8);
|
|
11102
|
+
const videoMatrixCoefficients = data.getBits(8);
|
|
11103
|
+
data.stopReadingBits();
|
|
11104
|
+
const codecInitializationDataSize = data.getUint16();
|
|
11105
|
+
const codecInitializationData = data.getSlice(codecInitializationDataSize);
|
|
11106
|
+
box.expectNoMoreBytes();
|
|
11107
|
+
return {
|
|
11108
|
+
type: "vpcc-box",
|
|
11109
|
+
profile,
|
|
11110
|
+
level,
|
|
11111
|
+
bitDepth: bitDepth2,
|
|
11112
|
+
chromaSubsampling,
|
|
11113
|
+
videoFullRangeFlag,
|
|
11114
|
+
videoColorPrimaries,
|
|
11115
|
+
videoTransferCharacteristics,
|
|
11116
|
+
videoMatrixCoefficients,
|
|
11117
|
+
codecInitializationDataSize,
|
|
11118
|
+
codecInitializationData,
|
|
11119
|
+
codecString: getvp09ConfigurationString({ profile, level, bitDepth: bitDepth2 })
|
|
11120
|
+
};
|
|
11121
|
+
};
|
|
11122
|
+
|
|
11056
11123
|
// src/containers/iso-base-media/tfdt.ts
|
|
11057
11124
|
var parseTfdt = ({
|
|
11058
11125
|
iterator,
|
|
@@ -11380,7 +11447,7 @@ var processBox = async ({
|
|
|
11380
11447
|
if (boxType === "stsz") {
|
|
11381
11448
|
return {
|
|
11382
11449
|
type: "box",
|
|
11383
|
-
box:
|
|
11450
|
+
box: parseStsz({
|
|
11384
11451
|
iterator,
|
|
11385
11452
|
offset: fileOffset,
|
|
11386
11453
|
size: boxSize
|
|
@@ -11390,7 +11457,7 @@ var processBox = async ({
|
|
|
11390
11457
|
if (boxType === "stco" || boxType === "co64") {
|
|
11391
11458
|
return {
|
|
11392
11459
|
type: "box",
|
|
11393
|
-
box:
|
|
11460
|
+
box: parseStco({
|
|
11394
11461
|
iterator,
|
|
11395
11462
|
offset: fileOffset,
|
|
11396
11463
|
size: boxSize,
|
|
@@ -11401,7 +11468,7 @@ var processBox = async ({
|
|
|
11401
11468
|
if (boxType === "pasp") {
|
|
11402
11469
|
return {
|
|
11403
11470
|
type: "box",
|
|
11404
|
-
box:
|
|
11471
|
+
box: parsePasp({
|
|
11405
11472
|
iterator,
|
|
11406
11473
|
offset: fileOffset,
|
|
11407
11474
|
size: boxSize
|
|
@@ -11411,7 +11478,7 @@ var processBox = async ({
|
|
|
11411
11478
|
if (boxType === "stss") {
|
|
11412
11479
|
return {
|
|
11413
11480
|
type: "box",
|
|
11414
|
-
box:
|
|
11481
|
+
box: parseStss({
|
|
11415
11482
|
iterator,
|
|
11416
11483
|
offset: fileOffset,
|
|
11417
11484
|
boxSize
|
|
@@ -11421,7 +11488,7 @@ var processBox = async ({
|
|
|
11421
11488
|
if (boxType === "ctts") {
|
|
11422
11489
|
return {
|
|
11423
11490
|
type: "box",
|
|
11424
|
-
box:
|
|
11491
|
+
box: parseCtts({
|
|
11425
11492
|
iterator,
|
|
11426
11493
|
offset: fileOffset,
|
|
11427
11494
|
size: boxSize
|
|
@@ -11431,7 +11498,7 @@ var processBox = async ({
|
|
|
11431
11498
|
if (boxType === "stsc") {
|
|
11432
11499
|
return {
|
|
11433
11500
|
type: "box",
|
|
11434
|
-
box:
|
|
11501
|
+
box: parseStsc({
|
|
11435
11502
|
iterator,
|
|
11436
11503
|
offset: fileOffset,
|
|
11437
11504
|
size: boxSize
|
|
@@ -11550,7 +11617,7 @@ var processBox = async ({
|
|
|
11550
11617
|
if (boxType === "stts") {
|
|
11551
11618
|
return {
|
|
11552
11619
|
type: "box",
|
|
11553
|
-
box:
|
|
11620
|
+
box: parseStts({
|
|
11554
11621
|
data: iterator,
|
|
11555
11622
|
size: boxSize,
|
|
11556
11623
|
fileOffset
|
|
@@ -11560,16 +11627,22 @@ var processBox = async ({
|
|
|
11560
11627
|
if (boxType === "avcC") {
|
|
11561
11628
|
return {
|
|
11562
11629
|
type: "box",
|
|
11563
|
-
box:
|
|
11630
|
+
box: parseAvcc({
|
|
11564
11631
|
data: iterator,
|
|
11565
11632
|
size: boxSize
|
|
11566
11633
|
})
|
|
11567
11634
|
};
|
|
11568
11635
|
}
|
|
11636
|
+
if (boxType === "vpcC") {
|
|
11637
|
+
return {
|
|
11638
|
+
type: "box",
|
|
11639
|
+
box: parseVpcc({ data: iterator, size: boxSize })
|
|
11640
|
+
};
|
|
11641
|
+
}
|
|
11569
11642
|
if (boxType === "av1C") {
|
|
11570
11643
|
return {
|
|
11571
11644
|
type: "box",
|
|
11572
|
-
box:
|
|
11645
|
+
box: parseAv1C({
|
|
11573
11646
|
data: iterator,
|
|
11574
11647
|
size: boxSize
|
|
11575
11648
|
})
|
|
@@ -11578,7 +11651,7 @@ var processBox = async ({
|
|
|
11578
11651
|
if (boxType === "hvcC") {
|
|
11579
11652
|
return {
|
|
11580
11653
|
type: "box",
|
|
11581
|
-
box:
|
|
11654
|
+
box: parseHvcc({
|
|
11582
11655
|
data: iterator,
|
|
11583
11656
|
size: boxSize,
|
|
11584
11657
|
offset: fileOffset
|
|
@@ -11588,7 +11661,7 @@ var processBox = async ({
|
|
|
11588
11661
|
if (boxType === "tfhd") {
|
|
11589
11662
|
return {
|
|
11590
11663
|
type: "box",
|
|
11591
|
-
box:
|
|
11664
|
+
box: getTfhd({
|
|
11592
11665
|
iterator,
|
|
11593
11666
|
offset: fileOffset,
|
|
11594
11667
|
size: boxSize
|
|
@@ -11598,7 +11671,7 @@ var processBox = async ({
|
|
|
11598
11671
|
if (boxType === "mdhd") {
|
|
11599
11672
|
return {
|
|
11600
11673
|
type: "box",
|
|
11601
|
-
box:
|
|
11674
|
+
box: parseMdhd({
|
|
11602
11675
|
data: iterator,
|
|
11603
11676
|
size: boxSize,
|
|
11604
11677
|
fileOffset
|
|
@@ -11608,7 +11681,7 @@ var processBox = async ({
|
|
|
11608
11681
|
if (boxType === "esds") {
|
|
11609
11682
|
return {
|
|
11610
11683
|
type: "box",
|
|
11611
|
-
box:
|
|
11684
|
+
box: parseEsds({
|
|
11612
11685
|
data: iterator,
|
|
11613
11686
|
size: boxSize,
|
|
11614
11687
|
fileOffset
|
|
@@ -11618,7 +11691,7 @@ var processBox = async ({
|
|
|
11618
11691
|
if (boxType === "trex") {
|
|
11619
11692
|
return {
|
|
11620
11693
|
type: "box",
|
|
11621
|
-
box:
|
|
11694
|
+
box: parseTrex({ iterator, offset: fileOffset, size: boxSize })
|
|
11622
11695
|
};
|
|
11623
11696
|
}
|
|
11624
11697
|
if (boxType === "moof") {
|
|
@@ -11771,6 +11844,13 @@ var findBestJump = ({
|
|
|
11771
11844
|
const minProgress = Math.min(...Object.values(progresses));
|
|
11772
11845
|
const trackNumberWithLowestProgress = Object.entries(progresses).find(([, progress]) => progress === minProgress)?.[0];
|
|
11773
11846
|
const firstSampleAboveMinProgress = offsetsSorted.findIndex((offset) => sampleMap.get(offset).track.trackId === Number(trackNumberWithLowestProgress) && !visited.has(getKey(sampleMap.get(offset))));
|
|
11847
|
+
if (firstSampleAboveMinProgress === -1) {
|
|
11848
|
+
const backup = offsetsSorted.findIndex((offset) => !visited.has(getKey(sampleMap.get(offset))));
|
|
11849
|
+
if (backup === -1) {
|
|
11850
|
+
throw new Error("this should not happen");
|
|
11851
|
+
}
|
|
11852
|
+
return backup;
|
|
11853
|
+
}
|
|
11774
11854
|
return firstSampleAboveMinProgress;
|
|
11775
11855
|
};
|
|
11776
11856
|
var calculateJumpMarks = ({
|
|
@@ -11786,12 +11866,10 @@ var calculateJumpMarks = ({
|
|
|
11786
11866
|
const jumpMarks = [];
|
|
11787
11867
|
let indexToVisit = 0;
|
|
11788
11868
|
const visited = new Set;
|
|
11789
|
-
let rollOverToProcess = false;
|
|
11790
11869
|
const increaseIndex = () => {
|
|
11791
11870
|
indexToVisit++;
|
|
11792
11871
|
if (indexToVisit >= offsetsSorted.length) {
|
|
11793
|
-
|
|
11794
|
-
indexToVisit = 0;
|
|
11872
|
+
throw new Error("should not roll over, should jump");
|
|
11795
11873
|
}
|
|
11796
11874
|
};
|
|
11797
11875
|
let lastVisitedSample = null;
|
|
@@ -11805,6 +11883,10 @@ var calculateJumpMarks = ({
|
|
|
11805
11883
|
afterSampleWithOffset: lastVisitedSample.samplePosition.offset,
|
|
11806
11884
|
jumpToOffset: offsetsSorted[firstSampleAboveMinProgress]
|
|
11807
11885
|
};
|
|
11886
|
+
if (firstSampleAboveMinProgress === offsetsSorted.indexOf(lastVisitedSample.samplePosition.offset) + 1) {
|
|
11887
|
+
indexToVisit = firstSampleAboveMinProgress;
|
|
11888
|
+
return;
|
|
11889
|
+
}
|
|
11808
11890
|
indexToVisit = firstSampleAboveMinProgress;
|
|
11809
11891
|
jumpMarks.push(jumpMark);
|
|
11810
11892
|
};
|
|
@@ -11824,17 +11906,7 @@ var calculateJumpMarks = ({
|
|
|
11824
11906
|
visited,
|
|
11825
11907
|
progresses
|
|
11826
11908
|
});
|
|
11827
|
-
|
|
11828
|
-
addJumpMark({ firstSampleAboveMinProgress });
|
|
11829
|
-
indexToVisit = firstSampleAboveMinProgress;
|
|
11830
|
-
} else {
|
|
11831
|
-
while (true) {
|
|
11832
|
-
increaseIndex();
|
|
11833
|
-
if (!visited.has(getKey(sampleMap.get(offsetsSorted[indexToVisit])))) {
|
|
11834
|
-
break;
|
|
11835
|
-
}
|
|
11836
|
-
}
|
|
11837
|
-
}
|
|
11909
|
+
addJumpMark({ firstSampleAboveMinProgress });
|
|
11838
11910
|
};
|
|
11839
11911
|
while (true) {
|
|
11840
11912
|
const currentSamplePosition = sampleMap.get(offsetsSorted[indexToVisit]);
|
|
@@ -11844,16 +11916,6 @@ var calculateJumpMarks = ({
|
|
|
11844
11916
|
continue;
|
|
11845
11917
|
}
|
|
11846
11918
|
visited.add(sampleKey);
|
|
11847
|
-
if (rollOverToProcess) {
|
|
11848
|
-
if (!lastVisitedSample) {
|
|
11849
|
-
throw new Error("no last visited sample");
|
|
11850
|
-
}
|
|
11851
|
-
jumpMarks.push({
|
|
11852
|
-
afterSampleWithOffset: lastVisitedSample.samplePosition.offset,
|
|
11853
|
-
jumpToOffset: currentSamplePosition.samplePosition.offset
|
|
11854
|
-
});
|
|
11855
|
-
rollOverToProcess = false;
|
|
11856
|
-
}
|
|
11857
11919
|
lastVisitedSample = currentSamplePosition;
|
|
11858
11920
|
if (visited.size === offsetsSorted.length) {
|
|
11859
11921
|
addFinalJumpIfNecessary();
|
|
@@ -11871,6 +11933,8 @@ var calculateJumpMarks = ({
|
|
|
11871
11933
|
}
|
|
11872
11934
|
if (spread > MAX_SPREAD_IN_SECONDS) {
|
|
11873
11935
|
considerJump();
|
|
11936
|
+
} else if (indexToVisit === offsetsSorted.length - 1) {
|
|
11937
|
+
considerJump();
|
|
11874
11938
|
} else {
|
|
11875
11939
|
increaseIndex();
|
|
11876
11940
|
}
|
|
@@ -13147,10 +13211,7 @@ var innerParseMp3PacketHeader = (iterator) => {
|
|
|
13147
13211
|
throw new Error("Expected Layer I, II or III");
|
|
13148
13212
|
}
|
|
13149
13213
|
const layer = layerBits === 3 ? 1 : layerBits === 2 ? 2 : 3;
|
|
13150
|
-
|
|
13151
|
-
if (protectionBit !== 1) {
|
|
13152
|
-
throw new Error("Does not support CRC yet");
|
|
13153
|
-
}
|
|
13214
|
+
iterator.getBits(1);
|
|
13154
13215
|
const bitrateIndex = iterator.getBits(4);
|
|
13155
13216
|
const bitrateInKbit = getBitrateKB({
|
|
13156
13217
|
bits: bitrateIndex,
|
|
@@ -15254,7 +15315,7 @@ var parseWav = (state) => {
|
|
|
15254
15315
|
if (type === "id3") {
|
|
15255
15316
|
return parseId32({ state });
|
|
15256
15317
|
}
|
|
15257
|
-
if (type === "junk" || type === "fllr") {
|
|
15318
|
+
if (type === "junk" || type === "fllr" || type === "bext") {
|
|
15258
15319
|
return parseJunk({ state });
|
|
15259
15320
|
}
|
|
15260
15321
|
if (type === "fact") {
|