Within a TS the packet size will be constant.
Hence it should usually suffice to determine the packet size once, and then continue to use the same value.
Currently with a 204 or 208 byte packet TS file (8 or 16 extra R/S ECC bytes, ignored in pkt decode), dvbsnoop is not able to synchronise with the data, which suggests the sync algorithm is not very good even in this simple case.
I would suggest something like:
1. read file to find first sync byte 0x47 (could be data byte with same value)
2. read next 210 bytes
3. look at +188 else +204 else +208 for next sync byte
4a) if sync found in 3, use that value
4b) if sync not found (spurious pkt start), go to 1) to find next sync byte value
An alternative might be to just read the first (say) 1k of the file, then look for 0x47 values, and deduce a) most likely repeat interval [188/204/208] b) start offset
And in any case, have a cmd line option to set/override the packet size.
Logged In: YES
user_id=323126
Originator: YES
Will have a look at posting a mod - but am only interested in offline (file-based) analysis (running under Cygwin) hence method may not be suitable for realtime use.