pub struct SwVideoCompositor { /* private fields */ }Expand description
Composites the latest frames from any number of independent input pipelines into one fixed-rate opaque BGRA video stream.
Like crate::elements::AudioMixer, this is a SourceElement, not
a conventional one-input filter: upstream pipelines terminate at the
sinks returned by SwVideoCompositorHandle::add_source, while this
element’s own pipeline drives output on its independent clock. Input
frame PTS values therefore do not become output PTS; output advances by
one tick in SwVideoCompositor::time_base for every composed frame.
Implementations§
Source§impl SwVideoCompositor
impl SwVideoCompositor
Sourcepub fn new(
name: impl Into<String>,
options: VideoCompositorOptions,
) -> Result<(Self, SwVideoCompositorHandle), SwVideoCompositorError>
pub fn new( name: impl Into<String>, options: VideoCompositorOptions, ) -> Result<(Self, SwVideoCompositorHandle), SwVideoCompositorError>
Creates a compositor and a weak runtime handle for registering inputs.
Sourcepub fn format(&self) -> Pixel
pub fn format(&self) -> Pixel
Returns the fixed output pixel format, ffmpeg::format::Pixel::BGRA.
Sourcepub fn frame_rate(&self) -> Rational
pub fn frame_rate(&self) -> Rational
Returns the configured output frame rate.
Sourcepub fn time_base(&self) -> Rational
pub fn time_base(&self) -> Rational
Returns the reciprocal of Self::frame_rate, used as output PTS units.
Trait Implementations§
Source§impl Element for SwVideoCompositor
impl Element for SwVideoCompositor
Source§fn name(&self) -> Arc<str> ⓘ
fn name(&self) -> Arc<str> ⓘ
crate::bus::BusEvent stores names as
Arc<str> for exactly this reason: a hot path like
crate::queue::Queue posting BusEvent::Dropped once per
overflowed buffer shouldn’t pay for a fresh heap allocation every
time it wants to report which element it is.Source§fn element_type(&self) -> ElementType
fn element_type(&self) -> ElementType
ElementType.Source§fn pp_log(&self) -> &PpLog
fn pp_log(&self) -> &PpLog
crate::bus::Bus::post — same
id/name as Element::name, just already wrapped as the
crate::pp_log::PpLog its pp_info!/pp_warn!/pp_error! macros need. A
stored private field, not built fresh per call, for the same reason
name() returns a cheap Arc<str> clone instead of a fresh String
— see its own docs.Source§fn pp_log_mut(&mut self) -> &mut PpLog
fn pp_log_mut(&mut self) -> &mut PpLog
Element::pp_log reads — used by
crate::pipeline::ChainBuilder to stamp the owning
crate::pipeline::Pipeline’s id onto every element that
passes through it, via element_pp_log. Not meant to be called
from anywhere else.impl Send for SwVideoCompositor
Source§impl Source for SwVideoCompositor
impl Source for SwVideoCompositor
Source§impl SourceElement for SwVideoCompositor
impl SourceElement for SwVideoCompositor
Source§fn run(&mut self, control: &ControlReceiver, bus: &Bus) -> Result<()>
fn run(&mut self, control: &ControlReceiver, bus: &Bus) -> Result<()>
Eos (normal completion),
crate::pipeline::Pipeline::finish, or Stop (see
ControlMsg::Stop) — call crate::control::drain_control
once per loop iteration to make control responsive between
blocking reads. Read moreSource§fn seek(&mut self, _target: Duration) -> Result<Duration>
fn seek(&mut self, _target: Duration) -> Result<Duration>
target, an absolute position from the
start of the media (e.g. av_seek_frame for
crate::elements::FileDemuxer). Called by
crate::control::drain_control as part of handling
ControlMsg::Seek, before that message is forwarded to the
source’s own pads — so whatever’s read next comes from the new
position by the time downstream elements are told to flush for it. Read more