pub struct Options { /* private fields */ }Expand description
FLAC encoding options
Implementations§
Source§impl Options
impl Options
Sourcepub fn block_size(self, block_size: u16) -> Result<Self, OptionsError>
pub fn block_size(self, block_size: u16) -> Result<Self, OptionsError>
Sets new block size
Block size must be ≥ 16
For subset streams, this must be ≤ 4608 if the sample rate is ≤ 48 kHz - or ≤ 16384 for higher sample rates.
Sourcepub fn max_lpc_order(
self,
max_lpc_order: Option<u8>,
) -> Result<Self, OptionsError>
pub fn max_lpc_order( self, max_lpc_order: Option<u8>, ) -> Result<Self, OptionsError>
Sets new maximum LPC order
The valid range is: 0 < max_lpc_order ≤ 32
A value of None means that no LPC subframes will be encoded.
Sourcepub fn max_partition_order(
self,
max_partition_order: u32,
) -> Result<Self, OptionsError>
pub fn max_partition_order( self, max_partition_order: u32, ) -> Result<Self, OptionsError>
Sets maximum residual partion order.
The valid range is: 0 ≤ max_partition_order ≤ 15
Sourcepub fn mid_side(self, mid_side: bool) -> Self
pub fn mid_side(self, mid_side: bool) -> Self
Whether to use mid-side encoding
The default is true.
Sourcepub fn fast_channel_correlation(self, fast: bool) -> Self
pub fn fast_channel_correlation(self, fast: bool) -> Self
Whether to calculate the best channel correlation quickly
The default is false
Sourcepub fn padding(self, size: u32) -> Result<Self, OptionsError>
pub fn padding(self, size: u32) -> Result<Self, OptionsError>
Updates size of padding block
size must be < 2²⁴
If size is set to 0, removes the block entirely.
The default is to add a 4096 byte padding block.
Sourcepub fn no_padding(self) -> Self
pub fn no_padding(self) -> Self
Remove any padding blocks from metadata
This makes the file smaller, but will likely require rewriting it if any metadata needs to be modified later.
Sourcepub fn tag<S>(self, field: &str, value: S) -> Selfwhere
S: Display,
pub fn tag<S>(self, field: &str, value: S) -> Selfwhere
S: Display,
Adds new tag to comment metadata block
Creates new crate::metadata::VorbisComment block if not already present.
Sourcepub fn comment(self, comment: VorbisComment) -> Self
pub fn comment(self, comment: VorbisComment) -> Self
Replaces entire crate::metadata::VorbisComment metadata block
This may be more convenient when adding many fields at once.
Sourcepub fn picture(self, picture: Picture) -> Self
pub fn picture(self, picture: Picture) -> Self
Add new crate::metadata::Picture block to metadata
Files may contain multiple crate::metadata::Picture blocks,
and this adds a new block each time it is used.
Sourcepub fn cuesheet(self, cuesheet: Cuesheet) -> Self
pub fn cuesheet(self, cuesheet: Cuesheet) -> Self
Add new crate::metadata::Cuesheet block to metadata
Files may (theoretically) contain multiple crate::metadata::Cuesheet blocks,
and this adds a new block each time it is used.
In practice, CD images almost always use only a single cue sheet.
Sourcepub fn application(self, application: Application) -> Self
pub fn application(self, application: Application) -> Self
Add new crate::metadata::Application block to metadata
Files may contain multiple crate::metadata::Application blocks,
and this adds a new block each time it is used.
Sourcepub fn seektable_seconds(self, seconds: u8) -> Self
pub fn seektable_seconds(self, seconds: u8) -> Self
Generate crate::metadata::SeekTable with the given number of seconds between seek points
The default is to generate a SEEKTABLE with 10 seconds between seek points.
If seconds is 0, removes the SEEKTABLE block.
The interval between seek points may be larger than requested if the encoder’s block size is larger than the seekpoint interval.
Sourcepub fn seektable_frames(self, frames: usize) -> Self
pub fn seektable_frames(self, frames: usize) -> Self
Generate crate::metadata::SeekTable with the given number of FLAC frames between seek points
If frames is 0, removes the SEEKTABLE block
Sourcepub fn no_seektable(self) -> Self
pub fn no_seektable(self) -> Self
Do not generate a seektable in our encoded file
Sourcepub fn add_block<B>(&mut self, block: B) -> &mut Selfwhere
B: PortableMetadataBlock,
pub fn add_block<B>(&mut self, block: B) -> &mut Selfwhere
B: PortableMetadataBlock,
Add new block to metadata
If the block may only occur once in a file, any previous block of that same type is removed.
Sourcepub fn add_blocks<B>(&mut self, iter: impl IntoIterator<Item = B>) -> &mut Selfwhere
B: PortableMetadataBlock,
pub fn add_blocks<B>(&mut self, iter: impl IntoIterator<Item = B>) -> &mut Selfwhere
B: PortableMetadataBlock,
Add new blocks to metadata
If the block may only occur once in a file, any current block of that type is replaced by the final block in the iterator - if any. Otherwise, all blocks in the iterator are used.
Sourcepub fn overwrite(self) -> Self
pub fn overwrite(self) -> Self
Overwrites existing file if it already exists
This only applies to encoding functions which create files from paths.
The default is to not overwrite files if they already exist.