diff --git a/DShowPlugin/DShowPlugin.cpp b/DShowPlugin/DShowPlugin.cpp index c1d6e99e..1ec8dfb6 100644 --- a/DShowPlugin/DShowPlugin.cpp +++ b/DShowPlugin/DShowPlugin.cpp @@ -34,6 +34,10 @@ HINSTANCE hinstMain = NULL; #define DSHOW_CLASSNAME TEXT("DeviceCapture") +//CTSTR lpRoxioVideoCaptureGUID = TEXT("{6994AD05-93EF-11D0-A3-CC-00-A0-C9-22-31-96}"); +const GUID PIN_CATEGORY_ROXIOCAPTURE = {0x6994AD05, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}}; + + bool SourceListHasDevice(CTSTR lpDevice, XElement *sourceList) { UINT numSources = sourceList->NumElements(); @@ -105,11 +109,11 @@ bool CurrentDeviceExists(CTSTR lpDevice, bool bGlobal, bool &isGlobal) return false; } -IBaseFilter* GetExceptionDevice(CTSTR lpGUID) +bool GetGUIDFromString(CTSTR lpGUID, GUID &targetGUID) { String strGUID = lpGUID; if(strGUID.Length() != 38) - return NULL; + return false; strGUID = strGUID.Mid(1, strGUID.Length()-1); @@ -117,7 +121,7 @@ IBaseFilter* GetExceptionDevice(CTSTR lpGUID) strGUID.GetTokenList(GUIDData, '-', FALSE); if (GUIDData.Num() != 5) - return NULL; + return false; if (GUIDData[0].Length() != 8 || GUIDData[1].Length() != 4 || @@ -125,10 +129,8 @@ IBaseFilter* GetExceptionDevice(CTSTR lpGUID) GUIDData[3].Length() != 4 || GUIDData[4].Length() != 12 ) { - return NULL; + return false; } - - GUID targetGUID; targetGUID.Data1 = (UINT)tstring_base_to_uint(GUIDData[0], NULL, 16); targetGUID.Data2 = (WORD)tstring_base_to_uint(GUIDData[1], NULL, 16); targetGUID.Data3 = (WORD)tstring_base_to_uint(GUIDData[2], NULL, 16); @@ -141,6 +143,15 @@ IBaseFilter* GetExceptionDevice(CTSTR lpGUID) targetGUID.Data4[6] = (BYTE)tstring_base_to_uint(GUIDData[4].Mid(8, 10), NULL, 16); targetGUID.Data4[7] = (BYTE)tstring_base_to_uint(GUIDData[4].Right(2), NULL, 16); + return true; +} + +IBaseFilter* GetExceptionDevice(CTSTR lpGUID) +{ + GUID targetGUID; + if (!GetGUIDFromString(lpGUID, targetGUID)) + return NULL; + IBaseFilter *filter; if(SUCCEEDED(CoCreateInstance(targetGUID, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&filter))) return filter; @@ -332,7 +343,7 @@ IPin* GetOutputPin(IBaseFilter *filter, const GUID *majorType) if(SUCCEEDED(propertySet->Get(AMPROPSETID_Pin, AMPROPERTY_PIN_CATEGORY, NULL, 0, &pinCategory, sizeof(GUID), &retSize))) { - if(pinCategory == PIN_CATEGORY_CAPTURE) + if(pinCategory == PIN_CATEGORY_CAPTURE || pinCategory == PIN_CATEGORY_ROXIOCAPTURE) { SafeRelease(propertySet); SafeRelease(pins); diff --git a/GraphicsCapture/GraphicsCaptureHook/D3D9Capture.cpp b/GraphicsCapture/GraphicsCaptureHook/D3D9Capture.cpp index 721d5a03..9ef326ed 100644 --- a/GraphicsCapture/GraphicsCaptureHook/D3D9Capture.cpp +++ b/GraphicsCapture/GraphicsCaptureHook/D3D9Capture.cpp @@ -463,7 +463,7 @@ void DoD3D9CPUHook(IDirect3DDevice9 *device) //------------------------------------------------ - IDirect3DSurface9 *backBuffer; + IDirect3DSurface9 *backBuffer = NULL; D3DSURFACE_DESC sd; ZeroMemory(&sd, sizeof(sd)); @@ -479,16 +479,16 @@ void DoD3D9CPUHook(IDirect3DDevice9 *device) RUNEVERYRESET logOutput << CurrentTimeString() << "DoD3D9CPUHook: Could not get back buffer surface info, result = " << (UINT)hErr << endl; bSuccess = false; } - } + SafeRelease(backBuffer); + if (bSuccess) { //sometimes the backbuffer does not actually match the swap chain size, //so you have to use the backbuffer size to get the right value d3d9CaptureInfo.cx = sd.Width; d3d9CaptureInfo.cy = sd.Height; - backBuffer->Release(); for(UINT i=0; i