Skip to main content

VideoLayer

Struct VideoLayer 

Source
pub struct VideoLayer {
    pub source: LayerSource,
    pub proxy: Option<ProxySource>,
    pub x: AnimatedValue<f64>,
    pub y: AnimatedValue<f64>,
    pub scale_x: AnimatedValue<f64>,
    pub scale_y: AnimatedValue<f64>,
    pub rotation: AnimatedValue<f64>,
    pub opacity: AnimatedValue<f64>,
    pub blend_mode: BlendMode,
    pub composite_op: CompositeOp,
    pub effects: Vec<FilterStep>,
}
Expand description

A single video layer in a MultiTrackComposer composition.

Layers are composited in the order they are added, the first (add_layer) at the bottom of the stack. Trim / timeline placement are expressed by the caller as leading FilterSteps in effects (e.g. Trim + OffsetPts); this layer type is model-free.

The x, y, scale_x, scale_y, rotation, and opacity fields accept either a constant (AnimatedValue::Static) or a time-varying keyframe track (AnimatedValue::Track). The initial filter graph is built from the value at Duration::ZERO; per-frame updates are added in issue #363.

Fields§

§source: LayerSource

Where this layer’s frames come from (a file, a lavfi string, or a generated text/solid source).

§proxy: Option<ProxySource>

Optional low-resolution proxy to decode from instead of source.

When Some, frames are decoded from the proxy and scaled up to the original source resolution before trim/effects/compositing, so the output is identical in size to a non-proxy render. Only meaningful for a LayerSource::File source.

§x: AnimatedValue<f64>

X offset on the canvas in pixels (top-left origin).

§y: AnimatedValue<f64>

Y offset on the canvas in pixels.

§scale_x: AnimatedValue<f64>

Horizontal scale factor applied to the source frame (1.0 = original width).

§scale_y: AnimatedValue<f64>

Vertical scale factor applied to the source frame (1.0 = original height).

§rotation: AnimatedValue<f64>

Clockwise rotation in degrees (0.0 = no rotation).

§opacity: AnimatedValue<f64>

Opacity (0.0 = fully transparent, 1.0 = fully opaque).

§blend_mode: BlendMode

How this layer blends with the layer(s) below it.

BlendMode::Normal uses the FFmpeg overlay filter (standard alpha-over composite). All other modes use the FFmpeg blend filter with the corresponding all_mode. Defaults to BlendMode::Normal.

Colour blend only — applies when composite_op is CompositeOp::Over. For a non-Over composite op the layer is composited by the Porter-Duff operator and blend_mode is not additionally applied.

§composite_op: CompositeOp

Porter-Duff alpha-compositing operator for placing this layer over the canvas. Defaults to CompositeOp::Over (standard alpha-over).

Over keeps the existing blend_mode compositing (overlay / blend all_mode). Under/In/Out/Atop/Xor composite the layer via the corresponding Porter-Duff construction (the colour blend_mode is not applied in that case).

For a non-Over op, opacity uses its initial value only — animated opacity is not tracked per-frame on these paths (the blend all_opacity / overlay alpha is set once at build time).

§effects: Vec<FilterStep>

Per-layer video filter steps applied to this layer’s decoded stream before compositing.

Applied in order after scale/rotate/opacity and before the overlay node. Any timeline trim / placement steps (Trim + ResetPts + OffsetPts) the caller emits belong at the front of this list so they precede timing-sensitive effects (Speed). Typical use: FilterStep::Eq { brightness, contrast, saturation } for per-clip color correction. An empty Vec (the default) is a no-op.

Trait Implementations§

Source§

impl Clone for VideoLayer

Source§

fn clone(&self) -> VideoLayer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VideoLayer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.