Skip to main content

ApplyOptions

Struct ApplyOptions 

Source
#[non_exhaustive]
pub struct ApplyOptions { pub steps: i32, pub track_result: Option<ReplayGainResult>, pub album_info: Option<AacAlbumInfo>, pub prevent_clipping: bool, pub wrap: bool, pub preserve_timestamp: bool, pub use_temp_file: bool, pub write_undo: bool, pub write_replaygain_tags: bool, pub use_id3v2: bool, pub channel: Option<Channel>, pub skip_clipping_check: bool, }
Expand description

Driver configuration for apply_with_options.

Construct via ApplyOptions::new and tweak fields directly — this struct is data-only, no builder methods.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§steps: i32

Requested gain in MP3 gain steps (1 step = 1.5 dB).

§track_result: Option<ReplayGainResult>

Per-track ReplayGain analysis. Provides peak() for the ReplayGain-based clipping check and gain_db() / peak() for ReplayGain tag writing.

§album_info: Option<AacAlbumInfo>

Album-level info that feeds the album fields of the ReplayGain tags.

§prevent_clipping: bool

-k: if the requested gain would clip, cap it at the available headroom instead of applying as-is.

§wrap: bool

-w: wrap around 0–255 instead of saturating. Also disables the clipping check (wrap mode is intentionally lossy).

§preserve_timestamp: bool

-p: restore the file’s mtime after writing.

§use_temp_file: bool

-t: historically opted into temp-file writes. All file rewrites now go through a sibling temp file + atomic rename unconditionally (issue #227), so the flag is accepted but has no effect.

§write_undo: bool

Record an undo tag (APE for MP3, MP4 freeform for AAC, ID3v2 TXXX when Self::use_id3v2 is on).

§write_replaygain_tags: bool

Write ReplayGain metadata tags. Requires Self::track_result to be set. AAC writes to mp4 freeform metadata; MP3 writes ID3v2 TXXX frames when Self::use_id3v2 is on, otherwise APEv2 REPLAYGAIN_* items (issue #204).

§use_id3v2: bool

-s i: MP3 only — use ID3v2 TXXX frames for undo and ReplayGain instead of APE.

§channel: Option<Channel>

-l: MP3 only — apply gain to a single channel (Stereo / Dual Channel) instead of all channels. AAC has no per-channel apply path; setting this on an AAC file is an error.

§skip_clipping_check: bool

Skip the pre-apply clipping check entirely. For callers that will never surface ApplyReport::clipping_detected (-c / -q, or the channel path), the headroom check’s full-file analyze() is pure waste (issue #232). Ignored when Self::prevent_clipping is on — -k needs the check to cap the gain.

Implementations§

Source§

impl ApplyOptions

Source

pub fn new(steps: i32) -> Self

Construct with a requested step count and “safe” defaults (undo on, no temp file, no clipping prevention, no tag writing).

Trait Implementations§

Source§

impl Clone for ApplyOptions

Source§

fn clone(&self) -> ApplyOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ApplyOptions

Source§

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

Formats the value using the given formatter. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.