pub struct AudioConfig {
pub sample_rate: u32,
pub channels: u16,
pub bits_per_sample: u16,
pub coding: AudioCoding,
pub encoder_delay: u32,
}Expand description
The optional audio track of an Mp4StreamWriter.
Fields§
§sample_rate: u32Samples per second.
channels: u16Channel count.
bits_per_sample: u16Bits per sample (16 for PCM; what the encoder reports for AAC).
coding: AudioCodingHow the samples are coded.
encoder_delay: u32Samples the encoder emitted before the first real one, to be skipped on playback via an edit list.
A transform codec cannot start cold: AAC’s first packets carry the
window it needed to get going, and the content proper begins after them
— 2048 samples for the usual two-frame priming, which is 43 ms and
plainly visible against a picture. The samples stay in the file, because
the decoder needs them; an elst is how the format says “begin here”.
Implementations§
Source§impl AudioConfig
impl AudioConfig
Sourcepub fn pcm_s16le(sample_rate: u32, channels: u16) -> Self
pub fn pcm_s16le(sample_rate: u32, channels: u16) -> Self
Signed 16-bit little-endian interleaved PCM, stored as sowt.
Sourcepub fn aac(
sample_rate: u32,
channels: u16,
asc: Vec<u8>,
encoder_delay: u32,
) -> Self
pub fn aac( sample_rate: u32, channels: u16, asc: Vec<u8>, encoder_delay: u32, ) -> Self
AAC, with the AudioSpecificConfig its decoder needs.
encoder_delay is in samples; see the field. Zero if the encoder has
already accounted for it, or you would rather not say.
Sourcepub fn bytes_per_frame(&self) -> usize
pub fn bytes_per_frame(&self) -> usize
Bytes in one audio frame across all channels. PCM only — an AAC packet is its own size.
Trait Implementations§
Auto Trait Implementations§
impl Forget for AudioConfig
impl Freeze for AudioConfig
impl Move for AudioConfig
impl RefUnwindSafe for AudioConfig
impl Send for AudioConfig
impl Sync for AudioConfig
impl Unpin for AudioConfig
impl UnsafeUnpin for AudioConfig
impl UnwindSafe for AudioConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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