Rediger

Del via


CBaseFilter.JoinFilterGraph method

[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 JoinFilterGraph method notifies the filter that it has joined or left a filter graph. This method implements the IBaseFilter::JoinFilterGraph method.

Syntax

HRESULT JoinFilterGraph(
       IFilterGraph *pGraph,
  [in] LPCWSTR      pName
);

Parameters

pGraph

Pointer to the filter graph manager's IFilterGraph interface, or NULL if the filter is leaving the graph.

pName [in]

Pointer to a Unicode string containing a name for the filter.

Return value

Returns S_OK.

Remarks

This method sets the CBaseFilter::m_pGraph member variable equal to the pGraph parameter. It also queries for an IMediaEventSink interface pointer and stores it in the CBaseFilter::m_pSink member variable. However, the filter does not keep a reference count on either of these interfaces. Doing so would create a circular reference count, because the filter graph manager keeps a reference count on the filter.

The method copies the string specified by pName into the CBaseFilter::m_pName member variable.

Requirements

Requirement Value
Header
Amfilter.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBaseFilter Class