Skip to main content

PreviewPass

Struct PreviewPass 

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

The portable half of a preview pass: which frame the next preview is of, and what becomes of the picture once something has decoded it.

What is not here is the loop. The pass walks forwards one preview at a time and something has to advance it: a thread on native (PreviewIndex), an idle callback in a browser (crate::web_previews). Both drive this, so the stride derivation, the slot bookkeeping and the shrink are written once and a browser preview is the same picture a native one is.

Implementations§

Source§

impl PreviewPass

Source

pub fn new( options: PreviewOptions, dimensions: &VideoDimensions, frame_count: u64, ) -> Self

A pass over frame_count frames of a dimensions source, with the stride PreviewOptions::stride derives from the two.

Source

pub fn store(&self) -> PreviewStore

A handle on the pictures, for whatever answers seeks from them.

Source

pub fn stride(&self) -> u64

How many frames apart this pass’s previews are.

Source

pub fn next_frame(&self) -> Option<FrameIndex>

The frame the next preview is of, or None once the pass has visited every position.

Source

pub fn accept(&mut self, picture: &VideoFrame, limits: &Limits)

Shrinks picture into the position next_frame named, and advances past it.

A picture that cannot be shrunk leaves its slot empty, exactly as a frame that would not decode does: the index is an optimization, and a gap in it costs a fallback to the neighbor rather than an error the caller has to show.

Source

pub fn skip(&mut self)

Advances past a position whose frame would not decode, leaving its slot empty.

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

Source§

impl<S> FromSample<S> for S

Source§

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.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

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

Source§

fn to_sample_(self) -> U

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.