use crate::error::Result;
#[derive(Debug, Clone, Copy)]
pub struct TocByte {
config: u8,
stereo: bool,
frame_code: u8,
}
impl TocByte {
pub const fn parse(byte: u8) -> Result<Self> {
let config = (byte >> 3) & 0x1F;
let stereo = (byte & 0x04) != 0;
let frame_code = byte & 0x03;
Ok(Self {
config,
stereo,
frame_code,
})
}
#[must_use]
pub const fn config(&self) -> u8 {
self.config
}
#[must_use]
pub const fn is_stereo(&self) -> bool {
self.stereo
}
#[must_use]
pub const fn frame_code(&self) -> u8 {
self.frame_code
}
}
#[derive(Debug, Clone, Copy)]
pub enum OpusMode {
SilkOnly,
Hybrid,
CeltOnly,
}
#[derive(Debug, Clone, Copy)]
pub enum Bandwidth {
Narrowband,
Mediumband,
Wideband,
SuperWideband,
Fullband,
}