Microsoft DirectX 8.1 (C++)

CTransformFilter Class

CTransformFilter Class Hierarchy

The CTransformFilter class is a base class for implementing transform filters. This class is designed for implementing a transform filter with one input pin and one output pin. It uses separate allocators for the input pin and the output pin. To create a filter that processes data in place, use the CTransInPlaceFilter class.

This filter uses the CTransformInputPin class for its input pin, and the CTransformOutputPin class for its output pin. Typically, you do not need to override these pin classes. Most of the pin methods call corresponding methods on the CTransformFilter class, so you can override the filter methods if necessary. The filter creates both pins in the CTransformFilter::GetPin method. If you do override the pin classes, you must override GetPin to create your custom pins.

By default, the input pin does not propose a media type during the connection process. Therefore, the input connection will be made using a media type proposed by the upstream filter (assuming that any are valid). You should still register the input media types when you register the filter, so that the Filter Mapper object will find it. For more information, see How to Register DirectShow Filters.

The output pin proposes a media type through the filter's CTransformFilter::GetMediaType method, which the derived class must implement. The output pin will refuse a connection unless the input pin has been connected.

This class does not queue the output data. Each output sample is delivered from inside the IMemInputPin::Receive method.

To use this class, derive a new class from CTransformFilter and implement the following methods:

You might need to override other methods as well, depending on the requirements of your filter.

Requirements

Header: Declared in Transfrm.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Protected Member Variables  
m_bEOSDelivered Flag that indicates whether the filter has sent an end-of-stream notification.
m_bSampleSkipped Flag that indicates whether the most recent sample was dropped.
m_bQualityChanged Flag that indicates whether the quality has changed.
m_csFilter Critical section that protects the filter state.
m_csReceive Critical section that protects the streaming state.
m_pInput Pointer to the input pin.
m_pOutput Pointer to the output pin.
Public Methods  
CTransformFilter Constructor method.
~CTransformFilter Destructor method.
GetPinCount Retrieves the number of pins on the filter. Virtual.
GetPin Retrieves a pin. Virtual.
Transform Transforms an input sample to produce an output sample. Virtual.
StartStreaming Called when the filter switches to the paused state. Virtual.
StopStreaming Called when the filter switches to the stopped state. Virtual.
AlterQuality Notifies the filter that a quality change is requested. Virtual.
SetMediaType Called when the media type is set on one of the filter's pins. Virtual.
CheckConnect Determines whether a pin connection is suitable. Virtual.
BreakConnect Releases a pin from a connection. Virtual.
CompleteConnect Completes a pin connection. Virtual.
Receive Receives a media sample, processes it, and delivers an output sample to the downstream filter. Virtual.
InitializeOutputSample Retrieves a new output sample and initializes it.
EndOfStream Notifies the filter that no additional data is expected from the input pin. Virtual.
BeginFlush Begins a flush operation. Virtual.
EndFlush Ends a flush operation. Virtual.
NewSegment Notifies the filter that media samples received after this call are grouped as a segment. Virtual.
Pure Virtual Methods  
CheckInputType Checks whether a specified media type is acceptable for input.
CheckTransform Checks whether an input media type is compatible with an output media type.
DecideBufferSize Sets the output pin's buffer requirements.
GetMediaType Retrieves a preferred media type for the output pin.
IMediaFilter Methods  
Stop Stops the filter.
Pause Pauses the filter.
IBaseFilter Methods  
FindPin Retrieves the pin with the specified identifier.