2,543
社区成员
发帖
与我相关
我的任务
分享
IDirectXVideoDecoderService * pDecoder = NULL;
IDirect3D9 *pD3D = NULL;
IDirect3DDevice9 *pDevice = NULL;
// Set up structure to create D3D Device
D3DPRESENT_PARAMETERS d3dpp;
ZeroMemory( &d3dpp, sizeof( d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
// Set up structure to create D3D Device
if( FAILED( pD3D = Direct3DCreate9( D3D_SDK_VERSION)))
{
RT_LOG("Failed to Create Direct3D9!\n");
return E_FAIL;
}
RT_LOG( "Success to Create Direct3D9 !\n");
if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, this->m_hWnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &pDevice)))
{
RT_LOG("Failed to Create Direct3D9 Device!\n");
return E_FAIL;
}
RT_LOG( "Success to Create Direct3D9 Device!\n");
if( FAILED( DXVA2CreateVideoService( pDevice, IID_PPV_ARGS(&pDecoder))))
{
RT_LOG("Failed to CreatVideoService!\n");
return E_FAIL;
}
UINT nCount;
GUID* pGuids;
if( FAILED(pDecoder->GetDecoderDeviceGuids( &nCount, &pGuids)))
{
RT_LOG("Failed to Get Decoder!\n");
return E_FAIL;
}
CString src;
for( UINT i =0; i < nCount; i++)
{
for (int j = 1; j < _countof(DXVA2Decoder); j++) {
if (pGuids[i] == *DXVA2Decoder[j].Guid) {
WriteConsole( hOutPut, DXVA2Decoder[j].Description, _tcslen(DXVA2Decoder[j].Description), NULL, NULL);
WriteConsole( hOutPut, _T("\n"), _tcslen( _T("\n")), NULL, NULL);
break;
}
}
src ="";
src.Format(_T("%08X-%04X-%04X-%02X%02X%02X%02X%02X%02X%02X%02X\n"), pGuids[i].Data1, pGuids[i].Data2,
pGuids[i].Data3, pGuids[i].Data4[0], pGuids[i].Data4[1], pGuids[i].Data4[2], pGuids[i].Data4[3],
pGuids[i].Data4[4],pGuids[i].Data4[5],pGuids[i].Data4[6],pGuids[i].Data4[7]);
WriteConsole( hOutPut, src, src.GetLength(), NULL, NULL);
}
pDecoder->Release();
pDevice->Release();
pD3D->Release();
return S_OK;