pub trait ControlFunctions: Sealed {
Show 26 methods
// Required method
unsafe fn ctl(
&mut self,
request: i32,
ptr: *mut c_void,
) -> Result<(), ControlError>;
// Provided methods
fn check_error(
err_code: i32,
param: Option<i32>,
) -> Result<(), ControlError> { ... }
fn get_frame_size(&mut self) -> i32 { ... }
fn set_vbr(&mut self, vbr: bool) { ... }
fn get_vbr(&mut self) -> bool { ... }
fn set_vbr_quality(&mut self, quality: f32) { ... }
fn get_vbr_quality(&mut self) -> f32 { ... }
fn set_vad(&mut self, vad: bool) { ... }
fn get_vad(&mut self) -> bool { ... }
fn set_abr(&mut self, abr: i32) { ... }
fn get_abr(&mut self) -> i32 { ... }
fn set_quality(&mut self, quality: i32) { ... }
fn set_bitrate(&mut self, bitrate: i32) { ... }
fn get_bitrate(&mut self) -> i32 { ... }
fn set_sampling_rate(&mut self, samplingrate: i32) { ... }
fn get_sampling_rate(&mut self) -> i32 { ... }
fn reset_state(&mut self) { ... }
fn set_submode_encoding(&mut self, submode: bool) { ... }
fn get_submode_encoding(&mut self) -> bool { ... }
fn get_lookahead(&mut self) -> i32 { ... }
fn set_plc_tuning(&mut self, tuning: i32) { ... }
fn get_plc_tuning(&mut self) -> i32 { ... }
fn set_vbr_max_bitrate(&mut self, max_bitrate: i32) { ... }
fn get_vbr_max_bitrate(&mut self) -> i32 { ... }
fn set_highpass(&mut self, highpass: bool) { ... }
fn get_highpass(&mut self) -> bool { ... }
}Expand description
Trait for the control functions of the encoder and decoder
This trait is implemented for both the encoder and decoder, and provides a common interface for the control functions of both.
ctl is the only function that needs to be implemented, and is used to call
the control functions of the underlying speex library.
This trait is sealed, and cannot be implemented outside of this crate.
Required Methods§
Sourceunsafe fn ctl(
&mut self,
request: i32,
ptr: *mut c_void,
) -> Result<(), ControlError>
unsafe fn ctl( &mut self, request: i32, ptr: *mut c_void, ) -> Result<(), ControlError>
Calls a control function of the underlying speex library
§Safety
Implementations of this function call the control functions of the underlying speex library, and as such are unsafe. The caller must ensure that the parameters passed to this function are valid.
Provided Methods§
Sourcefn check_error(err_code: i32, param: Option<i32>) -> Result<(), ControlError>
fn check_error(err_code: i32, param: Option<i32>) -> Result<(), ControlError>
Internal function used to convert the error codes returned by the control function into a result type
Sourcefn get_frame_size(&mut self) -> i32
fn get_frame_size(&mut self) -> i32
Gets the frame size (in samples) of the encoder/decoder
Sourcefn set_vbr_quality(&mut self, quality: f32)
fn set_vbr_quality(&mut self, quality: f32)
Sets the VBR quality of the encoder/decoder
The value should be between 0 and 10, with 10 being the highest quality.
Sourcefn get_vbr_quality(&mut self) -> f32
fn get_vbr_quality(&mut self) -> f32
Gets the VBR quality of the encoder/decoder
Sourcefn set_quality(&mut self, quality: i32)
fn set_quality(&mut self, quality: i32)
Sets the overall quality of the encoder/decoder The value should be between 0 and 10, with 10 being the highest quality. Default is 8.
Sourcefn set_bitrate(&mut self, bitrate: i32)
fn set_bitrate(&mut self, bitrate: i32)
Sets the current bitrate of the encoder/decoder
Sourcefn get_bitrate(&mut self) -> i32
fn get_bitrate(&mut self) -> i32
Gets the current bitrate of the encoder/decoder
Sourcefn set_sampling_rate(&mut self, samplingrate: i32)
fn set_sampling_rate(&mut self, samplingrate: i32)
Sets the sampling rate used for bitrate computation
Sourcefn get_sampling_rate(&mut self) -> i32
fn get_sampling_rate(&mut self) -> i32
Gets the sampling rate used for bitrate computation
Sourcefn reset_state(&mut self)
fn reset_state(&mut self)
resets the encoder/decoder memories to zero
Sourcefn set_submode_encoding(&mut self, submode: bool)
fn set_submode_encoding(&mut self, submode: bool)
Sets whether submode encoding is done in each frame
Note that false breaks the specification for the format
Sourcefn get_submode_encoding(&mut self) -> bool
fn get_submode_encoding(&mut self) -> bool
Gets whether submode encoding is enabled or not
Sourcefn get_lookahead(&mut self) -> i32
fn get_lookahead(&mut self) -> i32
Gets the lookahead value currently in use by the encoder/decoder
Sum the lookahead of a Speex decoder and the lookahead of a Speex encoder to get the total lookahead.
Sourcefn set_plc_tuning(&mut self, tuning: i32)
fn set_plc_tuning(&mut self, tuning: i32)
Sets tuning for Packet-Loss Concealment (expected loss rate)
Sourcefn get_plc_tuning(&mut self) -> i32
fn get_plc_tuning(&mut self) -> i32
Gets current Packet-Loss Concealment tuning value
Sourcefn set_vbr_max_bitrate(&mut self, max_bitrate: i32)
fn set_vbr_max_bitrate(&mut self, max_bitrate: i32)
Sets the max bit-rate allowed in VBR mode
Sourcefn get_vbr_max_bitrate(&mut self) -> i32
fn get_vbr_max_bitrate(&mut self) -> i32
Gets the max bit-rate allowed in VBR mode
Sourcefn set_highpass(&mut self, highpass: bool)
fn set_highpass(&mut self, highpass: bool)
Enables or disables highpass filtering of the input/output
Sourcefn get_highpass(&mut self) -> bool
fn get_highpass(&mut self) -> bool
Gets whether highpass filtering of the input/output is enabled
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.