I'm trying to better understand Microsoft media foundation framework. Say, if I have a win32 window in my app (or its HWND handle), how do I render pixels from the IMF2DBuffer (or at least from IMFMediaBuffer) into it?
PS. Do I need to use the good old GDI: device contexts, CreateDIBSection/GetDIBits and BitBlt/StretchBlt?
You can use GDI too, but this is just way out of date.
In most cases, when you are to create modern, performant, power efficient application, you would expect at least some amount of hardware acceleration. Quite so often your video comes from encoded stream, and your
IMFMediaBuffercomes from video decoder with video frame backed by DirectX texture in video memory. You want to render it without accessing its actual bits. In other cases you use Direct3D to produce content, or you use another video API (such as Direct2D) with interop into Direct3D.The common ground here is that your content is already in video memory, and you want to render into Direct3D swapchain to visualize. Quite so often this has simple Direct3D scene involved, and you render this video frame as a resource into it.
You would normally prefer Direct3D11 to Direct3D9 because the latter is already out of date too, even though Media Foundation is also a bit rusty (specifically, public well known MF samples use rather Direct3D9).
But you of course you can cut corners and flush image into good old DIB and present with GDI.