A source whose data comes from application code pushing buffers in,
rather than this element reading them itself — GStreamer’s appsrc
equivalent, the reverse of crate::elements::AppSink. Push encoded
MediaBuffer::Packets (straight into a decoder) or already-decoded
MediaBuffer::Video/MediaBuffer::Audio (e.g. frames from a
camera SDK, or synthetic test data) via AppSourceHandle, from any
thread — a live capture callback, a network receive loop, a test.
A cheaply-cloneable handle for pushing buffers into an AppSource
from any thread — Clone is just two refcount bumps (name and the
channel sender are both cheap to share).
Sums an arbitrary, dynamically-changing number of audio sources into
one output stream — the structural mirror of crate::elements::Tee:
Tee is one input fanned out to a dynamic set of outputs behind a
lock; AudioMixer is a dynamic set of inputs (added/removed via
MixerHandle, from whatever thread each one’s own source pipeline
runs on) summed into one output. Unlike Tee, which is a passive
Sink driven entirely by whatever calls consume, AudioMixer has
to drive itself: it’s a SourceElement with its own run thread,
ticking every TICK_INTERVAL to sum however many samples each
currently-attached input has ready — because mixing has to keep
producing something on a steady clock even when some (or all) inputs
have gone quiet, the same reason
WasapiCaptureSource synthesizes silence for gaps
rather than just emitting nothing.
Construction-time options for AudioMixer::new — the mixer’s fixed
output format. Every input is resampled to match this on the way in
(see InputBuffer::push); the mixer never adapts to whatever an
input happens to produce.
Demuxes a file, exposing one src pad per container stream (indexed the
same way as StreamInfo::index). Linking a pad “selects” that stream;
leaving it unlinked just drops its packets. Real demuxer I/O is
blocking, so this is meant to be run as the pipeline’s source thread.
A cheaply-cloneable handle for adding or removing an AudioMixer’s
input sources while the pipeline is running — the mirror image of
crate::elements::TeeHandle: Tee lets you attach/detach outputs
from another thread; this lets you attach/detach inputs. Keeps only a
Weak reference for the same reason TeeHandle does: retaining a
handle after the mixer’s own pipeline finishes must not keep its
internal state alive forever, and every operation becomes a harmless
no-op once the mixer is gone.
One AudioMixer input, returned by MixerHandle::add_source.
Resamples every incoming frame to the mixer’s fixed output format and
appends it to this input’s own buffer — the actual summing happens
later, on AudioMixer::run’s own thread, not here. consume runs on
whatever thread is driving the upstream source this got linked to
(a different pipeline’s own thread, in the normal case), so every
access to the shared input map goes through MixerShared’s lock.
Generates a synthetic sine-wave tone — GStreamer’s audiotestsrc
equivalent. No real capture device involved: TestAudioSource::run
fabricates however many samples wall-clock time now owes on a
drift-free absolute schedule (expected = elapsed * sample_rate,
needed = expected - samples_emitted — the same shape
WasapiCaptureSource::fill_silence_gap/AudioMixer::mix_tick both
use, not a fixed
per-tick sample count, which would drift the same way a fixed-duration
thread::sleep-only schedule would), stamps it with an increasing
pts (one sample per tick of TestAudioSource::time_base’s units),
and pushes it straight downstream — useful for exercising
AudioMixer/an encoder/a muxer without a real microphone.
Generates a synthetic, moving-diagonal-gradient video stream —
GStreamer’s videotestsrc equivalent. No real decode/demux involved:
run() fabricates one Pixel::YUV420P frame per tick, stamps it with
an increasing pts (one tick per frame, in TestVideoSource::time_base’s
units), and pushes it straight downstream — useful for exercising
Scaler/Pacer/D3d12Renderer/etc. without a real file or camera.
D3d12Renderer in particular already handles Pixel::YUV420P on its
CPU-upload path, so this can feed a renderer directly, no decoder
needed.
Construction-time settings for one text layer, passed to
D3d11VideoCompositorHandle::add_text_layer — the
text sibling of super::video_layer::VideoLayer, which add_source
takes the same way. font_data (raw TTF/OTF bytes; this crate bundles
no font of its own) has no sane default, so — mirroring
super::video_layer::VideoLayer::new, which takes the one field a
caller must supply (rect) and defaults the rest — Self::new takes
only font_data and defaults font_size/color/x/y, all freely
reassignable before the call to add_text_layer.
A cheaply cloneable handle for adding and removing compositor inputs.
It mirrors crate::elements::MixerHandle, but each registration also
returns a VideoLayerHandle for changing that input’s placement.
The two endpoints created for one compositor input registration.
Move sink into the upstream pipeline and retain layer in application
code for runtime placement changes.
One terminal video input returned by
VideoCompositorHandle::add_source. It stores only the latest frame,
so a fast producer cannot build an unbounded queue behind a slower
compositor output rate.
An opaque, stable identity for one compositor input registration.
Replacing an input with the same name creates a different identity, so
an old sink or layer handle can never affect its replacement.