Skip to main content

Player

Struct Player 

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

A simple video player: one source playing to one output.

Player wraps the Compositor for the common case of playing a single video file to a single output (monitor or texture). For more complex multi-source or multi-output scenarios, use Compositor directly.

§Rendering

Player renders to a wgpu texture, which the host application can composite into its own scene. The close button is rendered as a UI overlay stub.

Implementations§

Source§

impl Player

Source

pub fn from_file<P: AsRef<Path>>( path: P, width: u32, height: u32, ) -> Result<Self>

Create a player for a single video file.

The output defaults to the full monitor/screen size.

Source

pub fn advance(&mut self, delta: Duration) -> Result<()>

Advance playback by the given delta time.

Source

pub fn render(&mut self) -> Result<()>

Render the current frame to an output texture.

In Phase 1, this is stubbed. Full implementation would composite layers to the output texture and render the close button UI.

Source

pub fn compositor_mut(&mut self) -> &mut Compositor

Get mutable access to the underlying compositor for advanced control.

Source

pub fn compositor(&self) -> &Compositor

Get immutable access to the underlying compositor.

Source

pub fn video_source_id(&self) -> &str

Get the video source ID (for reference).

Source

pub fn output(&self) -> Option<&Output>

Get the current output (for inspection or modification).

Source

pub fn output_mut(&mut self) -> Option<&mut Output>

Get the current output (mutable).

Auto Trait Implementations§

§

impl !RefUnwindSafe for Player

§

impl !Sync for Player

§

impl !UnwindSafe for Player

§

impl Freeze for Player

§

impl Send for Player

§

impl Unpin for Player

§

impl UnsafeUnpin for Player

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