Search code examples
c#videodirectshowdirectshow.net

IVMRMixerControl9 not implemented on Video Mixing Renderer 9


I am trying to extract the IVMRMixerControl9 from the Video Mixing Renderer 9, but this COM based Direct Show filter doesn't list this interface as implemented, and I can't QueryInterface for it. I am trying to set enable the "YUV mixing mode", which I presumably do using the IVMRMixerControl9::SetMixingPrefs method.

Why does MSDN documentation list the VMR9 implementing IVMRMixerControl9, but I can't extract the interface? I have checked on Windows XP and Windows 7, no luck.

var vmr9 = new VideoMixingRenderer9() as IBaseFilter;
// this is always null. this is the C# equivalent of QueryInterface
var mixerControl = vmr9 as IVMRMixerControl9;

Here is an image of the setting I am trying to enable.

Pixture of setting trying to enable


Solution

  • Too early, the mixer is loaded on demand. Or, you can force it by explicit SetNumberOfStreams call.

            IBaseFilter baseFilter = new VideoMixingRenderer9() as IBaseFilter;
            IVMRFilterConfig9 vmrFilterConfig = baseFilter as IVMRFilterConfig9;
            vmrFilterConfig.SetNumberOfStreams(1);
            IVMRMixerControl9 vmrMixerControl = baseFilter as IVMRMixerControl9;
            Debug.Assert(vmrMixerControl != null);