pub struct Config {
pub sample_rate: u32,
pub channel_count: u32,
}Expand description
Typed Opus configuration mirroring the parsed fields of an OpusHead packet.
Fields§
§sample_rate: u32§channel_count: u32Implementations§
Source§impl Config
impl Config
Sourcepub fn parse<T: Buf>(buf: &mut T) -> Result<Self>
pub fn parse<T: Buf>(buf: &mut T) -> Result<Self>
Parse an OpusHead buffer (RFC 7845 §5.1).
Verifies the magic signature; reads channel count and sample rate; ignores pre-skip, gain, and channel mapping. Any trailing bytes are consumed.
Sourcepub fn encode(&self) -> Result<Bytes>
pub fn encode(&self) -> Result<Bytes>
Encode the minimal OpusHead packet (19 bytes; channel mapping family 0, zero pre-skip and gain).
Errors with Error::UnsupportedChannelCount unless channel_count is 1
or 2 — mapping family 0 is only defined for mono/stereo per RFC 7845 §5.1.
Multi-channel streams need family 1 with a channel mapping table, which
this helper does not emit.
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more