Skip to main content

Module resync

Module resync 

Source
Expand description

Stateful TS byte-stream resynchroniser — ISO/IEC 13818-1 §2.4.3.2.

Recovers 188-byte MPEG-TS packet alignment from an arbitrary byte stream (file reads, UDP payloads) that may start mid-packet or contain leading garbage. Also detects 204-byte Reed-Solomon-coded packets (DVB RS-coded outer forward-error-correction layer) and strips the 16 parity bytes, yielding standard 188-byte TS packets in both cases.

§Feature gate

This module is only compiled when the ts feature is enabled (the default), because it depends on the TS constants in crate::ts.

§Example

use dvb_si::resync::TsResync;

let mut r = TsResync::new();
// Feed arbitrary bytes (file chunks, UDP datagrams, etc.).
let packets: Vec<[u8; 188]> = r.feed(b"some raw bytes");
let stats = r.stats();

Structs§

ResyncStats
Counters accumulated during resynchronisation.
TsResync
Stateful TS byte-stream resynchroniser (ISO/IEC 13818-1 §2.4.3.2).

Enums§

PacketStride
Detected packet size after locking.

Constants§

LOCK_CONFIRMATIONS
Consecutive sync bytes at the candidate stride required to declare lock.
RS_PACKET_SIZE
Reed-Solomon-coded TS packet size: 188-byte payload + 16 parity bytes (DVB RS outer FEC, ISO/IEC 13818-1 §2.4.3.2 informative note).
RS_PARITY_LEN
Number of Reed-Solomon parity bytes appended to a 204-byte packet.