Skip to main content

RealtimeComposer

Struct RealtimeComposer 

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

Composites externally-decoded frames from several layers into one frame, reusing a single built filter graph across frames.

Build once with new; then per output frame, push_layer one frame for every layer and pull the composited result. The output frame is rgba. The graph (and any lut3d file its effects load) is built once, so it is suitable for real-time playback.

Implementations§

Source§

impl RealtimeComposer

Source

pub fn new(layers: &[RealtimeLayer]) -> Result<Self, FilterError>

Builds a compositor for the given layers (at least one required).

§Errors

Returns FilterError::CompositionFailed when layers is empty or the underlying FFmpeg graph cannot be built.

Source

pub fn layer_count(&self) -> usize

Number of layers (== number of input slots).

Source

pub fn push_layer( &mut self, idx: usize, frame: &VideoFrame, ) -> Result<(), FilterError>

Pushes one frame into layer idx’s input slot.

Push exactly one frame per layer before each pull. The frame must match the layer’s declared width/height/pixel format.

§Errors

Returns FilterError if idx is out of range or the frame cannot be pushed.

Source

pub fn pull(&mut self) -> Result<Option<VideoFrame>, FilterError>

Pulls the next composited frame (rgba), or None if not yet available.

§Errors

Returns FilterError on an unexpected FFmpeg error.

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.