pub trait Decoder: Send {
type Error;
// Required methods
fn sample_rate(&self) -> u32;
fn num_frames(&self) -> usize;
fn decode(&mut self) -> Result<Vec<Frame>, Self::Error>;
fn seek(&mut self, index: usize) -> Result<usize, Self::Error>;
}
Expand description
Decodes chunks of audio.
Required Associated Types§
type Error
type Error
Errors that can occur when decoding audio.
Required Methods§
fn sample_rate(&self) -> u32
fn sample_rate(&self) -> u32
Returns the sample rate of the audio (in Hz).
fn num_frames(&self) -> usize
fn num_frames(&self) -> usize
Returns the total number of samples of audio.