pub struct CodecPipeline { /* private fields */ }Expand description
Codec pipeline for encoding/decoding audio frames.
For PCMU/PCMA, we implement the G.711 codec directly. For Opus, uses the audiopus crate when the “opus” feature is enabled, otherwise falls back to a raw-bytes stub.
Implementations§
Source§impl CodecPipeline
impl CodecPipeline
pub fn new(codec: CodecType) -> Self
pub fn codec_type(&self) -> CodecType
Sourcepub fn encode(&mut self, pcm_samples: &[i16]) -> Result<Vec<u8>, CodecError>
pub fn encode(&mut self, pcm_samples: &[i16]) -> Result<Vec<u8>, CodecError>
Encode PCM samples (16-bit linear, mono) to codec format
Sourcepub fn decode(&mut self, data: &[u8]) -> Result<Vec<i16>, CodecError>
pub fn decode(&mut self, data: &[u8]) -> Result<Vec<i16>, CodecError>
Decode codec format to PCM samples (16-bit linear, mono)
Sourcepub fn silence_frame(&self) -> Vec<u8> ⓘ
pub fn silence_frame(&self) -> Vec<u8> ⓘ
Generate silence for one frame
Auto Trait Implementations§
impl Freeze for CodecPipeline
impl RefUnwindSafe for CodecPipeline
impl Send for CodecPipeline
impl !Sync for CodecPipeline
impl Unpin for CodecPipeline
impl UnsafeUnpin for CodecPipeline
impl UnwindSafe for CodecPipeline
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