Discussion:
Custom DirectShow render filter linker problem
(too old to reply)
d***@gmail.com
2008-12-09 21:05:47 UTC
Permalink
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@@***@ABU_GUID@@PBDPAUIUnknown@@***@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!
The March Hare [MVP]
2008-12-10 01:44:20 UTC
Permalink
Post by d***@gmail.com
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!
Answered in the MSDN dshow forum.

Please do not multi-post.

See: http://tmhare.mvps.org/help.htm#mp

Also, this newsgroup is no longer active. See my regular message here.
--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution
Loading...