Expand description
A multi-format audio container decoder (FLAC / PCM / WAV).
This crate decodes FLAC, PCM, and WAV containers into planar
audio_core_bsd::AudioFrames on a worker thread. It is deliberately
not real-time safe: implementations are expected to perform file I/O
and heap allocation freely. Decoded frames are handed to a lock-free ring
buffer or similar channel so the RT audio thread never touches this crate.
§Supported formats
- FLAC — lossless, decoded via
SymphoniaDecoder(symphonia 0.6). - WAV — PCM/IEEE-float RIFF, decoded via
WavDecoder(hound). - PCM — raw headerless little-endian samples (planned).
Use open for magic-byte auto-detection, or construct a concrete
decoder directly when the container is known ahead of time.
§Dependency licensing
This crate depends on symphonia (MPL-2.0, pure Rust) and
hound (Apache-2.0/MIT, pure Rust). MPL-2.0 permits static/dynamic
linking from a BSD-2-Clause crate without copyleft contamination,
provided that any modified symphonia source files are republished under
MPL-2.0. Unmodified use (the default) imposes only a notice obligation.
Because MPL-2.0 is file-level, any forked/modified symphonia files must
carry the MPL header and be disclosed.
§Example
Open a container by magic-byte sniffing and drain it frame-by-frame into
planar audio_core_bsd::AudioFrames:
use audio_codec_bsd::open;
use std::path::Path;
let mut dec = open(Path::new("song.flac"))?;
let info = dec.open(Path::new("song.flac"))?;
while let Some(_frame) = dec.next_frame()? {
// push _frame into a lock-free ring for the RT thread.
}Re-exports§
pub use decoder::ContainerDecoder;pub use decoder::FormatKind;pub use decoder::StreamInfo;pub use error::CodecError;pub use error::Result;pub use format::open;pub use symphonia_impl::SymphoniaDecoder;pub use wav::WavDecoder;