Login
 
Archive
Links
Search
Blog List
There are no categories in this blog.
 
Apr 13

Written by: Jeremiah Morrill
4/13/2008 4:02 AM

If you've been reading this blog this week, you probably noticed am attempting to make a WPF control that allows a developer to play DVDs rendered WPF.  I had some reasonable success, but the project had to be hard-coded way to much.  For instance I required 3rd party DVD filters and two (count them, TWO!) FFDShow filters to even make the DirectShow graph work.  The problem lies in the design of the VideoRendererElement.  I expected to always be able to use the SampleGrabber filter to get samples from the DirectShow graph and just pump them into the VRE.  Well it turns out the SampleGrabber is not compatible with VIDEOINFOHEADER2, the media type used by MPEG2, probably for the extra interlace information.  So to get DVDs in WPF cleanly: 

1.) I need to modify the VRE to be more flexible so all the AMMediaType fields can be set.

2.) I need to make my own SampleGrabber filter that does play nice with VIDEOINFOHEADER2.  This may be a DirectShow renderer filter.

The VRE should, in theory, be able to play DVDs out of the box, without the menagerie of 3rd party filters I have to use right now.

These changes could also pave the way for adding the ability to play audio/video files embedded in your DLLs.  Imagine being able to point to a "pack://application:,,,/MyVideo.wmv" in  your XAML.  Maybe if not from your resource file, but any System.IO.Stream?  That may be handy.

I don't foresee any huge changes to the VRE API.  I was thinking something like this (for you DirectShow folks):

//Tell VRE to get samples from the VRE input renderer

videoRendererElement.UseInputRenderer = true;

//Add the input renderer to the filter graph which is rendering the media, such as a DVD graph

myDShowFilterGraph.AddFilter(videoRendererElement.InputRenderer, "VRE Renderer")

Now that you have this custom renderer in your DVD graph, when it runs, it will automagically pump the samples into the VRE, no more messy SampleGrabber crap and very simple integration with DirectShow...Of course I'll still have the simple GDI and pixel buffer update hooks.

Feel free to give any feedback on things you'd like to see or ridicule about my approach :)!

-Jer

Tags:

2 comments so far...

Re: DVDs in WPF, Playing AV Media from DLL resources, etc

Very, very nice work Jer. Looking fwd to some examples and C# code.

/Ken

By Ken on   4/13/2008 7:08 AM

Re: DVDs in WPF, Playing AV Media from DLL resources, etc

That sounds like a great approach to me ... I have been using your mediabridge and look forward to switching to the VRE when it is ready.

By Eric Meyer on   4/13/2008 12:09 PM

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  
  Minimize
Text/HTML Minimize
Copyright 2007
Downloaded from DNNSkins.com