pub struct Encoder { /* private fields */ }
Expand description
An Opus encoder with associated state.
Implementations
sourceimpl Encoder
impl Encoder
sourcepub fn new(
sample_rate: u32,
channels: Channels,
mode: Application
) -> Result<Encoder>
pub fn new(
sample_rate: u32,
channels: Channels,
mode: Application
) -> Result<Encoder>
Create and initialize an encoder.
sourcepub fn encode(&mut self, input: &[i16], output: &mut [u8]) -> Result<usize>
pub fn encode(&mut self, input: &[i16], output: &mut [u8]) -> Result<usize>
Encode an Opus frame.
sourcepub fn encode_float(
&mut self,
input: &[f32],
output: &mut [u8]
) -> Result<usize>
pub fn encode_float(
&mut self,
input: &[f32],
output: &mut [u8]
) -> Result<usize>
Encode an Opus frame from floating point input.
sourcepub fn encode_vec(&mut self, input: &[i16], max_size: usize) -> Result<Vec<u8>>
pub fn encode_vec(&mut self, input: &[i16], max_size: usize) -> Result<Vec<u8>>
Encode an Opus frame to a new buffer.
sourcepub fn encode_vec_float(
&mut self,
input: &[f32],
max_size: usize
) -> Result<Vec<u8>>
pub fn encode_vec_float(
&mut self,
input: &[f32],
max_size: usize
) -> Result<Vec<u8>>
Encode an Opus frame from floating point input to a new buffer.
sourcepub fn reset_state(&mut self) -> Result<()>
pub fn reset_state(&mut self) -> Result<()>
Reset the codec state to be equivalent to a freshly initialized state.
sourcepub fn get_final_range(&mut self) -> Result<u32>
pub fn get_final_range(&mut self) -> Result<u32>
Get the final range of the codec’s entropy coder.
sourcepub fn get_bandwidth(&mut self) -> Result<Bandwidth>
pub fn get_bandwidth(&mut self) -> Result<Bandwidth>
Get the encoder’s configured bandpass.
sourcepub fn get_sample_rate(&mut self) -> Result<u32>
pub fn get_sample_rate(&mut self) -> Result<u32>
Get the samping rate the encoder was intialized with.
sourcepub fn set_bitrate(&mut self, value: Bitrate) -> Result<()>
pub fn set_bitrate(&mut self, value: Bitrate) -> Result<()>
Set the encoder’s bitrate.
sourcepub fn get_bitrate(&mut self) -> Result<Bitrate>
pub fn get_bitrate(&mut self) -> Result<Bitrate>
Get the encoder’s bitrate.
sourcepub fn set_vbr_constraint(&mut self, vbr: bool) -> Result<()>
pub fn set_vbr_constraint(&mut self, vbr: bool) -> Result<()>
Enable or disable constrained VBR.
sourcepub fn get_vbr_constraint(&mut self) -> Result<bool>
pub fn get_vbr_constraint(&mut self) -> Result<bool>
Determine if constrained VBR is enabled.
sourcepub fn set_inband_fec(&mut self, value: bool) -> Result<()>
pub fn set_inband_fec(&mut self, value: bool) -> Result<()>
Configures the encoder’s use of inband forward error correction (FEC).
sourcepub fn get_inband_fec(&mut self) -> Result<bool>
pub fn get_inband_fec(&mut self) -> Result<bool>
Gets encoder’s configured use of inband forward error correction.
sourcepub fn set_packet_loss_perc(&mut self, value: i32) -> Result<()>
pub fn set_packet_loss_perc(&mut self, value: i32) -> Result<()>
Sets the encoder’s expected packet loss percentage.
sourcepub fn get_packet_loss_perc(&mut self) -> Result<i32>
pub fn get_packet_loss_perc(&mut self) -> Result<i32>
Gets the encoder’s expected packet loss percentage.
sourcepub fn get_lookahead(&mut self) -> Result<i32>
pub fn get_lookahead(&mut self) -> Result<i32>
Gets the total samples of delay added by the entire codec.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Encoder
impl !Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more