Partager via


IBaseFilter::JoinFilterGraph

 
Microsoft DirectShow 9.0

IBaseFilter::JoinFilterGraph

The JoinFilterGraph method notifies the filter that it has joined or left the filter graph.

Syntax

  HRESULT JoinFilterGraph(
  IFilterGraph *pGraph,
  LPCWSTR pName
);

Parameters

pGraph

[in] Pointer to the Filter Graph Manager's IFilterGraph interface, or NULL if the filter is leaving the graph.

pName

[in, string] Pointer to a wide-character string that specifies a name for the filter.

Return Values

Returns S_OK if successful, or an HRESULT value indicating the cause of the error.

Remarks

When the Filter Graph Manager adds a filter to the filter graph, it calls this method with a pointer to itself. It assigns a name for this instance of the filter through the pName parameter. The name can be retrieved by calling the IBaseFilter::QueryFilterInfo method.

When the Filter Graph Manager removes the filter from the graph, it calls this method with a NULL pointer.

Applications should never call this method. To add a filter to the graph, call the IFilterGraph::AddFilter method on the filter graph manager.

Filter developers: The filter can store the IFilterGraph interface pointer and query it for other Filter Graph Manager interfaces. However, it must never hold a reference count on the Filter Graph Manager. Doing so creates a circular reference count, because the Filter Graph Manager keeps a reference count on the filter. A circular reference count prevents the interface from being released properly, which can lead to a deadlock. The IFilterGraph interface is guaranteed to be valid until the Filter Graph Manager calls this method again with the value NULL. For an implementation of this method, see the CBaseFilter::JoinFilterGraph method.

Requirements

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

Library: Use Strmiids.lib.

See Also