pub struct PusiReassembler { /* private fields */ }Expand description
Generic PUSI-delimited payload reassembler: a PID filter over the shared
PusiAccumulator.
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 new(pid: u16) -> Self
pub fn new(pid: u16) -> Self
Create a new reassembler for the given pid using the default maximum unit size.
Sourcepub fn with_max_unit_size(pid: u16, max: usize) -> Self
pub fn with_max_unit_size(pid: u16, max: usize) -> Self
Create a new reassembler with a custom maximum unit size.
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, it is complete — it
is returned as Some(unit_bytes) (an empty unit is not returned), and
a fresh unit begins with this packet’s payload. When pusi == false,
the payload is appended to the in-progress unit; payload before the
first PUSI is ignored (ISO/IEC 13818-1 §2.4.3.2), and a unit past the
size cap is discarded until the next PUSI.