#[non_exhaustive]pub struct AudioFormat {
pub codec: Codec,
pub sample_rate: u32,
pub channels: u8,
pub bit_depth: u8,
pub codec_header: Option<Vec<u8>>,
}Expand description
The audio format a stream announces.
The fields are the wire values of the stream announcement, unchanged. For Codec::Pcm the
samples are signed 16-bit little-endian when bit_depth is 16, interleaved by channel; other
depths keep the same convention scaled to the announced width.
The struct is non-exhaustive so a later protocol revision can add a field without breaking a
sink implementation. A sink only receives it from Sink::open.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.codec: CodecCodec of the stream.
sample_rate: u32Sample rate in hertz.
channels: u8Number of interleaved channels.
bit_depth: u8Bits per sample; meaningful for Codec::Pcm and Codec::Flac.
codec_header: Option<Vec<u8>>Codec header carried by the stream announcement, decoded from its base64 form.
For FLAC this is the fLaC marker followed by STREAMINFO; a decoder needs it before the
first frame. Absent for PCM and Opus. The bytes are exactly what the server sent.