Skip to main content

Module packet

Module packet 

Source
Expand description

User packet extraction from BBFrame data fields.

Supports Normal Mode (NM, 188-byte stride) and High Efficiency Mode (HEM, 187-byte stride) per EN 302 755 §5.1.8.

In NM the first byte of each user packet in the data field is a CRC-8 that replaces the original sync byte (0x47). In HEM the sync byte is simply absent and must be prepended.

§SYNCD handling

SYNCD gives the bit offset from the start of the DATA FIELD to the first bit of the CRC-8 byte of the first user packet (NM) or the first byte of the first user packet (HEM). Callers typically prepend any carry-over from the previous BBFrame and pass the result plus SYNCD.

§NPD/DNP reinsertion (HEM only)

When NPD is active (matype.npd == true), each transmitted user packet is followed by a 1-byte DNP counter. The HemTsIter skips these DNP bytes automatically.

Structs§

CarryOverExtractor
Stateful UP extractor that carries partial user packets across BBFrame boundaries — a single UP can span multiple frames, especially in HEM where stride=187 bytes.
HemTsIter
Iterator over HEM TS user packets.
NmTsIter
Iterator over NM TS user packets.

Constants§

HEM_UP_SIZE
User packet size in High Efficiency Mode (187 bytes = TS minus sync byte).
NM_UP_SIZE
User packet size in Normal Mode (188 bytes = full MPEG-2 TS packet).
TS_SYNC_BYTE
MPEG-2 sync byte that CRC-8 replaces in NM.

Functions§

up_iter
Build an appropriate user-packet iterator for the given BBHEADER.