I have developed a simple video editor using C# and DirectShow.net. As of now, I have a DirectShow filter graph built using DirectShow Editing Services. My application controls the graph, runs, pauses and stops the playback in a preview window as needed. In an editing session, the graph gets changed according to user requests to add, remove or modify the media.
Currently I use a PictureBox wrapped into WindowsFormsHost to preview edited videos. But I really want to try using Jeremiah Morril’s WPF MediaKit instead. (http://wpfmediakit.codeplex.com)
The initial line of thought (my brute force approach) was to pass IGraphBuilder and IPin from my graph to the OpenSource() function in MediaUriPlayer.cs in WPF MediaKit, so that a VMR9 renderer is added and connected to my existing graph instead of creating a new graph as it is done in the original OpenSource(). This did not work out nicely, and I gave up after trying various combinations and most of the time getting the “COM object separated from its underlying RCW” error.
Following the initial failure, I searched and came across Morrill’s similar VideoRendererElement at http://videorendererelement.codeplex.com. It seems that it won’t be too hard to add a sample grabber to my DirectShow graph and use it to send samples to VideoRendererElement. It would be just like the webcam example that is included with VideoRendererElement.
Finally, I’m wondering if it would not it be possible to use any of the newer controls from WPF MediaKit in the same way, that is by passing samples from a sample grabber in my graph to a MediaUriElement, DvdPlayerElement, or another control from the WPF MediaKit collection. Essentially my question is: Can anyone recommend using WPF MediaKit or VideoRenderingElement to implement this sample grabber scenario? Or perhaps someone can suggest an even better way for my DES made filter graph to render into a WPF control ...