Skip to main content

Frame Provider

frame_provider.rs holds the one mapping from a clip at a timeline frame to what the compositor draws. Preview and export share it and differ only in how they obtain decoded frames, which is the FrameProvider trait.

frame-provider.png

The trait

MethodContract
frame_forOk(None) means not available now: not cached yet (preview), or past the end of the file (export). A decode error stays Err, so export never turns it into a silent black frame.
compound_textureThe composed frame of a compound clip's nested timeline as a GPU texture. The default returns None, and the caller falls back on frame_for (composed and read back to the CPU).

Implementations

TypeUsed by
RenderAhead (vv-app)Preview. Reads the timeline frame cache filled by the render-ahead decode thread.
StreamingFrameProviderExport. Keeps one decoder open per clip and seeks only when the clip changes; every seek flushes to a keyframe, too slow to do per frame. It marks every clip it is asked for and, once a frame is decoded, closes the decoders of the others (sweep), nested and crossing clips included.
GpuCompoundsWraps either one. Composes compound clips recursively on the GPU so the texture stays on the card instead of a round trip through CPU and YUV.

Building layers

  • track_layers_at is the entry point for a whole track. It returns one layer, or two inside a crossing transition (tail of the left clip, then head of the right one).
  • clip_layer evaluates the keyframed transform at the source frame, adds the transition push and the fade opacity, and attaches the active filters and blend mode.
  • A nested timeline whose clips are still decoding gives no frame: a half-composed frame would be worse than none.
  • OwnedLayer owns what vv_render::Layer borrows (Video, Texture, Solid, Text, Adjustment). vv-render does not depend on vv-media, so video frames are passed as raw YUV planes (as_render_yuv_frame).