Skip to main content

Module ts

Module ts 

Source
Expand description

MPEG-TS packet parser and section reassembler — ITU-T H.222.0 §2.4 (= ISO/IEC 13818-1).

Structs§

AdaptationField
Decoded adaptation field — full §2.4.3.4 layout including transport-private data and the adaptation-field extension sub-structure.
AdaptationFieldExtension
Adaptation-field extension (ISO/IEC 13818-1:2007 §2.4.3.5, adaptation_field_extension_flag == 1).
Ltw
legal_time_window field within the adaptation-field extension (ISO/IEC 13818-1:2007 §2.4.3.5, ltw_flag == 1).
Pcr
Program Clock Reference (ISO/IEC 13818-1:2007 §2.4.3.5): a 33-bit base on a 90 kHz clock plus a 9-bit extension on a 27 MHz clock.
SeamlessSplice
seamless_splice field within the adaptation-field extension (ISO/IEC 13818-1:2007 §2.4.3.5, seamless_splice_flag == 1).
SectionReassembler
Reassembles PSI/SI sections from TS packets on a single PID.
TsHeader
Parsed TS header — the 4-byte transport header fields.
TsPacket
Borrowed view into one 188-byte TS packet.

Enums§

AdaptationFieldControl
2-bit adaptation_field_control field — ITU-T H.222.0 (08/2023) Table 2-5.
ScramblingControl
2-bit transport_scrambling_control field — ITU-T H.222.0 (08/2023) Table 2-4 (defines only 00 = not scrambled); DVB assigns 01/10/11 in ETSI TS 100 289 V1.1.1 §5.1 Table 1 (reserved, even CW, odd CW).

Constants§

ADAPTATION_FLAG
ISO/IEC 13818-1 §2.4.3.3: byte 3 bit 5 = adaptation_field_control (bit 5 = 1 means adaptation present).
AF_PCR_FLAG
PCR present flag (bit 4 of adaptation field flags byte — §2.4.3.4).
CC_MASK
ISO/IEC 13818-1 §2.4.3.3: byte 3 bits [3:0] = 4-bit continuity_counter.
PAYLOAD_FLAG
ISO/IEC 13818-1 §2.4.3.3: byte 3 bit 4 = adaptation_field_control (bit 4 = 1 means payload present).
PID_MASK_HI
ISO/IEC 13818-1 §2.4.3.3: byte 1 bits [4:0] = 13-bit PID (upper 5 bits).
SCRAMBLING_MASK
ISO/IEC 13818-1 §2.4.3.3: byte 3 bits [7:6] = 2-bit scrambling control.
TS_PACKET_SIZE
Size of one MPEG-TS packet (ETSI EN 300 468 §3.2, ISO/IEC 13818-1 §2.4.3.2).
TS_SYNC_BYTE
Sync byte that every TS packet starts with (ISO/IEC 13818-1 §2.4.3.2).

Functions§

extract_ts_payload
Extract the payload bytes from a raw 188-byte TS packet slice.
iter_packets
Iterate over all valid TS packets in a byte buffer.