pub struct Encoder { /* private fields */ }Expand description
Opus encoder over the PCM layout declared in EncoderInput.
Implementations§
Source§impl Encoder
impl Encoder
pub fn new( input: EncoderInput, output: EncoderOutput, ) -> Result<Self, AudioError>
pub fn input(&self) -> &EncoderInput
pub fn output(&self) -> &EncoderOutput
Sourcepub fn codec_rate(&self) -> u32
pub fn codec_rate(&self) -> u32
Sample rate libopus actually runs at.
Sourcepub fn codec_channels(&self) -> u32
pub fn codec_channels(&self) -> u32
Channel count libopus actually runs at.
Sourcepub fn frame_size(&self) -> usize
pub fn frame_size(&self) -> usize
Number of input frames libopus consumes per call.
Sourcepub fn encode_f32(&mut self, pcm: &[f32]) -> Result<Bytes, AudioError>
pub fn encode_f32(&mut self, pcm: &[f32]) -> Result<Bytes, AudioError>
Encode one frame of interleaved f32 PCM at codec_rate.
pcm.len() must equal frame_size() * codec_channels(). The
producer typically handles format conversion and resampling
before calling this; for direct use, the caller does the same.
Sourcepub fn catalog(&self) -> AudioConfig
pub fn catalog(&self) -> AudioConfig
hang catalog entry describing this encoder’s output stream.
Trait Implementations§
Auto Trait Implementations§
impl !Sync for Encoder
impl Freeze for Encoder
impl RefUnwindSafe for Encoder
impl Unpin for Encoder
impl UnsafeUnpin for Encoder
impl UnwindSafe for Encoder
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