Struct symphonia_core::codecs::CodecParameters
source · pub struct CodecParameters {Show 17 fields
pub codec: CodecType,
pub sample_rate: Option<u32>,
pub time_base: Option<TimeBase>,
pub n_frames: Option<u64>,
pub start_ts: u64,
pub sample_format: Option<SampleFormat>,
pub bits_per_sample: Option<u32>,
pub bits_per_coded_sample: Option<u32>,
pub channels: Option<Channels>,
pub channel_layout: Option<Layout>,
pub delay: Option<u32>,
pub padding: Option<u32>,
pub max_frames_per_packet: Option<u64>,
pub packet_data_integrity: bool,
pub verification_check: Option<VerificationCheck>,
pub frames_per_block: Option<u64>,
pub extra_data: Option<Box<[u8]>>,
}
Expand description
Codec parameters stored in a container format’s headers and metadata may be passed to a codec
using the CodecParameters
structure.
Fields§
§codec: CodecType
The codec type.
sample_rate: Option<u32>
The sample rate of the audio in Hz.
time_base: Option<TimeBase>
The timebase of the stream.
The timebase is the length of time in seconds of a single tick of a timestamp or duration. It can be used to convert any timestamp or duration related to the stream into seconds.
n_frames: Option<u64>
The length of the stream in number of frames.
If a timebase is available, this field can be used to calculate the total duration of the
stream in seconds by using TimeBase::calc_time
and passing the number of frames as the
timestamp.
start_ts: u64
The timestamp of the first frame.
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.
bits_per_coded_sample: Option<u32>
The number of bits per one encoded audio sample.
channels: Option<Channels>
A bitmask of all channels in the stream.
channel_layout: Option<Layout>
The channel layout.
delay: Option<u32>
The number of leading frames inserted by the encoder that should be skipped during playback.
padding: Option<u32>
The number of trailing frames inserted by the encoder for padding that should be skipped during playback.
max_frames_per_packet: Option<u64>
The maximum number of frames a packet will contain.
packet_data_integrity: bool
The demuxer guarantees packet data integrity.
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 CodecParameters
impl CodecParameters
pub fn new() -> CodecParameters
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_time_base(&mut self, time_base: TimeBase) -> &mut Self
pub fn with_time_base(&mut self, time_base: TimeBase) -> &mut Self
Provide the TimeBase
.
sourcepub fn with_n_frames(&mut self, n_frames: u64) -> &mut Self
pub fn with_n_frames(&mut self, n_frames: u64) -> &mut Self
Provide the total number of frames.
sourcepub fn with_start_ts(&mut self, start_ts: u64) -> &mut Self
pub fn with_start_ts(&mut self, start_ts: u64) -> &mut Self
Provide the timestamp of the first frame.
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_channel_layout(&mut self, channel_layout: Layout) -> &mut Self
pub fn with_channel_layout(&mut self, channel_layout: Layout) -> &mut Self
Provide the channel layout.
sourcepub fn with_delay(&mut self, delay: u32) -> &mut Self
pub fn with_delay(&mut self, delay: u32) -> &mut Self
Provide the number of delay frames.
sourcepub fn with_padding(&mut self, padding: u32) -> &mut Self
pub fn with_padding(&mut self, padding: u32) -> &mut Self
Provide the number of padding frames.
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_packet_data_integrity(&mut self, integrity: bool) -> &mut Self
pub fn with_packet_data_integrity(&mut self, integrity: bool) -> &mut Self
Specify if the packet’s data integrity was guaranteed.
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 CodecParameters
impl Clone for CodecParameters
source§fn clone(&self) -> CodecParameters
fn clone(&self) -> CodecParameters
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more