Skip to main content

PcmMeta

Struct PcmMeta 

Source
pub struct PcmMeta {
    pub end_timestamp: Duration,
    pub timestamp: Duration,
    pub segment_index: Option<u32>,
    pub source_byte_offset: Option<u64>,
    pub variant_index: Option<usize>,
    pub spec: PcmSpec,
    pub frames: u32,
    pub epoch: u64,
    pub frame_offset: u64,
    pub source_bytes: u64,
}
Expand description

Timeline metadata for a PCM chunk.

Combines audio format specification with position on the logical timeline. Each chunk gets unique timeline coordinates; PcmSpec is the static part.

Intentionally without #[non_exhaustive]: external crates construct it via PcmMeta { spec, ..Default::default() } for fixtures; the pattern survives field additions, and non_exhaustive would block the struct-literal idiom altogether.

Fields§

§end_timestamp: Duration

Wall-clock position after this chunk’s frames have played out, computed by the decoder from its own frame counter. Used by Timeline::advance_committed_chunk to update the playhead without re-doing frames * 1e9 / sample_rate arithmetic on the consumer side. For frame-based decoders (MP3 / AAC) the last chunk may legitimately push this a few ms past the rounded total_duration; the timeline clamps to duration on write.

§timestamp: Duration

Timestamp of the first frame in this chunk.

§segment_index: Option<u32>

Segment index within playlist (None for progressive files).

§source_byte_offset: Option<u64>

Absolute byte offset of this chunk’s source data within the input stream, when the decoder reports it. Apple’s AudioFile exposes this via AudioStreamPacketDescription.mStartOffset; other backends (Symphonia, Android MediaExtractor) do not surface per-packet byte offsets through their public API and leave this None. When present, downstream code can pin the chunk to an exact byte range without recomputing rate × time.

§variant_index: Option<usize>

Variant/quality level index (None for progressive files).

§spec: PcmSpec

Audio format (channels, sample rate).

§frames: u32

Number of audio frames this chunk represents (one frame = spec.channels interleaved samples). Decoder fills it from the output buffer length; consumer-side splits update it in place when slicing a chunk into consumed/remaining halves.

§epoch: u64

Decoder generation — increments on each ABR switch / decoder recreation.

§frame_offset: u64

Absolute frame offset from the start of the track.

§source_bytes: u64

Number of source-stream bytes that produced this chunk’s PCM, as reported by the underlying decoder packet (e.g. Packet.data.len() for Symphonia, mDataByteSize for Apple AudioConverter, readSampleData return for Android MediaExtractor).

Lets the consumer correlate chunk frames with the source byte position without recomputing rate × time externally — the decoder already knows the exact mapping for variable-bitrate compressed formats and arbitrary-sized PCM packets. 0 means “unknown” (mock decoders, post-EOF flush chunks).

Trait Implementations§

Source§

impl Clone for PcmMeta

Source§

fn clone(&self) -> PcmMeta

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 PcmMeta

Source§

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

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

impl Default for PcmMeta

Source§

fn default() -> PcmMeta

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

impl From<&PcmMeta> for ChunkPosition

Source§

fn from(meta: &PcmMeta) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for PcmMeta

Source§

fn eq(&self, other: &PcmMeta) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PcmMeta

Source§

impl Eq for PcmMeta

Source§

impl StructuralPartialEq for PcmMeta

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,