DirectShow Animated Header -- Filters and Pins DirectShow Animated Header -- Filters and Pins* Microsoft DirectShow SDK
*Index  *Topic Contents
*Previous Topic: Filter Graph Manager and Filter Graphs
*Next Topic: Stream Control Architecture

Filters and Pins


The two basic components used in the stream architecture are filters and pins. A filter is a COM object that performs a specific task, such as reading data from a disk. For each stream it handles, it exposes at least one pin. A pin is a COM object created by the filter, that represents a point of connection for a unidirectional data stream on the filter, as shown in the following illustration.

Pin illustration

Input pins accept data into the filter, and output pins provide data to other filters. A source filter provides one output pin for each stream of data in the file. A typical transform filter, such as a compression/decompression (codec) filter, provides one input pin and one output pin, while an audio output filter typically exposes only one input pin. More complex arrangements are also possible.

You can name pins anything you want. If your pin name begins with the tilde (~) character, the filter graph will not automatically render that pin when an application calls IGraphBuilder::RenderFile. This can apply to pins that are just informational and are not meant to be rendered, or need to be enumerated so that their properties can be set. The tilde (~) prefix only affects the behavior of RenderFile and intelligent connect (IGraphBuilder::Connect). Note that intelligent connect can still be used to connect pins with this property if they implement the IPin::Connect method. However, output pins of intermediate filters which are being used to complete the connection which have the tilde at the start of their name will not be connected as part of the intelligent connection attempt.

At a minimum, a filter exposes the IBaseFilter interface. This interface provides methods that allow the enumeration of the pins on the filter and return filter information. It also provides the inherited methods from IMediaFilter; these methods allow control of state processing (for example running, pausing, and stopping) and synchronization, and are called primarily by the filter graph manager.

In addition, a filter might expose several other interfaces, depending on the media types supported and tasks performed. For example, a filter can expose the ISpecifyPropertyPages interface to support a property page.

Pins are responsible for providing interfaces to connect with other pins and for transporting the data. The pin interfaces support the following:

Pin interfaces differ slightly, depending on whether they are output pins or input pins.

An output pin typically exposes the following interfaces.

An input pin typically exposes the following interfaces.

The standard transport interface, IMemInputPin, provides data transfer through shared memory buffers, although other transport interfaces can be used. For example, where two components are connected directly in hardware, they can connect to each other by using the IPin interface, and then seek a private interface that can manage the transfer of data directly between the two components.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page