Skip to main content

resync

Function resync 

Source
pub fn resync(buf: &[u8]) -> Option<usize>
Expand description

Find the byte offset of the first confirmed 0x47 sync byte in buf.

“Confirmed” means either buf[offset + 188] == 0x47 (two-packet confirmation), or the buffer is too small for two packets (best-effort single-sync-byte alignment).

Returns None when buf contains no 0x47 byte at all.

This is a stateless best-effort helper. For a full stateful resynchroniser with 204-byte detection and per-call carry-over buffering, use mpeg_ts::resync::TsResync.