This article describes the plug-in distributor architecture and provides some rules assumed by the default Microsoft® DirectShow™ control distributors.
Contents of this article:
Plug-in Distributors and Extensibility
The filter graph manager exports control interfaces; it also distributes the actions of interface methods to the appropriate filters. For example, the IMediaControl::Run method on the filter graph manager is called by an application to run the filter graph; this command is distributed to the IMediaFilter::Run method of each filter method by the filter graph manager. This distribution allows applications to have a single point of control to perform the basic operations.
To allow the filter graph manager to be extensible, a mechanism known as a plug-in distributor (PID) is used. This is a Component Object Model (COM) object that exposes a particular control interface and implements it by calling the enumerator of the filter graph manager, finding which filters expose the control interface and communicating directly with those filters. PIDs are supplied for the standard control interfaces; independent software vendors (ISVs) can replace these supplied PIDs and also add others.
When the filter graph manager is asked for an interface that it does not recognize, it searches the registry for a PID. This is an unnamed value under the following key.
HKEY_CLASSES_ROOT\Interface\<IID>\Distributor
This value provides the class identifier (CLSID) of an object that can distribute the interface identifier (IID). The filter graph manager then instantiates that object as an aggregated object, specifying the IUnknown implementation of the filter graph manager as the outer IUnknown, and asking for the IID. The object will then be able to use its outer IUnknown pointer to obtain an IFilterGraph interface. With this interface, it can enumerate the filters to implement its control interface methods and properties; it will also be able to use the IMediaControl implementation of the filter graph manager for correctly ordered and synchronized state changes (run, pause, stop, and so on).
Control Distributors
A control distributor is a PID that is used to control the data flow in the filter graph; for example, starting or stopping playback of a media stream. The standard control distributors supplied with DirectShow directly implement their distribution. These distributors make the following assumptions.
PIDs must keep track of the filters in the filter graph. This is done by implementing the IDistributorNotify interface on the distributor. IDistributorNotify has the same Run, Pause, and Stop methods as IMediaFilter, all of which are called before the calling the filter. It also has a IDistributorNotify::NotifyGraphChange method, which notifies the distributor when any filters are added or removed from the filter graph, or connections change.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.