pub struct AudioCodecParameters {
pub codec: AudioCodecId,
pub profile: Option<CodecProfile>,
pub sample_rate: Option<u32>,
pub sample_format: Option<SampleFormat>,
pub bits_per_sample: Option<u32>,
pub bits_per_coded_sample: Option<u32>,
pub channels: Option<Channels>,
pub max_frames_per_packet: Option<u64>,
pub verification_check: Option<VerificationCheck>,
pub frames_per_block: Option<u64>,
pub extra_data: Option<Box<[u8]>>,
}Expand description
Codec parameters for audio codecs.
Fields§
§codec: AudioCodecIdThe codec ID.
profile: Option<CodecProfile>The codec-defined profile.
sample_rate: Option<u32>The sample rate of the audio in Hz.
sample_format: Option<SampleFormat>The sample format of an audio sample.
bits_per_sample: Option<u32>The number of bits per one decoded audio sample.
This may be less-than the intrinsic bit-width of the data type of the decoded samples. In such cases, any extra bits are 0 and shouldn’t be considered as part of the sample. It will never be greater-than the intrinsic bit-width of the sample data type.
bits_per_coded_sample: Option<u32>The number of bits per one encoded audio sample.
In rare cases where audio samples are encoded with fewer bits than the decoded bits-per-sample, this indicates the number of bits per one encoded audio sample so that a decoder may scale the sample to the correct number of bits. This will never be greater-than the number of bits per decoded sample.
If None, assumed to equal bits_per_sample.
channels: Option<Channels>Audio channels.
max_frames_per_packet: Option<u64>The maximum number of frames a packet will contain.
verification_check: Option<VerificationCheck>A method and expected value that may be used to perform verification on the decoded audio.
frames_per_block: Option<u64>The number of frames per block, in case packets are seperated in multiple blocks.
extra_data: Option<Box<[u8]>>Extra data (defined by the codec).
Implementations§
Source§impl AudioCodecParameters
impl AudioCodecParameters
pub fn new() -> AudioCodecParameters
Sourcepub fn for_codec(&mut self, codec: AudioCodecId) -> &mut Self
pub fn for_codec(&mut self, codec: AudioCodecId) -> &mut Self
Provide the AudioCodecId.
Sourcepub fn with_profile(&mut self, profile: CodecProfile) -> &mut Self
pub fn with_profile(&mut self, profile: CodecProfile) -> &mut Self
Provide codec profile.
Sourcepub fn with_sample_rate(&mut self, sample_rate: u32) -> &mut Self
pub fn with_sample_rate(&mut self, sample_rate: u32) -> &mut Self
Provide the sample rate in Hz.
Sourcepub fn with_sample_format(&mut self, sample_format: SampleFormat) -> &mut Self
pub fn with_sample_format(&mut self, sample_format: SampleFormat) -> &mut Self
Provide the codec’s decoded audio sample format.
Sourcepub fn with_bits_per_sample(&mut self, bits_per_sample: u32) -> &mut Self
pub fn with_bits_per_sample(&mut self, bits_per_sample: u32) -> &mut Self
Provide the bit per sample of a decoded audio sample.
Sourcepub fn with_bits_per_coded_sample(
&mut self,
bits_per_coded_sample: u32,
) -> &mut Self
pub fn with_bits_per_coded_sample( &mut self, bits_per_coded_sample: u32, ) -> &mut Self
Provide the bits per sample of an encoded audio sample.
Sourcepub fn with_channels(&mut self, channels: Channels) -> &mut Self
pub fn with_channels(&mut self, channels: Channels) -> &mut Self
Provide the channel map.
Sourcepub fn with_max_frames_per_packet(&mut self, len: u64) -> &mut Self
pub fn with_max_frames_per_packet(&mut self, len: u64) -> &mut Self
Provide the maximum number of frames per packet.
Sourcepub fn with_frames_per_block(&mut self, len: u64) -> &mut Self
pub fn with_frames_per_block(&mut self, len: u64) -> &mut Self
Provide the maximum number of frames per packet.
Sourcepub fn with_extra_data(&mut self, data: Box<[u8]>) -> &mut Self
pub fn with_extra_data(&mut self, data: Box<[u8]>) -> &mut Self
Provide codec extra data.
Sourcepub fn with_verification_code(&mut self, code: VerificationCheck) -> &mut Self
pub fn with_verification_code(&mut self, code: VerificationCheck) -> &mut Self
Provide a verification code of the final decoded audio.
Trait Implementations§
Source§impl Clone for AudioCodecParameters
impl Clone for AudioCodecParameters
Source§fn clone(&self) -> AudioCodecParameters
fn clone(&self) -> AudioCodecParameters
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more