pub struct Builder { /* private fields */ }Expand description
Builder of C LAME encoder.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new() -> Option<Self>
pub fn new() -> Option<Self>
Creates new encoder with default parameters: J-Stereo, 44.1khz 128kbps CBR mp3 file at quality 5
Returns None if unable to allocate struct.
Sourcepub unsafe fn as_ptr(&mut self) -> *mut lame_global_flags
pub unsafe fn as_ptr(&mut self) -> *mut lame_global_flags
Get access to underlying LAME structure, without dropping ownership.
User must guarantee not to close or dealloc this pointer
Sourcepub fn set_sample_rate(&mut self, rate: u32) -> Result<(), BuildError>
pub fn set_sample_rate(&mut self, rate: u32) -> Result<(), BuildError>
Sets sample rate.
Defaults to 44_100.
Returns whether it is supported or not.
Sourcepub fn with_sample_rate(self, rate: u32) -> Result<Self, BuildError>
pub fn with_sample_rate(self, rate: u32) -> Result<Self, BuildError>
Sets sample rate using the builder pattern.
Defaults to 44_100.
Returns an error if it is not supported.
Sourcepub fn set_num_channels(&mut self, num: u8) -> Result<(), BuildError>
pub fn set_num_channels(&mut self, num: u8) -> Result<(), BuildError>
Sets number of channels.
Defaults to 2.
Returns whether it is supported or not.
Sourcepub fn with_num_channels(self, num: u8) -> Result<Self, BuildError>
pub fn with_num_channels(self, num: u8) -> Result<Self, BuildError>
Sets sample rate using the builder pattern.
Defaults to 2.
Returns an error if it is not supported.
Sourcepub fn set_brate(&mut self, brate: Bitrate) -> Result<(), BuildError>
pub fn set_brate(&mut self, brate: Bitrate) -> Result<(), BuildError>
Sets bitrate (as kbps).
Defaults to compression ratio of 11.
Returns whether it is supported or not.
Sourcepub fn with_brate(self, brate: Bitrate) -> Result<Self, BuildError>
pub fn with_brate(self, brate: Bitrate) -> Result<Self, BuildError>
Sets bitrate (as kbps) using the builder pattern.
Defaults to compression ratio of 11.
Returns an error if it is not supported.
Sourcepub fn set_mode(&mut self, mode: Mode) -> Result<(), BuildError>
pub fn set_mode(&mut self, mode: Mode) -> Result<(), BuildError>
Sets MPEG mode.
Default is picked by LAME depending on compression ration and input channels.
Returns whether it is supported or not.
Sourcepub fn with_mode(self, mode: Mode) -> Result<Self, BuildError>
pub fn with_mode(self, mode: Mode) -> Result<Self, BuildError>
Sets MPEG mode using the builder pattern.
Default is picked by LAME depending on compression ration and input channels.
Returns an error if it is not supported.
Sourcepub fn set_quality(&mut self, quality: Quality) -> Result<(), BuildError>
pub fn set_quality(&mut self, quality: Quality) -> Result<(), BuildError>
Sets quality.
Default is good one(5)
Returns whether it is supported or not.
Sourcepub fn with_quality(self, quality: Quality) -> Result<Self, BuildError>
pub fn with_quality(self, quality: Quality) -> Result<Self, BuildError>
Sets quality using the builder pattern.
Default is good one(5)
Returns an error if it is not supported.
Sourcepub fn set_vbr_quality(&mut self, quality: Quality) -> Result<(), BuildError>
pub fn set_vbr_quality(&mut self, quality: Quality) -> Result<(), BuildError>
Sets VBR quality.
Returns whether it is supported or not.
Sourcepub fn with_vbr_quality(self, quality: Quality) -> Result<Self, BuildError>
pub fn with_vbr_quality(self, quality: Quality) -> Result<Self, BuildError>
Sets VBR quality using the builder pattern.
Returns an error if it is not supported.
Sourcepub fn set_to_write_vbr_tag(&mut self, value: bool) -> Result<(), BuildError>
pub fn set_to_write_vbr_tag(&mut self, value: bool) -> Result<(), BuildError>
Sets whether to write VBR tag.
Default is true.
Returns whether it is supported or not.
Sourcepub fn with_to_write_vbr_tag(self, value: bool) -> Result<Self, BuildError>
pub fn with_to_write_vbr_tag(self, value: bool) -> Result<Self, BuildError>
Sets whether to write VBR tag using the builder pattern.
Default is true.
Returns an error if it is not supported.
Sourcepub fn set_vbr_mode(&mut self, value: VbrMode) -> Result<(), BuildError>
pub fn set_vbr_mode(&mut self, value: VbrMode) -> Result<(), BuildError>
Sets VBR mode.
Default is off (i.e. CBR)
Returns whether it is supported or not.
Sourcepub fn with_vbr_mode(self, value: VbrMode) -> Result<Self, BuildError>
pub fn with_vbr_mode(self, value: VbrMode) -> Result<Self, BuildError>
Sets VBR mode using the bulder pattern.
Default is off (i.e. CBR)
Returns an error if it is not supported.
Sourcepub fn set_id3_tag(&mut self, value: Id3Tag<'_>) -> Result<(), Id3TagError>
pub fn set_id3_tag(&mut self, value: Id3Tag<'_>) -> Result<(), Id3TagError>
Sets id3tag tag.
If FlushGap is used, then v1 will not be added.
But v2 is always added at the beginning.
Returns whether it is supported or not.
Sourcepub fn with_id3_tag(self, value: Id3Tag<'_>) -> Result<Self, Id3TagError>
pub fn with_id3_tag(self, value: Id3Tag<'_>) -> Result<Self, Id3TagError>
Sets id3tag tag using the builder pattern.
If FlushGap is used, then v1 will not be added.
Returns an error if it is not supported.
Sourcepub fn build(self) -> Result<Encoder, BuildError>
pub fn build(self) -> Result<Encoder, BuildError>
Attempts to initialize encoder with specified parameters.
Returns None if parameters are invalid or incompatible.