pub struct PusiReassembler { /* private fields */ }Expand description
Generic PUSI-delimited payload reassembler.
Accumulates payload bytes across consecutive TS packets sharing the same
PID, using payload_unit_start_indicator to delimit unit boundaries.
§Example
let mut reassembler = PusiReassembler::new(0x0004);
// Feed pusi=true first packet
if let Some(unit) = reassembler.push(0x0004, true, &first_payload) {
// unit is complete (would only happen if a second PUSI follows)
}
// Feed continuation
reassembler.push(0x0004, false, &cont_payload);
// Drain the final unit
if let Some(unit) = reassembler.flush() {
// process complete unit
}Implementations§
Source§impl PusiReassembler
impl PusiReassembler
Sourcepub fn push(&mut self, pid: u16, pusi: bool, payload: &[u8]) -> Option<Vec<u8>>
pub fn push(&mut self, pid: u16, pusi: bool, payload: &[u8]) -> Option<Vec<u8>>
Feed one TS packet’s (pid, payload_unit_start_indicator, payload bytes).
Packets whose pid != self.pid are silently ignored (returns None).
PUSI semantics: When pusi == true, the packet marks the start of a
new unit. If a unit was already in progress (i.e. a prior PUSI-start
was never closed by a following PUSI), the in-progress unit is
complete — it is returned as Some(unit_bytes), and a fresh unit
begins with this packet’s payload.
When pusi == false, the payload is appended to the in-progress unit.
Returns Some(Vec<u8>) when a completed unit is emitted; None
otherwise.
Trait Implementations§
Source§impl Clone for PusiReassembler
impl Clone for PusiReassembler
Source§fn clone(&self) -> PusiReassembler
fn clone(&self) -> PusiReassembler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more