{\r
HWCInPin *This = impl_from_IPin(iface);\r
\r
- if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IPin)) {\r
- *ppv = &This->IPin_iface;\r
+ if (IsEqualIID(riid, &IID_IUnknown)) {\r
+ *ppv = (IUnknown *)(&This->IPin_iface);\r
+ IPin_AddRef((IPin*)*ppv);\r
+ } else if (IsEqualIID(riid, &IID_IPin)) {\r
+ *ppv = (IPin *)(&This->IPin_iface);\r
IPin_AddRef((IPin*)*ppv);\r
} else if (IsEqualIID(riid, &IID_IMemInputPin)) {\r
- *ppv = &This->IMemInputPin_iface;\r
+ *ppv = (IMemInputPin *)(&This->IMemInputPin_iface);\r
IPin_AddRef((IMemInputPin*)*ppv);\r
} else {\r
*ppv = NULL;\r
SAFE_RELEASE(This->m_pConnectedPin);\r
}\r
if (This->m_pAllocator) {\r
+ IMemAllocator_Decommit(This->m_pAllocator);\r
SAFE_RELEASE(This->m_pAllocator);\r
}\r
g_free((void*)This);\r
\r
static STDMETHODIMP HWCPin_Connect(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)\r
{\r
+ HWCInPin *This = impl_from_IPin(iface);\r
+\r
+ if (!pReceivePin) {\r
+ return E_POINTER;\r
+ }\r
+\r
+ if (This->m_pConnectedPin) {\r
+ return VFW_E_ALREADY_CONNECTED;\r
+ }\r
+\r
if (!pmt)\r
return S_OK;\r
return S_FALSE;\r
HWCInPin *This = impl_from_IPin(iface);\r
\r
HRESULT hr;\r
+ FILTER_STATE fs;\r
+ IBaseFilter_GetState(This->m_pCFilter, 0, &fs);\r
+ if (fs != State_Stopped) {\r
+ return VFW_E_NOT_STOPPED;\r
+ }\r
if (This->m_pConnectedPin == NULL) {\r
hr = S_FALSE;\r
} else {\r
+ if (This->m_pAllocator) {\r
+ hr = IMemAllocator_Decommit(This->m_pAllocator);\r
+ if (FAILED(hr)) {\r
+ return hr;\r
+ }\r
+ SAFE_RELEASE(This->m_pAllocator);\r
+ }\r
SAFE_RELEASE(This->m_pConnectedPin);\r
hr = S_OK;\r
}\r
return hr;\r
}\r
\r
-static STDMETHODIMP HWCPin_ConnectedTo(IPin *iface, IPin **pPin)\r
+static STDMETHODIMP HWCPin_ConnectedTo(IPin *iface, IPin **ppPin)\r
{\r
HWCInPin *This = impl_from_IPin(iface);\r
\r
- if (pPin == NULL)\r
+ if (ppPin == NULL)\r
return E_POINTER;\r
\r
if (This->m_pConnectedPin == NULL) {\r
+ *ppPin = NULL;\r
return VFW_E_NOT_CONNECTED;\r
} else {\r
- *pPin = This->m_pConnectedPin;\r
+ *ppPin = This->m_pConnectedPin;\r
IPin_AddRef(This->m_pConnectedPin);\r
}\r
return S_OK;\r
{\r
HWCInPin *This = impl_from_IMemInputPin(iface);\r
\r
- if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IMemInputPin)) {\r
- *ppv = &This->IMemInputPin_iface;\r
- IMemInputPin_AddRef((IMemInputPin*)*ppv);\r
+ if (IsEqualIID(riid, &IID_IUnknown)) {\r
+ *ppv = (IUnknown *)(&This->IMemInputPin_iface);\r
+ IPin_AddRef((IPin*)*ppv);\r
} else if (IsEqualIID(riid, &IID_IPin)) {\r
- *ppv = &This->IPin_iface;\r
+ *ppv = (IPin *)(&This->IPin_iface);\r
IPin_AddRef((IPin*)*ppv);\r
+ } else if (IsEqualIID(riid, &IID_IMemInputPin)) {\r
+ *ppv = (IMemInputPin *)(&This->IMemInputPin_iface);\r
+ IPin_AddRef((IMemInputPin*)*ppv);\r
} else {\r
*ppv = NULL;\r
return E_NOINTERFACE;\r
SAFE_RELEASE(This->m_pConnectedPin);\r
}\r
if (This->m_pAllocator) {\r
+ IMemAllocator_Decommit(This->m_pAllocator);\r
SAFE_RELEASE(This->m_pAllocator);\r
}\r
g_free((void*)This);\r