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. Vector sources rasterize to fit within fit (width, height), keeping aspect; raster sources use their own size.

§Errors

If the frame cannot be produced.

Source

fn resident_bytes(&self) -> usize

Bytes the source holds between renders (cached frames, images, and file bytes).

Provided Methods§

Source

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

Locators rendering at time will read that the source does not already hold.

Source

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

Another independently positioned reader sharing this source’s decoded data and frame budget. None when any time is equally cheap to draw, so the host can share the source.

Source

fn shared_bytes(&self) -> usize

The part of Self::resident_bytes shared with Self::reader readers, counted once.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§