pub struct Player<I = RenderedTexture> { /* private fields */ }Expand description
Stateful real-time runner holding the last picture drawn. I is FrameRenderer::Image: a
RenderedTexture on the GPU or an Arc<CpuImage> on the alpha2_render::CpuRenderer.
Defaults to MissingFramePolicy::HoldPrevious; see Player::with_missing_frame_policy.
Implementations§
Source§impl<I> Player<I>
impl<I> Player<I>
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, for preparing 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 prefetch requests include, clamped to 120.
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;
MissingFramePolicy::Wait withholds it so the host can show a loading state. The held
frame is retained either way.
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, R: FrameRenderer<Image = I> + ?Sized>(
&'a mut self,
project: &EngineProject,
renderer: &R,
frames: &dyn FrameProvider,
time: MediaTime,
) -> Result<PlaybackFrame<'a, I>, EngineError>
pub fn render_at<'a, R: FrameRenderer<Image = I> + ?Sized>( &'a mut self, project: &EngineProject, renderer: &R, frames: &dyn FrameProvider, time: MediaTime, ) -> Result<PlaybackFrame<'a, I>, EngineError>
Evaluates and attempts to present the host clock’s current frame.
With inputs missing, the last successful texture is returned with repeated = true under
MissingFramePolicy::HoldPrevious and withheld under MissingFramePolicy::Wait.
texture is absent before the first success.
A frame whose size, cache key and content epoch match the last returned texture (with every
source keyed) is not rendered and returns unchanged = true. Unkeyed sources always render.
§Errors
Returns timeline evaluation, quality, or rendering failures, and
EngineError::UnregisteredEffect naming an effect the frame draws
that renderer has not registered.
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for Player<I>
impl<I> RefUnwindSafe for Player<I>
impl<I> Send for Player<I>
impl<I> Sync for Player<I>
impl<I> Unpin for Player<I>
impl<I> UnsafeUnpin for Player<I>
impl<I> UnwindSafe for Player<I>
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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