Writing Transform Filters
|Microsoft DirectShow 9.0|
This section describes how to write a transform filter, defined as a filter that has exactly one input pin and one output pin. To illustrate the steps, this section describes a hypothetical transform filter that outputs run-length encoded (RLE) video. It does not describe the RLE-encoding algorithm itself, only the tasks that are specific to DirectShow. (DirectShow already provides an RLE codec through the AVI Compressor filter.)
This section assumes that you will use the DirectShow base class library to create filters. Although you can write a filter without it, the base class library is strongly recommended.
- Note Before writing a transform filter, consider whether a DirectX Media Object (DMO) would fulfill your requirements. DMOs can do many of the same things as filters, and the programming model for DMOs is simpler. DMOs are hosted in DirectShow through the DMO Wrapper filter, but can also be used outside of DirectShow. DMOs are now the recommended solution for encoders and decoders.
This section includes the following topics:
- Step 1. Choose a Base Class
- Step 2. Declare the Filter Class
- Step 3. Support Media Type Negotiation
- Step 4. Set Allocator Properties
- Step 5. Transform the Image
- Step 6. Add Support for COM