mediabunny 1.35.0 → 1.35.1

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.
@@ -20759,7 +20759,8 @@ var Mediabunny = (() => {
20759
20759
  let version = 0;
20760
20760
  let contents;
20761
20761
  let sampleSizeInBits = 16;
20762
- if (PCM_AUDIO_CODECS.includes(trackData.track.source._codec)) {
20762
+ const isPcmCodec = PCM_AUDIO_CODECS.includes(trackData.track.source._codec);
20763
+ if (isPcmCodec) {
20763
20764
  const codec = trackData.track.source._codec;
20764
20765
  const { sampleSize } = parsePcmCodec(codec);
20765
20766
  sampleSizeInBits = 8 * sampleSize;
@@ -20767,6 +20768,9 @@ var Mediabunny = (() => {
20767
20768
  version = 1;
20768
20769
  }
20769
20770
  }
20771
+ if (trackData.muxer.isQuickTime) {
20772
+ version = 1;
20773
+ }
20770
20774
  if (version === 0) {
20771
20775
  contents = [
20772
20776
  Array(6).fill(0),
@@ -20793,6 +20797,7 @@ var Mediabunny = (() => {
20793
20797
  // Sample rate (lower)
20794
20798
  ];
20795
20799
  } else {
20800
+ const compressionId = isPcmCodec ? 0 : -2;
20796
20801
  contents = [
20797
20802
  Array(6).fill(0),
20798
20803
  // Reserved
@@ -20808,7 +20813,7 @@ var Mediabunny = (() => {
20808
20813
  // Number of channels
20809
20814
  u16(Math.min(sampleSizeInBits, 16)),
20810
20815
  // Sample size (bits)
20811
- u16(0),
20816
+ i16(compressionId),
20812
20817
  // Compression ID
20813
20818
  u16(0),
20814
20819
  // Packet size
@@ -20816,12 +20821,21 @@ var Mediabunny = (() => {
20816
20821
  // Sample rate (upper)
20817
20822
  u16(0),
20818
20823
  // Sample rate (lower)
20819
- u32(1),
20820
- // Samples per packet (must be 1 for uncompressed formats)
20821
- u32(sampleSizeInBits / 8),
20822
- // Bytes per packet
20823
- u32(trackData.info.numberOfChannels * sampleSizeInBits / 8),
20824
- // Bytes per frame
20824
+ isPcmCodec ? [
20825
+ u32(1),
20826
+ // Samples per packet (must be 1 for uncompressed formats)
20827
+ u32(sampleSizeInBits / 8),
20828
+ // Bytes per packet
20829
+ u32(trackData.info.numberOfChannels * sampleSizeInBits / 8)
20830
+ // Bytes per frame
20831
+ ] : [
20832
+ u32(0),
20833
+ // Samples per packet (don't bother, still works with 0)
20834
+ u32(0),
20835
+ // Bytes per packet (variable)
20836
+ u32(0)
20837
+ // Bytes per frame (variable)
20838
+ ],
20825
20839
  u32(2)
20826
20840
  // Bytes per sample (constant in FFmpeg)
20827
20841
  ];