delphifilterdirectshowdspack

How can I directly embed a DirectShow Push Source filter in an EXE?


I have a Delphi 6 program that receives audio from an external program via a socket. Now I want to feed that audio to a DirectShow filter graph I create that routes that audio to different output filters on the PC. I am using DSPACK for my DirectShow filter graph work. I'll be using one of the DSPACK examples that shows how to create a Push Source Filter as my starting point.

Is it possible to embed a DirectShow filter directly into my main EXE, or do I have to create an external DLL or AX file and run regsvr32 on it? I'd like to avoid creating an external module otherwise I'll have to create a parameter and data passing bridge between it and my main program and I'd prefer to eliminate that work. I'm wondering if there is a way to simply include the push source filter code in my main program and finesse Windows into working with it as a DirectShow filter if that is at all possible.


Solution

  • Filters don't have to be put into libraries (DLL), and they don't have to be even registered COM objects, no. As mentioned, the only reason to make this, is to make the filter available to applications through CoCreateInstance and/or through enumeration of DirectShow categories.

    Being put into your application directly, it has to implement IBaseFilter and you will IFilterGraph::AddFilter it into the graph. An advantage of having filter privately, is that you don't need to implement communication between application and filter through COM interface, and you can use native/direct pointers.

    See also Geraint's post Using Filters Without Registration.