Поделиться через


Controlling Filter Graphs Using C

 
Microsoft DirectShow 9.0

Controlling Filter Graphs Using C

If you are writing your Microsoft® DirectShow® application in C (rather than C++), you must use a vtable pointer to call methods. The following example illustrates how to call the IUnknown::QueryInterface method from an application written in C:

pGraph->lpVtbl->QueryInterface(pGraph, &IID_IMediaEvent, (void **)&pEvent);

The following shows the equivalent call in C++:

pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);

In C, interfaces are defined as structures. The lpVtbl member is a pointer to a table of interface methods (the vtable). All methods take an additional parameter, which is a pointer to the interface.