共用方式為


IGraphConfig Interface

 
Microsoft DirectShow 9.0

IGraphConfig Interface

The Filter Graph Manager exposes IGraphConfig to support dynamic graph building. 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.

The most straightforward way to rebuild the graph dynamically is to call the IGraphConfig::Reconnect method. This method handles most of the details of dynamically rebuilding the graph. If a situation ever arises where you want to implement your own technique, IGraphConfig also provides the IGraphConfig::Reconfigure method. This method obtains a lock on the filter graph and then calls a callback function in your application, which reconfigures the graph. With this method, most of the work is shifted to your application. For more information, see Dynamic Graph Building.

To optimize the process of adding and removing filters, the filter graph maintains a cache of filters. During a call to the Reconnect method, you can specify that any filters removed from the graph get added to the cache. You can also add a filter to the cache directly, if you know it is likely to be needed, by calling IGraphConfig::AddFilterToCache. The IGraphBuilder::Render, IGraphBuilder::RenderFile, and IGraphBuilder::Connect methods automatically try to use filters in the cache before using other filters. Also, in the Reconnect method you can specify that only cached filters will be used for the reconnection. Note that filters held in the cache are not actually part of the graph. They are disconnected from any pins and are kept in a stopped state.

In addition to the methods inherited from IUnknown, the IGraphConfig interface exposes the following methods.

Method Description
Reconnect Performs a dynamic reconnection between two pins.
Reconfigure Locks the filter graph and calls a callback function in the application or filter to perform a dynamic reconfiguration.
AddFilterToCache Adds a filter to the filter cache.
RemoveFilterFromCache Removes a filter from the filter cache.
EnumCacheFilter Enumerates the filters in the filter cache.
GetStartTime Retrieves the reference time used when the filter graph was last put into a running state.
PushThroughData Pushes data through the filter graph to the specified pin.
SetFilterFlags Sets a filter's configuration information.
GetFilterFlags Retrieves a filter's configuration information.
RemoveFilterEx Removes a filter from the filter graph.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.