Rediger

Del via


Filter Graph Manager

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The Filter Graph Manager builds and controls filter graphs. This object is the central component in DirectShow. Applications use it to build and control filter graphs. The Filter Graph Manager also handles synchronization, event notification, and other aspects of the controlling the filter graph. Create this object by calling CoCreateInstance.

CLSID

There are two CLSIDs for creating the Filter Graph Manager:

CLSID Description
CLSID_FilterGraph Creates the Filter Graph Manager on a shared worker thread.
CLSID_FilterGraphNoThread Creates the Filter Graph Manager on the application thread.

 

Generally, applications should use CLSID_FilterGraph. Both CLSIDs create the same object, but they use different threading models:

  • CLSID_FilterGraph creates the Filter Graph Manager on a worker thread, which is shared by all CLSID_FilterGraph instances within the same process. The thread dispatches messages sent by filters, and controls the lifetime of any windows created by filters.
  • CLSID_FilterGraphNoThread creates the Filter Graph Manager on the application's thread. If you use this CLSID, the thread that calls CoCreateInstance must have a message loop that dispatches messages; otherwise, deadlocks can occur. Also, before the application thread exits, it must release the Filter Graph Manager and all graph objects (such as filters, pins, reference clocks, and so forth).

Interfaces

The Filter Graph Manager exposes the following interfaces:

DirectShow Objects