Skip to main content

Module wav

Module wav 

Source
Expand description

Minimal pure-Rust RIFF/WAVE container.

Supports reading and writing linear PCM streams via the pcm_* codecs (pcm_u8, pcm_s16le, pcm_s24le, pcm_s32le, pcm_f32le, pcm_f64le) and dispatches WAVE_FORMAT_ALAW (0x0006) / WAVE_FORMAT_MULAW (0x0007) streams to the external pcm_alaw / pcm_mulaw codecs (provided by oxideav-g711, applied at decode time by the host runtime — this crate’s WAV layer only handles framing).

§WAVEFORMATEXTENSIBLE (wFormatTag = 0xFFFE)

Per docs/container/riff/waveformatextensible/README.md the demuxer parses the 22-byte extension and surfaces:

  • wValidBitsPerSample — actual bit precision (may differ from the wBitsPerSample container size for 24-in-32-bit PCM).
  • dwChannelMaskSPEAKER_* bitmap describing the channel ordering of the interleaved PCM byte stream.
  • SubFormat GUID — the codec identifier when the legacy wFormatTag is the EXTENSIBLE escape hatch.

Well-known KSDATAFORMAT_SUBTYPE_* GUIDs (PCM, IEEE_FLOAT, ALAW, MULAW) are mapped to the same codec ids the legacy WAVEFORMATEX path would have produced. Unknown GUIDs synthesise a wav:guid_<canonical-text> codec id so downstream CodecRegistry::make_decoder lookups fail cleanly naming the actual GUID.

The extension fields are also exposed verbatim through Demuxer::metadata under the keys wav:fmt.valid_bits_per_sample / wav:fmt.channel_mask / wav:fmt.subformat (matching the round-75 oxideav-avi shape, but single-stream so no per-stream index).

Structs§

WavDemuxer
WAV demuxer.
WavMuxOptions
Optional muxer configuration: write a WAVE_FORMAT_EXTENSIBLE (wFormatTag = 0xFFFE) header with the supplied dwChannelMask, wValidBitsPerSample, and SubFormat GUID. See docs/container/riff/waveformatextensible/README.md §“Channel-mask” for the standard layouts.

Constants§

WAVE_FORMAT_ALAW
WAVE_FORMAT_ALAW — ITU-T G.711 A-law (RFC 2361 A.7).
WAVE_FORMAT_EXTENSIBLE
WAVE_FORMAT_EXTENSIBLE — escape hatch with 22-byte extension carrying wValidBitsPerSample / dwChannelMask / SubFormat GUID (per docs/container/riff/waveformatextensible/README.md).
WAVE_FORMAT_IEEE_FLOAT
WAVE_FORMAT_IEEE_FLOAT — 32-bit / 64-bit IEEE 754 float PCM.
WAVE_FORMAT_MULAW
WAVE_FORMAT_MULAW — ITU-T G.711 μ-law (RFC 2361 A.8).
WAVE_FORMAT_PCM
WAVE_FORMAT_PCM — integer linear PCM (mmreg.h).

Functions§

open_muxer_with
Open the WAV muxer with caller-controlled WAVEFORMATEXTENSIBLE options. Identical to open_muxer when opts == WavMuxOptions::default().
register