Skip to main content

BbframePump

Struct BbframePump 

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

Per-PLP BBFrame→inner-TS pump.

Feed one PLP’s BBFrame data-field bytes at a time with feed; the pump parses the BBHEADER, detects NM vs HEM, and runs the per-PLP CarryOverExtractor — interleaved PLPs keep independent carry-over state.

The returned slice borrows an internal buffer that is cleared on every call; copy out anything you need to keep.

use dvb_bbframe::pump::BbframePump;

let mut pump = BbframePump::new();
// Receive a BBFrame data-field byte slice (BBHEADER + data field)
// for PLP 5:
let df_bytes = vec![0u8; 200];
let inner_ts_packets = pump.feed(5, &df_bytes);
for pkt in inner_ts_packets {
    println!("inner TS packet recovered");
}

Implementations§

Source§

impl BbframePump

Source

pub fn new() -> Self

Create a fresh pump with no PLP state.

Source

pub fn feed(&mut self, plp_id: u8, df_bytes: &[u8]) -> &[[u8; 188]]

Feed one PLP’s BBFrame data-field bytes (df_bytes = 10-byte BBHEADER

  • data field).

Returns the inner 188-byte TS packets completed by this frame.

Per-PLP carry-over state is keyed by plp_id so interleaved PLPs don’t corrupt each other’s carry-over. A new plp_id lazily creates a fresh extractor.

This method is infallible: malformed input, bad BBHEADERs, and non-TS payloads emit no packets and bump a stat counter — never panics, never errors out.

Source

pub fn stats(&self) -> BbframePumpStats

Diagnostic counters accumulated across all feed calls.

The per-PLP carry_over field aggregates the stats from all PLP extractors; check carry_over.npd_unsupported in particular — a non-zero value means valid HEM frames were dropped (NPD reinsertion unsupported).

Trait Implementations§

Source§

impl Default for BbframePump

Source§

fn default() -> Self

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

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> ErasedDestructor for T
where T: 'static,

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.