I'm writing a program with DirectShow that plays a video through a custom allocator. While setting the custom allocator, I'm having a bit of trouble setting a callback. The interface that I'm using is the IVMRSurfaceAllocator9 which has a "callback" method:
IVMRSurfaceAllocator9::InitializeDevice
I wrote my own implementation for this following the same return and input:
HRESULT CALLBACK InitializeDevice(DWORD_PTR dwUserID, VMR9AllocationInfo *lpAllocInfo, DWORD *lpNumBuffers)
{
//Set VMR to work with directx
graphics.Release();
if(!graphics.InitializeGraphics(g_hWnd, pWidth, pHeight, false))
return E_FAIL;
//Set the D3D device
if(FAILED(pSAN->SetD3DDevice(graphics.GetDevice(), NULL)))
return E_FAIL;
return S_OK;
}
but I don't know how to tell the interface that I want this to be the callback. I tried this:
pSAN->InitializeDevice = InitializeDevice;
but obviously that didn't work and it gave me an error. How do I set the callback?
Thanks.