|
Yes
|
|
|
|
|
Thanks for all the help.
A win32 DLL Project doesnt come with all the necessary files such as the def file, after fooling around I see that the MFC DLL Project does come with def file, am I correct in using that as the project, or have I gone crazy
and I cant see the def file in the Win32 DLL Porject.
|
|
|
|
|
There should be one with the sample code. If not here's the contents of one of my source filter
project def files:
LIBRARY MyDirectShowSource.ax
EXPORTS
DllMain PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
I just checked the sample code - mine is identical except for the LIBRARY name (which makes sense
because I started with the pushsource sample).
I also noticed the sample code doesn't come with a solution or project file for VS. You can
copy the files from the sample folders to your own project folder, rename any you want renamed,
and buld a project for them without problem though. You've already built an empty DLL project so
you should just have to copy the files and add them to your project (including the def file).
They should be built Unicode as well.
|
|
|
|
|
Thanks,
Will have a go at that and see if I can get it to work.
Thanks for all the input.
|
|
|
|
|
I created an empty project, I added all the PushSource Files, but now I am getting these linking errors.
Strmbasd.lib(wxutil.obj) : error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "public: int __thiscall CAMMsgEvent::WaitMsg(unsigned long)" (?WaitMsg@CAMMsgEvent@@QAEHK@Z)
Strmbasd.lib(wxdebug.obj) : error LNK2019: unresolved external symbol __imp__timeGetTime@0 referenced in function "public: __thiscall CDisp::CDisp(__int64,int)" (??0CDisp@@QAE@_JH@Z)
Strmbasd.lib(wxutil.obj) : error LNK2019: unresolved external symbol __imp__timeSetEvent@20 referenced in function "unsigned int __cdecl CompatibleTimeSetEvent(unsigned int,unsigned int,void
(__stdcall*)(unsigned int,unsigned int,unsigned long,unsigned long,unsigned long),unsigned long,unsigned int)" (?CompatibleTimeSetEvent@@YAIIIP6GXIIKKK@ZKI@Z)
Debug/TestSource.ax : fatal error LNK1120: 2 unresolved externals
Does anyone know why this is happeneing
|
|
|
|
|
Have you built the filter base class library as outlined here[^]?
Once you build the lib(s) then add the appropriate (debug or non-debug) lib file to your project.
Mark
|
|
|
|
|
Hi Mark,
I am getting some serious linking errors, I followed the webpage you sent me, and I am getting linking errors.
I have put my project files up at http://www.ece.ubc.ca/~npatel/MemorySource.zip
It is the project file that I have copied Push Source into. It uses Visual C++ 2003 .NET
What am I doing wrong?
|
|
|
|
|
godspeed123 wrote: I am getting some serious linking errors
You are just missing atlsd.lib
Don't forget to change the "Filter name strings" in pushsource.h and generate your own GUIDs
to replace the ones in PushGuids.h
For your version you probably won't need any of the Dib stuff either since you already have a
source of video frames. But I'm getting ahead of yourself When this builds I would recommend
testing it out in graphedit - make sure it works like the sample is supposed to THEN alter
it for your needs
Mark
|
|
|
|
|
I tried adding atlsd.lib, still the same unresolved external symbols
There are the linking errors
Linking...
Creating library Debug/MemorySource.lib and object Debug/MemorySource.exp
PushSourceDesktop.obj : error LNK2019: unresolved external symbol "public: __thiscall CSourceStream::CSourceStream(unsigned short *,long *,class CSource *,unsigned short const *)" (??0CSourceStream@@QAE@PAGPAJPAVCSource@@PBG@Z) referenced in function "public: __thiscall CPushPinDesktop::CPushPinDesktop(long *,class CSource *)" (??0CPushPinDesktop@@QAE@PAJPAVCSource@@@Z)
PushSourceBitmap.obj : error LNK2001: unresolved external symbol "public: __thiscall CSourceStream::CSourceStream(unsigned short *,long *,class CSource *,unsigned short const *)" (??0CSourceStream@@QAE@PAGPAJPAVCSource@@PBG@Z)
PushSourceBitmapSet.obj : error LNK2019: unresolved external symbol "public: __thiscall CSourceStream::CSourceStream(unsigned short *,long *,class CSource *,unsigned short const *)" (??0CSourceStream@@QAE@PAGPAJPAVCSource@@PBG@Z) referenced in function "public: __thiscall CPushPinBitmapSet::CPushPinBitmapSet(long *,class CSource *)" (??0CPushPinBitmapSet@@QAE@PAJPAVCSource@@@Z)
PushSourceDesktop.obj : error LNK2019: unresolved external symbol "void __cdecl DbgLogInfo(unsigned long,unsigned long,unsigned short const *,...)" (?DbgLogInfo@@YAXKKPBGZZ) referenced in function "public: virtual __thiscall CPushPinDesktop::~CPushPinDesktop(void)" (??1CPushPinDesktop@@UAE@XZ)
PushSourceBitmap.obj : error LNK2001: unresolved external symbol "void __cdecl DbgLogInfo(unsigned long,unsigned long,unsigned short const *,...)" (?DbgLogInfo@@YAXKKPBGZZ)
PushSourceBitmapSet.obj : error LNK2001: unresolved external symbol "void __cdecl DbgLogInfo(unsigned long,unsigned long,unsigned short const *,...)" (?DbgLogInfo@@YAXKKPBGZZ)
PushSourceDesktop.obj : error LNK2019: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" (?DbgAssert@@YGXPBG0H@Z) referenced in function "public: virtual long __thiscall CPushPinDesktop::DecideBufferSize(struct IMemAllocator *,struct _AllocatorProperties *)" (?DecideBufferSize@CPushPinDesktop@@UAEJPAUIMemAllocator@@PAU_AllocatorProperties@@@Z)
PushSourceBitmap.obj : error LNK2001: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" (?DbgAssert@@YGXPBG0H@Z)
PushSourceBitmapSet.obj : error LNK2001: unresolved external symbol "void __stdcall DbgAssert(unsigned short const *,unsigned short const *,int)" (?DbgAssert@@YGXPBG0H@Z)
PushSourceDesktop.obj : error LNK2019: unresolved external symbol "public: __thiscall CSource::CSource(unsigned short *,struct IUnknown *,struct _GUID)" (??0CSource@@QAE@PAGPAUIUnknown@@U_GUID@@@Z) referenced in function "private: __thiscall CPushSourceDesktop::CPushSourceDesktop(struct IUnknown *,long *)" (??0CPushSourceDesktop@@AAE@PAUIUnknown@@PAJ@Z)
PushSourceBitmap.obj : error LNK2001: unresolved external symbol "public: __thiscall CSource::CSource(unsigned short *,struct IUnknown *,struct _GUID)" (??0CSource@@QAE@PAGPAUIUnknown@@U_GUID@@@Z)
PushSourceBitmapSet.obj : error LNK2001: unresolved external symbol "public: __thiscall CSource::CSource(unsigned short *,struct IUnknown *,struct _GUID)" (??0CSource@@QAE@PAGPAUIUnknown@@U_GUID@@@Z)
Debug/MemorySource.ax : fatal error LNK1120: 4 unresolved externals
|
|
|
|
|
It built for me. I just needed to add atlsd.lib and point to my own strmbasd.lib.
Those errors look like you haven't included strmbasd.lib
|
|
|
|
|
In the linker settings where you added strmbasd.lib (input/additional dependencies) you may need
to use the full path to strmbasd.lib.
ACK I didn't mean to reply to myself
|
|
|
|
|
In the linker settings where you added strmbasd.lib (input/additional dependencies) you may need
to use the full path to strmbasd.lib.
|
|
|
|
|
Hi Mark,
I redid the project on another machine and it works fine there. Yay !!! finally thanks to you I have it working.
So now once its compiled how does one go about finding a unique GUID, and loading this up in GraphEdit. My understanding is I have to register the dll with regsvr32.
Once again I thanks you for all the help.
|
|
|
|
|
Step 1) Generate new GUIDS. There's 3 of them in your project's pushguids.h.
You can use guidgen.exe (GUI) to create 1 at a time or uuidgen.exe to generate many sequential
GUIDs. Both utilities are in the platform SDK bin folder.
Step 2) modify those strings ("Filter name strings") in pushsource.h to your own names.
That will make your filter easier to find in graphedit.
Step 3) From a command prompt - "cd" to the folder your MemorySource.ax is in.
use "regsvr32 drive:\fullpath\MemorySource.ax" to register the com dll.
Step 4) Test in graphedit
-- modified at 21:10 Tuesday 26th December, 2006
|
|
|
|
|
Sweet its working!!!!!!!!!!!!!!!!
Last question hopefully
So if I have images being stored in memory, how do you pass that into this source filter since it has no input. All of these filters generate data internally, my data is sitting in memory all I want to do it pull that data into directshow.
|
|
|
|
|
godspeed123 wrote: Sweet its working!!!!!!!!!!!!!!!!
Cool
godspeed123 wrote: how do you pass that into this source filter since it has no input
The short answer: Any way you want!
A longer answer:
I would add a COM interface to the filter so you can add any methods you want to it and call them
just like you do the documented methods in Microsoft's DirectShow filters.
I'm no COM expert so if anyone wants to jump in and show how to do this better I'm all ears
(eyes?).
Example. There's 3 filters in your code. I'll use the CPushSourceBitmap class (PushSource
Bitmap Filter) as an example (I did it this way originally so I wouldn't mess up the original
class).
In pushsource.h define a COM interface class (you'll need another GUID for the interface)
Note that the GUID is defined here using standard IID_ naming convention and the same GUID, in
MIDL form, is used in the MIDL_INTERFACE macro.
DEFINE_GUID(IID_IMySource,
0x0aaaaaaa, 0xaaaa, 0xaaaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa);
MIDL_INTERFACE("0aaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa")
IMySourceFilter : public IUnknown
{
public:
};
Next derive CPushSourceBitmap from the new interface class (IMySourceFilter)
{ becomes
class CPushSourceBitmap : public CSource, public IMySourceFilter
{
public:
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
DECLARE_IUNKNOWN;
In pushsourcebitmap.cpp add the implementation for any new interface functions plus the
implementation of NonDelegatingQueryInterface() (note the use of the new GUID)
STDMETHODIMP CPushSourceBitmap::NonDelegatingQueryInterface( REFIID riid, void ** ppv)
{
CheckPointer(ppv,E_POINTER);
if(riid == IID_IMySource)
{
return GetInterface((IMySourceFilter *) this, ppv);
}
else
{
return CSource::NonDelegatingQueryInterface(riid, ppv);
}
}
Use regsvr32 like before except with the /u switch to uninstall the previous filter.
Then use regsvr32 to register the filter again (with the new interface).
Now your filter has a custom COM interface so you can control it from the outside, just like
any other filters. Use QueryInterface as usual to get an interface pointer:
IMySourceFilter *pifMySource = NULL;
pMyFilter->QueryInterface(IID_IMySource, (void **)&pifMySource);
Now you can add methods to send frames to the filter or whatever scheme you want to use - you
can also have the filter call a callback function to grab frames.
-- modified at 22:49 Tuesday 26th December, 2006
|
|
|
|
|
Very good responses from you. My wishes for you
*
|
|
|
|
|
Thanks Mark for all the information, I will try it all out.
Once agian I am grateful for all the help you have given me.
|
|
|
|
|
Hi,
So I finished adding everything that you said and I could load the new filter in graphEdit. I kept the name the same as the sample, I am updating CPushSourceDesktop.
So now I want to be able to go into another C++ program and set this filter up.
Is the declaration to get it instantiated as follows:
CPushSourceDesktop *pMyFilter;
and then do this
hr = CoCreateInstance(CLSID_PushSourceDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&pMyFilter));
hr = pGraph->AddFilter(pMyFilter, L"PushSource Desktop Filter");
IMySourceFilter *pifMySource = NULL;
pMyFilter->QueryInterface(IID_IMySource, reinterpret_cast<void**>(&pifMySource));
Its giving me linking errors :
error LNK2001: unresolved external symbol _IID_IMySource
error LNK2001: unresolved external symbol _CLSID_PushSourceDesktop
I included everything
#include "Dshow.h"
#include "Qedit.h"
#include "Streams.h"
#include "PushGuids.h"
#include "PushSource.h"
and the lib I included Strmiids.lib Quartz.lib MemorySource.lib
Any help would be appreiciated
|
|
|
|
|
The underscores preceding the symbols are suspicious
Did you include this file (above your GUID definitions)
#include <initguid.h>
and use the DEFINE_GUID macro to define them?
// {AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}
DEFINE_GUID(CLSID_PushSourceDesktop,
0xaaaaaaaa, 0xaaaa, 0xaaaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa);
|
|
|
|
|
Hi,
Thanks for the response. I added the #include <initguid.h> and it compiled, but when I run the program and I have written
hr = CoCreateInstance(CLSID_PushSourceDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IBaseFilter, reinterpret_cast<void**>(&pMyFilter));
hr = pGraph->AddFilter(pMyFilter, L"PushSource Desktop Filter");
The program crashes with an error Module MemorySource.ax, 2 objects left active!
At line 316 of dllentry.cpp
And then the program aborts.
Does anyone know why this is happening
|
|
|
|
|
|
I can't figure out what's up.
If I substitute one of my known working filters then it works fine.
I tried to build a filter from scratch using your code and it fails (I'm not saying it's your
code - I mean just using your test hello() method).
If I see something or something comes to mind I'll let you know!
|
|
|
|
|
Which line does the crash occur on? CoCreateInstance()?
I can't test your code since it has the PVxx.h header file that's missing.
Mark
|
|
|
|
|
Hi,
Thanks for the response.
The error occurrs on the AddFilter line, the PVxx.h you can delete, I am not using it in the filter.
I was just fooling around with things trying to get it to work.
|
|
|
|
|