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, Error>

A surround encoder for channels channels with the standard layout of mapping_family (see ChannelLayout::surround).

§Errors

Error::BadArg for an unsupported channel count / mapping family, or any error from creating the per-stream encoders.

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

Number of Opus streams in each multistream packet.

Source

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

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

§Errors

Any error from the per-stream crate::OpusEncoder::encode calls or from assembling the self-delimited multistream packet.

Source

pub fn sample_rate(&self) -> i32

Input sampling rate in Hz.

Source§

impl OpusMSEncoder

Source

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

Cap the audio bandwidth of every stream at once.

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.