I've made a modified version of demux_ts (from xine-lib-1.1.1), and it's available here:
The main difference is the changed parsing logic; a hierarchical object model of PAT-->PMTs-->streams is now constructed and maintained. There's also support for using multiple programs and audio languages. There are also a few demo features, namely internal buffering for faster program switching when using multiprogram ts, and (although it doesn't really belong in demux_ts) a simplified teletext subtitle decoder.
The new features can't be used with existing front ends, so a duly modified sxfe ("sxfetv") is available at the same location.
I've used the following to test the demuxer with a full dvb ts stream:
dvbsnoop -s ts -tsraw -b | ./sxfe stdin://mpeg2
I'm not quite sure if all the functionality of the original demux_ts is
retained, since I've tested the demuxer only with mpeg-2 TS from Finnish DVB
transmissions. At least I've omitted some stream formats, but it should
be easy to re-enable them. It also remains a question, whether this version has any
benefits over the original demuxer in general use.
For further info, see the comments at the beginning of demux_ts.c.