Skip to main content

WavDemuxer

Struct WavDemuxer 

Source
pub struct WavDemuxer { /* private fields */ }
Expand description

WAV demuxer.

Beyond the Demuxer trait, this type exposes round-77 accessors for the WAVEFORMATEXTENSIBLE side-info — format_tag, valid_bits_per_sample, channel_mask, subformat. Callers that only have a Box<dyn Demuxer> should rely on the wav:fmt.* metadata keys instead.

Implementations§

Source§

impl WavDemuxer

Source

pub fn format_tag(&self) -> u16

On-wire wFormatTag from the fmt chunk (one of WAVE_FORMAT_*). Preserved verbatim for round-trip purposes — the codec id already encodes the decoder dispatch.

Source

pub fn valid_bits_per_sample(&self) -> Option<u16>

WAVEFORMATEXTENSIBLE.Samples.wValidBitsPerSample — actual bit precision per sample. None for legacy WAVEFORMATEX streams (non-EXTENSIBLE wFormatTag).

Source

pub fn channel_mask(&self) -> Option<u32>

WAVEFORMATEXTENSIBLE.dwChannelMaskSPEAKER_* bitmap describing the channel ordering of the interleaved PCM byte stream. None for non-EXTENSIBLE streams.

See docs/container/riff/waveformatextensible/README.md §“dwChannelMask bits” for the standard layouts.

Source

pub fn channel_layout(&self) -> Option<String>

Human-readable speaker layout decoded from Self::channel_mask — a +-separated list of SPEAKER_* positions in canonical least-significant-bit-first order (e.g. "FRONT_LEFT+FRONT_RIGHT+FRONT_CENTER+LOW_FREQUENCY").

None when the stream is non-EXTENSIBLE, or when the mask is 0 (no assigned speaker positions). The same value is mirrored under the wav:fmt.channel_layout metadata key for dyn Demuxer consumers. See docs/container/riff/waveformatextensible/ms-waveformatextensible.html.

Source

pub fn subformat(&self) -> Option<&[u8; 16]>

WAVEFORMATEXTENSIBLE.SubFormat — 16-byte GUID (the actual codec identifier when format_tag == WAVE_FORMAT_EXTENSIBLE). Returned in on-wire byte order (first three groups little-endian, trailing two groups big-endian); use Self::subformat_text for the canonical text representation.

Source

pub fn subformat_text(&self) -> Option<String>

WAVEFORMATEXTENSIBLE.SubFormat formatted as a canonical XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX GUID string.

Source

pub fn acid(&self) -> Option<&AcidChunk>

Typed view of the Acidizer acid chunk when the file carried one with a well-formed 24-byte body. None when the chunk is absent or truncated. The same fields are mirrored under the wav:acid.* metadata keys for dyn Demuxer consumers.

Trait Implementations§

Source§

impl Demuxer for WavDemuxer

Source§

fn format_name(&self) -> &str

Name of the container format (e.g., "wav").
Source§

fn streams(&self) -> &[StreamInfo]

Streams in this container. Stable across the lifetime of the demuxer.
Source§

fn next_packet(&mut self) -> Result<Packet>

Read the next packet from any stream. Returns Error::Eof at end.
Source§

fn seek_to(&mut self, stream_index: u32, pts: i64) -> Result<i64>

Seek to the nearest keyframe at or before pts (in the given stream’s time base). Returns the actual timestamp seeked to, or Error::Unsupported if this demuxer can’t seek.
Source§

fn metadata(&self) -> &[(String, String)]

Container-level metadata as ordered (key, value) pairs. Keys follow a loose convention borrowed from Vorbis comments: title, artist, album, comment, date, sample_name:<n>, channels, n_patterns, etc. Demuxers that carry no metadata return an empty slice (the default).
Source§

fn duration_micros(&self) -> Option<i64>

Container-level duration, if known. Default is None — callers may fall back to the longest per-stream duration. Expressed as microseconds for portability; convert to seconds at the edge.
Source§

fn set_active_streams(&mut self, _indices: &[u32])

Hint that only the listed stream indices will be consumed by the pipeline. Demuxers that can efficiently skip inactive streams at the container level (e.g., MKV cluster-aware, MP4 trak-aware) should override this. The default is a no-op — the pipeline drops unwanted packets on the floor.
Source§

fn attached_pictures(&self) -> &[AttachedPicture]

Attached pictures (cover art, artist photos, …) embedded in the container. Returns an empty slice (the default) when the container carries none or doesn’t support them. Containers that do — ID3v2 on MP3, METADATA_BLOCK_PICTURE on FLAC, covr atoms on MP4, etc. — override this to expose the images.
Source§

fn chapters(&self) -> &[Chapter]

Structured chapter / cue list. Default returns an empty slice for back-compat; demuxers that carry chapters (MKV Chapters, MP4 chapter track, Ogg CHAPTERnn= Vorbis comments, …) should override and return Chapter records in presentation order. Coexists with the legacy chapter:N:* flat-metadata keys; new consumers should prefer this.
Source§

fn attachments(&self) -> &[Attachment]

Structured attachment list. Default returns an empty slice for back-compat; demuxers that carry attachments (MKV Attachments, …) should override and return Attachment records in container order. Coexists with the legacy attachment:N:* flat-metadata keys; new consumers should prefer this.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.