下一个代码应该提供 inputInfo 和 outputInfo 配置以获取 IMFTransform,并且此 IMFTransform 用于将 ID3D11Texture2D(格式为 DXGI_FORMAT_B8G8R8A8_UNORM)编码为 H264
我了解格式 DXGI_FORMAT_B8G8R8A8_UNORM 可以作为 MFVideoFormat_NV12 上的 IMFTranform 是 D3D_AWARE 。但是我在获得 D3D_AWARE 的 IMFTranform 时遇到问题
MFT_REGISTER_TYPE_INFO inputInfo = { MFMediaType_Video, MFVideoFormat_NV12 };
MFT_REGISTER_TYPE_INFO outputInfo = { MFMediaType_Video, MFVideoFormat_H264 };
MFT_OUTPUT_STREAM_INFO mosiBuffer;
UINT32 unFlags = MFT_ENUM_FLAG_SYNCMFT | MFT_ENUM_FLAG_LOCALMFT | MFT_ENUM_FLAG_SORTANDFILTER;
CatchError( MFTEnumEx(
MFT_CATEGORY_VIDEO_ENCODER,
unFlags,
&inputInfo, // Input type
&outputInfo, // Output type
&ppActivate,
&count
),(LPSTR)"Line 385");
CatchError(ppActivate[0]->ActivateObject(
__uuidof(IMFTransform),
(void**)& pTransform
),(LPSTR)"Line 392");
CatchError(pTransform->ProcessMessage(MFT_MESSAGE_NOTIFY_BEGIN_STREAMING, NULL),(LPSTR)"Line 396");
IMFAttributes* imfAttributes;
CatchError(pTransform->GetAttributes(&imfAttributes), (LPSTR)"Error getAttributes from pTransform");
CatchError(imfAttributes->GetUINT32(MF_SA_D3D_AWARE,0), (LPSTR)"Error pTranform not D3D_AWARE");;
在最后几行,当我这样做时:
CatchError(pTransform->GetAttributes(&imfAttributes), (LPSTR)"Error getAttributes from pTransform");
CatchError(imfAttributes->GetUINT32(MF_SA_D3D_AWARE,0), (LPSTR)"Error pTranform not D3D_AWARE");
我收到错误“错误 pTranform not D3D_AWARE”,我不知道如何获得 D3D_AWARE 的 pTranform
我用这个 Windows Duplication API 在我的计算机上尝试了一些程序,然后将其编码为 H264 并且它们可以工作
提前致谢