Skip to main content

VisualSource

Trait VisualSource 

Source
pub trait VisualSource: Send {
    // Required methods
    fn report(&self) -> &ProbeReport;
    fn render(
        &mut self,
        time: MediaTime,
        fit: (u32, u32),
    ) -> Result<VisualFrame, ExtensionError>;
    fn resident_bytes(&self) -> usize;

    // Provided methods
    fn needs(&self, _time: MediaTime) -> Vec<String> { ... }
    fn reader(&self) -> Option<Box<dyn VisualSource>> { ... }
    fn shared_bytes(&self) -> usize { ... }
}
Expand description

A source a provider opened: asked for frames by source time.

Required Methods§

Source

fn report(&self) -> &ProbeReport

What the file is.

Source

fn render( &mut self, time: MediaTime, fit: (u32, u32), ) -> Result<VisualFrame, ExtensionError>

The frame shown at time. A vector source is rasterized to fit within fit (width, height), keeping its shape; a raster source answers at its own size.

§Errors

Why the frame cannot be produced.

Source

fn resident_bytes(&self) -> usize

The bytes the source holds between renders: decoded frames and images it keeps, its last rendered frame, and its file’s bytes when it keeps them. A host that bounds what its open sources hold counts this, and closes a source to free it.

Provided Methods§

Source

fn needs(&self, _time: MediaTime) -> Vec<String>

The resources rendering at time reads, by locator: those the source does not already hold. A host that registers resources only while they are used (a page’s frames) registers these before the render and releases them after.

Source

fn reader(&self) -> Option<Box<dyn VisualSource>>

Another reader of this open source, positioned on its own: what it decodes and where it is decoding are its own, and what the source decoded when it opened (its file, and for an animation its checked frames and the frames kept between requests, within one frame budget) is shared with this one and every other reader made from either. None for a source whose readers need nothing of their own, one that draws any time as cheaply: a host shares that source.

Source

fn shared_bytes(&self) -> usize

Of Self::resident_bytes, what this source shares with the readers made by Self::reader: the same bytes for each of them, which a host counts once.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§