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
| Magic | Container | Decoder |
|---|---|---|
b"fLaC" | FLAC | SymphoniaDecoder |
b"RIFF" … b"WAVE" | RIFF/WAVE | WavDecoder |
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.