Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

How to get the VP9 decoder from a C++ program on Hololens 2?

TrylzTrylz
edited March 31 in HoloLens companion app

I am implementing a VP9 hardware decoder that will run on PC and Hololens 2.
When I try to load the "MSVP9DEC.dll", it works well on PC but the DLL is not found on Hololens. I have installed the VP9 Video Extensions on the device.

Here the snipped code. The "assert(DecoderDll)" fails on Hololens:

HRESULT CreateCOMObjectFromDll(HMODULE dll,
const CLSID& clsid,
const IID& iid,
void** object);

void CreateVP9Decoder()
{
#if PLATFORM_HOLOLENS
    HMODULE DecoderDll = ::LoadPackagedLibrary(L"MSVP9DEC.dll", 0ul);
#else
    HMODULE DecoderDll = ::LoadLibrary(L"MSVP9DEC.dll");
#endif

    assert(DecoderDll);

    const GUID CLSID_VpxDecoder = { 0xE3AAF548, 0xC9A4, 0x4C6E,  {0x23, 0x4D, 0x5A, 0xDA, 0x37, 0x4B, 0x00, 0x00 } };

    Microsoft::WRL::ComPtr<IMFTransform> VP9Decoder;

    HRESULT hr = CreateCOMObjectFromDll(DecoderDll, CLSID_VpxDecoder,
        IID_PPV_ARGS(&VP9Decoder));

    assert(SUCCEEDED(hr));

    //...

}

__pragma(warning(push))
__pragma(warning(disable: 4191))

//@See: https://chromium.googlesource.com/chromium/src/+/master/media/gpu/windows/dxva_video_decode_accelerator_win.cc
HRESULT CreateCOMObjectFromDll(HMODULE dll,
    const CLSID& clsid,
    const IID& iid,
    void** object) {

    if (!dll || !object)
        return E_INVALIDARG;

    using GetClassObject =
        HRESULT(WINAPI*)(const CLSID& clsid, const IID& iid, void** object);

    GetClassObject get_class_object = reinterpret_cast<GetClassObject>(
        GetProcAddress(dll, "DllGetClassObject"));

    assert(get_class_object);

    TComPtr<IClassFactory> factory;
    HRESULT hr = get_class_object(clsid, IID_PPV_ARGS(&factory));

    assert(SUCCEEDED(hr));

    hr = factory->CreateInstance(NULL, iid, object);
    return hr;
}

__pragma(warning(pop))

Thank you!

Sign In or Register to comment.