Expand description
Generic PSI/SI section framing — ITU-T H.222.0 §2.4 (= ISO/IEC 13818-1) and ETSI EN 300 468 §5.1.1.
Every PSI and SI table is carried in one or more sections. This module parses the section header and exposes the payload for table-specific parsers to consume.
§Section layout
byte 0: table_id (8 bits)
byte 1 bit 7: section_syntax_indicator (1 bit)
byte 1 bit 6: private_indicator (1 bit)
byte 1 bits 5-4: reserved (2 bits)
byte 1 bits 3-0 + byte 2: section_length (12 bits)
Long-form (section_syntax_indicator == 1):
byte 3-4: table_id_extension (16 bits)
byte 5: reserved(2) | version_number(5) | current_next_indicator(1)
byte 6: section_number (8 bits)
byte 7: last_section_number (8 bits)
byte 8..(total-4): payload
last 4 bytes: CRC_32
Short-form (section_syntax_indicator == 0, e.g. TDT):
byte 3..(3+section_length): payload (no extension header, no CRC)NOTE the TOT exception: the TOT (0x73) also sets SSI=0 but DOES end with a
CRC_32 (EN 300 468 §5.2.6). Parsing it through this generic short-form
path folds the CRC into payload — use the table-specific TotSection parser instead.
section_length counts bytes after the 3-byte section header, so the
total section size is section_length + 3. It is derived from the payload
on serialize, never stored, so a section whose payload is edited cannot
carry a stale count or CRC.
Structs§
- Section
- A parsed PSI/SI section header, borrowing the raw input buffer for payload.
Functions§
- validate_
crc - Validate the CRC-32 of a complete long-form section held in
raw: the header, the payload and the 4 trailing CRC bytes.