mediabunny 1.50.1 → 1.50.2

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.
@@ -9501,6 +9501,7 @@ var Mediabunny = (() => {
9501
9501
  data: frameData,
9502
9502
  lacing: 0 /* None */,
9503
9503
  decoded: true,
9504
+ postProcessed: false,
9504
9505
  mainAdditional: originalBlock.mainAdditional
9505
9506
  });
9506
9507
  }
@@ -10118,6 +10119,7 @@ var Mediabunny = (() => {
10118
10119
  data: blockData,
10119
10120
  lacing,
10120
10121
  decoded: !hasDecodingInstructions,
10122
+ postProcessed: false,
10121
10123
  mainAdditional: null
10122
10124
  });
10123
10125
  }
@@ -10152,6 +10154,7 @@ var Mediabunny = (() => {
10152
10154
  data: blockData,
10153
10155
  lacing,
10154
10156
  decoded: !hasDecodingInstructions,
10157
+ postProcessed: false,
10155
10158
  mainAdditional: null
10156
10159
  };
10157
10160
  trackData.blocks.push(this.currentBlock);
@@ -10787,6 +10790,23 @@ var Mediabunny = (() => {
10787
10790
  block.data = this.internalTrack.demuxer.decodeBlockData(this.internalTrack, block.data);
10788
10791
  block.decoded = true;
10789
10792
  }
10793
+ if (!block.postProcessed) {
10794
+ if (this.internalTrack.info?.codec === "prores") {
10795
+ const hasFrameContainer = block.data.length >= 8 && block.data[4] === 105 && block.data[5] === 99 && block.data[6] === 112 && block.data[7] === 102;
10796
+ if (!hasFrameContainer) {
10797
+ const newData = new Uint8Array(block.data.length + 8);
10798
+ const newDataView = toDataView(newData);
10799
+ newDataView.setUint32(0, newData.length, false);
10800
+ newData[4] = 105;
10801
+ newData[5] = 99;
10802
+ newData[6] = 112;
10803
+ newData[7] = 102;
10804
+ newData.set(block.data, 8);
10805
+ block.data = newData;
10806
+ }
10807
+ }
10808
+ block.postProcessed = true;
10809
+ }
10790
10810
  const data = options.metadataOnly ? PLACEHOLDER_DATA : block.data;
10791
10811
  const timestamp = block.timestamp / this.internalTrack.segment.timestampFactor;
10792
10812
  const duration = block.duration / this.internalTrack.segment.timestampFactor;
@@ -30542,6 +30562,13 @@ var Mediabunny = (() => {
30542
30562
  const release = await this.mutex.acquire();
30543
30563
  try {
30544
30564
  const trackData = this.getVideoTrackData(track, packet, meta);
30565
+ let packetData = packet.data;
30566
+ if (track.source._codec === "prores") {
30567
+ if (packetData.byteLength < 8) {
30568
+ throw new Error("ProRes packet too small, expected at least 8 bytes.");
30569
+ }
30570
+ packetData = packetData.subarray(8);
30571
+ }
30545
30572
  const isKeyFrame = packet.type === "key";
30546
30573
  this.validateTimestamp(trackData.track, packet.timestamp, isKeyFrame);
30547
30574
  let timestamp = packet.timestamp;
@@ -30551,7 +30578,7 @@ var Mediabunny = (() => {
30551
30578
  duration = roundToDivisor(duration, track.metadata.frameRate);
30552
30579
  }
30553
30580
  const additions = trackData.info.alphaMode ? packet.sideData.alpha ?? null : null;
30554
- const videoChunk = this.createInternalChunk(packet.data, timestamp, duration, packet.type, additions);
30581
+ const videoChunk = this.createInternalChunk(packetData, timestamp, duration, packet.type, additions);
30555
30582
  if (track.source._codec === "vp9") this.fixVP9ColorSpace(trackData, videoChunk);
30556
30583
  trackData.chunkQueue.push(videoChunk);
30557
30584
  await this.interleaveChunks();