Click here to Skip to main content
15,891,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Directshow question Pin
godspeed12326-Dec-06 14:23
godspeed12326-Dec-06 14:23 
GeneralRe: Directshow question Pin
Mark Salsbery26-Dec-06 14:29
Mark Salsbery26-Dec-06 14:29 
GeneralRe: Directshow question Pin
Mark Salsbery26-Dec-06 14:33
Mark Salsbery26-Dec-06 14:33 
GeneralRe: Directshow question Pin
Mark Salsbery26-Dec-06 14:33
Mark Salsbery26-Dec-06 14:33 
GeneralRe: Directshow question Pin
godspeed12326-Dec-06 14:51
godspeed12326-Dec-06 14:51 
GeneralRe: Directshow question [modified] Pin
Mark Salsbery26-Dec-06 15:04
Mark Salsbery26-Dec-06 15:04 
GeneralRe: Directshow question Pin
godspeed12326-Dec-06 15:37
godspeed12326-Dec-06 15:37 
GeneralRe: Directshow question [modified] Pin
Mark Salsbery26-Dec-06 16:16
Mark Salsbery26-Dec-06 16:16 
godspeed123 wrote:
Sweet its working!!!!!!!!!!!!!!!!


Cool Smile | :)

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:
    // define pure virtual methods here
};

Next derive CPushSourceBitmap from the new interface class (IMySourceFilter)
//the old code
//class CPushSourceBitmap : public CSource
{
becomes
class CPushSourceBitmap : public CSource, public IMySourceFilter
{
public:
    // provide the overrides for IMySourceFilter virtual methods here
 
    // Expose IMySourceFilter
    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:
//pMyFilter is instance of filter obtained with CoCreateInstance()
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
GeneralRe: Directshow question Pin
Astricks26-Dec-06 17:13
Astricks26-Dec-06 17:13 
GeneralRe: Directshow question Pin
godspeed12327-Dec-06 16:25
godspeed12327-Dec-06 16:25 
GeneralRe: Directshow question [modified] Pin
godspeed12327-Dec-06 16:45
godspeed12327-Dec-06 16:45 
GeneralRe: Directshow question Pin
Mark Salsbery28-Dec-06 5:35
Mark Salsbery28-Dec-06 5:35 
GeneralRe: Directshow question Pin
godspeed12328-Dec-06 14:13
godspeed12328-Dec-06 14:13 
GeneralRe: Directshow question Pin
godspeed12328-Dec-06 16:12
godspeed12328-Dec-06 16:12 
GeneralRe: Directshow question Pin
Mark Salsbery30-Dec-06 12:09
Mark Salsbery30-Dec-06 12:09 
GeneralRe: Directshow question Pin
Mark Salsbery30-Dec-06 7:54
Mark Salsbery30-Dec-06 7:54 
GeneralRe: Directshow question Pin
godspeed12330-Dec-06 9:58
godspeed12330-Dec-06 9:58 
QuestionProblem in saving Files and Folders Pin
vijay_aroli26-Dec-06 5:52
vijay_aroli26-Dec-06 5:52 
AnswerRe: Problem in saving Files and Folders Pin
Mark Salsbery26-Dec-06 7:00
Mark Salsbery26-Dec-06 7:00 
GeneralRe: Problem in saving Files and Folders Pin
vijay_aroli26-Dec-06 8:26
vijay_aroli26-Dec-06 8:26 
GeneralRe: Problem in saving Files and Folders Pin
Mark Salsbery26-Dec-06 8:43
Mark Salsbery26-Dec-06 8:43 
GeneralRe: Problem in saving Files and Folders Pin
vijay_aroli26-Dec-06 9:11
vijay_aroli26-Dec-06 9:11 
GeneralRe: Problem in saving Files and Folders Pin
Mark Salsbery26-Dec-06 11:27
Mark Salsbery26-Dec-06 11:27 
QuestionConvert char array into CString Pin
Johpoke26-Dec-06 5:08
Johpoke26-Dec-06 5:08 
AnswerRe: Convert char array into CString Pin
Mark Salsbery26-Dec-06 5:36
Mark Salsbery26-Dec-06 5:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.