pub struct Encoder { /* private fields */ }Expand description
LAME Encoder.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn sample_rate(&self) -> u32
pub fn sample_rate(&self) -> u32
Returns sample rate.
Sourcepub fn num_channels(&self) -> u8
pub fn num_channels(&self) -> u8
Returns number of channels.
Sourcepub fn encode(
&mut self,
input: impl EncoderInput,
output: &mut [MaybeUninit<u8>],
) -> Result<usize, EncodeError>
pub fn encode( &mut self, input: impl EncoderInput, output: &mut [MaybeUninit<u8>], ) -> Result<usize, EncodeError>
Attempts to encode PCM data, writing whatever available onto output buffer
§Arguments:
input- Data input. Can be MonoPcm, DualPcm or InterleavedPcmoutput- Output buffer to write into.
§Result:
On success, returns number of bytes written (can be 0). Otherwise returns error indicating potential issue.
Sourcepub fn encode_to_vec(
&mut self,
input: impl EncoderInput,
output: &mut Vec<u8>,
) -> Result<usize, EncodeError>
pub fn encode_to_vec( &mut self, input: impl EncoderInput, output: &mut Vec<u8>, ) -> Result<usize, EncodeError>
Attempts to encode PCM data, writing whatever available onto output buffer
output size is adjusted on success only
Refer for details to encode()
Sourcepub fn flush<T: EncoderFlush>(
&mut self,
output: &mut [MaybeUninit<u8>],
) -> Result<usize, EncodeError>
pub fn flush<T: EncoderFlush>( &mut self, output: &mut [MaybeUninit<u8>], ) -> Result<usize, EncodeError>
Attempts flush all data, writing whatever available onto output buffer
Padding with 0 to complete MP3
§Type:
- FlushNoGap - performs flush, using ancillary data to fill gaps;
- FlushGap - performs flush, padding with 0;
§Arguments:
output- Output buffer to write into. As it is final action, you need at least 7200 bytes to hold at MP3 data.
§Result:
On success, returns number of bytes written (can be 0). Otherwise returns error indicating potential issue.
Sourcepub fn flush_to_vec<T: EncoderFlush>(
&mut self,
output: &mut Vec<u8>,
) -> Result<usize, EncodeError>
pub fn flush_to_vec<T: EncoderFlush>( &mut self, output: &mut Vec<u8>, ) -> Result<usize, EncodeError>
Attempts flush all data, writing whatever available onto output buffer.
output size is adjusted on success only
Refer for details to flush()
Trait Implementations§
impl Send for Encoder
According to LAME 3.99.5 HACKING, it is thread-safe.
impl Sync for Encoder
According to LAME 3.99.5 HACKING, it is thread-safe.