Skip to main content

VideoEffectRenderer

Struct VideoEffectRenderer 

Source
pub struct VideoEffectRenderer { /* private fields */ }
Expand description

Reusable single-frame renderer for a Clip’s video effect chain.

Built once via Clip::video_effect_renderer; holds one FilterGraph configured with the same yuv420p working space and Clip::video_effect_chain that Timeline::render() uses, so a host preview matches the exported result. Feed frames through render repeatedly — the graph (and any lut3d .cube file it loads) is built once, not per frame, which is the right choice for real-time preview.

All frames passed to render must share the pixel format (the input_format given at construction) and the dimensions of the first rendered frame. Build a new renderer if the grade, format, or frame size changes.

Implementations§

Source§

impl VideoEffectRenderer

Source

pub fn new( clip: &Clip, input_format: PixelFormat, ) -> Result<VideoEffectRenderer, PipelineError>

Builds a renderer for clip’s current effect chain. Frames passed to render must be in input_format; the output is returned in the same format.

The graph itself is configured lazily from the first frame’s dimensions on the initial render call.

§Errors

Returns PipelineError::Filter if the filter graph cannot be built.

Source

pub fn render( &mut self, frame: &VideoFrame, ) -> Result<VideoFrame, PipelineError>

Applies the effect chain to one frame, reusing the built graph.

frame must match the input_format and dimensions established by the first rendered frame. The returned frame has the same pixel format as the input. The frame’s own timestamp is forwarded to the graph (as Timeline::render() does); the effect chain is pixel-domain and does not depend on PTS ordering.

§Errors

Returns PipelineError::Filter if the frame cannot be processed.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.