Skip to main content

SectionPacketizer

Struct SectionPacketizer 

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

Packetizes PSI/SI sections into 188-byte TS packets.

This is the byte-exact inverse of SectionReassembler::feed: packets produced here, when fed back through the reassembler, yield the same sections in order.

ISO/IEC 13818-1:2007 §2.4.4 (docs/iso_13818_1_systems.md).

Implementations§

Source§

impl SectionPacketizer

Source

pub fn new(pid: u16) -> Self

Start a packetizer for pid with continuity_counter = 0.

Source

pub fn with_continuity(pid: u16, cc: u8) -> Self

Start at a specific continuity_counter (0..=15) — for resuming a stream.

Source

pub fn pid(&self) -> u16

The PID this packetizer emits packets for.

Source

pub fn continuity_counter(&self) -> u8

The continuity_counter for the next emitted packet.

Source

pub fn packetize_into( &mut self, sections: &[&[u8]], out: &mut Vec<[u8; 188]>, ) -> usize

Packetize a batch of complete sections into 188-byte TS packets, appended to out (cleared first).

Returns the number of packets appended.

Source

pub fn packetize(&mut self, sections: &[&[u8]]) -> Vec<[u8; 188]>

Allocating convenience wrapper over packetize_into.

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.