Obtain the IMFDXGIBuffer interface from your IMFMediaBuffer via QueryInterface: https://msdn.microsoft.com/en-us/library/windows/desktop/hh447901(v=vs.85).aspx. Use GetResource to access the ID3D11Texture2D wrapped by this media buffer. Store the sub resource index using GetSubresourceIndex. Use ID3D11DeviceContext::CopySubresourceRegion (https://msdn.microsoft.com/en-us/library/windows/desktop/ff476394(v=vs.85).aspx), by specifying the stored sub resource index as SrcSubresource parameter, to copy the obtained ID3D11Texture2D as pSrcResource parameter, to your device's swapchain (set in pDstResource). Call Present(1) of your swapchain.
CopySubresourceRegion(pSwapChain, 0, 0, 0, 0, pTexture2D, index, NULL);
Note: You should set the same D3D11 device via IMFDXGIDeviceManager to the decoder for this to work.
More details:
ComPtr<IMFMediaBuffer> buffer; CHK(sample->GetBufferByIndex(0, &buffer)); // Get the MF DXGI buffer ComPtr<IMFDXGIBuffer> dxgiBuffer; if (FAILED(buffer.As(&dxgiBuffer))) { ComPtr<ID3D11Texture2D> texture; unsigned int subresource; CHK(dxgiBuffer->GetResource(IID_PPV_ARGS(&texture))); CHK(dxgiBuffer->GetSubresourceIndex(&subresource)); ComPtr<ID3D11Device> device; ComPtr<ID3D11DeviceContext> context; texture->GetDevice(&device); device->GetImmediateContext(&context); context->CopySubresourceRegion(m_pSwapChain, 0, 0, 0, 0, texture.Get(), subresource, nullptr); }