DirectShow divides a complex multimedia task (e.g. video playback) into a sequence of fundamental processing steps known as
filters. Each filterwhich represents one stage in the processing of the datahas input and/or output
pins that may be used to connect the filter to other filters. The generic nature of this connection mechanism enables filters to be connected in various ways so as to implement different complex functions. To implement a specific complex task, a developer must first build a
filter graph by creating instances of the required filters, and then connecting the filters together. There are three main types of filters: ;Source filters: These provide the source streams of data. For example, reading raw bytes from any media file. ;Transform filters: These transform data that is provided from other filter's output. For example, doing a transform such as adding text on top of video or uncompressing an MPEG frame. ;Renderer filters: These render the data. For example, sending audio to the sound card, drawing video on the screen or writing data to a file. During the rendering process, the filter graph searches the
Windows Registry for registered filters and builds its graph of filters based on the locations provided. After this, it connects the filters together, and, at the developer's request, executes (i.e., plays, pauses, etc.) the created graph. DirectShow filter graphs are widely used in video playback (in which the filters implement functions such as file parsing, video and audio demultiplexing, decompressing and rendering) as well as for video and audio recording, editing, encoding, transcoding or network transmission of media. Interactive tasks such as DVD navigation may also be controlled by DirectShow. file, as rendered by the DirectShow sample in
GraphEdit, an application with a
GUI for DirectShow used to visually build and test filter graphs. In this picture the boxes represent filters and the grey dots appearing on the sides of the filters represent pins. In the above example, from left to right, the graph contains a
source filter to read an MP3 file,
stream splitter and decoder filters to parse and decode the audio, and a
rendering filter to play the raw audio samples. Each filter has one or more pins that can be used to connect that filter to other filters. Every pin functions either as an output or input source for data to flow from one filter to another. Depending on the filter, data is either "pulled" from an input pin or "pushed" to an output pin in order to transfer data between filters. Each pin can only connect to one other pin and they have to agree on what kind of data they are sending. Most filters are built using a set of C++ classes provided in the DirectShow SDK, called the DirectShow Base Classes. These handle much of the creation, registration and connection logic for the filter. For the filter graph to use filters automatically, they need to be registered in a separate DirectShow registry entry as well as being registered with COM. This registration can be managed by the DirectShow Base Classes. However, if the application adds the filters manually, they do not need to be registered at all. Unfortunately, it is difficult to modify a graph that is already running. It is usually easier to stop the graph and create a new graph from scratch. Starting with DirectShow 8.0, dynamic graph building, dynamic reconnection, and filter chains were introduced to help alter the graph while it was running. However, some filter vendors ignore this feature, making graph modification problematic after a graph has begun processing. Although DirectShow is capable of dynamically building a graph to render a given media type, in certain instances it is difficult for developers to rely on this functionality and they need to resort to manually building filter graphs if the resulting filter graph is variable. It is possible for filter graphs to change over time as new filters are installed on the computer. ==Features==