figured out and added support for certain roxio devices

master
jp9000 2013-06-02 19:11:27 -07:00
parent bf32058972
commit 5054bea8fb
3 changed files with 22 additions and 11 deletions

View File

@ -34,6 +34,10 @@ HINSTANCE hinstMain = NULL;
#define DSHOW_CLASSNAME TEXT("DeviceCapture") #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) bool SourceListHasDevice(CTSTR lpDevice, XElement *sourceList)
{ {
UINT numSources = sourceList->NumElements(); UINT numSources = sourceList->NumElements();
@ -105,11 +109,11 @@ bool CurrentDeviceExists(CTSTR lpDevice, bool bGlobal, bool &isGlobal)
return false; return false;
} }
IBaseFilter* GetExceptionDevice(CTSTR lpGUID) bool GetGUIDFromString(CTSTR lpGUID, GUID &targetGUID)
{ {
String strGUID = lpGUID; String strGUID = lpGUID;
if(strGUID.Length() != 38) if(strGUID.Length() != 38)
return NULL; return false;
strGUID = strGUID.Mid(1, strGUID.Length()-1); strGUID = strGUID.Mid(1, strGUID.Length()-1);
@ -117,7 +121,7 @@ IBaseFilter* GetExceptionDevice(CTSTR lpGUID)
strGUID.GetTokenList(GUIDData, '-', FALSE); strGUID.GetTokenList(GUIDData, '-', FALSE);
if (GUIDData.Num() != 5) if (GUIDData.Num() != 5)
return NULL; return false;
if (GUIDData[0].Length() != 8 || if (GUIDData[0].Length() != 8 ||
GUIDData[1].Length() != 4 || GUIDData[1].Length() != 4 ||
@ -125,10 +129,8 @@ IBaseFilter* GetExceptionDevice(CTSTR lpGUID)
GUIDData[3].Length() != 4 || GUIDData[3].Length() != 4 ||
GUIDData[4].Length() != 12 ) GUIDData[4].Length() != 12 )
{ {
return NULL; return false;
} }
GUID targetGUID;
targetGUID.Data1 = (UINT)tstring_base_to_uint(GUIDData[0], NULL, 16); targetGUID.Data1 = (UINT)tstring_base_to_uint(GUIDData[0], NULL, 16);
targetGUID.Data2 = (WORD)tstring_base_to_uint(GUIDData[1], NULL, 16); targetGUID.Data2 = (WORD)tstring_base_to_uint(GUIDData[1], NULL, 16);
targetGUID.Data3 = (WORD)tstring_base_to_uint(GUIDData[2], 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[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); 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; IBaseFilter *filter;
if(SUCCEEDED(CoCreateInstance(targetGUID, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&filter))) if(SUCCEEDED(CoCreateInstance(targetGUID, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&filter)))
return 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(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(propertySet);
SafeRelease(pins); SafeRelease(pins);

View File

@ -463,7 +463,7 @@ void DoD3D9CPUHook(IDirect3DDevice9 *device)
//------------------------------------------------ //------------------------------------------------
IDirect3DSurface9 *backBuffer; IDirect3DSurface9 *backBuffer = NULL;
D3DSURFACE_DESC sd; D3DSURFACE_DESC sd;
ZeroMemory(&sd, sizeof(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; RUNEVERYRESET logOutput << CurrentTimeString() << "DoD3D9CPUHook: Could not get back buffer surface info, result = " << (UINT)hErr << endl;
bSuccess = false; bSuccess = false;
} }
} }
SafeRelease(backBuffer);
if (bSuccess) if (bSuccess)
{ {
//sometimes the backbuffer does not actually match the swap chain size, //sometimes the backbuffer does not actually match the swap chain size,
//so you have to use the backbuffer size to get the right value //so you have to use the backbuffer size to get the right value
d3d9CaptureInfo.cx = sd.Width; d3d9CaptureInfo.cx = sd.Width;
d3d9CaptureInfo.cy = sd.Height; d3d9CaptureInfo.cy = sd.Height;
backBuffer->Release();
for(UINT i=0; i<NUM_BUFFERS; i++) for(UINT i=0; i<NUM_BUFFERS; i++)
{ {

View File

@ -62,7 +62,7 @@ If compiling static (which I don't do anymore), please make sure to
include the static libgcc.a that your mingw provides. Depending on your include the static libgcc.a that your mingw provides. Depending on your
mingw version you may need to add/remove stuff from Hacks.cpp to get it mingw version you may need to add/remove stuff from Hacks.cpp to get it
properly working. It sucks, I know, but I'm not the one who decided to properly working. It sucks, I know, but I'm not the one who decided to
make x264 uncompilable on microsoft's C compiler. make x264 uncompilable on microsoft's (admittedly worthless) C compiler.