Struct CodecParameters
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]>>,
}
dep_symphonia
only.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§
§impl CodecParameters
impl CodecParameters
pub fn new() -> CodecParameters
pub fn for_codec(&mut self, codec: CodecType) -> &mut CodecParameters
pub fn for_codec(&mut self, codec: CodecType) -> &mut CodecParameters
Provide the CodecType
.
pub fn with_sample_rate(&mut self, sample_rate: u32) -> &mut CodecParameters
pub fn with_sample_rate(&mut self, sample_rate: u32) -> &mut CodecParameters
Provide the sample rate in Hz.
pub fn with_time_base(&mut self, time_base: TimeBase) -> &mut CodecParameters
pub fn with_time_base(&mut self, time_base: TimeBase) -> &mut CodecParameters
Provide the TimeBase
.
pub fn with_n_frames(&mut self, n_frames: u64) -> &mut CodecParameters
pub fn with_n_frames(&mut self, n_frames: u64) -> &mut CodecParameters
Provide the total number of frames.
pub fn with_start_ts(&mut self, start_ts: u64) -> &mut CodecParameters
pub fn with_start_ts(&mut self, start_ts: u64) -> &mut CodecParameters
Provide the timestamp of the first frame.
pub fn with_sample_format(
&mut self,
sample_format: SampleFormat,
) -> &mut CodecParameters
pub fn with_sample_format( &mut self, sample_format: SampleFormat, ) -> &mut CodecParameters
Provide the codec’s decoded audio sample format.
pub fn with_bits_per_sample(
&mut self,
bits_per_sample: u32,
) -> &mut CodecParameters
pub fn with_bits_per_sample( &mut self, bits_per_sample: u32, ) -> &mut CodecParameters
Provide the bit per sample of a decoded audio sample.
pub fn with_bits_per_coded_sample(
&mut self,
bits_per_coded_sample: u32,
) -> &mut CodecParameters
pub fn with_bits_per_coded_sample( &mut self, bits_per_coded_sample: u32, ) -> &mut CodecParameters
Provide the bits per sample of an encoded audio sample.
pub fn with_channels(&mut self, channels: Channels) -> &mut CodecParameters
pub fn with_channels(&mut self, channels: Channels) -> &mut CodecParameters
Provide the channel map.
pub fn with_channel_layout(
&mut self,
channel_layout: Layout,
) -> &mut CodecParameters
pub fn with_channel_layout( &mut self, channel_layout: Layout, ) -> &mut CodecParameters
Provide the channel layout.
pub fn with_delay(&mut self, delay: u32) -> &mut CodecParameters
pub fn with_delay(&mut self, delay: u32) -> &mut CodecParameters
Provide the number of delay frames.
pub fn with_padding(&mut self, padding: u32) -> &mut CodecParameters
pub fn with_padding(&mut self, padding: u32) -> &mut CodecParameters
Provide the number of padding frames.
pub fn with_max_frames_per_packet(&mut self, len: u64) -> &mut CodecParameters
pub fn with_max_frames_per_packet(&mut self, len: u64) -> &mut CodecParameters
Provide the maximum number of frames per packet.
pub fn with_packet_data_integrity(
&mut self,
integrity: bool,
) -> &mut CodecParameters
pub fn with_packet_data_integrity( &mut self, integrity: bool, ) -> &mut CodecParameters
Specify if the packet’s data integrity was guaranteed.
pub fn with_frames_per_block(&mut self, len: u64) -> &mut CodecParameters
pub fn with_frames_per_block(&mut self, len: u64) -> &mut CodecParameters
Provide the maximum number of frames per packet.
pub fn with_extra_data(&mut self, data: Box<[u8]>) -> &mut CodecParameters
pub fn with_extra_data(&mut self, data: Box<[u8]>) -> &mut CodecParameters
Provide codec extra data.
pub fn with_verification_code(
&mut self,
code: VerificationCheck,
) -> &mut CodecParameters
pub fn with_verification_code( &mut self, code: VerificationCheck, ) -> &mut CodecParameters
Provide a verification code of the final decoded audio.
Trait Implementations§
§impl Clone for CodecParameters
impl Clone for CodecParameters
§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§impl Debug for CodecParameters
impl Debug for CodecParameters
§impl Default for CodecParameters
impl Default for CodecParameters
§fn default() -> CodecParameters
fn default() -> CodecParameters
Auto Trait Implementations§
impl Freeze for CodecParameters
impl RefUnwindSafe for CodecParameters
impl Send for CodecParameters
impl Sync for CodecParameters
impl Unpin for CodecParameters
impl UnwindSafe for CodecParameters
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.