pub struct SwVideoCompositorHandle { /* private fields */ }Expand description
A cheaply cloneable handle for adding and removing compositor inputs.
It mirrors crate::elements::MixerHandle, but each registration also
returns a SwVideoLayerHandle for changing that input’s placement.
Implementations§
Source§impl SwVideoCompositorHandle
impl SwVideoCompositorHandle
Sourcepub fn add_source(
&self,
name: impl Into<String>,
layer: VideoLayer,
) -> Result<Option<SwVideoCompositorInput>, SwVideoCompositorError>
pub fn add_source( &self, name: impl Into<String>, layer: VideoLayer, ) -> Result<Option<SwVideoCompositorInput>, SwVideoCompositorError>
Registers an input and returns its terminal Sink plus independent
runtime layer control. Reusing name replaces the old registration;
old sinks and layer handles become harmlessly stale.
Sourcepub fn remove_source(&self, name: &str)
pub fn remove_source(&self, name: &str)
Removes name immediately. Existing input sinks and layer handles
become disconnected and cannot affect a later same-name source.
Sourcepub fn set_frame_rate(&self, frame_rate: Rational) -> bool
pub fn set_frame_rate(&self, frame_rate: Rational) -> bool
Returns the number of compositor inputs currently registered.
Returns zero after the compositor has been dropped. Changes the rate this compositor emits at, from the next tick.
Returns false for a rate that is not positive, and for a compositor
that has already been dropped. The same contract as the GPU
compositors’ setters, and with the same caveat: SwVideoCompositor::time_base is the reciprocal of this and the output
pts is a tick counter in those units, so a change re-means every
timestamp after it while the ones already downstream were stamped under
the old rate — see crate::rate.
Sourcepub fn frame_rate(&self) -> Option<Rational>
pub fn frame_rate(&self) -> Option<Rational>
The rate this compositor is emitting at, or None once it is gone.
Read back rather than remembered by the caller: a rate refused by
Self::set_frame_rate leaves the old one in place.
pub fn source_count(&self) -> usize
Trait Implementations§
Source§impl Clone for SwVideoCompositorHandle
impl Clone for SwVideoCompositorHandle
Source§fn clone(&self) -> SwVideoCompositorHandle
fn clone(&self) -> SwVideoCompositorHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more