Skip to main content

Player

Struct Player 

Source
pub struct Player { /* private fields */ }
Expand description

Stateful real-time runner.

MissingFramePolicy::HoldPrevious is the default; a host that would rather show its own loading state than a stale frame selects MissingFramePolicy::Wait through Player::with_missing_frame_policy.

Implementations§

Source§

impl Player

Source

pub fn render_size( &self, project: &EngineProject, ) -> Result<RenderSize, EngineError>

The size frames of project render at: where a host prepares their captions.

§Errors

Returns an error when the quality profile cannot size the project.

Source

pub fn new(quality: QualityProfile) -> Result<Self, EngineError>

Creates a player with explicit runtime quality.

§Errors

Returns EngineError::InvalidQualityProfile for invalid controls.

Source

pub const fn with_prefetch_frames(self, frames: u32) -> Self

Sets how many future frame boundaries are included in prefetch requests. Values above 120 are clamped to keep one request bounded.

Source

pub const fn prefetch_frames(&self) -> u32

How many future frame boundaries prefetch requests include.

Source

pub const fn quality(&self) -> QualityProfile

Returns the active quality profile.

Source

pub const fn with_missing_frame_policy(self, policy: MissingFramePolicy) -> Self

Sets what Player::render_at returns while source frames are missing.

MissingFramePolicy::HoldPrevious repeats the last successful texture, which keeps real-time playback moving. MissingFramePolicy::Wait withholds it, so the host can render its own loading state instead of presenting a frame that belongs to another timestamp. The held frame is retained either way and is presented again as soon as a render succeeds.

Source

pub const fn missing_frame_policy(&self) -> MissingFramePolicy

Returns the policy used when source frames are unavailable.

Source

pub fn prefetch_needs( &self, project: &EngineProject, time: MediaTime, ) -> Result<Vec<FrameNeed>, EngineError>

Collects deduplicated decode requests for the current and future frames.

§Errors

Returns evaluation or timeline overflow errors.

Source

pub fn render_at<'a>( &'a mut self, project: &EngineProject, renderer: &Renderer, frames: &dyn FrameProvider, time: MediaTime, ) -> Result<PlaybackFrame<'a>, EngineError>

Evaluates and attempts to present the host clock’s current frame.

When inputs are missing, the most recent successful texture is returned with repeated = true under MissingFramePolicy::HoldPrevious, and withheld under MissingFramePolicy::Wait. Before the first successful frame, texture is absent and the host can display its own loading state.

A frame whose output equals the texture last returned (the same render size, frame-graph cache key and renderer content epoch, with every source keyed) is not rendered: that texture is returned again with unchanged = true, and no GPU work is encoded. A frame drawn from a source without a stable key always renders.

§Errors

Returns timeline evaluation, quality, or rendering failures, and EngineError::UnregisteredEffect naming an effect the frame draws that renderer has not registered.

Source

pub fn reset(&mut self)

Drops the held frame, for example after a seek or project swap.

Trait Implementations§

Source§

impl Debug for Player

Source§

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

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

impl Default for Player

Source§

fn default() -> Self

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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