Error While Overriding virtual methods of Directshow Baseclasses:
---------------------------------------------------------------
while overriding some fns,
I got an error ...
class CMyTransformInputPin : public CTransformInputPin
{
public :
HRESULT Receive(IMediaSample* pSample);
};
HRESULT CMyTransformInputPin :: Receive(IMediaSample* pSample)
{
HRESULT hr = S_OK;
hr = CTransformInputPin::Receive(pSample);
return hr;
}
I got an error as follows :
error C2555: 'CTemporalInputPin::Receive' : overriding virtual function differs from 'CTransformInputPin::Receive' only by return type or calling convention
baseclasses\transfrm.h(33) : see declaration of 'CTransformInputPin'
Solution :
-------------
I modified it as follows :
class CMyTransformInputPin : public CTransformInputPin
{
public :
STDMETHODIMP Receive(IMediaSample* pSample); // Modification is Here...
};
HRESULT CMyTransformInputPin :: Receive(IMediaSample* pSample)
{
HRESULT hr = S_OK;
hr = CTransformInputPin::Receive(pSample);
return hr;
}
Now It is working.For STDMETHODIMP macro expansion is as follows :
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
For STDMETHODCALLTYPE macro defn is as follows :
#ifdef _68K_
#define STDMETHODCALLTYPE __cdecl
#else
#define STDMETHODCALLTYPE __stdcall
#endif
So it varies in calling convention, So I got an error...
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment