[−][src]Struct audiopus::coder::Decoder
Decoder
to decode.
Methods
impl Decoder
[src]
pub fn new(sample_rate: SampleRate, channels: Channels) -> Result<Decoder>
[src]
Creates a new Opus decoder.
pub fn decode<'a, TP, TS>(
&mut self,
input: Option<TP>,
output: TS,
fec: bool
) -> Result<usize> where
TP: TryInto<Packet<'a>>,
TS: TryInto<MutSignals<'a, i16>>,
[src]
&mut self,
input: Option<TP>,
output: TS,
fec: bool
) -> Result<usize> where
TP: TryInto<Packet<'a>>,
TS: TryInto<MutSignals<'a, i16>>,
Decodes an Opus packet as input
and writes decoded data into output
.
Passing None
as input
indicates a packet loss.
Errors:
If passed input
's length exceeds std::i32::MAX
, PacketTooLarge
will be returned.
If passed output
's length exceeds std::i32::MAX
, SignalsTooLarge
will be returned.
pub fn decode_float<'a, TP, TS>(
&mut self,
input: TP,
output: TS,
fec: bool
) -> Result<usize> where
TP: TryInto<Packet<'a>>,
TS: TryInto<MutSignals<'a, f32>>,
[src]
&mut self,
input: TP,
output: TS,
fec: bool
) -> Result<usize> where
TP: TryInto<Packet<'a>>,
TS: TryInto<MutSignals<'a, f32>>,
Decodes an Opus frame from floating point input.
The input
signal (interleaved if 2 channels) will be encoded into the
output
payload and on success, returns the length of the
encoded packet.
pub fn last_packet_duration(&self) -> Result<u32>
[src]
Gets the duration (in samples) of the last packet successfully decoded or concealed.
pub fn pitch(&self) -> Result<i32>
[src]
Gets the pitch period at 48 kHz of the last decoded frame, if available.
This can be used for any post-processing algorithm requiring the use of pitch, e.g. time stretching/shortening. If the last frame was not voiced, or if the pitch was not coded in the frame, then zero is returned.
pub fn gain(&self) -> Result<i32>
[src]
Gets the decoder's configured amount to scale PCM signal by in Q8 dB units.
pub fn set_gain(&self, gain: i32) -> Result<()>
[src]
Configures decoder gain adjustment.
Scales the decoded output by a factor of gain
specified in
Q8 dB units.
Warning:
This has a maximum range of -32768 to 32767 inclusive, and returns
BadArgument
otherwise.
The default is 0 indicating no adjustment.
Info: This setting survives decoder reset.
pub fn size(&self) -> usize
[src]
Gets size of self's underlying Opus-decoder in bytes.
Trait Implementations
impl GenericCtl for Decoder
[src]
fn final_range(&self) -> Result<u32>
[src]
fn phase_inversion_disabled(&self) -> Result<bool>
[src]
fn set_phase_inversion_disabled(&mut self, disabled: bool) -> Result<()>
[src]
fn sample_rate(&self) -> Result<SampleRate>
[src]
fn reset_state(&mut self) -> Result<()>
[src]
impl Drop for Decoder
[src]
fn drop(&mut self)
[src]
We have to ensure that the resource our wrapping Opus-struct is pointing to is deallocated properly.
impl Debug for Decoder
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,