Microsoft DirectX 8.1 (C++) |
The derived filter class must provide a few member functions, typically to:
All derived filter classes must implement a static CFactoryTemplate::CreateInstance function. You can also choose to override the CBaseFilter::GetSetupData member function to make your filter self-registering. Beyond this, your classes must override a few member functions in the transform base classes. For more information about instantiating the filter, see Creating a Transform Filter.
If your derived filter class is based on the CTransformFilter class, you must override the following member functions.
Member function | |
Transform | Implement transform. |
CheckInputType | Verify support of media type. |
CheckTransform | Verify support for transforming this type (for debugging builds only). |
DecideBufferSize | Set size and count when copying. |
GetMediaType | Suggest media types for the output pin. |
If your derived filter class is based on the CTransInPlaceFilter class, override the following member functions.
Member function | |
CTransInPlaceFilter::Transform | Implement transform. |
CTransformFilter::CheckInputType | Verify support of media type. |
Beyond providing your transform filter with a default implementation by providing the minimum overrides, you can override other member functions to provide more specialized behavior. Which member functions you override, of course, depends on what you want your filter to do. For example, you must override the CTransformFilter::GetPin and CTransformFilter::GetPinCount member functions if you want to have more than one input pin and one output pin on the filter.
Also, several base class member functions, such as CBasePin::BreakConnect or CBasePin::CompleteConnect, are called as notifications to your filter through the pins. Typically, most of these member functions exist only on the pins. In the classes based on CTransformFilter, the pin functions are implemented to call similarly named functions in the filter class. This means that the member functions you most likely will want to override are all collected into one filter class, so you can leave the pin classes unchanged, making implementation smaller and easier. These member functions are as follows.
Member function | Reason to override |
GetPinCount | If adding more pins to the transform filter. |
GetPin | If adding more pins to the transform filter. |
CheckConnect | To obtain extra interfaces at connect time or for other reasons. |
BreakConnect | To release extra interfaces when connection is broken or for other reasons. |
CompleteConnect | To perform some action at the end of connection (such as reconnecting the input pin). |
SetMediaType | To be notified when the media type has been set. |
StartStreaming | To be notified when entering the streaming state. |
StopStreaming | To be notified when exiting the streaming state. |
AlterQuality | To do anything with quality-control messages other than passing them on. |