diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-07-07 01:59:00 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2012-07-07 01:59:00 +0400 |
commit | 9cc21dc6ff0accde79578748b29f34b504433be5 (patch) | |
tree | 71cdaa10dcaed7d19eb6d21c0e19a72af1c42f45 /src/DSUtil/DSUtil.h | |
parent | f9326d594897c20c8614dbb89c91f5d044abd11a (diff) |
cosmetics in the multi line macros
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5382 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/DSUtil/DSUtil.h')
-rw-r--r-- | src/DSUtil/DSUtil.h | 94 |
1 files changed, 53 insertions, 41 deletions
diff --git a/src/DSUtil/DSUtil.h b/src/DSUtil/DSUtil.h index fee29c510..f7caf057b 100644 --- a/src/DSUtil/DSUtil.h +++ b/src/DSUtil/DSUtil.h @@ -163,66 +163,78 @@ public: }
};
-#define BeginEnumFilters(pFilterGraph, pEnumFilters, pBaseFilter) \
- {CComPtr<IEnumFilters> pEnumFilters; \
- if (pFilterGraph && SUCCEEDED(pFilterGraph->EnumFilters(&pEnumFilters))) \
- { \
- for (CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
- {
+#define BeginEnumFilters(pFilterGraph, pEnumFilters, pBaseFilter) \
+ { \
+ CComPtr<IEnumFilters> pEnumFilters; \
+ if (pFilterGraph && SUCCEEDED(pFilterGraph->EnumFilters(&pEnumFilters))) \
+ { \
+ for (CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
+ {
#define EndEnumFilters }}}
-#define BeginEnumCachedFilters(pGraphConfig, pEnumFilters, pBaseFilter) \
- {CComPtr<IEnumFilters> pEnumFilters; \
- if (pGraphConfig && SUCCEEDED(pGraphConfig->EnumCacheFilter(&pEnumFilters))) \
- { \
- for (CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
- {
+#define BeginEnumCachedFilters(pGraphConfig, pEnumFilters, pBaseFilter) \
+ { \
+ CComPtr<IEnumFilters> pEnumFilters; \
+ if (pGraphConfig && SUCCEEDED(pGraphConfig->EnumCacheFilter(&pEnumFilters))) \
+ { \
+ for (CComPtr<IBaseFilter> pBaseFilter; S_OK == pEnumFilters->Next(1, &pBaseFilter, 0); pBaseFilter = NULL) \
+ {
#define EndEnumCachedFilters }}}
-#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \
- {CComPtr<IEnumPins> pEnumPins; \
- if (pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \
- { \
- for (CComPtr<IPin> pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \
- {
+#define BeginEnumPins(pBaseFilter, pEnumPins, pPin) \
+ { \
+ CComPtr<IEnumPins> pEnumPins; \
+ if (pBaseFilter && SUCCEEDED(pBaseFilter->EnumPins(&pEnumPins))) \
+ { \
+ for (CComPtr<IPin> pPin; S_OK == pEnumPins->Next(1, &pPin, 0); pPin = NULL) \
+ {
#define EndEnumPins }}}
-#define BeginEnumMediaTypes(pPin, pEnumMediaTypes, pMediaType) \
- {CComPtr<IEnumMediaTypes> 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 BeginEnumMediaTypes(pPin, pEnumMediaTypes, pMediaType) \
+ { \
+ CComPtr<IEnumMediaTypes> 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 EndEnumMediaTypes(pMediaType) \
+ } \
+ if (pMediaType) \
+ DeleteMediaType(pMediaType); \
+ } \
+ }
-#define BeginEnumSysDev(clsid, pMoniker) \
- {CComPtr<ICreateDevEnum> pDevEnum4$##clsid; \
- pDevEnum4$##clsid.CoCreateInstance(CLSID_SystemDeviceEnum); \
- CComPtr<IEnumMoniker> pClassEnum4$##clsid; \
- if (SUCCEEDED(pDevEnum4$##clsid->CreateClassEnumerator(clsid, &pClassEnum4$##clsid, 0)) \
- && pClassEnum4$##clsid) \
- { \
- for (CComPtr<IMoniker> pMoniker; pClassEnum4$##clsid->Next(1, &pMoniker, 0) == S_OK; pMoniker = NULL) \
- {
+#define BeginEnumSysDev(clsid, pMoniker) \
+ { \
+ CComPtr<ICreateDevEnum> pDevEnum4$##clsid; \
+ pDevEnum4$##clsid.CoCreateInstance(CLSID_SystemDeviceEnum); \
+ CComPtr<IEnumMoniker> pClassEnum4$##clsid; \
+ if (SUCCEEDED(pDevEnum4$##clsid->CreateClassEnumerator(clsid, &pClassEnum4$##clsid, 0)) \
+ && pClassEnum4$##clsid) \
+ { \
+ for (CComPtr<IMoniker> pMoniker; pClassEnum4$##clsid->Next(1, &pMoniker, 0) == S_OK; pMoniker = NULL) \
+ {
#define EndEnumSysDev }}}
#define PauseGraph \
CComQIPtr<IMediaControl> _pMC(m_pGraph); \
OAFilterState _fs = -1; \
- if (_pMC) _pMC->GetState(1000, &_fs); \
+ if (_pMC) \
+ _pMC->GetState(1000, &_fs); \
if (_fs == State_Running) \
_pMC->Pause(); \
\
HRESULT _hr = E_FAIL; \
CComQIPtr<IMediaSeeking> _pMS((IUnknown*)(INonDelegatingUnknown*)m_pGraph); \
REFERENCE_TIME _rtNow = 0; \
- if (_pMS) _hr = _pMS->GetCurrentPosition(&_rtNow);
+ if (_pMS) \
+ _hr = _pMS->GetCurrentPosition(&_rtNow);
#define ResumeGraph \
if (SUCCEEDED(_hr) && _pMS && _fs != State_Stopped) \
@@ -234,6 +246,10 @@ public: #define QI(i) (riid == __uuidof(i)) ? GetInterface((i*)this, ppv) :
#define QI2(i) (riid == IID_##i) ? GetInterface((i*)this, ppv) :
+#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } }
+#define SAFE_DELETE_ARRAY(p) { if (p) { delete [] (p); (p) = NULL; } }
+#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } }
+
template <typename T> __inline void INITDDSTRUCT(T& dd)
{
ZeroMemory(&dd, sizeof(dd));
@@ -251,10 +267,6 @@ static CUnknown* WINAPI CreateInstance(LPUNKNOWN lpunk, HRESULT* phr) return punk;
}
-#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } }
-#define SAFE_DELETE_ARRAY(p) { if (p) { delete [] (p); (p) = NULL; } }
-#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } }
-
inline int LNKO(int a, int b)
{
if (a == 0 || b == 0) {
|