The building block of DirectShow is a software component called a filter
.
A filter is a software component that performs some operation on a multimedia
Stream. For example, DirectShow filters can
Read files
Get video from a video capture device
Decode various stream formats, such
MPEG-1 video
Pass data to the graphics or sound card
DirectShow
The development module is called
Filter
,
Filter
Is a component that performs operations on Multimedia Streams.
DirectShow filters can read files, obtain videos from Video Capture Devices, decode data streams in various formats, and transmit data to the display or sound card.
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
Series of uncompressed video frames.
Filters
Receives input and generates output. For example, if
Filter
Decoding
MPEG-1
Video format, the input is
MPEG
The output is a series of video frames that are not compressed.
In DirectShow, an application performs any task by connecting
Chains of filters together, so that the output from one filter becomes
Input for another. A set of connected filters is called a filter graph
.
For example, the following dimo-shows a filter graph for playing an AVI
File.
In
DirectShow
In
Filters
To execute some tasks. Therefore
Filter
Is another input. Connected together
Filters
Is called
Filter graph.
The following picture shows a playback
Avi
File
Filter graph:
The file source filter reads the AVI file from the hard disk.
Avi splitter filter parses the file into two streams, a compressed video stream
And an audio stream. The AVI decompressor filter decodes the video frames.
Video Renderer Filter draws the frames to the display, using DirectDraw or GDI.
The default directsound device filter plays the audio stream, using
Directsound.
File Source Filter read from disk
Avi
File. Avi splitter Filter
Extract the compressed video and audio data streams from the file. Avi decompressor Filter
Decompress the video frame. Video Renderer Filter
Use
DirectDraw
Or
GDI
Draw a data frame to the display. Use default directsound device Filter
Directsound
Play audio streams.
The application does not have to manage all of this data flow.
Instead, the filters are controlled by a high-level component called the filter
Graph Manager. The application makes high-level API callsuch
"Run" (to move data through the graph) or "stop" (to stop
The flow of data). If you require more control over the stream operations, you
Can access the filters directly through COM interfaces. The filter graph
Manager also passes event notifications to the application.
Applications do not need to manage all data streams.
Filters
Called
Filter graph Manager
High-level component control. Application call Advanced
API, such
Run
And
Stop
. If you need more control flow operations, you can
Com
Interface direct access
Filters
.
Filter graph Manager also sends notification events to applications.
The filter graph manager serves another purpose as well: it
Provides methods for the application to build the filter graph, by connecting
The filters together. (DirectShow also provides varous helper objects that
Simplify this process. These are thoroughly described in the documentation .)
Filter graph manager has another purpose:
Filters
Connect to develop applications
Filter graph
Provides methods (DirectShow also provides some help objects to simplify these processes, which are thoroughly described in the document)
The application creates an instance of the filter graph manager.
The application uses the filter graph manager to build a filter
Graph. The exact set of filters in the graph will depend on the application.
The application uses the filter graph manager to control
Filter graph and stream data through the filters. Throughout this process,
Application will also respond to events from the filter graph manager.
Create an application
Filter graph Manager
.
Application Usage
Filter graph Manager
Generate
Filter graph
.
Graph
Accurate
Filters
The set will depend on the application.
The application passes through
Filter graph Manager
Control
Filter graph
And pass through
Filters
Data streams. In this process, the application will
Filter graph Manager
.
When processing is completed, the application releases the filter
Graph manager and all of the filters.
When the process is completed, the application is released
Filter graph Manager
And all
Filters
.
DirectShow is based on COM; the filter graph manager and
Filters are all COM objects. You shoshould have a general understanding of COM
Client programming before you begin programming DirectShow. keep books about
COM programming are available.
DirectShow is based on
Com
,
Filter graph Manager
And
Filters
All
Com
Object. Start
DirectShow
Before programming, you must
Com
About client programming. Many
Com
Programming books.
To get
Started with DirectShow, read the art
Icle how to play a file
,
Which presents a simple console application to play a video file.
Section about DirectShow
Explains
The DirectShow architecture in more detail, while the Section using DirectShow
Examines
The major scenarios that are supported by DirectShow, such as capture, video
Editing, DVD playback, and television.
Read
How to play a file
This article begins
Directshwo
This article demonstrates a simple console program to play video files.
About DirectShow
Detailed explanations
DirectShow
Architecture.
Using DirectShow
The Section provides
DirectShow
Main supported code, such as collection, video editing,
DVD
Playback, TV.