DirectX VA 디바이스 개체 인스턴스 삭제
다음 예제 코드를 사용하여 DirectX VA 디바이스 개체의 인스턴스를 삭제합니다. 이 코드는 DdMoCompDestroy 콜백 함수의 구현입니다. DD_MOTIONCOMPCALLBACKS 구조체의 DestroyMoComp 멤버는 콜백 함수를 가리킵니다.
DWORD APIENTRY
MOCOMPCB_DESTROY(
PDD_DESTROYMOCOMPDATA lpData
)
{
// The driver saves the device class object in lpDriverReserved1
// during the call to the DdMoCompCreate callback. For more information,
// see Creating Instances of DirectX VA Device Objects.
DXVA_DeviceBaseClass* pDXVABase =
(DXVA_DeviceBaseClass*)lpData->lpMoComp->lpDriverReserved1;
if (pDXVABase == NULL) {
lpData->ddRVal = E_POINTER;
return DDHAL_DRIVER_HANDLED;
}
// Process according to the device type in the class object.
// For more information, see Defining DirectX VA Device Classes.
switch (pDXVABase->m_DeviceType) {
// This is the deinterlace container device.
case DXVA_DeviceContainer:
lpData->ddRVal = S_OK;
delete pDXVABase;
break;
// This is the ProcAmp control device.
case DXVA_DeviceProcAmpControl:
{
DXVA_ProcAmpControlDeviceClass* pDXVADev =
(DXVA_ProcAmpControlDeviceClass*)pDXVABase;
// Part of the ProcAmp Control DDI.
lpData->ddRVal = pDXVADev->ProcAmpControlCloseStream();
delete pDXVADev;
}
break;
// This is the deinterlace bob device.
case DXVA_DeviceDeinterlacer:
{
DXVA_DeinterlaceBobDeviceClass* pDXVADev =
(DXVA_DeinterlaceBobDeviceClass*)pDXVABase;
// Part of the Deinterlace DDI.
lpData->ddRVal = pDXVADev->DeinterlaceCloseStream();
delete pDXVADev;
}
break;
// This is the COPP device.
case DXVA_DeviceCOPP:
DXVA_COPPDeviceClass* pDXVADev = (DXVA_COPPDeviceClass*)pDXVABase;
ULONG BytesReturned;
HANDLE handle = (HANDLE)GetDriverHandleFromPDEV(lpData ->lpDD->lpGbl->dhpdev)
COPP_IO_InputBuffer InputBuffer;
InputBuffer.ppThis = &pDXVADev->m_pThis;
InputBuffer.InputBuffer = NULL;
InputBuffer.phr = &lpData->ddRVal;
EngDeviceIoControl(handle,
IOCTL_COPP_CloseDevice,
&InputBuffer,
sizeof(InputBuffer),
NULL,
0,
&BytesReturned);
delete pDXVADev;
}
break;
}
return DDHAL_DRIVER_HANDLED;
}