pub enum MediaBuffer {
Packet(Arc<Packet>),
Video(Arc<UnboundObjectPoolRef<Video>>),
Audio(Arc<Audio>),
Eos,
}Expand description
The unit of data that flows between elements.
Compressed and uncompressed data are kept as distinct variants (rather
than a single opaque Buffer type like GStreamer) because ffmpeg-next
already gives us strongly-typed Packet/Frame types — collapsing them
into one type would just mean unwrapping again downstream.
Payloads are Arc-wrapped so MediaBuffer is cheaply Clone —
duplicating a buffer (e.g. crate::elements::Tee fanning packets out
to a decode branch and a remux branch) is a refcount bump, never a copy
of the encoded/decoded data.
Video specifically wraps an UnboundObjectPoolRef, not a plain
ffmpeg::frame::Video — that’s what lets whichever element produced it
(see crate::pool::UnboundObjectPool, owned as that element’s own
struct field) get the underlying buffer back automatically once every
Arc clone downstream has been dropped, instead of it just being freed.
Variants§
Packet(Arc<Packet>)
Video(Arc<UnboundObjectPoolRef<Video>>)
Audio(Arc<Audio>)
Eos
End of stream marker. Elements that hold resources (encoders with delayed frames, muxers, …) should flush when they see this.
Implementations§
Trait Implementations§
Source§impl Clone for MediaBuffer
impl Clone for MediaBuffer
Source§fn clone(&self) -> MediaBuffer
fn clone(&self) -> MediaBuffer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more