共用方式為


IGraphConfig::Reconfigure

 
Microsoft DirectShow 9.0

IGraphConfig::Reconfigure

The Reconfigure method locks the filter graph and calls a callback function in the application or filter to perform a dynamic reconfiguration.

Syntax

  HRESULT Reconfigure(
  IGraphConfigCallback *pCallback,
  PVOID pvContext,
  DWORD dwFlags,
  HANDLE hAbortEvent
);

Parameters

pCallback

[in] Pointer to the IGraphConfigCallback callback interface on the application or filter.

pvContext

[in] Pointer to a variable of type PVOID that is passed to the callback routine.

dwFlags

[in] Application-defined flags that are passed to the callback routine.

hAbortEvent

[in] Handle to an event. If the caller is a filter calling on one of its data processing threads, this parameter should be a handle to an event that will be signaled when the filter is put into a stopped state. Otherwise, this parameter can be NULL. For more information, see Remarks.

Return Values

Returns S_OK if successful, or an error code otherwise. Possible errors include VFW_E_WRONG_STATE, if the method could not obtain a lock on the filter graph; whatever HRESULT was returned by the callback routine; or an error code indicating that the graph could not put the filters into a running state.

Remarks

This method is provided so that an application or filter can implement specialized dynamic graph building. In most cases, however, the IGraphConfig::Reconnect method is adequate, and should be preferred because it handles most of the implementation details.

Before calling this method, block any streams as needed and push the data through the graph (see IPinFlowControl::Block and IGraphConfig::PushThroughData). If the callback method succeeds, IGraphConfig::Reconfigure attempts to put all the filters into a running state. (The caller must then unblock the data flow.) Otherwise, it returns whatever error code the callback method returned.

If a filter calls this method on one of its own data processing threads, it creates the potential for a deadlock. The method obtains a lock on the filter graph, which can block the filter from stopping on receiving a call to IMediaFilter::Stop. To prevent this situation, the method takes a handle to an event object provided by filter. The filter should signal the event if it receives a call to its Stop method.

Requirements

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

Library: Use Strmiids.lib.

See Also