MediaFoundation VideoComponent for Windows

Here is an sample implementation of VideoComponent for Windows based on MediaFoundation. It provides better modern multimedia format support than DirectShow.

It is taken from Microsoft classic samples pack and modified for JUCE (protectedplayback example).

You need to replace juce_Video_windows.h with juce_Video_windows.h bellow and add juce_Video_IMFMediaSession.h include to juce_VideoComponent.cpp

Also add MediaFoundation headers and libraries to juce_Video.cpp

Headers and libraries

 // Media Foundation headers
 #include <mfapi.h>
 #include <mfobjects.h>
 #include <mfidl.h>
 #include <mferror.h>
 
 // EVR headers
 #include <evr.h>

 #pragma comment (lib, "mf.lib")
 #pragma comment (lib, "mfplat.lib")
 #pragma comment (lib, "mfuuid.lib")
 #pragma comment (lib, "evr.lib")

juce_Video_IMFMediaSession.h (52.3 KB)

juce_Video_windows.h (17.7 KB)

It is not polished so if someone has some production code to test and report it would be great.

Bye

1 Like