locked
What interop technology for Media Foundation/WPF? RRS feed

  • Question

  • Hi,

     

    I need to write the Media Foundation parts of our WPF C# application in C++. What is the best choice for interop? I'm new to interop and C++ so I'm not sure what is best in this situation to call my C++ dll: P/Invoke, COM or C++/CLI. The Media Foundation dll would be standard video player functions with sequencer source/playlist, painting to a window handle provided by HwndHost.

     

    Dave

    Saturday, December 17, 2011 5:08 AM

Answers

  • I'm currently writing such an application with the same constraints. I've choosen to write a C++ COM dll, which wraps MF, and exposes a few functions for my WPF application.

    The only thing I don't use is the HwndHost class, because the video window can't benefit of WPF's AirSpace.

    Instead I wrote a custom EVR presenter, which writes the video frames in a D3DImage component.

    If you need samples, the MSDN has them all. You may just need to find them and adapt them for you

    Hope this helps ^^

    Mike

    • Edited by Michael Delva Sunday, December 18, 2011 10:06 AM
    • Marked as answer by Dave Lowndes Monday, December 19, 2011 2:08 AM
    Sunday, December 18, 2011 10:05 AM

All replies

  • I'm currently writing such an application with the same constraints. I've choosen to write a C++ COM dll, which wraps MF, and exposes a few functions for my WPF application.

    The only thing I don't use is the HwndHost class, because the video window can't benefit of WPF's AirSpace.

    Instead I wrote a custom EVR presenter, which writes the video frames in a D3DImage component.

    If you need samples, the MSDN has them all. You may just need to find them and adapt them for you

    Hope this helps ^^

    Mike

    • Edited by Michael Delva Sunday, December 18, 2011 10:06 AM
    • Marked as answer by Dave Lowndes Monday, December 19, 2011 2:08 AM
    Sunday, December 18, 2011 10:05 AM
  • That's a great help thanks Mike!
    Monday, December 19, 2011 2:09 AM