GDCL Home About GDCL DirectShow WinNt & WDM

The Component Object Model

DirectShow is based on the Component Object Model or COM. This is a mechanism for identifying and communicating between component applications in a generic manner. COM communication is done via interfaces or groups of functions implemented by COM objects.

A group of functions is defined (including all parameters and return values) and identified by a unique 128-bit interface id (a globally-unique id or GUID). A COM Object (also defined by a GUID, referred to in this case as a class id) is created by a call to a Win32 API (CoCreateInstance), and what is returned is a pointer to a specific interface. The interface will be returned as a pointer to a table of function pointers, pointing to the functions defined in this interface. This model is based on the C++ abstract class: like an abstract base class, the interface definition defines a layout for the table of function pointers (the v-table) and derived classes (the COM objects) provide implementations. One object can implement many different interfaces: each interface includes the QueryInterface method that lets you find another interface on the same object.

COM Objects can be in-process, in which case they are implemented as DLLs and loaded into the calling application's address space. In this case, the entries in the interface's v-table point directly to the COM object's functions. They can also be implemented as a server process, in which case the core COM code will provide marshalling to transfer the call, its parameters and any return values across to a separate process or even a different machine. On Windows NT, XP and Vista, COM objects can also be Win32 services.

 Related Topics

Microsoft's COM home page