Skip to main content

T2miPump

Struct T2miPump 

Source
pub struct T2miPump { /* private fields */ }
Expand description

Feed-and-iterate T2-MI pump.

Supports two operating modes:

  • TS-encapsulated (most common): construct with T2miPump::new, passing the 13-bit PID carrying T2-MI (from the PMT). Feed 188-byte MPEG-TS packets with T2miPump::feed_ts. The pump filters by PID, strips the TS header per ISO/IEC 13818-1 §2.4.3.2, and forwards the payload to the internal PacketReassembler (ETSI TS 102 773 §6.1.1).

  • Raw (un-encapsulated): construct with T2miPump::raw. Feed arbitrary byte slices with T2miPump::feed_raw. The pump buffers bytes and emits events once a full packet (determined by the header’s payload_len_bits) is available.

§PID note

PIDs are 13-bit values (0x0000–0x1FFF per ISO/IEC 13818-1 §2.4.3.2). This type uses u16 directly; no newtype is introduced. Values above 0x1FFF are accepted without error — the PID filter simply never matches.

Implementations§

Source§

impl T2miPump

Source

pub fn new(pid: u16) -> Self

Create a TS-encapsulated pump that filters to pid.

pid is the 13-bit T2-MI PID from the PMT (e.g. 0x0006 for data piping).

§PID range

Valid MPEG-TS PIDs are 13-bit (0x0000–0x1FFF); this parameter is u16. No newtype is introduced to keep the API lightweight.

Source

pub fn raw() -> Self

Create an un-encapsulated raw-stream pump.

Use T2miPump::feed_raw to supply bytes. The pump buffers internally and emits events by packet boundary, not by call boundary — a packet split across two feed_raw calls produces exactly one event.

Source

pub fn stats(&self) -> Stats

Accumulated statistics.

Source

pub fn feed_ts(&mut self, packet: &[u8]) -> impl Iterator<Item = T2miEvent> + '_

Feed one 188-byte MPEG-TS packet. Infallible: malformed packets are counted in Stats::malformed_packets and discarded.

Packets on the wrong PID are silently ignored (only Stats::ts_packets is incremented).

Returns a draining iterator over any T2-MI events completed by this feed.

Source

pub fn feed_raw(&mut self, data: &[u8]) -> impl Iterator<Item = T2miEvent> + '_

Feed raw T2-MI bytes (un-encapsulated mode).

The slice may contain a partial packet; bytes are buffered internally. A packet split across two feed_raw calls produces exactly one event.

Returns a draining iterator over any T2-MI events completed by this feed.

Auto Trait Implementations§

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.