pub struct AudioOnlyConfig {
pub input_codec: AudioCodecId,
pub output_codec: AudioCodecId,
pub sample_rate: u32,
pub channels: u8,
pub bitrate: u32,
}Expand description
Configuration for an audio-only transcode operation.
Fields§
§input_codec: AudioCodecIdCodec of the input audio stream.
output_codec: AudioCodecIdCodec to encode the output audio to.
sample_rate: u32Target sample rate in Hz (e.g. 48000).
channels: u8Number of output channels (1 = mono, 2 = stereo, etc.).
bitrate: u32Target bitrate in bits per second. Ignored for lossless codecs; use 0 to select the codec default.
Implementations§
Source§impl AudioOnlyConfig
impl AudioOnlyConfig
Sourcepub fn new(
input_codec: AudioCodecId,
output_codec: AudioCodecId,
sample_rate: u32,
channels: u8,
bitrate: u32,
) -> Result<Self>
pub fn new( input_codec: AudioCodecId, output_codec: AudioCodecId, sample_rate: u32, channels: u8, bitrate: u32, ) -> Result<Self>
Creates a new AudioOnlyConfig and validates the parameters.
§Errors
Returns TranscodeError::InvalidInput when:
channelsis 0 or greater than 8sample_rateis below 8 000 Hz or above 192 000 Hz
Sourcepub fn opus_stereo() -> Self
pub fn opus_stereo() -> Self
Shortcut: stereo Opus at 128 kbps / 48 kHz.
§Panics
Never panics – the hard-coded values always pass validation.
Sourcepub fn flac_stereo() -> Self
pub fn flac_stereo() -> Self
Shortcut: stereo FLAC lossless at 48 kHz.
§Panics
Never panics – the hard-coded values always pass validation.
Trait Implementations§
Source§impl Clone for AudioOnlyConfig
impl Clone for AudioOnlyConfig
Source§fn clone(&self) -> AudioOnlyConfig
fn clone(&self) -> AudioOnlyConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AudioOnlyConfig
impl RefUnwindSafe for AudioOnlyConfig
impl Send for AudioOnlyConfig
impl Sync for AudioOnlyConfig
impl Unpin for AudioOnlyConfig
impl UnsafeUnpin for AudioOnlyConfig
impl UnwindSafe for AudioOnlyConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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