Microsoft DirectX 8.1 (C++)

Filter Graphs

The basic building block of DirectShow is a software component called a filter. A filter generally performs a single operation on a multimedia stream. For example, there are DirectShow filters that

Filters receive input and produce output. For example, if a filter decodes MPEG-1 video, the input is the MPEG-encoded stream and the output is an uncompressed RGB video stream.

To perform a given task, an application connects several filters so that the output from one filter becomes the input for another. A set of connected filters is called a filter graph. As an illustration of this concept, the following diagram shows a filter graph for playing an AVI file.

Filter Graph to play an AVI file

Your application does not have to manage the individual filters in a filter graph. Instead, DirectShow provides a high-level component called the Filter Graph Manager. The Filter Graph Manager controls the flow of data through the graph. Your application makes high-level API calls such as "Run" (to move data through the graph) or "Stop" (to stop the flow of data). If you require more direct control of stream operations, you can access the filters directly through COM interfaces. The Filter Graph Manager also passes event notifications to the application, so that your application can respond to events, such as the end of a stream.

In addition, the Filter Graph Manager simplifies the process of building a filter graph. For example, you can specify a file name, and the Filter Graph Manager will build a graph to play that file.