MediaFoundation Rendering

Nov 30, 2011 at 6:17 PM

I see there are some stubs for using MediaFoundation in WPFMediaKit but I'm wondering how I can utilize MF instead of DShow for the MediaUriPlayer? We are targeting Windows7 and the MediaKit DShow example isn't rendering anything without plugins (ie ffdshow). My hope is that MF will have better support for rending various video formats. Can someone point me in the right direction for implementing this?

Thanks, Mike

Nov 30, 2011 at 9:55 PM


I've gutted the DShow code from MediaUriPlayer and implemented the MediaFoundation code from an MS provided example. It seems to load the video and play without error but I get no rendered video. I'm assuming it has to do with how I'm assigning the EvrPresenter in the MF topology. Here's the code where I'm assigning the Evr:

if (guidMajorType == MFMediaType.Video)
                object sink;
                hr = MFExtern.MFCreateVideoRenderer(new Guid("6EF2A660-47C0-4666-B13D-CBB717F2FA2C"), out sink);

                IMFVideoRenderer pVideoRenderer = sink as IMFVideoRenderer;
                hr = pVideoRenderer.InitializeRenderer(null, presenter);

Is there any other flags or code I need to add to the presenter?

Mar 29, 2012 at 3:31 PM

Has this ever been resolved?