pub struct OpusConfig { /* private fields */ }Expand description
Opus audio codec configuration.
Implementations§
Source§impl OpusConfig
impl OpusConfig
Sourcepub fn voice() -> Self
pub fn voice() -> Self
Voice/VOIP optimised preset.
Uses VOIP application mode, maximum complexity, VBR, and forward error correction — suitable for speech transmission over lossy networks.
Sourcepub fn music() -> Self
pub fn music() -> Self
Music streaming preset.
Uses Audio application mode, maximum complexity, VBR, and a 20 ms frame duration — optimal balance for music with transparent quality.
Sourcepub fn fullband() -> Self
pub fn fullband() -> Self
Full-band (20 Hz–20 kHz) audio preset.
Forces full-band mode with maximum complexity and VBR.
Sourcepub fn application(self, app: OpusApplication) -> Self
pub fn application(self, app: OpusApplication) -> Self
Sets the application type.
Sourcepub fn complexity(self, complexity: u8) -> Self
pub fn complexity(self, complexity: u8) -> Self
Sets the complexity (0-10).
Sourcepub fn frame_duration(self, duration_ms: f32) -> Self
pub fn frame_duration(self, duration_ms: f32) -> Self
Sets the frame duration in milliseconds.
Sourcepub fn with_vbr(self, enabled: bool) -> Self
pub fn with_vbr(self, enabled: bool) -> Self
Enables or disables variable bitrate via builder pattern.
Sourcepub fn with_constrained_vbr(self, enabled: bool) -> Self
pub fn with_constrained_vbr(self, enabled: bool) -> Self
Enables or disables constrained VBR mode.
Constrained VBR limits bitrate peaks while still allowing variation, giving better quality than strict CBR with bounded bitrate.
Sourcepub fn with_dtx(self, enabled: bool) -> Self
pub fn with_dtx(self, enabled: bool) -> Self
Enables or disables Discontinuous Transmission (DTX).
DTX reduces bitrate during silence by sending comfort noise packets, useful for VOIP applications where silence is frequent.
Sourcepub fn with_fec(self, enabled: bool) -> Self
pub fn with_fec(self, enabled: bool) -> Self
Enables or disables in-band Forward Error Correction (FEC).
FEC adds redundant audio data that allows partial recovery from packet loss in VoIP scenarios. Increases bitrate slightly.
Sourcepub fn with_packet_loss_perc(self, pct: u8) -> Self
pub fn with_packet_loss_perc(self, pct: u8) -> Self
Sets the expected packet loss percentage (0–100).
This hint guides the encoder in tuning FEC strength and bitrate distribution. Requires FEC to be enabled for full effect.
Sourcepub fn build(self) -> CodecConfig
pub fn build(self) -> CodecConfig
Converts to base codec config.
Trait Implementations§
Source§impl Clone for OpusConfig
impl Clone for OpusConfig
Source§fn clone(&self) -> OpusConfig
fn clone(&self) -> OpusConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OpusConfig
impl Debug for OpusConfig
Auto Trait Implementations§
impl Freeze for OpusConfig
impl RefUnwindSafe for OpusConfig
impl Send for OpusConfig
impl Sync for OpusConfig
impl Unpin for OpusConfig
impl UnsafeUnpin for OpusConfig
impl UnwindSafe for OpusConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more