Set d3d11 manager in MFT, need to adjust the decoder profile search

This commit is contained in:
Linnea May 2021-11-09 16:43:05 -08:00
Родитель 8052a7a8b9
Коммит 0e9cf7c79c
3 изменённых файлов: 18 добавлений и 10 удалений

Просмотреть файл

@ -837,14 +837,17 @@ HRESULT TransformBlur::OnSetD3DManager(ULONG_PTR ulParam)
return S_OK;
}
IDirect3DDeviceManager9* p_IMFDXGIManager = NULL;
IMFDXGIDeviceManager* p_IMFDXGIManager = NULL;
HANDLE p_deviceHandle;
IDirectXVideoDecoderService* pDecoderService = NULL;
// TODO: Change video and video device to fields
ID3D11VideoDevice* pDecoderService = NULL;
ID3D11Device* pd3dDevice = NULL;
// Get the Device Manager sent from the topology loader
IUnknown* ptr = (IUnknown*) ulParam;
HRESULT hr = ptr->QueryInterface(IID_IDirect3DDeviceManager9, (void**)&m_pD3DDeviceManager);
HRESULT hr = ptr->QueryInterface(IID_IMFDXGIDeviceManager, (void**)&m_pD3DDeviceManager);
if (FAILED(hr))
{
goto done;
@ -852,9 +855,14 @@ HRESULT TransformBlur::OnSetD3DManager(ULONG_PTR ulParam)
// Get a handle to the DXVA decoder service
hr = m_pD3DDeviceManager->OpenDeviceHandle(&p_deviceHandle);
// Get the decoder service
// Get the d3d11 device
m_pD3DDeviceManager->GetVideoService(p_deviceHandle, IID_ID3D12Device, (void**) &pd3dDevice);
hr = m_pD3DDeviceManager->GetVideoService(p_deviceHandle, IID_IDirectXVideoDecoderService, (void**) &m_pDecoderService);
// Get the d3d11 video device
hr = m_pD3DDeviceManager->GetVideoService(p_deviceHandle, IID_ID3D11VideoDevice, (void**) &m_pDecoderService);
if (FAILED(hr))
{
OutputDebugString(L"Failed to get DXVA decoder service");
@ -880,7 +888,7 @@ HRESULT TransformBlur::ProcessInput(
)
{
AutoLock lock(m_critSec);
IDirect3DSurface9** ppSurface = NULL;
IDirect3DSurface11* ppSurface = NULL;
IMFMediaBuffer* pBuffer = NULL;
if (pSample == NULL)

Просмотреть файл

@ -13,9 +13,9 @@
#include <initguid.h>
#include <uuids.h> // DirectShow GUIDs
#include <d3d9types.h>
#include <d3d9.h>
#include <d3d11.h>
#include <dxva2api.h>
#include <d3d9helper.h>
//#include <d3d11helper.h>
#define USE_LOGGING
@ -212,7 +212,7 @@ private:
IMAGE_TRANSFORM_FN m_pTransformFn;
// D3D fields
IDirect3DDeviceManager9* m_pD3DDeviceManager;
IMFDXGIDeviceManager* m_pD3DDeviceManager;
IDirectXVideoDecoderService* m_pDecoderService;
SegmentModel m_segmentModel;

Просмотреть файл

@ -1336,7 +1336,7 @@ HRESULT AddTransformNode(
UINT32 p_aware = FALSE;
pMFT->GetAttributes(&p_attr);
UINT32 aware = MFGetAttributeUINT32(p_attr, MF_SA_D3D_AWARE, p_aware);
if (aware == TRUE && d3dManager) {
if (false && aware == TRUE && d3dManager) {
pMFT->ProcessMessage(MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)d3dManager);
pNode->SetUINT32(MF_TOPONODE_D3DAWARE, TRUE);
}