[long] internal PSI demux and decoder

Arnaud de Bossoreille de Ribou bozo at via.ecp.fr
Fri May 24 23:44:16 CEST 2002

I've just had a look (nearly two hours) to the code in
"plugins/mpeg_system/mpeg_ts.c" and my conclusion is that the internal
PSI demux and decoder is unable to handle PSI tables with more than one


Here are some points that make me think they both are pieces of sh*t:

Have a look to the code of TSDemuxPSI()...

First when p[i] is a u8 (p[i] & 0xF) << 8 is zero (a detail). Moreover
approximately 20 lines may be trashed without any difference due to
tests that are always false (for instance: line 298, the variable is set
to 0 just before).

If people look closer they see that the first packet of a section which
is not the first of the table (section_number != 0) is trashed.

I'm not sure but it looks like TSDecodePAT() and TSDecodePMT() simply
put the sections with section_number != 0 in their ignore list.


My goal is not to promote libdvbpsi but:

The internal PSI handler of vlc didn't, doesn't and won't [1] handle
multiple sections.

The internal PSI handler of vlc didn't, doesn't and won't [1] respect
the ISO/IEC 13818 since sections can be transmitted in any order
(numerical or not). It is written in ISO/IEC 13818, Annex C.2.iii.

The internal PSI handler of vlc is very hard to maintain in an
intermediate state between ugliness/kludginess/bugginess/whatyouwant and
full ISO compliance whereas libdvbpsi is supposed to be full ISO
compliant. If someone with a lot of courage wants to patch it so that it
can handle multiple sections, he will loose a lot of time to rewrite
what libdvbpsi already does.

[1] but if we put the code of libdvbpsi in it.


So imho I think we should leave the internal PSI handler of vlc in the
trash box and check that libdvbpsi works on all the plateforms supported
by vlc. It currently works on Linux-i386, Mac OS X, probably all Linux-*
and maybe with some little patches on all the plateforms man has thought
of in his entire life.

This is only my opinion. Do what you want, I don't care since I use
libdvbpsi ;-)


About the problem on languages that come from vls (CVS): I'm going to
fix the bug which generate a multiple sections PMT (a bug of either vls
or libdvbpsi, I haven't had a look at it until now).

My 2 cents,


This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>

More information about the vlc-devel mailing list