Skip to main content

OpusMSEncoder

Struct OpusMSEncoder 

Source
pub struct OpusMSEncoder {
    pub bitrate_bps: i32,
    /* private fields */
}
Expand description

Multistream encoder: one Opus encoder per stream (coupled = stereo, the rest mono), coded per the channel layout and concatenated self-delimited.

Fields§

§bitrate_bps: i32

Total target bitrate across all streams (split evenly, coupled=2x mono).

Implementations§

Source§

impl OpusMSEncoder

Source

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

Source

pub fn set_bitrate(&mut self, total: i32)

Split the total bitrate across streams (each coupled stream gets 2x a mono stream’s share, matching its 2 channels).

Source

pub fn nb_streams(&self) -> usize

Source

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

Encode one frame of interleaved input (nb_channels per sample) into a multistream packet. scratch output is returned as a Vec.

Source

pub fn sample_rate(&self) -> i32

Source§

impl OpusMSEncoder

Bandwidth passthrough helper (so callers can cap all streams at once).

Source

pub fn set_max_bandwidth(&mut self, bw: Bandwidth)

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.