Microsoft DirectX 8.1 (C++) |
For information about the connection process, including media type and allocator negotiation, see How Filters Connect. When you are determining your transform filter characteristics, it might help for you to understand the model of allocator negotiation for transform filters.
If your transform filter requires copying, then it will copy media samples from a buffer established by its input pin to a buffer established by its output pin. These buffers are provided by allocators that might actually be located in other filters, perhaps even several filters removed if the filters in between do not copy the data.
A copying transform filter typically tries to use the allocator of the upstream filter for its input pin, and the allocator of the downstream filter for its output pin. During the connection process, the output pin of the upstream filter determines which allocator to use for the upstream transport, so the input pin of the copy transform must be prepared to create an allocator for the upstream transport if its IMemInputPin::GetAllocator method is called by the connecting output pin. The base classes provide a way to create a new allocator from the input pin of any connection.
On the other hand, transform-in-place filters do not make copies, but rather modify the data in an existing buffer. These filters should always offer the allocator from the downstream filter to the upstream filter. This requires a reconnection, because the filter does not know about the downstream filter when its input pin is first connected. Also, because in-place transforms do not change the media type, the media type from the downstream filter should be offered to the upstream filter upon reconnection.