Skip to main content

Module format

Module format 

Source
Expand description

Container-format auto-detection and decoder factory.

open sniffs the leading magic bytes of a file and returns a boxed concrete decoder for the sniffed container. This is the ergonomic entry point for end-to-end decoding: callers do not need to know whether a file is FLAC, WAV, or PCM ahead of time.

§Magic-byte sniffing

MagicContainerDecoder
b"fLaC"FLACSymphoniaDecoder
b"RIFF"b"WAVE"RIFF/WAVEWavDecoder

Anything else yields CodecError::Format. Sniffing reads at most 12 bytes, so it is cheap and non-destructive.

Functions§

open
Sniff the container by magic bytes and open the matching decoder.