Direct Show Interfaces

Created by Jijith Nadumuri at 28 Apr 2010 12:22 and updated at 28 Apr 2010 12:57

DirectShow Interfaces

The DirectShow application programming interface is a media-streaming architecture for the Windows platform. Using DirectShow, your applications can perform high-quality video and audio playback or capture. It supports a wide variety of formats, including Advanced Systems Format (ASF), Motion Picture Experts Group (MPEG), Audio-Video Interleaved (AVI), MPEG Audio Layer-3 (MP3), and WAV sound files.

Internally, DirectShow uses DirectSound and DirectDraw. The older name of DirectShaw was Acitve Movie. Hence, many of the interfaces have the prefix AM in it. (Eg:- IAMFilterGraphCallback, IAMGraphBuilderCallback). The term ActiveMovie is no longer used.

The building block of DirectShow is a software component called a filter. In DirectShow, an application performs any task by connecting chains of filters together, so that the output from one filter becomes the input for another. A set of connected filters is called a filter graph. The filters and filter graphs are controlled by a high-level component called the Filter Graph Manager. The application makes high-level API calls such as "Run" (to move data through the graph) or "Stop" (to stop the flow of data) to the filter graph manager. The filter graph manager does the rest. It also provides methods for the application to build the filter graph, by connecting the filters together.

Interfaces for Building Filter Graphs

Creation method:- CoCreateInstance

IFilterGraph

The IFilterGraph represents the graph building capabilities of a Filter Graph Manager. It enables an application to build a filter graph. An application can use it to add filters to the graph, connect or disconnect filters, remove filters, and perform other basic operations. However, the IGraphBuilder interface inherits from this interface and provides additional methods that are more sophisticated. Therefore, applications should use IGraphBuilder rather than using IFilterGraph directly.

The following family of interfaces, each represents the graph building capabilities of a Filter Graph Manager.

IUnknown => IFilterGraph => IGraphBulider => IFilterGraph2

IGraphBuilder

The IGraphBuilder interface represents the the graph building capabilities of a Filter Graph Manager. IGraphBuilder adds further methods that construct graphs from partial information. For example, the IGraphBuilder::RenderFile method builds a graph for file playback, given the name of the file. Using these methods, an application does not need to specify every filter and pin connection in the graph. This is called intelligent connect. It is based on some filter search and connect algorithm.

IFilterGraph2

The IFilterGraph2 interface represents the the graph building capabilities of a Filter Graph Manager. IFilterGraph2 adds two more methods to improve the filter graph manager.

ICaptureGraphBuilder2

The ICaptureGraphBuilder2 interface represents an FGM (Filter Graph Manager) for audio/video capturing. This interfaces doesn’t require any Video Mixing Renderer (VMR) or Video Port Manager (VPR) filters, since it will not render any video, but only capture a video being rendered.

IDVDGraphBuilder

The IDVDGraphBuilder interface represents an FGM (Filter Graph Manager) for DVD playback. It builds a filter graph for DVD-Video playback from the available software and hardware on the system.

A DVD filter graph requires either a hardware or software MPEG-2 decoder, which DirectShow does not provide. You must install a DirectShow-compatible third-party decoder on your computer before attempting to build the DVD filter graph.

Helper Interfaces that helps building the filter graph

ICreateDevEnum This interface enumerate system devices, that belongs to various device categories, such as video capture devices, audio capture devices, video compressors etc.
IGraphConfig This interface enables applications and filters to reconfigure the filter graph while the graph is in a running state, and without losing data from the stream.
IGraphVersion This interface provide a way for plug-in distributors and applications to know when the graph has changed.
IEnumFilters This interfae enuerates the filters in the graph (To create an instance of this interface call IFilterGraph::EnumFilters method).
IFilterMapper2 Filters use this interface to register and unregister themselves. When the filter graph manager builds a filter graph, it uses this interface to look up filters and determine their characteristics. Applications can also use this interface to search for filters in the registry.
IAMFilterGraphCallback Provides a callback mechanism during graph building. This interface is used to receive callback notifications if a pin cannot be rendered.
IAMGraphBuilderCallback Provides a callback mechanism during graph building. This interface is used to receive callback notifications when FGM selects a candidate filter defenition and is about to create it or when it creates a filter and is about to connect it.

Share:- Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License