Implementing IUnknown in DirectShow

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

DirectShow is based on the Component Object Model (COM). If you write your own filter, you must implement it as a COM object. The DirectShow base classes provide a framework from which to do this. Using the base classes is not required, but it can simplify the development process. This topic describes some of the internal details of COM objects and their implementation in the DirectShow base classes.

This topic assumes that you know how to program COM client applications — in other words, that you understand the methods in IUnknown — but does not assume any prior experience developing COM objects. DirectShow handles many of the details of developing a COM object. If you have experience developing COM objects, you should read Using CUnknown, which describes the CUnknown base class.

COM is a specification, not an implementation. It defines the rules that a component must follow; putting those rules into effect is left to the developer. In DirectShow, all objects derive from a set of C++ base classes. The base class constructors and methods do most of the COM "bookkeeping" work, such as keeping a consistent reference count. By deriving your filter from a base class, you inherit the functionality of the class. To use base classes effectively, you need a general understanding of how they implement the COM specification.

For more information about IUnknown, see

See Also

Concepts

DirectShow and COM