JoshyFun's blog

General discussion about everything related with Digital TV (Satellite, terrestrial, cable, High Definition, ...), including news related with digital TV and my web page.
Please hit "reload" to get the most recent updates.

Saturday, November 25, 2006

The TS 184 bytes hell

As most DVB cards software developers knows, SS1 (Technotrend Premium) cards (and all MDAPI compliant programs) give you TS packets of 184 bytes instead the 188 bytes of each TS packet, this means you receive only the payload, yes you have the most important thing, the data, but you miss the PUSI (Payload Unit Start Indicator) flag. Try to get plain tables from payload only data is quite complex and most people simply try to find some patterns in the data intented to parse, the problem is that this patterns work with one broadcaster and fail in others (little differences in how data is represented), so this is not a very good mode of parsing.

When I was working in PMCAM2 found the same problem to handle EMM data, so I wrote a piece of code that do not search for patterns, instead it checks some DVB semantics in order to find the stream sequence. The algorithm works in a 99.99% of table cases, with better results as less table IDs are being broadcasted in the same PID, this means, if the given PID only broadcasts 1 or 2 different table IDs the algorithm will be almost perfect, but if the PID gives you 255 (that's impossible) table IDs the algorithm will not work at all (unless all the tables carry a CRC32 check).

As many people have this problem, the source code of the algorithm and a DLL implementation (in order to be used in other programming languages different than Delphi) has been published. You can download it from my site, or from this direct link:

http://joshyfun.peque.org/special/TS184_100.zip with source code, compiled DLL and one example written in Delphi.

0 Comments:

Post a Comment

<< Home