@poe-platform/safe-bash 0.1.843 → 0.1.845

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.
@@ -13,7 +13,7 @@ import {
13
13
  scanMp4Frames,
14
14
  scanMp4Packets,
15
15
  wavPacketFrames
16
- } from "./chunk-SBBMNLD6.js";
16
+ } from "./chunk-CMGVQM4Y.js";
17
17
 
18
18
  // packages/safe-bash-command-ffprobe/src/read-intervals.ts
19
19
  import { PagedStorage } from "@poe-platform/safe-fs/storage";
@@ -399724,19 +399724,29 @@ function serializeWav(doc, options = {}) {
399724
399724
  } else {
399725
399725
  throw new Error("WAV encoding requires decoded PCM audio");
399726
399726
  }
399727
+ const channelMask = audioTrack?.decodedAudio?.channelMask ?? (decodedAudio ? decodedAudio.channelMask : void 0) ?? [11, 263, 55, 63, 1807, 1599][channels - 3];
399728
+ const extensible = channelMask !== void 0 || channels > 2;
399729
+ const fmtSize = extensible ? 40 : 16;
399727
399730
  const padding = pcmBytes.byteLength % 2;
399728
- const writer = new BinaryWriter(44 + pcmBytes.byteLength + padding);
399731
+ const writer = new BinaryWriter(28 + fmtSize + pcmBytes.byteLength + padding);
399729
399732
  writer.writeFourCC("RIFF");
399730
- writer.writeU32LE(36 + pcmBytes.byteLength + padding);
399733
+ writer.writeU32LE(20 + fmtSize + pcmBytes.byteLength + padding);
399731
399734
  writer.writeFourCC("WAVE");
399732
399735
  writer.writeFourCC("fmt ");
399733
- writer.writeU32LE(16);
399734
- writer.writeU16LE(formatTag);
399736
+ writer.writeU32LE(fmtSize);
399737
+ writer.writeU16LE(extensible ? 65534 : formatTag);
399735
399738
  writer.writeU16LE(channels);
399736
399739
  writer.writeU32LE(sampleRate);
399737
399740
  writer.writeU32LE(sampleRate * channels * (bitsPerSample >>> 3));
399738
399741
  writer.writeU16LE(channels * (bitsPerSample >>> 3));
399739
399742
  writer.writeU16LE(bitsPerSample);
399743
+ if (extensible) {
399744
+ writer.writeU16LE(22);
399745
+ writer.writeU16LE(bitsPerSample);
399746
+ writer.writeU32LE(channelMask ?? 0);
399747
+ writer.writeU32LE(formatTag);
399748
+ writer.writeBytes(Uint8Array.of(0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113));
399749
+ }
399740
399750
  writer.writeFourCC("data");
399741
399751
  writer.writeU32LE(pcmBytes.byteLength);
399742
399752
  writer.writeBytes(pcmBytes);
@@ -399829,7 +399839,7 @@ function wavAst() {
399829
399839
  canDemux: true,
399830
399840
  canMux: true,
399831
399841
  supportedVideoCodecs: [],
399832
- supportedAudioCodecs: ["pcm_s16le", "pcm_u8"],
399842
+ supportedAudioCodecs: ["pcm_s16le", "pcm_u8", "pcm_s24le", "pcm_s32le", "pcm_f32le"],
399833
399843
  detect(bytes, filename) {
399834
399844
  if (isWavSignature(bytes)) return true;
399835
399845
  if (filename && filename.toLowerCase().endsWith(".wav")) return isWavSignature(bytes);