Skip to main content

Video

Struct Video 

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

A playing video, through whichever back end can play it. AVFoundation is tried first; a file it refuses on opening, fails on later, or draws no picture of within 1.5 s is played by FFmpeg when present, keeping the player’s settings and place.

Main thread only (it is not Send). Dropping it stops playback.

Implementations§

Source§

impl Video

Source

pub fn open(path: &Path) -> Result<Video>

Opens a file for playback, paused at the start, with no sound when FFmpeg plays it. Fails off the main thread, and for anything probe refuses.

Source

pub fn open_with(path: &Path, mixer: Option<&Mixer>) -> Result<Video>

As Video::open; when FFmpeg plays the file its sound goes to mixer (AVFoundation plays its own).

Source

pub fn backend(&self) -> Backend

Which back end is playing.

Source

pub fn info(&self) -> &Info

Source

pub fn is_ready(&self) -> bool

The video has loaded and can show frames.

Source

pub fn error(&self) -> Option<String>

Why the video can’t play, once every back end has given up. A system failure FFmpeg may still recover from (on the next Video::tick) is not reported.

Source

pub fn play(&mut self)

Plays at the current speed; from the end, plays from the start.

Source

pub fn pause(&mut self)

Source

pub fn toggle(&mut self)

Source

pub fn is_playing(&self) -> bool

Source

pub fn seek(&mut self, secs: f64)

Jumps to secs exactly (clamped to the clip).

Source

pub fn step(&mut self, frames: i32)

Moves frames frames forwards (or backwards when negative) and pauses, as frame stepping does in any player.

Source

pub fn rate(&self) -> f32

Source

pub fn set_rate(&mut self, rate: f32)

Source

pub fn set_volume(&mut self, volume: f32)

0..=1.

Source

pub fn set_muted(&mut self, muted: bool)

Source

pub fn needs_mixer(&self) -> bool

Whether this preview has yet to be given an output by Video::set_mixer.

Source

pub fn set_mixer(&mut self, mixer: Mixer)

Gives a preview the output its FFmpeg sound goes to, whichever player has it now or takes over later.

Source

pub fn set_looping(&mut self, looping: bool)

Source

pub fn looping(&self) -> bool

Source

pub fn current_time(&self) -> f64

The playhead in seconds.

Source

pub fn tick(&mut self)

Call every frame: at the end of the clip, starts again from the top when looping, or stops. When the system player has failed or has drawn nothing in time, FFmpeg takes over here.

Source

pub fn current_frame(&self) -> Result<Frame>

The picture at the playhead at the clip’s full size, turned upright: what Eagle’s frame tools (set as thumbnail, copy, save) capture. Decoded afresh, so it does not disturb playback or the frames Video::frame hands out.

Source

pub fn frame(&mut self) -> Option<Frame>

The frame due now, if it differs from the last one handed out.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Video

§

impl !Send for Video

§

impl !Sync for Video

§

impl !UnwindSafe for Video

§

impl Freeze for Video

§

impl Unpin for Video

§

impl UnsafeUnpin for Video

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> AutoreleaseSafe for T
where T: ?Sized,

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
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

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.

§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.