diff --git a/plugins/GSdx/GSCapture.cpp b/plugins/GSdx/GSCapture.cpp index 74559b1d28..5aeede9b09 100644 --- a/plugins/GSdx/GSCapture.cpp +++ b/plugins/GSdx/GSCapture.cpp @@ -26,6 +26,36 @@ #ifdef _WIN32 +class CPinInfo : public PIN_INFO { +public: + CPinInfo() { pFilter = NULL; } + ~CPinInfo() { if (pFilter) pFilter->Release(); } +}; + +class CFilterInfo : public FILTER_INFO { +public: + CFilterInfo() { pGraph = NULL; } + ~CFilterInfo() { if (pGraph) pGraph->Release(); } +}; + +#define BeginEnumFilters(pFilterGraph, pEnumFilters, pBaseFilter) \ + {CComPtr pEnumFilters; \ + if(pFilterGraph && SUCCEEDED(pFilterGraph->EnumFilters(&pEnumFilters))) \ + { \ + for(CComPtr pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \ + { \ + +#define EndEnumFilters }}} + +#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \ + {CComPtr pEnumPins; \ + if(pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \ + { \ + for(CComPtr pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \ + { \ + +#define EndEnumPins }}} + // // GSSource // @@ -332,15 +362,6 @@ public: } }; -#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \ - {CComPtr pEnumPins; \ - if(pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \ - { \ - for(CComPtr pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \ - { \ - -#define EndEnumPins }}} - static IPin* GetFirstPin(IBaseFilter* pBF, PIN_DIRECTION dir) { if(!pBF) return(NULL); diff --git a/plugins/GSdx/GSCaptureDlg.cpp b/plugins/GSdx/GSCaptureDlg.cpp index 0efa74d937..b48393e58f 100644 --- a/plugins/GSdx/GSCaptureDlg.cpp +++ b/plugins/GSdx/GSCaptureDlg.cpp @@ -23,6 +23,18 @@ #include "GSdx.h" #include "GSCaptureDlg.h" +#define BeginEnumSysDev(clsid, pMoniker) \ + {CComPtr pDevEnum4$##clsid; \ + pDevEnum4$##clsid.CoCreateInstance(CLSID_SystemDeviceEnum); \ + CComPtr pClassEnum4$##clsid; \ + if(SUCCEEDED(pDevEnum4$##clsid->CreateClassEnumerator(clsid, &pClassEnum4$##clsid, 0)) \ + && pClassEnum4$##clsid) \ + { \ + for(CComPtr pMoniker; pClassEnum4$##clsid->Next(1, &pMoniker, 0) == S_OK; pMoniker = NULL) \ + { \ + +#define EndEnumSysDev }}} + GSCaptureDlg::GSCaptureDlg() : GSDialog(IDD_CAPTURE) { diff --git a/unfree/baseclasses/streams.h b/unfree/baseclasses/streams.h index 35b2dee3d6..a69b4bc43c 100644 --- a/unfree/baseclasses/streams.h +++ b/unfree/baseclasses/streams.h @@ -182,68 +182,7 @@ typedef struct { #define NUMELMS(aa) (sizeof(aa)/sizeof((aa)[0])) #endif -class CPinInfo : public PIN_INFO -{ -public: - CPinInfo() {pFilter = NULL;} - ~CPinInfo() {if(pFilter) pFilter->Release();} -}; -class CFilterInfo : public FILTER_INFO -{ -public: - CFilterInfo() {pGraph = NULL;} - ~CFilterInfo() {if(pGraph) pGraph->Release();} -}; - -#define BeginEnumFilters(pFilterGraph, pEnumFilters, pBaseFilter) \ - {CComPtr pEnumFilters; \ - if(pFilterGraph && SUCCEEDED(pFilterGraph->EnumFilters(&pEnumFilters))) \ - { \ - for(CComPtr pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \ - { \ - -#define EndEnumFilters }}} - -#define BeginEnumCachedFilters(pGraphConfig, pEnumFilters, pBaseFilter) \ - {CComPtr pEnumFilters; \ - if(pGraphConfig && SUCCEEDED(pGraphConfig->EnumCacheFilter(&pEnumFilters))) \ - { \ - for(CComPtr pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \ - { \ - -#define EndEnumCachedFilters }}} - -#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \ - {CComPtr pEnumPins; \ - if(pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \ - { \ - for(CComPtr pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \ - { \ - -#define EndEnumPins }}} - -#define BeginEnumMediaTypes(pPin, pEnumMediaTypes, pMediaType) \ - {CComPtr pEnumMediaTypes; \ - if(pPin && SUCCEEDED(pPin->EnumMediaTypes(&pEnumMediaTypes))) \ - { \ - AM_MEDIA_TYPE* pMediaType = NULL; \ - for(; S_OK == pEnumMediaTypes->Next(1, &pMediaType, NULL); DeleteMediaType(pMediaType), pMediaType = NULL) \ - { \ - -#define EndEnumMediaTypes(pMediaType) } if(pMediaType) DeleteMediaType(pMediaType); }} - -#define BeginEnumSysDev(clsid, pMoniker) \ - {CComPtr pDevEnum4$##clsid; \ - pDevEnum4$##clsid.CoCreateInstance(CLSID_SystemDeviceEnum); \ - CComPtr pClassEnum4$##clsid; \ - if(SUCCEEDED(pDevEnum4$##clsid->CreateClassEnumerator(clsid, &pClassEnum4$##clsid, 0)) \ - && pClassEnum4$##clsid) \ - { \ - for(CComPtr pMoniker; pClassEnum4$##clsid->Next(1, &pMoniker, 0) == S_OK; pMoniker = NULL) \ - { \ - -#define EndEnumSysDev }}} #else #ifdef DEBUG