For those wondering HOW I'm doing this, the classes come with the Windows 2008 SDK, and the Vista SDK...
http://msdn.microsoft.com/en-us/library/...S.85).aspx
The nice thing about this is the work is done by the OS, the hardest parts have all been done for us already. Control is done stream side, and all the features of DirectX are available to us, such as bloom, watermark, alpha, and colorspace adjust.
Code:
HRESULT GetVPService(
IDirect3DDeviceManager9 *pDeviceManager,
IDirectXVideoProcessorService **ppVPService
)
{
HRESULT hr;
HANDLE hDevice;
hr = pDeviceManager->OpenDeviceHandle(&hDevice);
if (SUCCEEDED(hr))
{
hr = pDeviceManager->GetVideoService(
hDevice,
__uuidof(IDirectXVideoProcessorService),
(void**)ppVPService
);
pD3DManager->CloseDeviceHandle(hDevice)
}
return hr;
}
Above creates the device for DXVA, and tells us what supported values are there for our consumption... and ties it to D3D as a layer seen in the handle
for hDevice.
Now, rendering a watermark via a blit is easy, but the depth mask is not straight forward...
Code:
HRESULT VideoProcessBlt(
[in] IDirect3DSurface9 *pRT,
[in] const DXVA2_VideoProcessBltParams *pBltParams,
[in] const DXVA2_VideoSample *pSamples,
[in] UINT NumSamples,
[out] HANDLE *pHandleComplete
);
the hard part is encoding our display as a DXVA compliant stream, so it can be blended...
Thats what I'm trying to finger out now...
Lookie here...
Code:
typedef struct _DXVA2_VideoSample {
REFERENCE_TIME Start;
REFERENCE_TIME End;
DXVA2_ExtendedFormat SampleFormat;
IDirect3DSurface9* SrcSurface;
RECT SrcRect;
RECT DstRect;
DXVA2_AYUVSample8 Pal[16];
DXVA2_Fixed32 PlanarAlpha;
DWORD SampleData;
} DXVA2_VideoSample;
Closer... everyday I learn something new.
Last thing to do will be to add a fallback mode for when DXVA rendering fails... to use standard codecs.
Harder than SDL, but easier than people make it out to be...