Share via


CBaseStreamControl::SetFilterGraph

 
Microsoft DirectShow 9.0

CBaseStreamControl::SetFilterGraph

The SetFilterGraph method specifies the event sink for stream control events.

Syntax

  void SetFilterGraph(
    IMediaEventSink *pSink
);

Parameters

pSink

Pointer to the Filter Graph Manager's IMediaEventSink interface, or NULL when the filter leaves the filter graph.

Return Values

This method does not return a value.

Remarks

Call this method from inside the filter's IBaseFilter::JoinFilterGraph method. The CBaseStreamControl class uses the IMediaEventSink interface to send EC_STREAM_CONTROL_STARTED and EC_STREAM_CONTROL_STOPPED events.

If your filter derives from CBaseFilter, first call the CBaseFilter::JoinFilterGraph method, which sets the CBaseFilter::m_pSink member variable. Then pass m_pSink to the SetFilterGraph method. Note that m_pSink is NULL when the filter leaves the graph, which is correct.

Example Code

STDMETHODIMP CMyFilter::JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName)
{
    // Note: It's OK if pGraph is NULL.

    HRESULT hr = CBaseFilter::JoinFilterGraph(pGraph, pName);
    if (SUCCEEDED(hr)) 
    {
        m_pMyPin->SetFilterGraph(m_pSink);
    }
    return hr;
}

Requirements

**  Header:** Declared in Strmctl.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

See Also