Skip to main content

OpusEncoder

Struct OpusEncoder 

Source
pub struct OpusEncoder {
    pub bitrate_bps: i32,
    pub complexity: i32,
    pub use_cbr: bool,
    pub use_inband_fec: bool,
    pub packet_loss_perc: i32,
    /* private fields */
}

Fields§

§bitrate_bps: i32§complexity: i32§use_cbr: bool§use_inband_fec: bool

Enable in-band FEC (LBRR). When set to true, the encoder will include redundant copies of previous frames (at lower quality) to allow packet-loss recovery on the decoder side.

§packet_loss_perc: i32

Expected packet loss percentage (0-100). Used to determine whether LBRR encoding is worth the overhead. Non-zero value enables LBRR when use_inband_fec is also true.

Implementations§

Source§

impl OpusEncoder

Source

pub fn new( sampling_rate: i32, channels: usize, application: Application, ) -> Result<Self, &'static str>

Source

pub fn enable_hybrid_mode(&mut self) -> Result<(), &'static str>

Enable Hybrid mode (SILK + CELT). This is only valid for sampling rates of 24000 or 48000 Hz. In Hybrid mode, SILK handles the low-frequency portion and CELT handles the high-frequency. IMPORTANT: Hybrid mode requires the input to be at the encoder’s sampling rate (24kHz or 48kHz). The SILK encoder will internally use 16kHz for its processing.

Source

pub fn encode( &mut self, input: &[f32], frame_size: usize, output: &mut [u8], ) -> Result<usize, &'static str>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.