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: i32Total target bitrate across all streams (split evenly, coupled=2x mono).
Implementations§
Source§impl OpusMSEncoder
impl OpusMSEncoder
Sourcepub fn new(
sample_rate: i32,
channels: usize,
mapping_family: i32,
application: Application,
) -> Result<Self, Error>
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.
Sourcepub fn set_bitrate(&mut self, total: i32)
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).
Sourcepub fn nb_streams(&self) -> usize
pub fn nb_streams(&self) -> usize
Number of Opus streams in each multistream packet.
Sourcepub fn encode(
&mut self,
input: &[f32],
frame_size: usize,
) -> Result<Vec<u8>, Error>
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.
Sourcepub fn sample_rate(&self) -> i32
pub fn sample_rate(&self) -> i32
Input sampling rate in Hz.
Source§impl OpusMSEncoder
impl OpusMSEncoder
Sourcepub fn set_max_bandwidth(&mut self, bw: Bandwidth)
pub fn set_max_bandwidth(&mut self, bw: Bandwidth)
Cap the audio bandwidth of every stream at once.