Question

Few days ago, I wanted to give Media Foundation a try.

The first thing I've noticed is that is doesn't play an MPEG2 file (at least not on Windows 7), however, Windows Media Player 12 does. Therefore, I've ran mftrace wmplayer.exe and examined the output.

9052,2BF4 14:06:36.00364 COle32ExportDetours::CoCreateInstance @ Created {14D7A407-396B-44B3-BE85-5199A0F0F80A} Media Foundation DShow Source Resolver (C:\Windows\SysWOW64\mfds.dll) @0984E950 - traced interfaces: 
9052,1BEC 14:06:36.00450 COle32ExportDetours::CoCreateInstance @ Created {CDA42200-BD88-11D0-BD4E-00A0C911CE86} Filter Mapper2 (C:\Windows\SysWOW64\quartz.dll) @0821B894 - traced interfaces: 
9052,2BF4 14:06:36.00723 COle32ExportDetours::CoCreateInstance @ Created {E436EBB3-524F-11CE-9F53-0020AF0BA770} Filter Graph (C:\Windows\SysWOW64\quartz.dll) @081C7DD0 - traced interfaces: IGraphBuilder @081C7DD0, IMediaControl @04E6D66C, 
9052,2BF4 14:06:36.00741 COle32ExportDetours::CoCreateInstance @ Created {0344EC28-5339-4124-A186-2E8EEF168785} MFSourceFilter (C:\Windows\SysWOW64\mfds.dll) @09934228 - traced interfaces: 
9052,2BF4 14:06:36.00742 CMFPlatExportDetours::MFStartup @ Version=0x00020070, dwFlags=0x00000000
9052,2BF4 14:06:36.01176 CGraphBuilderDetours::AddFilter @081C7DD0 filter: 'MF Source Filter'
9052,2BF4 14:06:36.01194 COle32ExportDetours::CoCreateInstance @ Created {336475D0-942A-11CE-A870-00AA002FEAB5} MPEG-I Stream Splitter (C:\Windows\SysWOW64\quartz.dll) @08084574 - traced interfaces: 
9052,2BF4 14:06:36.01238 COle32ExportDetours::CoCreateInstance @ Created {AFB6C280-2C41-11D3-8A60-0000F81E0E4A} MPEG-2 Demultiplexer (C:\Windows\SysWOW64\mpg2splt.ax) @082003E4 - traced interfaces: 
9052,2BF4 14:06:36.01328 COle32ExportDetours::CoCreateInstance @ Created {E1F1A0B8-BEEE-490D-BA7C-066C40B5E2B9} Microsoft DTV-DVD Audio Decoder (C:\Windows\SysWOW64\msmpeg2adec.dll) @0829C77C - traced interfaces: 
9052,2BF4 14:06:36.04667 COle32ExportDetours::CoCreateInstance @ Created {212690FB-83E5-4526-8FD7-74478B7939CD} Microsoft DTV-DVD Video Decoder (C:\Windows\SysWOW64\msmpeg2vdec.dll) @082C04BC - traced interfaces: 
9052,2BF4 14:06:36.04668 CGraphBuilderDetours::AddFilter @081C7DD0 filter: ''

It seems like they're creating a Media Source that uses DirectShow. They're building a DirectShow graph with an MFSourceFilter which, I guess, is passing the decoded audio/video information to Media Foundation. Because searching the web for MFSourceFilter doesn't help at all, I was wondering if anyone has used that MFSourceFilter before and where I should get started.

(I've already read the question decode MPEG1/2 video with Media Foundation but it doesn't contain what I'm looking for.)

Was it helpful?

Solution

WMP uses Media Foundation, and if unlucky, detours via DirectShow.

Here is a sample WMP playback for MPEG-2 file in Windows 7. Windows Media Player built a DirectShow graph internally and picked on of the available MPEG-2 decoders.

enter image description here

This actual playback is backed by DirectShow entirely, the source on this playback is regular File Source (Async) Filter. WMP might be using the filter in question to obtain information (esp. media types) involved in playback or for other reasons specific to its internal implementation. Possibly even trying to substitute the source of the media to play, however what I see is that this filter is removed and regular DirectShow playback remains.

The bottom line is that Media Foundation DirectShow Wrapper and Source Resolver exist, but they are not documented, used by WMP temporarily (possibly used by MF transparently) and not used on actual playback. Hence, nothing to reuse at the moment.

One of the possible scenarious for this filter that I can think of is to build internal DirectShow topology to provide metadata information for MF client.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top