pub struct AudioFormat {
pub sample_format: Sample,
pub sample_rate: u32,
pub channels: u16,
}Expand description
A complete uncompressed-audio format description.
Unlike a (sample_rate, channels) tuple, this also carries the sample
representation, so it can be passed directly from a hardware endpoint
such as WasapiCaptureSource/WasapiRenderer to an
crate::elements::AudioResampler/crate::elements::SwAudioEncoder
without guessing either one. Kept directly under elements rather than
under any one of those (same reasoning as
crate::elements::RtspTransport/crate::elements::VideoFormat’s own
placement): it crosses source/filter/sink, not owned by any single one.
Fields§
§sample_format: SampleIn-memory representation and planar/packed layout of each sample.
sample_rate: u32Number of samples per channel per second, in hertz.
channels: u16Number of interleaved or planar audio channels.
Implementations§
Source§impl AudioFormat
impl AudioFormat
Sourcepub fn new(sample_format: Sample, sample_rate: u32, channels: u16) -> Self
pub fn new(sample_format: Sample, sample_rate: u32, channels: u16) -> Self
Creates an audio format from its sample representation, rate, and channel count.
Sourcepub fn channel_layout(self) -> ChannelLayout
pub fn channel_layout(self) -> ChannelLayout
Returns FFmpeg’s default channel layout for Self::channels.
Trait Implementations§
Source§impl Clone for AudioFormat
impl Clone for AudioFormat
Source§fn clone(&self) -> AudioFormat
fn clone(&self) -> AudioFormat
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more