Wednesday, August 18, 2010

Tricks and Tips for using the VMR9

A few months ago I did some work involving the VMR9, and I hit several brick walls. Many of these brick walls I hit about six months previously when working on a PC application for HD DVD playback (no, there were no plans to ship it, even then), but I hadn�t taken enough notes of the solutions back then and had to re-debug them all over again. In case you hit these same problems, or I do at some point in my future, here they are and how I solved them. I do not claim domain expert status in this area, nor should you treat my claims here as gospel. I also cannot explain why these changes fixed things. However they worked for me and might for you.

I was trying to build a graph that rendered video into a custom allocator/presenter, using the VMR in renderless mode. The issues were:

Failure to QI the VMR for IVMRMixerControl9No video output when the VMR is in renderless mode at all on Vista, identical code worked fine on XPWhen I fixed that above, I could get MPEG2 video to render on XP but not WMV, and Vista still rendered nothingThe solutions turned out to be:

QueryInterface on the VMR9 for IVMRMixerControl9 returns E_NOINTERFACE until you call SetNumberOfStreams on it.

If you ask the VMR to use YUV in renderless mode on Vista, nothing will render. The fix is to not ask for it. (Duh).

The order you set up VMR9 for renderless mode is critical. The original code that worked OK for MPEG2 on XP but not at all for WMV was as follows (error handling omitted for clarity):


spVMR->QueryInterface(IID_IVMRFilterConfig9, &spConfig);


After much experimentation the code that worked in all cases was:





I can only guess that when you add the VMR filter to the graph you must have already set up the custom allocator/presenter. Why Vista is more fussy than XP, and why MPEG2 behaved differently than WMV I cannot begin to guess at.

View the original article here

No comments:

Post a Comment