Showing posts with label DShow custom filter windows ce filtergraph. Show all posts
Showing posts with label DShow custom filter windows ce filtergraph. Show all posts

Thursday, 24 January 2008

Using custom DShow filters without registering DLLs

If you are creating a media application or utility that requires a DMO or DShow filter but instead of having clunky separate dlls that may need code signing and/or registring with DShow, did you know that you can embed the filter within your main application.

For example for a source filter you can specify a new class and base it on the DShow components you require:

class MySourceFilter : public CSourceStream
{
public:
MySourceFilter( HRESULT* phr, LPCWSTR pName);
virtual ~MySourceFilter(void);

..
..
}

When you create your filtergraph you can use AddFilter to add an instance of your class:


// Create and add new source filter
m_source = new MySourceFilter(NULL, &hr);
hr = m_pGraph->AddFilter((IBaseFilter*)m_source, L"Source");


Simple as that!

You don't need to support the registration or have registry files to allow DShow to find your filter as you've explictly added it yourself.