Write a Transform Filter in C/C++
A transform filter takes media input and alters it in some way. When you design a transform filter, your filter class derives from one of the transform base classes, CTransformFilter, CTransInPlaceFilter, or CVideoTransformFilter, or from the more generic CBaseFilter class. Which base class you choose depends on whether your filter must copy media samples or can transform them in place. See Determine Which Base Classes to Use for more information.
The filter graph manager can use the functions of the base classes your filter derives from to fit your filter into the filter graph and automatically create the connections between your filters. The filter mapper uses your filter's registry information to configure the filter graph.
For the simplest transform filter (for example, one that has only one input pin and one output pin), you can derive your filter class from CTransformFilter and override only the Transform and CheckInputType functions. If you need custom features, you can override additional functions to create your own connections, pins, and other filter features and capabilities. See Override the Base Class Member Functions for more information. You can also derive your filter class from CBaseFilter and override its methods.
This section discusses how to:
- Define and Instantiate Your Filter Class
- Override CheckInputType (does not apply to filter classes derived from CBaseFilter)
- Override the Transform Function (does not apply to filter classes derived from CBaseFilter)
- Access Additional Interfaces
- Create Registry Information
Every transform filter must implement code to perform all the preceding steps except access additional interfaces.
For background information about transform filters, see the following topics:
For information on registering a filter or making it self-registering, see Registering DirectShow Filters.
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.