CBaseStreamControl.SetFilterGraph 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 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 value
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.
Examples
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
Requirement | Value |
---|---|
Header |
|
Library |
|