Access Denied when Activating Media Foundations HEVC decoder

1

I'm trying to write a program that uses IMFTransform to decode HEVC video. I was able to create an IMFTransform decoder, call SetInputType with MF_MT_MAJOR_TYPE=MFMediaType_Video and MF_MT_SUBTYPE=MFVideoFormat_HEVC, but I got MF_E_ATTRIBUTENOTFOUND when I called SetOutputType with MFVideoFormat_NV12.

Eventually I decide to try installing "HEVC Video Extensions" from the Microsft Store but now my code fails at IMFActivate::ActivateObject and returns the error E_ACCESSDENIED.

// WindowsProject6.cpp : Defines the entry point for the application.
//

#include <iostream>
#include <initguid.h>
#include <mfapi.h>
#include <mftransform.h>
#include <combaseapi.h>
#include <d3d11.h>
#include <optional>
#include <Mferror.h>

int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    MFT_REGISTER_TYPE_INFO inputInfo{ MFMediaType_Video , MFVideoFormat_HEVC };
    MFT_REGISTER_TYPE_INFO outputInfo{ MFMediaType_Video , MFVideoFormat_NV12 };
    //CLSID* clsIds;
    //unsigned int numClsIds = 255;
    IMFActivate** activates;
    unsigned int numActivates = 255;

    CoInitialize(NULL);

    //auto result2 = MFTEnum(MFT_CATEGORY_VIDEO_DECODER, 0, &inputInfo, nullptr, nullptr, &clsIds, &numClsIds);
    auto result = MFTEnumEx(MFT_CATEGORY_VIDEO_DECODER, MFT_ENUM_FLAG_SYNCMFT, &inputInfo, nullptr, &activates, &numActivates);
    if (result != S_OK) {
      std::cout << "MFTEnum failed" << std::endl;
      std::terminate();
    }

    std::cout << numActivates << std::endl;

    if (!numActivates) {
      std::cout << "No HEVC decoders found" << std::endl;
      std::terminate();
    }

    IMFTransform* decoder;
    result = activates[0]->ActivateObject(IID_PPV_ARGS(&decoder));
    if (result != S_OK) {
      std::cout << "ActivateObject failed" << std::endl;
      std::terminate();
    }
}

I uninstalled "HEVC Video Extensions" but I still get the access denied error. I still have something called "HEVC Video Extensions from Device Manufacturer" which "App & Features" says was installed several weeks ago. In the Visual Studio Output Window I see the following:

 info:Windows::Services::Store::StoreContextFactory::GetDefault() invoked. (CV:JU3c8WzRMkqe8jy+.2)  [Windows::Services::Store::StoreContextFactory::GetDefault]
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\OneCoreUAPCommonProxyStub.dll'. 
 info:StoreContextServer::Initialize: packageFullName = , productStoreId = , isLicensed = false, isAppContainer = false [Windows::Services::Store::Internal::StoreContextServer::Initialize]
 info:Windows::Services::Store::StoreContext::AcquireStoreLicenseForOptionalPackageAsync invoked. (CV:JU3c8WzRMkqe8jy+.2.3) [Windows::Services::Store::StoreContext::AcquireStoreLicenseForOptionalPackageAsync]
ERROR:  (0x80070057)    [ClientProcessUtils::GetCallingAppPackageFamilyName]
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\usermgrcli.dll'. 
ERROR:  (0x80070057)    [ClientProcessUtils::GetCallingAppPackageFamilyName]
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\AppContracts.dll'. 
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\UserMgrProxy.dll'. 
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\Windows.Shell.ServiceHostBuilder.dll'. 
'WindowsProject5.exe' (Win32): Loaded 'C:\Windows\System32\OnDemandBrokerClient.dll'. 
onecoreuap\base\appmodel\appcontracts\lib\odbexecutor.cpp(115)\AppContracts.dll!00007FFEA083664B: (caller: 00007FFEA07E4A35) ReturnHr(1) tid(3dbc) 80073D54 The process has no package identity.
    CallContext:[\AppServiceBackgroundTask] 

Which seems to indicate that the problem is that I'm not writing a UWP app, I'm making a Win32 Desktop program. My objective is to eventually extend an existing Win32 program so UWP isn't an option. Also, I didn't get this error before install ing the HEVC extensions.

Update:

I ran my program on another computer I own where it works fine. The "The process has no package identity" appears there too but doesn't appear to be a problem.

winapi
ms-media-foundation
dxva
asked on Stack Overflow May 22, 2020 by user2690730 • edited May 25, 2020 by user2690730

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0