Partager via


Adding Filters to the Graph

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

If a moniker is found for a source filter that can read a file of the specified type, the Filter Graph Manager uses CoCreateInstance to create an instance of the filter using the returned GUID, and then calls its own AddFilter method to add the filter to the filter graph. Once added to the graph, the filter creates one or more output pins configured for the type of file it will be reading. After the pin(s) are created, the Filter Graph Manager will examine the media type each pin supports and then look again in the registry for a filter that can accept that media type on its input pin. When it finds a suitable filter, it adds it to the graph and then calls the IPin::Connect method on the upstream filter's output pin. The output pin can enumerate the supported media types on the input pin and attempt to use that type by calling IPin::ReceiveConnection on that pin. If the input pin agrees on the media type, then the connection is made. This process is repeated until all the necessary filters have been added to the graph. Typically, the second filter in a playback graph will be a parser or splitter filter, which reads a raw stream of data, such as AVI or MPEG, and splits it into separate audio and video streams, creating an output pin for each stream. If the data for either stream is compressed, the next filter on each stream will be a decompressor, followed by a renderer filter.

The Intelligent Connect mechanisms can also be used by applications to partially build graphs. For example, assume you have a special filter that captures data from some device and outputs it in a standard format. Your application can manually add the first filter to the graph, then use the Filter Graph Manager to obtain a pointer to the filter, then use the filter's EnumPins or FindPin methods to obtain pointers to the output pins. Then, when the application supplies that pointer in a call to IGraphBuilder::Render, the Filter Graph Manager will use the Intelligent Connect process to finish building the rest of the graph. An application can also manually disconnect any filter inserted into a graph and replace it with another filter.

See Also

Concepts

Graph Building with Intelligent Connect