Skip to main content

SiMux

Struct SiMux 

Source
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

Source

pub fn new() -> Self

Create an empty scheduler (no entries, no pending emissions).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn poll(&mut self, now: Duration) -> Vec<[u8; 188]>

Allocating convenience wrapper over poll_into.

Trait Implementations§

Source§

impl Default for SiMux

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for SiMux

§

impl RefUnwindSafe for SiMux

§

impl Send for SiMux

§

impl Sync for SiMux

§

impl Unpin for SiMux

§

impl UnsafeUnpin for SiMux

§

impl UnwindSafe for SiMux

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.