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

Filter Graph Manager and Filter Graphs


To use the filter graph manager from an application, it is not necessary to know much about the underlying filter graphs. However, it is useful to understand at least the basic principles of filter graphs if you ever want to configure your own filter graph rather than letting the filter graph manager configure them for you.

A filter graph is composed of a collection of filters of different types. Most filters can be categorized into one of the following three types.

In addition to these three types, there are other kinds of filters, for example, effect filters, which add effects without changing the data type, and parser filters, which understand the format of the source data and know how to read the correct bytes, create times stamps, and perform seeks.

For example, a filter graph whose purpose is to play back an MPEG-compressed video from a file would use the following filters.

The following illustration shows such a filter graph.

MPEG filter graph example

It is possible for some filters to represent a combination of types. For example, a filter might be an audio renderer that also acts as a transform filter by passing through the video data. But typically, filters fit only one of these three types.

Filter graphs stream multimedia data through filters. In the media stream, one filter passes the media downstream to the next filter. An upstream filter describes the filter that passes data to the filter; a downstream filter describes the next filter in line for the data. This distinction is important because media flows downstream, but other information can go upstream.

To make a filter graph work, filters must be connected in the proper order, and the data stream must be started and stopped in the proper order. The filter graph manager connects filters and controls the media stream. It also has the ability to search for a configuration of filters that will render a particular media type and build that filter graph. Filter graphs can also be preconfigured, in which case the filter graph manager does not need to search for a configuration.

When searching for a rendering configuration, the filter graph manager uses the filter mapper, which first reads the registry and determines the types of filters available. The filter graph manager then attempts to link filters that accept that data type until it reaches a rendering filter. A merit value is registered with each filter and, of the filters that might be capable of handling the data, the filters with the highest merit are tried first.

Controlling the media stream means starting, pausing, or stopping the media stream. It can also mean playing for a particular duration or seeking to a particular point in the stream. The filter graph manager allows the application or ActiveX Control to specify these activities, and then calls the appropriate methods on the filters to invoke them. It also allows filters to post events that the application can retrieve. Therefore an application can, for example, retrieve status about some special filter it has installed.

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

*Top of Page