Sorry for the long winded email. I'd usually make use my blog, but I think I've got a bigger audience here lol.
I've just added support for the EVR renderer in the WPF MediaKit.
The EVR is the new(ish) video renderer that is used by the MediaElement. The EVR has a lot of benefits/features
, but mainly very precise sample presentation, *much* more tolerant against dropping of frames and most importantly, you need it for decent integration into MediaFoundation, DirectShow's successor. MediaFoundation, thus far in Vista, has been gimped...not really meant for mass consumption or general use. But with Windows 7, it's supposed to be the sh!t with the whiz bang hardware accelerated en/decoding. I didn't want to miss that boat and leave WPF out in the DirectShow
To support the EVR, you gotta write something called a "Presenter", which is a plugin
write for the EVR. I'm sure you can guess what the presenter does...I tried to write it in C# at first because I thought it would make me cool. But it didn't make me cool, it just made me angry. A lot of the MediaFoundation COM objects don't QueryInterface correctly so the CLR was having a fit. I started to eff with with vtables, which worked well, but I threw in the towel as the code became quite disgusting and near impossible to manage.
Microsoft has a great C++ EVR presenter sample in the Windows SDK, which is for a Win32 app, but it has all the boiler plate (so big props to them). After a few days of massaging that, I got it transformed into something consumable for WPF MediaKit. It wasn't too difficult, but the way the EVR wants to render queued samples and the way WPF wants to hold reference to the D3D surface do not
work together. So I ended up copying the surface being presented to a single d3d surface that is used to render to the WPF D3DImage. I also added automatic support for 32bit and 64bit, so the CLR will pick the right dll (Presenter32.dll or Presenter64.dll) Not sure if it will work on XP, but I did add support for D3D9 (not just D3D9Ex).
I will say that the EVR seems to eat up a little more CPU than the VMR9, but the more fluid video on 1080p is well worth it IMO. I was able to actually play some 1080p content smoothly that even WMP couldn't do! (Alexander from the WM HD showcase
) Right now I only added support for my MediaUriElement (MediaElement clone). To enable the EVR its like this:
Stretch="Uniform" VideoRenderer="EnhancedVideoRenderer" />
I'm still working out some bugs, but I'm real excited about this!