Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

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.

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, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

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

TrylzTrylz
edited March 2020 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.