Skip to main content

Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event { StartPlaying { media_27mhz: Ticks27, lead_us: Micros, }, Pause { hold_at_27mhz: Ticks27, reason: Reason, depth_us: Micros, resume_target_us: Micros, track: Option<u32>, }, Resume { media_27mhz: Ticks27, lead_us: Micros, }, TargetChanged { old_us: Micros, new_us: Micros, }, OverMax { need_us: Micros, max_us: Micros, }, Rebaselined, EventsDropped { count: u32, }, }
Expand description

A decision for the caller. Media positions are in the playback (PTS) domain as 27 MHz ticks (PTS90k x 300), i.e. the domain of on_media and on_tick’s playback.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

StartPlaying

First fill complete. Set the renderer clock to media_27mhz (the oldest buffered media) and rate 1.

Fields

§media_27mhz: Ticks27

Position to start from.

§lead_us: Micros

Lead at the decision.

§

Pause

Underrun or re-prime. Set the renderer rate to 0 and hold the clock at hold_at_27mhz; keep queueing every chunk that arrives meanwhile.

Fields

§hold_at_27mhz: Ticks27

Position to freeze at (never ahead of the data).

§reason: Reason

Why.

§depth_us: Micros

Buffered lead at the pause (0 if the clock overran the data).

§resume_target_us: Micros

Resume target known now; it can rise when the first post-stall chunk reveals the stall depth.

§track: Option<u32>

For an underrun or re-prime with two or more tracks known: the track whose media end bounded the lead (the starving track). None otherwise (single track, discontinuity).

§

Resume

Refilled. Re-seed the renderer clock to exactly media_27mhz and set rate 1 in one step.

Resume is also a “go”. After a Hint::PcrDiscontinuity (or SyncLoss/Reconnected) while Playing the controller emits Pause then, once refilled, Resume, never a second StartPlaying (StartPlaying happens once per controller until reset). A caller must therefore treat StartPlaying and Resume identically as “set the clock to media_27mhz and rate 1”. If that differs from the clock at pause (after a discontinuity) it is a time jump on the caller’s side: re-enqueue from there if the audio renderer flushes.

Fields

§media_27mhz: Ticks27

Position to restart from.

§lead_us: Micros

Lead at the decision.

§

TargetChanged

The target moved by at least one histogram bucket (or hit a bound).

Fields

§old_us: Micros

Previously reported target.

§new_us: Micros

New target (never above max_us).

§

OverMax

The estimated need exceeds max_us; the target is clamped (the cap is a guarantee). Raised once per excursion.

Fields

§need_us: Micros

Unclamped need.

§max_us: Micros

The cap.

§

Rebaselined

The baseline was reset (discontinuity, reconnect, sync loss).

§

EventsDropped

Events were lost because the caller did not poll in time.

Fields

§count: u32

How many.

Implementations§

Source§

impl Event

Source

pub fn to_record(&self) -> EventRecord

Convert to the plain-data record.

Source

pub fn name(&self) -> &'static str

Stable label of the variant.

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Self

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 Copy for Event

Source§

impl Debug for Event

Source§

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

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

impl Display for Event

Source§

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

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

impl Eq for Event

Source§

impl PartialEq for Event

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Event

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Event

Auto Trait Implementations§

§

impl Forget for Event

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe for Event

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<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.