Skip to main content

VideoStream

Struct VideoStream 

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

A running decoder and the frames it produced. Dropping it kills the decoder.

Implementations§

Source§

impl VideoStream

Source

pub fn spawn( command: Command, (width, height): (u32, u32), frames_per_second: u32, ) -> Result<Self>

Run command, which must write width x height RGBA frames back to back on its standard output at frames_per_second.

Source

pub fn ffmpeg<S: AsRef<OsStr>>( input: &[S], size: (u32, u32), frames_per_second: u32, ) -> Result<Self>

Decode with ffmpeg. input holds ffmpeg’s input arguments, such as ["-ss", "12", "-i", "clip.mp4"]. We letterbox the picture to size and drop the sound.

Source

pub fn latest(&mut self) -> Option<Vec<u8>>

The newest frame the clock has passed since the last call, or None when no new frame is due or decoded yet. We skip the frames in between, so a slow terminal drops frames and the picture keeps pace with the clock.

Source

pub fn shown(&self) -> u32

How many frames the stream has handed out or skipped.

Source

pub fn ended(&self) -> bool

Whether the decoder finished and every frame went out.

Trait Implementations§

Source§

impl Debug for VideoStream

Source§

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

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

impl Drop for VideoStream

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. 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<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, 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.