Login
 
Archive
Links
Search
Blog List
There are no categories in this blog.
 
Mar 18

Written by: Jeremiah Morrill
3/18/2008 12:35 AM

When I heard about the new, high-performance WriteableBitmap coming in .NET 3.5 my ears perked a bit.  Could this be what us video nuts need to dump the WPF MediaBridge once and for all?  Maybe...but probably not.  The new WriteableBitmap lets you write directly to the pixel buffer and tell WPF which areas are dirty.  I queried some folks who are "in the know", and it was said that the new WriteableBitmap isn't optimized for video and may not have the performance people seek in this scenario.

So I wanted to plan for the worst...and what better way than to keep on hackin'.  I wanted to create an easier API than that of the WPF MediaBridge.  Something where the developer does not have to know a lick of DirectShow, but can use it if they need to.  Here's the plan (and the crudely done Visio diagram):

image Simply put, I am going to create a WPF control.  As a consumer of the control's API, you would just have to initialize it with a video width, height and color space (RGB24, YUY2, etc).  Next a developer would simply send some video bytes to the control and the control would handle the rest.  Voila!  High performance video.

The "magic" will mostly be done behind the scenes.  When the control is initialized, it will load up the "BridgeFilter", using the MediaElement.  The BridgeFilter would then make a callback to the WPF application, passing the BridgeFilter's reference.  When video bytes are passed to the control, the control will pass those bytes to the BridgeFilter, which in turn passes them to the EVR renderer and ultimately WPF!

I haven't begun on this project, but if anyone has any suggestions, let me know sooner than later ;).

-Jer

Tags:

4 comments so far...

DVD Playback

Great work, i have been following your development to overcome the mediaelement problems with great anticipation. You mention your in your latest work that one does not need to know DirectShow. I have been trying to get the videorenderer to read a dvd disk or folder and render this out, so far no joy :-(
Any chance you can put together a dvd sample or point me in the right direction. This will put the last part of my media player in my car together.
Cheers Wayne

By Wayne on   4/8/2008 3:05 AM

Re: New WriteableBitmap - Ready for Custom/DirectShow Video?

You do not need to know directshow IF you just have pixels or compressed samples to send the renderer. Otherwise you typically would make your own dshow graph with the sample grabber in there and send the samples to the VideoRendererElement. This is easier than it sounds, just look at the examples from: http://directshownet.sourceforge.net/ Or look at the webcam code in the samples for the VideoRendererElement.

Now the news about DVD before you look at the DVD example they have. To avoid people pirating DVDs most DVD filters (codecs) wont let you inject a samplegrabber or use certain rendererers. I need to find a good open-source dshow filter that decodes dvds and I can make a code example how to do this. If you know of any let me know and I think I can scrape something together.

By Jeremiah Morrill on   4/8/2008 3:12 AM

Re: New WriteableBitmap - Ready for Custom/DirectShow Video?

based on what you say about dvds is this the reason i can only get sound and no pictures.
I am no guru in this area, but injecting a sample grabber would this then allow people to write out a new video file, hence why its prevented.
So this leaves me with a very broken media center in my car, i guees i will need to survive with music and pictures alone. Or i could just use the media ocx like i tried originally, but then i cant have wpf buttons like play etc sitting on top of the video.
Thanks for the reponse and work you have put into this project.
Wayne

By Wayne on   4/8/2008 4:52 AM

Re: New WriteableBitmap - Ready for Custom/DirectShow Video?

Hi. Andrey,Ukraine.
how to use YUY2????
where in the code to specify this? and how to initialize a component with YUY2?
my mail andreywin@gmail.com
andreywin@i.ua

By Andrey on   5/8/2008 5:23 AM

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