pub struct SiMux { /* private fields */ }Expand description
Section-repetition scheduler that builds TS packets on a caller-supplied clock.
Each entry is a PID + concatenated complete-section bytes + an emission
interval. Call poll_into with monotonically-increasing
now values to get 188-byte TS packets for every entry whose interval has
elapsed since its last emission.
The scheduler owns its section bytes — call upsert to
update them when SI changes. Continuity counters are continuous per-PID
across poll cycles.
§25 ms floor
MIN_SECTION_INTERVAL is the minimum valid interval (EN 300 468 §5.1.4.1).
Supplying an interval below this in upsert triggers a
debug_assert — in release builds the assertion compiles out; the caller
must ensure compliance.
Implementations§
Source§impl SiMux
impl SiMux
Sourcepub fn upsert(&mut self, pid: u16, sections: Vec<u8>, interval: Duration)
pub fn upsert(&mut self, pid: u16, sections: Vec<u8>, interval: Duration)
Register or replace the sections emitted on pid at interval.
sections is the concatenated complete-section bytes for one emission
cycle. Re-calling for the same pid updates the bytes and interval
while preserving the continuity counter.
§Panics (debug only)
debug_assert!(interval >= MIN_SECTION_INTERVAL) — EN 300 468 §5.1.4.1
requires a minimum inter-section interval of 25 ms.
Sourcepub fn upsert_pat(&mut self, sections: Vec<u8>)
pub fn upsert_pat(&mut self, sections: Vec<u8>)
PAT at PAT_MAX_INTERVAL on PID 0x0000.
Interval cites dvb-si/docs/ts_101_154_av_coding.md §4.1.7.
Sourcepub fn upsert_pmt(&mut self, pid: u16, sections: Vec<u8>)
pub fn upsert_pmt(&mut self, pid: u16, sections: Vec<u8>)
PMT at PMT_MAX_INTERVAL on the caller-supplied pid.
Interval cites dvb-si/docs/ts_101_154_av_coding.md §4.1.7.
Sourcepub fn upsert_sdt_actual(&mut self, sections: Vec<u8>)
pub fn upsert_sdt_actual(&mut self, sections: Vec<u8>)
SDT actual at SDT_ACTUAL_MAX_INTERVAL on PID 0x0011.
Interval cites dvb-si/docs/tr_101_211.md §4.4.1/§4.4.2.
Sourcepub fn upsert_nit(&mut self, sections: Vec<u8>)
pub fn upsert_nit(&mut self, sections: Vec<u8>)
NIT at NIT_MAX_INTERVAL on PID 0x0010.
Interval cites dvb-si/docs/tr_101_211.md §4.4.1/§4.4.2.
Sourcepub fn upsert_tdt(&mut self, sections: Vec<u8>)
pub fn upsert_tdt(&mut self, sections: Vec<u8>)
TDT at TDT_MAX_INTERVAL on PID 0x0014.
Interval cites dvb-si/docs/tr_101_211.md §4.4.1/§4.4.2.
Sourcepub fn upsert_tot(&mut self, sections: Vec<u8>)
pub fn upsert_tot(&mut self, sections: Vec<u8>)
TOT at TOT_MAX_INTERVAL on PID 0x0014.
Interval cites dvb-si/docs/tr_101_211.md §4.4.1/§4.4.2.
Sourcepub fn poll_into(&mut self, now: Duration, out: &mut Vec<[u8; 188]>) -> usize
pub fn poll_into(&mut self, now: Duration, out: &mut Vec<[u8; 188]>) -> usize
Emit every entry due at now (i.e. now - last_emit >= interval, and
first call always due), packetizing via SectionPacketizer, appended
to out (cleared first).
Updates each emitted entry’s last_emit = now. Deterministic given the
fed now sequence. Returns the packet count appended.