mediabunny 1.50.0 → 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();
@@ -33026,6 +33053,7 @@ ${cue.notes ?? ""}`;
33026
33053
  if (!forceClose) {
33027
33054
  await this.encoder.flush();
33028
33055
  await this.alphaEncoder?.flush();
33056
+ await wait(25);
33029
33057
  }
33030
33058
  if (this.encoder.state !== "closed") {
33031
33059
  this.encoder.close();
@@ -37403,9 +37431,13 @@ The @mediabunny/mp3-encoder extension package provides support for encoding MP3.
37403
37431
  firstSample.close();
37404
37432
  await tempOutput.finalize();
37405
37433
  } catch (error) {
37406
- Logging._info("Error when probing encoder support. Falling back to rerender path.", error);
37407
- needsRerender = true;
37434
+ Logging._warn(
37435
+ "An error occurred when probing encoder support. Falling back to rerender path.",
37436
+ error
37437
+ );
37408
37438
  void tempOutput.cancel();
37439
+ needsRerender = true;
37440
+ encodingConfig.transform.force = true;
37409
37441
  }
37410
37442
  } else {
37411
37443
  await tempOutput.cancel();