This article describes the Microsoft DirectShow base class library. This library is intended for filter developers, but application writers might find some of the helper classes and debugging utilities useful. The base class library is not required for DirectShow programming, however.
The following sections summarize the most important base classes in the library.
COM Object Classes
The following classes support the creation of COM objects:
CBaseObject: Most of the DirectShow classes derive from this class. It provides debugging assistance by keeping a count of all the active objects in the DLL at run time. In debug builds, the DLL will assert if it is unloaded while the object count is greater than zero. This makes it easier to track down leaks caused by reference-counting problems.
CUnknown: Implements IUnknown. All of the base classes that support COM interfaces derive from this class. This class derives from CBaseObject. It supports reference counting, QueryInterface, and aggregration. For more information, see How to Implement IUnknown.
Filter and Pin Classes
The following classes support the creation of DirectShow filter and pin objects:
CBaseInputPin: The base class for input pins that use local memory transport. Implements the IMemInputPin interface. This class derives from CBasePin.
CBaseOutputPin: The base class for output pins that use IMemInputPin connections. This class derives from CBasePin.
The following classes are useful for creating more specialized types of filters:
CSource: Base class for source filters. This class is designed for creating push sources. It is not suitable for pull sources, such as file readers. To create output pins for this class, use the CSourceStream class.
CTransInPlaceFilter: Base class for transform filters that do not copy data. This class performs the data processing directly on the input data before passing it downstream. The pins for this class are CTransInPlaceInputPin and CTransInPlaceOutputPin.
CVideoTransformFilter: Base class for video transform filters. This class derives from CTransformFilter and adds support for quality control.
CBaseRenderer: Base class for renderer filters. The input pin for this class is CRendererInputPin.
CBaseVideoRenderer: Base class for video renderers. This class derives from CBaseRenderer.
To use these classes, you must derive your own class and write code to support the functionality that is specific to your filter. The more specialized the base class, the less code you will need to write in your derived class.
Helper Objects
The following classes implement helper objects that are used by filters and pins. For the most part, you can use these classes without deriving new classes from them:
CPullPin: This class is a helper object for input pins on parser filters. It supports IAsyncReader connections with pull sources.
COutputQueue: This class is a helper object for output pins that queue samples for delivery on a worker thread.
CSourceSeeking: This class can be used to support seeking in a source filter with exactly one output pin. Filters with multiple pins (such as parsers) cannot use this class.
CEnumPins: Enumerator object for enumerating pins on a filter. Implements the IEnumPins interface.
CEnumMediaTypes: Enumerator object for enumerating preferred media types on a pin. Implements the IEnumMediaTypes interface.
CMediaSample: Media sample object. Implements the IMediaSample2 interface. The CImageSample class is a specialization of CMediaSample for video renderers.