Microsoft DirectX 8.0 |
This article introduces the basic terms and concepts needed to write a Microsoft® DirectShow® application. It also introduces some of the terminology used in DirectShow. After reading this section, you will be ready to write your first DirectShow application.
This article contains the following sections.
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.
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.
A typical DirectShow application performs three basic steps, as illustrated in the following diagram.
To get started with DirectShow, read How to Play a File. It presents a simple console application that plays a file. This application is the DirectShow equivalent of the classic "Hello World" program. Setting the Video Window and Responding to Events expand the program into a simple Windows application.