views:

352

answers:

2

So we have some filter for DS. It works - uses standard win dll's.

We want to convert that filter to some sort of non-using DS program. So we want it to call dlls in write order, do all what DS is doing but not be in any way dependable on DS - only on filter dll's.

So... How to convert DirectShow Filter to C++\C#?

A: 

It is possible to use DirectShow filters without using DirectShow, but you will need to write your own Graph implementation.

That means that you will have to implement the IFilterGraph, IMemInputPin and IMemOutputPin interfaces to make the DirectShow filter think it is running in it's native environment.

In order to pass buffers through the filter, you may need to implement IMemAllocator and IMediaSample

The buffer passing, in particular cannot be done in managed code. You might be able to do it with interop, but I think this would be easier to do in C++ than in C#. I did this once many years ago. It took about 3 months.

John Knoeller
+1  A: 

A better solution is to use the filter within a single-purpose graph, in which you have a custom source feeding the filter from the app, and a custom sink receiving the output and delivering it to the app. There's an example of this on www.gdcl.co.uk. I know this isn't quite what you are asking for, but your dependencies on dshow are very limited, and it's hard to see an environment in which the filter binary works but dshow basics are not available.

G

Geraint Davies