PDA

View Full Version : Set a list for setDeviceFrameFilters



Goodidea
December 12, 2017, 16:32:49
I wrote a frame filter as described by the chapter "Writing a Frame Filter: Binarization" in the user's guide.
This code work fine:


class MyFilter1 : public DShowLib::FrameFilterImpl<MyFilter1>
{
public:
MyFilter1 ();

... etc ...
};

...
Grabber.setDeviceFrameFilters (&MyFilter1);
...

Now I add a second filter, the class is called MyFilter2.
How can I do the filters' list?


tFrameFilterList filterList;
filterList.push_back ( ... MyFilter1 ??? );
filterList.push_back ( ... MyFilter2 ??? );
Grabber.setDeviceFrameFilters (filterList);

Best regards.
Paolo

(SDK 3.3)

Stefan Geissler
December 13, 2017, 16:50:36
Hi Paolo

Yes, it looks good so far.


DShowLib::tFrameFilterList flist = pGrabber->getDeviceFrameFilters();
pGrabber->stopLive();
flist.push_back( Filter1.get());
flist.push_back( Filter2.get());
flist.push_back( Filter3.get());
pGrabber->setDeviceFrameFilters(flist);
for( unsigned int i = 0; i < flist.size(); i++ )
{
if( flist.at(i) == m_iFilter.get())
flist.at(i)->AddRef();
}

pGrabber->startLive();

That should do the job.

Goodidea
December 13, 2017, 19:33:05
I had tried a code similar to yours.
Unfortunately, the problem is the error message:


... error C2039: 'get': is not a member of 'Filter1'

at line:

flist.push_back( Filter1.get());

Edit: the code work (between stopLive and startLive):


DShowLib::tFrameFilterList flist = m_pGrabber.getDeviceFrameFilters ();
flist.push_back (&MyFilter1);
flist.push_back (&MyFilter1);
m_pGrabber.setDeviceFrameFilters (flist);

Stefan Geissler
December 14, 2017, 09:18:11
Hello

good to read, it is working now.