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
impl PreviewPass
Sourcepub fn new(
options: PreviewOptions,
dimensions: &VideoDimensions,
frame_count: u64,
) -> Self
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.
Sourcepub fn store(&self) -> PreviewStore
pub fn store(&self) -> PreviewStore
A handle on the pictures, for whatever answers seeks from them.
Sourcepub fn next_frame(&self) -> Option<FrameIndex>
pub fn next_frame(&self) -> Option<FrameIndex>
The frame the next preview is of, or None once the pass has visited
every position.
Sourcepub fn accept(&mut self, picture: &VideoFrame, limits: &Limits)
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.