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
impl Player
Sourcepub fn render_size(
&self,
project: &EngineProject,
) -> Result<RenderSize, EngineError>
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.
Sourcepub fn new(quality: QualityProfile) -> Result<Self, EngineError>
pub fn new(quality: QualityProfile) -> Result<Self, EngineError>
Creates a player with explicit runtime quality.
§Errors
Returns EngineError::InvalidQualityProfile for invalid controls.
Sourcepub const fn with_prefetch_frames(self, frames: u32) -> Self
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.
Sourcepub const fn prefetch_frames(&self) -> u32
pub const fn prefetch_frames(&self) -> u32
How many future frame boundaries prefetch requests include.
Sourcepub const fn quality(&self) -> QualityProfile
pub const fn quality(&self) -> QualityProfile
Returns the active quality profile.
Sourcepub const fn with_missing_frame_policy(self, policy: MissingFramePolicy) -> Self
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.
Sourcepub const fn missing_frame_policy(&self) -> MissingFramePolicy
pub const fn missing_frame_policy(&self) -> MissingFramePolicy
Returns the policy used when source frames are unavailable.
Sourcepub fn prefetch_needs(
&self,
project: &EngineProject,
time: MediaTime,
) -> Result<Vec<FrameNeed>, EngineError>
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.
Sourcepub fn render_at<'a>(
&'a mut self,
project: &EngineProject,
renderer: &Renderer,
frames: &dyn FrameProvider,
time: MediaTime,
) -> Result<PlaybackFrame<'a>, EngineError>
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.