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§packet_loss_perc: i32Implementations§
Source§impl OpusEncoder
impl OpusEncoder
pub fn new( sampling_rate: i32, channels: usize, application: Application, ) -> Result<Self, &'static str>
pub fn enable_hybrid_mode(&mut self) -> Result<(), &'static str>
Sourcepub fn encode(
&mut self,
input: &[f32],
frame_size: usize,
output: &mut [u8],
) -> Result<usize, &'static str>
pub fn encode( &mut self, input: &[f32], frame_size: usize, output: &mut [u8], ) -> Result<usize, &'static str>
Encode a frame of interleaved f32 PCM (scale ±1.0; C opus_encode_float
convention where 1.0 maps to PCM16 32768). Samples are consumed exactly
up to frame_size * channels.
Sourcepub fn encode_i16(
&mut self,
input: &[i16],
frame_size: usize,
output: &mut [u8],
) -> Result<usize, &'static str>
pub fn encode_i16( &mut self, input: &[i16], frame_size: usize, output: &mut [u8], ) -> Result<usize, &'static str>
Encode a frame of interleaved PCM16 (opus_int16 C opus_encode()
convention). Produces byte-for-byte identical packets to
encode() called with the same audio converted via
sample as f32 / 32768.0, while skipping the f32 round-trip in the
SILK/VoIP path: the integer high-pass biquad and SILK pipeline are fed
natively, with no temporary conversion buffer (issue #28).
Auto Trait Implementations§
impl Freeze for OpusEncoder
impl RefUnwindSafe for OpusEncoder
impl Send for OpusEncoder
impl Sync for OpusEncoder
impl Unpin for OpusEncoder
impl UnsafeUnpin for OpusEncoder
impl UnwindSafe for OpusEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more