Microsoft DirectX 9.0


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


void SetFilterGraph(
    IMediaEventSink *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.


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)) 
    return hr;

See Also