[DirectShow] 004-about DirectShow Filters

Source: Internet
Author: User

DirectShow uses a modular architecture, where each stage of processing is done by a COM object called a filter. directShow provides a set of standard filters for applications to use, and developers can write their own custom filters that extend the functionality of DirectShow. to define strate, here are the steps needed to play an AVI video file, along with the filters that perform each step:

Read the raw data from the file as a byte stream (File Source Filter ).
Examine the AVI headers, and parse the byte stream into separate video frames and audio samples (AVI splitter filter ).
Decode the Video Frames (various decoder filters, depending on the compression format ).
Draw the Video Frames (Video Renderer Filter ).
Send the audio samples to the Sound Card (default directsound device filter ).
DirectShow uses the module system. Each stage of processing is completed by a COM object called filter. DirectShow provides a set of standard filters for applications. developers can also use the extended DirectShow function to write custom filters. The steps required to play a video file are as follows:
Reads data streams from files in the form of binary streams. (File Source Filter ).
Detects the AVI file header and separates Video Frames and audio samples from binary data streams. (AVI splitter filter ).
Video frame decoding (multiple decoding filters dependent on compression formats)
Video Renderer Filter ).
Sends audio samples to the sound card.

As the dimo-shows, each filter is connected to one or more other filters. the connection points are also COM objects, called pins. filters use pins to move data from one filter the next. the arrows in the distrishow show the direction in which the data travels. in DirectShow, a set of filters is called a filter graph.
As shown in the figure, each filter is connected to one or more other filters. The connection point is also a COM object called pins. Filters uses pins to move data from a filter to the next filter. The direction of the arrow in the figure is the direction of data flow. In DirectShow, a set of filters is called filter graph.

Filters have three possible states: running, stopped, and paused. when a filter is running, it processes media data. when it is stopped, it stops processing data. the paused state is used to cue data before running; the section data flow in the filter graph describes this concept in more detail. with very rare exceptions, state changes are coordinated throughout the entire filter graph; all the filters in the graph switch states in unison. thus, the entire filter graph is also said to be running, stopped, or paused.
Filters has three statuses: Run, stop, and pause. When the filter is running, it processes media data. When the filter is stopped, it stops processing data. The pause state is used to sending a prompt before running. This concept is described in detail in the data flow in the filter graph section. With very rare exceptions, state changes are coordinated throughout the entire filter graph; all filters in graph are consistent.

Filters can be grouped into several broad categories:
A source filter introduces data into the graph. The data might come from a file, a network, a camera, or anywhere else. Each source filter handles a different type of data source.
A transform filter takes an input stream, processes the data, and creates an output stream. encoders and decoders are examples of transform filters.
Renderer filters sit at the end of the chain. they receive data and present it to the user. for example, a video Renderer draws video frames on the display; an audio Renderer sends audio data to the sound card; and a file-writer filter writes data to a file.
A splitter filter splits an input stream into two or more outputs, typically parsing the input stream along the way. For example, the AVI splitter parses a byte stream into separate video and audio streams.
A mux filter takes multiple inputs and combines them into a single stream. for example, the avi mux performs the inverse operation of the AVI splitter. it takes audio and video streams and produces an AVI-formatted byte stream.
Filters can be divided into several types:
Source Filter inputs data to graph. Data can come from a file, network, camera, or other. Each source filter processes different types of data sources.
Transform filter generates an input stream, processes data, and creates an output stream. The encoder and decoder are an example of transform filter.
Renderer filters is at the end of the link. They receive and present data to users. For example, the video Renderer draws a video frame on the display, the audio Renderer sends audio data to the sound card, and the file-writer filter writes the data to the file.
Splitter filter separates the input stream into two or more output streams. For example, Avi splitter splits binary data streams into video streams and audio streams.
MUX filters generate multiple inputs and merge them into a single data stream. For example, Avi MUX executes the anti-operation of AVI splitter. It generates video and audio streams and binary streams in AVI format.
All DirectShow filters expose the ibasefilter interface, and all pins expose the ipin interface. DirectShow also defines define other interfaces that support more specific ality.
All DirectShow filters expose the ibasefilter interface, and all pins expose the ipin interface. DirectShow also defines many other interfaces to support more specific functions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.