Q:

best way to build graph for MPEG2 transport stream

on windows 7 the windows media player supports .ts files very well,
in the sense that windows media player knows how to handle such files without any additional codec packs.
however if I try to use graphedit to "render" a .ts file, it complains it 
doesnt know how to build a graph for it. 
what method does windows media player use to demux/decode these files?
is it directshow? windows media foundation? BDA? Microsoft TV Technologies? unified tuning model?
whatever the method they use, is available as an API to be used in my custom application?

A:

In DirectShow using only Microsoft filters it can be a bit of a mess.  The Mpeg2 Demultiplexer needs to be manually configured through code using the IMpeg2Demultiplexer interface or through the property pages to add output pins for the content streams.  Normally you would need to connect something else to the filter to parse the PSI/PAT information and identify the program ids of the content streams inside the transport stream.  Microsoft provides an SDK sample to do this in the Windows Platform SDK.
This is assuming that you have a regular mpeg2 transport stream file.  You can use the free apps MediaInfo or TsReader Lite to see exactly what is in your ts file.
There are non-Microsoft filters that make handling transport streams in DirectShow a lot easier.  The combination of the open source filters Haali Media Splitter and Ffdshow will do it without any extra configuration.  Or commercial filter packages from MainConcept, Elecard, LEADTools, etc.
I haven't done much hands-on work with Media Foundation, so I don't have much advice to offer on that front.  Newer versions of Windows Media Player use MF instead of DirectShow.  Some, but not all, new MF functionality is also exposed through DirectShow interfaces.

A:

I'm not sure of the method used by Windows Media Player.
I've used DirectShow to build a graph. From the source, you can add an MPEG-2 Demultiplexer, create the Audio and Video pins (using the IMpeg2Demultiplexer interface), then hook the Audio pin to the "Microsoft DTV-DVD Audio Decoder" and the Video pin to the "Microsoft DTV-DVD Video Decoder". You can then feed the outputs into an audio and a video renderer.
For example, here is part of a graph I have used:

David

