pub struct ProjectionDecoderRef<'a> { /* private fields */ }Expand description
Borrowed wrapper around a projection decoder state.
Implementations§
Source§impl<'a> ProjectionDecoderRef<'a>
impl<'a> ProjectionDecoderRef<'a>
Sourcepub unsafe fn from_raw(
ptr: *mut OpusProjectionDecoder,
sample_rate: SampleRate,
channels: u8,
streams: u8,
coupled_streams: u8,
) -> Self
pub unsafe fn from_raw( ptr: *mut OpusProjectionDecoder, sample_rate: SampleRate, channels: u8, streams: u8, coupled_streams: u8, ) -> Self
Wrap an externally-initialized projection decoder without taking ownership.
§Safety
ptrmust point to valid, initialized memory of at leastProjectionDecoder::size()bytesptrmust be aligned to at leastalign_of::<usize>()(malloc-style alignment)- The memory must remain valid for the lifetime
'a - Caller is responsible for freeing the memory after this wrapper is dropped
Use ProjectionDecoder::init_in_place to initialize the memory before calling this.
Sourcepub fn init_in(
buf: &'a mut AlignedBuffer,
sample_rate: SampleRate,
channels: u8,
streams: u8,
coupled_streams: u8,
demixing_matrix: &[u8],
) -> Result<Self>
pub fn init_in( buf: &'a mut AlignedBuffer, sample_rate: SampleRate, channels: u8, streams: u8, coupled_streams: u8, demixing_matrix: &[u8], ) -> Result<Self>
Initialize and wrap an externally allocated buffer.
§Errors
Returns Error::BadArg if the buffer is too small, or a mapped libopus error.
Methods from Deref<Target = ProjectionDecoder>§
Sourcepub fn decode(
&mut self,
packet: &[u8],
out: &mut [i16],
frame_size_per_ch: usize,
fec: bool,
) -> Result<usize>
pub fn decode( &mut self, packet: &[u8], out: &mut [i16], frame_size_per_ch: usize, fec: bool, ) -> Result<usize>
Decode into interleaved i16 PCM.
§Errors
Returns Error::InvalidState if the decoder handle was freed, Error::BadArg for
buffer/layout issues, a mapped libopus error, or Error::InternalError if libopus
reports an impossible decoded sample count.
Sourcepub fn decode_float(
&mut self,
packet: &[u8],
out: &mut [f32],
frame_size_per_ch: usize,
fec: bool,
) -> Result<usize>
pub fn decode_float( &mut self, packet: &[u8], out: &mut [f32], frame_size_per_ch: usize, fec: bool, ) -> Result<usize>
Decode into interleaved f32 PCM.
§Errors
Returns Error::InvalidState if the decoder handle was freed, Error::BadArg for
buffer/layout issues, a mapped libopus error, or Error::InternalError if libopus
reports an impossible decoded sample count.
Sourcepub fn coupled_streams(&self) -> u8
pub fn coupled_streams(&self) -> u8
Number of coupled coded streams expected in the input bitstream.
Sourcepub fn sample_rate(&self) -> SampleRate
pub fn sample_rate(&self) -> SampleRate
Decoder sample rate.