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: boolEnable 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: i32Expected 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
impl OpusEncoder
pub fn new( sampling_rate: i32, channels: usize, application: Application, ) -> Result<Self, &'static str>
Sourcepub fn enable_hybrid_mode(&mut self) -> Result<(), &'static str>
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.
pub fn encode( &mut self, input: &[f32], frame_size: usize, output: &mut [u8], ) -> Result<usize, &'static str>
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