Struct lame::Lame
[−]
[src]
pub struct Lame { /* fields omitted */ }
Represents a Lame encoder context.
Methods
impl Lame
[src]
fn new() -> Option<Lame>
[src]
Creates a new Lame encoder context with default parameters.
Returns None if liblame could not allocate its internal structures.
fn sample_rate(&self) -> u32
[src]
Sample rate of input PCM data. Defaults to 44100 Hz.
fn set_sample_rate(&mut self, sample_rate: u32) -> Result<(), Error>
[src]
Sets sample rate of input PCM data.
fn channels(&self) -> u8
[src]
Number of channels in input stream. Defaults to 2.
fn set_channels(&mut self, channels: u8) -> Result<(), Error>
[src]
Sets number of channels in input stream.
fn quality(&self) -> u8
[src]
LAME quality parameter. See set_quality
for more details.
fn set_quality(&mut self, quality: u8) -> Result<(), Error>
[src]
Sets LAME's quality parameter. True quality is determined by the bitrate but this parameter affects quality by influencing whether LAME selects expensive or cheap algorithms.
This is a number from 0 to 9 (inclusive), where 0 is the best and slowest and 9 is the worst and fastest.
fn kilobitrate(&self) -> i32
[src]
Returns the output bitrate in kilobits per second.
fn set_kilobitrate(&mut self, quality: i32) -> Result<(), Error>
[src]
Sets the target output bitrate. This value is in kilobits per second, so passing 320 would select an output bitrate of 320kbps.
fn init_params(&mut self) -> Result<(), Error>
[src]
Sets more internal parameters according to the other basic parameter settings.
fn encode(
&mut self,
pcm_left: &[i16],
pcm_right: &[i16],
mp3_buffer: &mut [u8]
) -> Result<usize, EncodeError>
[src]
&mut self,
pcm_left: &[i16],
pcm_right: &[i16],
mp3_buffer: &mut [u8]
) -> Result<usize, EncodeError>
Encodes PCM data into MP3 frames. The pcm_left
and pcm_right
buffers must be of the same length, or this function will panic.