Custom DirectShow render filter linker problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



I am trying to create a custom render filter for DirectShow. Being
fairly new to both C++ and DirectShow in general I am struggling a
bit!

I am getting a linker error trying to build my project:

Error 1 error LNK2001: unresolved external symbol "public: __thiscall
CBaseRenderer::CBaseRenderer(struct _GUID const &,char const *,struct
IUnknown *,long *)" (??
0CBaseRenderer@@QAE@ABU_GUID@@PBDPAUIUnknown@@PAJ@Z)
StreamRenderFilter.obj StreamRenderFilter

Doing a search yielded practically nothing, other than setting the
"Treat wchar_t as built in type" option to "No", which only results in
further linker errors including the one above.

Here is the code I have at the moment:

#include "streams.h"
#include <initguid.h>

#pragma comment(lib, "strmbase.lib")
#pragma comment(lib, "msvcrtd.lib")
#pragma comment(lib, "winmm.lib")

extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);
BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID
lpReserved)
{
return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);
}

STDAPI DllRegisterServer(void)
{
return AMovieDllRegisterServer2(TRUE);
}

STDAPI DllUnregisterServer()
{
return AMovieDllRegisterServer2(FALSE);
}


DEFINE_GUID(CLSID_StreamRenderFilter, 0xa14c371f, 0xcc84, 0x474a,
0x94, 0x59, 0x1f, 0xf0, 0x95, 0xe9, 0x3a, 0x30);

static const WCHAR g_wszName[] = L"Stream Render Filter";

AMOVIESETUP_MEDIATYPE sudMediaTypes[] = {
{ &MEDIATYPE_NULL, &MEDIASUBTYPE_NULL },
};

AMOVIESETUP_PIN sudOutputPin = {
L"", // Obsolete, not used.
FALSE, // Is this pin rendered?
FALSE, // Is it an output pin?
FALSE, // Can the filter create zero instances?
FALSE, // Does the filter create multiple instances?
&GUID_NULL, // Obsolete.
NULL, // Obsolete.
1, // Number of media types.
sudMediaTypes // Pointer to media types.
};

AMOVIESETUP_FILTER sudFilterReg = {
&CLSID_StreamRenderFilter, // Filter CLSID.
g_wszName, // Filter name.
MERIT_DO_NOT_USE, // Merit.
1, // Number of pin types.
&sudOutputPin // Pointer to pin information.
};


class CStreamRenderFilter : public CBaseRenderer
{
public:
DECLARE_IUNKNOWN;

CStreamRenderFilter(LPUNKNOWN pUnk, HRESULT *phr) : CBaseRenderer
(CLSID_StreamRenderFilter, NAME("CStreamRenderFilter"), pUnk, phr)
{

}

static CUnknown* WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr)
{
return new CStreamRenderFilter(punk, phr);
}

HRESULT CheckMediaType(const CMediaType *pMT)
{
return S_OK;
}

HRESULT DoRenderSample(IMediaSample *pMediaSample)
{
return S_OK;
}

AMOVIESETUP_FILTER *GetSetupData()
{
return((AMOVIESETUP_FILTER*)&sudFilterReg);
}
};

CFactoryTemplate g_Templates[] = {
{
g_wszName, // Name.
&CLSID_StreamRenderFilter, // CLSID.
CStreamRenderFilter::CreateInstance, // Creation function.
NULL,
&sudFilterReg // Pointer to filter information.
}
};
int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);


I have built the strmbase.lib library on my machine, using Visual
Studio 2008 SP1 on Vista Ultimate x64.

Any help and ideas on this would be much appreciated!
.



Relevant Pages

  • Re: Overlay Mixer and bitmap/text
    ... STDMETHODIMP NonDelegatingQueryInterface ... CImg2VidFilter(IUnknown *pUnk, HRESULT *phr); ... CSource, pUnk, CLSID_Img2VidFilter) ... HRESULT ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: streaming mp3 playback
    ... get no audio playback, even though setting up a test app shows playback ... DirectShow just wraps the core interfaces of DirectSound and waveOut, ... HRESULT hResult = CoInitialize; ... // Now query the graph builder for the particular controls we ...
    (microsoft.public.win32.programmer.directx.audio)
  • Re: ISampleGrabber
    ... data from SampleGrabber buffer in there. ... HRESULT GrabberCB::SampleCB ... Iain Downs (DirectShow MVP) ...
    (microsoft.public.win32.programmer.directx.video)