Microsoft DirectX 9.0 |
The CTransInPlaceFilter class is designed for in-place transform filters, which are filters that modify the input data rather than copying the data across buffers.To use this class, derive a new class from CTransInPlaceFilter and implement the following methods:
This class uses the CTransInPlaceInputPin class for its input pin, and the CTransInPlaceOutputPin class for its output pin. Typically, you do not need to override these pin classes. The filter creates both pins in the CTransInPlaceFilter::GetPin method. If you do override the pin classes, you must override GetPin to create your custom pins.
This class is designed so the input type always matches the output type. Whenever possible, the filter uses a single allocator for both pin connections.
Preferred Media Types
If the output pin is already connected, the input pin offers the downstream filter's preferred types. (In fact it simply returns the downstream filter's enumerator object.) Otherwise, it has no preferred types. The output pin has the same behavior, but in reverse: If the input pin is already connected, the output pin offers the upstream filter's preferred types. Otherwise, it has no preferred types.
Pin Connections
When one pin connects, the filter generally reconnects the other pin, to make sure that both pins use the same media type and the same allocator. (The mechanism for reconnecting pins is described in Reconnecting Pins.) Two scenarios are possible: Either the input pin connects first, or the ouput pin connects first.
Suppose the input pin connects first. The following steps occur:
Later, when the output pin connects:
Now consider the opposite scenario, where the output pin is the first pin to connect.
Then, when the input pin connects:
This sequence of events changes slightly if any of the allocators involved are read-only, because the downstream allocator must be writable. In that case, the filter might use two separate allocators.
Requirements
Header: Declared in Transip.h; include Streams.h.
Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
Protected Methods | |
Copy | Copies a media sample. |
InputPin | Retrieves a pointer to the filter's input pin. |
OutputPin | Retrieves a pointer to the filter's output pin. |
TypesMatch | Determines whether the input media type matches the output media type. |
UsingDifferentAllocators | Determines whether the input and output pins are using different allocators. |
Public Methods | |
CTransInPlaceFilter | Constructor method. |
GetPin | Retrieves a pin. |
GetMediaType | Retrieves a preferred media type for the output pin. |
DecideBufferSize | Sets the output pin's buffer requirements. |
CheckTransform | Checks whether an input media type is compatible with an output media type. |
CompleteConnect | Completes a pin connection. |
Receive | Receives a media sample, processes it, and delivers it to the downstream filter. |
Pure Virtual Methods | |
Transform | Transforms a sample in place. |