Options

Struct Options 

Source
pub struct Options { /* private fields */ }
Expand description

FLAC encoding options

Implementations§

Source§

impl Options

Source

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.

Source

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.

Source

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

Source

pub fn mid_side(self, mid_side: bool) -> Self

Whether to use mid-side encoding

The default is true.

Source

pub fn window(self, window: Window) -> Self

The windowing function to use for input samples

Source

pub fn fast_channel_correlation(self, fast: bool) -> Self

Whether to calculate the best channel correlation quickly

The default is false

Source

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.

Source

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.

Source

pub fn tag<S>(self, field: &str, value: S) -> Self
where S: Display,

Adds new tag to comment metadata block

Creates new crate::metadata::VorbisComment block if not already present.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

pub fn no_seektable(self) -> Self

Do not generate a seektable in our encoded file

Source

pub fn add_block<B>(&mut self, block: B) -> &mut Self

Add new block to metadata

If the block may only occur once in a file, any previous block of that same type is removed.

Source

pub fn add_blocks<B>(&mut self, iter: impl IntoIterator<Item = B>) -> &mut Self

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.

Source

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.

Source

pub fn fast() -> Self

Returns the fastest encoding options

These are tuned to encode as quickly as possible.

Source

pub fn best() -> Self

Returns the fastest encoding options

These are tuned to encode files as small as possible.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Options

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.