pub struct Demuxer { /* private fields */ }Expand description
Reads TS packets from pushed byte chunks, tracks PAT/PMT, and reassembles
per-PID PES packets into AccessUnits.
Implementations§
Source§impl Demuxer
impl Demuxer
Sourcepub fn push_bytes(&mut self, data: &[u8])
pub fn push_bytes(&mut self, data: &[u8])
Append incoming bytes (need not be 188-byte aligned across calls).
Sourcepub fn streams(&self) -> &[ElementaryStream]
pub fn streams(&self) -> &[ElementaryStream]
Elementary streams from the most recently parsed PMT (empty until then).
Sourcepub fn poll_access_unit(&mut self) -> Result<Option<AccessUnit>, Error>
pub fn poll_access_unit(&mut self) -> Result<Option<AccessUnit>, Error>
Pop the next fully reassembled access unit, or Ok(None) if not enough
bytes are buffered yet.
An access unit is only confirmed complete once the next PES packet on
the same PID starts (or Demuxer::finish is called) — this is
inherent to how PES packetization signals its own boundaries, not a
limitation specific to this crate.
Sourcepub fn finish(&mut self) -> Vec<AccessUnit>
pub fn finish(&mut self) -> Vec<AccessUnit>
Force-emit whatever is still accumulating per PID as a final access
unit each — call once at the end of a stream to avoid losing the very
last access unit per PID (see Demuxer::poll_access_unit’s doc).