Controlling the DirectShow graph

Aug 28, 2009 at 10:48 AM

Hi

We are currently using MediaElement to play Mpeg4-files in our application. During testing (Windows XP) we have experienced display problems on some computers. Two  main cases:

* Loops are miscolored and have wrong aspect ratio. Investigation has shown that this is due an unlucky combination of DirectShow filters and renderer being used to decode and render the files.

* Loops are flickering with green overlay. Investication indicates that the problem is that the graphic card does not support the hardware rendering used by the Enhanced Video Renderer.

Our hope is to resolve these problems by having full control of the DirectShow graph. That way we can be sure that the filters we install are actually used, and that the Enhanced Video Renderer is not used.

Is it possible to have this level of control when using the MediaUriElement?

   Kjetil

 

Coordinator
Aug 28, 2009 at 5:54 PM
That is totally possible, but if you favor some filters, you will have to modify the MediaUriPlayer.cs code.  If you simply just add your prefered filters to the graph before the grap is automatically built, dshow will try to use the filters in the graph first before it trys other filters installed in the system.
 
-Jer
Aug 31, 2009 at 8:06 AM

Thanks Jer!

I now created my own UriElement and UriPlayer classes, using the following code in UriPlayer.OpenSource():

m_renderer = CreateVideoRenderer(VideoRenderer, m_graph);

// Create custom filter graph
IBaseFilter demuxer = AddFilterByName(m_graph, FilterCategory.LegacyAmFilterCategory, "MainConcept MP4 Demultiplexer");
IBaseFilter decoder = AddFilterByName(m_graph, FilterCategory.LegacyAmFilterCategory, "MainConcept AVC/H.264 Video Decoder");
IBaseFilter sourceFilter = AddFilterByName(m_graph, FilterCategory.LegacyAmFilterCategory, "File Source (Async.)");
var fileSourceFilter = sourceFilter as IFileSourceFilter;
if (fileSourceFilter != null)
  fileSourceFilter.Load(fileSource, null);


Testing in GraphStudio shows that DirectShow by default selects a different set of source/codec/renderer, but with this I get just the chain I want.

    Kjetil