pub struct EncoderConfig {
pub channels: u32,
pub bits_per_sample: u32,
pub sample_rate: u32,
pub block_size: u32,
pub compression_level: u32,
pub md5: bool,
}Expand description
Audio format and compression settings for an Encoder.
Build one with EncoderConfig::new (libFLAC’s defaults: compression level 8,
4096-sample blocks, MD5 on) or EncoderConfig::chd (MAME/CHD’s exact
configuration), then adjust with the with_* methods if needed.
Fields§
§channels: u32Number of channels, 1–8. Stereo (2) enables mid/side decorrelation.
bits_per_sample: u32Bits per sample: 8, 12, 16, 20, 24, or 32.
sample_rate: u32Sample rate in Hz.
block_size: u32Fixed block size in samples (the final frame may be shorter). libFLAC’s default is 4096; CHD uses 2048.
compression_level: u32Compression preset, 0 (fastest) … 8 (smallest); values above 8 clamp to 8.
md5: boolWhether STREAMINFO carries the audio MD5 signature (libFLAC’s --no-md5-sum,
and CHD, set this false).
Implementations§
Source§impl EncoderConfig
impl EncoderConfig
Sourcepub fn new(channels: u32, bits_per_sample: u32, sample_rate: u32) -> Self
pub fn new(channels: u32, bits_per_sample: u32, sample_rate: u32) -> Self
A config for the given format at libFLAC’s defaults: compression level 8, 4096-sample blocks, MD5 enabled.
Sourcepub fn chd(block_size: u32) -> Self
pub fn chd(block_size: u32) -> Self
The exact configuration MAME/CHD uses: 2-channel / 16-bit / 44.1 kHz,
compression level 8, MD5 off, and the given fixed block_size (CHD
typically uses 2048). Pair with Encoder::encode_frames for the raw frame
bytes CHD embeds.
Sourcepub fn with_compression_level(self, level: u32) -> Self
pub fn with_compression_level(self, level: u32) -> Self
Set the compression level (0–8).
Sourcepub fn with_block_size(self, block_size: u32) -> Self
pub fn with_block_size(self, block_size: u32) -> Self
Set the fixed block size in samples.
Trait Implementations§
Source§impl Clone for EncoderConfig
impl Clone for EncoderConfig
Source§fn clone(&self) -> EncoderConfig
fn clone(&self) -> EncoderConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more