pub struct OpusDecoder { /* private fields */ }
Implementations§
Source§impl OpusDecoder
impl OpusDecoder
pub fn new( reader: Box<dyn Reader>, data_offset: u64, data_length: u64, fmt: &FmtChunk, total_samples: u64, ) -> Result<Self, AudioReadError>
pub fn get_channels(&self) -> u16
pub fn get_sample_rate(&self) -> u32
pub fn get_cur_frame_index(&self) -> u64
pub fn seek(&mut self, seek_from: SeekFrom) -> Result<(), AudioReadError>
pub fn decode_mono<S>(&mut self) -> Result<Option<S>, AudioReadError>where
S: SampleType,
pub fn decode_stereo<S>(&mut self) -> Result<Option<(S, S)>, AudioReadError>where
S: SampleType,
pub fn decode_frame<S>(&mut self) -> Result<Option<Vec<S>>, AudioReadError>where
S: SampleType,
Trait Implementations§
Source§impl Debug for OpusDecoder
impl Debug for OpusDecoder
Source§impl<S> Decoder<S> for OpusDecoderwhere
S: SampleType,
impl<S> Decoder<S> for OpusDecoderwhere
S: SampleType,
Source§fn get_channels(&self) -> u16
fn get_channels(&self) -> u16
Get num channels
Source§fn get_cur_frame_index(&mut self) -> Result<u64, AudioReadError>
fn get_cur_frame_index(&mut self) -> Result<u64, AudioReadError>
Get current frame index.
Source§fn seek(&mut self, seek_from: SeekFrom) -> Result<(), AudioReadError>
fn seek(&mut self, seek_from: SeekFrom) -> Result<(), AudioReadError>
Seek to a specific audio frame. An audio frame is each channel has one sample.
Source§fn decode_frame(&mut self) -> Result<Option<Vec<S>>, AudioReadError>
fn decode_frame(&mut self) -> Result<Option<Vec<S>>, AudioReadError>
Decode one audio frame. An audio frame is each channel has one sample. This method supports > 2 channels.
Source§fn decode_stereo(&mut self) -> Result<Option<(S, S)>, AudioReadError>
fn decode_stereo(&mut self) -> Result<Option<(S, S)>, AudioReadError>
Decode a stereo sample with left and right samples, if the audio has > 2 channels, this method fails.
Source§fn decode_mono(&mut self) -> Result<Option<S>, AudioReadError>
fn decode_mono(&mut self) -> Result<Option<S>, AudioReadError>
Decode a mono sample, multiple channels will be mixed into one channel.
Source§fn decode_frames(
&mut self,
num_frames: usize,
) -> Result<Vec<Vec<S>>, AudioReadError>
fn decode_frames( &mut self, num_frames: usize, ) -> Result<Vec<Vec<S>>, AudioReadError>
Decode multiple audio frames. This method supports > 2 channels.
Source§fn decode_monos(&mut self, num_monos: usize) -> Result<Vec<S>, AudioReadError>
fn decode_monos(&mut self, num_monos: usize) -> Result<Vec<S>, AudioReadError>
Decode multiple mono samples, multiple channels will be mixed into one channel.
Source§fn decode_stereos(
&mut self,
num_stereos: usize,
) -> Result<Vec<(S, S)>, AudioReadError>
fn decode_stereos( &mut self, num_stereos: usize, ) -> Result<Vec<(S, S)>, AudioReadError>
Decode multiple stereo samples with left and right samples, if the audio has > 2 channels, this method fails.
Source§fn set_downmixer(&mut self, _downmixer: &Downmixer)
fn set_downmixer(&mut self, _downmixer: &Downmixer)
Set the downmixer
Source§fn get_downmixer(&self) -> Option<Downmixer>
fn get_downmixer(&self) -> Option<Downmixer>
Get the downmixer
Auto Trait Implementations§
impl Freeze for OpusDecoder
impl !RefUnwindSafe for OpusDecoder
impl !Send for OpusDecoder
impl !Sync for OpusDecoder
impl Unpin for OpusDecoder
impl !UnwindSafe for OpusDecoder
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