问题
I have the following COM call:
IMFTransform* pMFT = NULL;
HRESULT hr = CoCreateInstance(CLSID_VideoProcessorMFT, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pMFT));
On my development machine, this call to CoCreateInstance succeeds.
However, when I deploy this on my old Windows 7 machine,
the call to CoCreateInstance fails,
and I don't know why.
Here's how I'm displaying the error:
_com_error err(hr);
LPCTSTR hrErrMsg = err.ErrorMessage();
WCHAR msg[MAX_PATH];
StringCbPrintf(msg, sizeof(msg), L"HRESULT=0x%X, %s", errContext, hrErr, hrErrMsg);
MessageBox(hwnd, msg, L"Error", MB_ICONERROR);
And here's the error I get in that message box:
HRESULT=0x80040154, Class not registered
That is, the COM class for the Video Processor MFT
is not registered.
I see that CLSID_VideoProcessorMFT is defined as:
EXTERN_GUID(CLSID_VideoProcessorMFT, 0x88753b26, 0x5b24, 0x49bd, 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82);
This is the GUID 88753B26-5B24-49bd-B2E7-0C445C78C982 in disguise.
I understand that COM classes are registered in the Windows Registry with a key containing this GUID.
Using Registry Editor on my developer machine, I can see the key:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{88753B26-5B24-49bd-B2E7-0C445C78C982}
and this key has a "Default" value of %SystemRoot%\System32\msvproc.dll,
referring to the filepath C:\Windows\System32\msvproc.dll,
which does exist.
On my old Windows 7 machine, this key in the registry does not exist --
as expected, given the "Class not registered" error.
And there is no file at C:\Windows\System32\msvproc.dll.
But this is where the trail goes cold.
I don't know what is supposed to register that class in the registry,
and why it hasn't run on my old Windows 7 machine.
Possible conclusions:
- I have to register the Video Processor MFT myself. However, the docs do not suggest this, and I don't know how I would do it.
- Windows 7 does not support the Video Processor MFT. But the docs provide no indication of this. Indeed, they say "Media Foundation requires Windows Vista or later", which should include my Windows 7 machine.
- I'm loading the Video Processor MFT in the wrong way. Is there a more system-independent way to load it?
Which of these is the right conclusion? Is it possible to load the Video Processor MFT on Windows 7? If so, how?
回答1:
Even though even older documentation for Video Processor MFT does not mention availability restrictions, they can still be assumed from related content:
Requirements
Minimum supported client: Windows 8 Release Preview
Minimum supported server: Windows Server 2012
Applications that target earlier versions of Windows are likely to be supposed to use other DSPs like Color Control Transform DSP and Color Converter DSP. These were/are not GPU accelerated though.
The advantage of Video Processor MFT was that it supported GPU-accelerated video processing using Microsoft Direct3D 11.
回答2:
(This is an expansion on @SimonMourier's very helpful comment, for future readers, since it was all new to me.)
I believe CLSID_VideoProcessorMFT is available as follows:
- For "Windows Desktop Applications" on >= Windows 8.1
- For "Windows Store Applications" on >= Windows 10
- For "Windows Phone Applications" on >= Windows 10
The header file mfidl.h documents which Windows version a specific COM class was introduced in. Following CLSID_VideoProcessorMFT to its definition, I find:
#if (WINVER >= _WIN32_WINNT_WINTHRESHOLD)
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
// ...
EXTERN_GUID(CLSID_VideoProcessorMFT, 0x88753b26, 0x5b24, 0x49bd, 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82);
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */
#endif // (WINVER >= _WIN32_WINNT_WINTHRESHOLD)
// ...
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#if (WINVER >= _WIN32_WINNT_WINBLUE)
#if (WINVER < _WIN32_WINNT_WINTHRESHOLD)
EXTERN_GUID(CLSID_VideoProcessorMFT, 0x88753b26, 0x5b24, 0x49bd, 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82);
#endif // (WINVER < _WIN32_WINNT_WINTHRESHOLD)
#endif // (WINVER >= _WIN32_WINNT_WINBLUE)
// ...
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
By following and decoding all these macros, I got the availability list above.
来源:https://stackoverflow.com/questions/61140795/class-not-registered-when-loading-the-video-processor-mft-on-windows-7