I am writing code for capturing Skype video call for windows 10, I am facing an issue as following:
1). Skype use Directx11, and I am able to hook into the IDXGISwapChain::Present, and use code as below to capture the screenshot:
ID3D11Device *device = NULL;
HRESULT hr = pswap->GetDevice(__uuidof(ID3D11Device), (void**)&device);
if (hr != S_OK)
{
OutputDebugStringA("++++++++ GetDevice failed ++++++");
return;
}
ID3D11DeviceContext *context;
device->GetImmediateContext(&context);
ID3D11Texture2D* backBuffer = nullptr;
hr = pswap->GetBuffer(0, __uuidof(*backBuffer), (LPVOID*)&backBuffer);
if (hr != S_OK)
{
OutputDebugStringA("++++++++ IDXGISwapChain::GetBuffer failed++++++");
return;
}
//Save to a JPG file
hr = SaveWICTextureToFile(context, backBuffer,
GUID_ContainerFormatJpeg, strScreenPath);
SafeRelease(device);
SafeRelease(context);
SafeRelease(backBuffer);
The problem is what I captured is either the local video frame(camera) or the remote video frame, what I want to capture is synthetic image, just like I see on the Skype window during a video call, I remember that in D3D9, there is a GetRenderTargetData() to retrieve the raw data from the back buffer, and it contains the rendered scene which is the same as I see on the Skype window during the video call, but I can't find a way to do this in D3D11....
Any advise is appreciated.
↧