Skip to main content

AudioCodecParameters

Struct AudioCodecParameters 

Source
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: AudioCodecId

The 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

Source

pub fn new() -> AudioCodecParameters

Source

pub fn for_codec(&mut self, codec: AudioCodecId) -> &mut Self

Provide the AudioCodecId.

Source

pub fn with_profile(&mut self, profile: CodecProfile) -> &mut Self

Provide codec profile.

Source

pub fn with_sample_rate(&mut self, sample_rate: u32) -> &mut Self

Provide the sample rate in Hz.

Source

pub fn with_sample_format(&mut self, sample_format: SampleFormat) -> &mut Self

Provide the codec’s decoded audio sample format.

Source

pub fn with_bits_per_sample(&mut self, bits_per_sample: u32) -> &mut Self

Provide the bit per sample of a decoded audio sample.

Source

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.

Source

pub fn with_channels(&mut self, channels: Channels) -> &mut Self

Provide the channel map.

Source

pub fn with_max_frames_per_packet(&mut self, len: u64) -> &mut Self

Provide the maximum number of frames per packet.

Source

pub fn with_frames_per_block(&mut self, len: u64) -> &mut Self

Provide the maximum number of frames per packet.

Source

pub fn with_extra_data(&mut self, data: Box<[u8]>) -> &mut Self

Provide codec extra data.

Source

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

Source§

fn clone(&self) -> AudioCodecParameters

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AudioCodecParameters

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AudioCodecParameters

Source§

fn default() -> AudioCodecParameters

Returns the “default value” for a type. Read more
Source§

impl From<AudioCodecParameters> for CodecParameters

Source§

fn from(value: AudioCodecParameters) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.