MFGetService 帮助程序函数不支持某些服务接口

Some Service interface are not supported in the MFGetService helper function

我正在尝试获取指向 IDirect3DSurface9 的指针,我使用辅助函数 MFGetService 并将 MR_BUFFER_SERVICE 传递给第二个 parameter.While 链接,我收到 "unresolved external symbol _MR_BUFFER_SERVICE" 错误。

我在evr.h中查找了MR_BUFFER_SERVICE的定义,找到了描述它的宏:

DEFINE_GUID(MR_BUFFER_SERVICE, 
    0xa562248c, 
    0x9ac6, 
    0x4ffc, 
    0x9f, 0xba, 0x3a, 0xf8, 0xf8, 0xad, 0x1a, 0x4d 
);

然后我决定自己制作这个 GUID 并传递给 MFGetService,但是在调试时我得到了错误代码 E_NOINTERFACE

//Here are the GUID struct I made:
const GUID FAR MR_BUFFER_SERVICE = { 0xa562248c,0x9ac6,0x4ffc, {0x9f, 0xba, 0x3a, 0xf8, 0xf8, 0xad, 0x1a, 0x4d} };

//The main code of getting a pointer to IDirect3DSurface9:
IDirect3DSurface9 *d3dsurface9;
IMFMediaBuffer* pBuffer = NULL;
hr = MFCreateMemoryBuffer(1024 * 10, &pBuffer);
if (FAILED(hr))
{
    MessageBox(NULL, L"fail in creating Media Buffer", NULL, NULL);
}
    hr = MFGetService(pBuffer, MR_BUFFER_SERVICE, 
        IID_PPV_ARGS(&d3dsurface9));
if (FAILED(hr))
{
    MessageBox(NULL, L"failed in getting IDirect3DSurface9", NULL, NULL);
}
  1. 链接器错误将通过额外链接 strmiids.lib
  2. 来解决
#pragma comment(lib, "strmiids.lib")
  1. MR_BUFFER_SERVICE 无法从您由 MFCreateMemoryBuffer 创建的通用系统内存支持的缓冲区中获得。此服务仅适用于包装相应 D3D9 表面的缓冲区,尤其是。使用 MFCreateDXSurfaceBuffer 函数创建。

详细信息记录在此处:DirectX Surface Buffer