Struct mp3lame_encoder::Encoder
source · 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 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.
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Encoder
impl !Send for Encoder
impl !Sync for Encoder
impl Unpin for Encoder
impl UnwindSafe for Encoder
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