CBaseStreamControl Class
A version of this page is also available for
4/8/2010
This class implements the IAMStreamControl interface on input and output pins in a filter graph.
This class provides control of the starting and stopping of various components of the stream.
Various streams can be turned on or off without affecting the rest of the graph. For example, an audio stream can be turned off while a video stream continues, for muting. Or perhaps a capture stream can be turned off while preview continues to flow. This could be used to assist in frame accuracy when exact capture start or stop times are important.
CBaseStreamControl enables you to specify start and stop times in the StartAt and StopAt member functions and provides stream information in the GetInfo member function.
CBaseStreamControl uses the StreamControlState enumerated data type to describe the various states a stream is in. If a stream is flowing it is indicated by the STREAM_FLOWING setting; otherwise, it is in a discarding state indicated by the STREAM_DISCARDING setting.
Filters that need to implement the interface on their own should typically inherit from CBaseStreamControl to obtain an implementation of the StartAt, StopAt, and GetInfo methods.
The CBaseStreamControl class also maintains state information and decides what to do with the sample.
To implement your own filter with pins that support CBaseStreamControl, do the following (but if you implement the IAMStreamControl interface without using CBaseStreamControl, the last two points do not apply):
Inform the filter object of all state changes through the NotifyFilterState member function.
Inform the filter object of all SetSyncSource calls to the filter.
Inform the filter object when in a flushing state, and when flushing is completed, in the CBaseStreamControl::Flushing member function.
Use the CheckStreamState function to make decisions about discarding or passing samples.
Make sure output pins set discontinuity flags on the first sample flowed after samples are discarded.
Tell your pin what the sink is when your filter joins a filter graph, as shown in the following example.
STDMETHODIMP CMyFilter::JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName) { HRESULT hr = CBaseFilter::JoinFilterGraph(pGraph, pName); if (hr == S_OK) m_pMyPin->SetFilterGraph(m_pSink); return hr; }
For sample code, see the video capture sample in the Samples\Multimedia\DShow\Src\Vidcap directory of the DirectX Media SDK.
Member Functions
Member function | Description |
---|---|
Constructs a CBaseStreamControl object. |
|
Retrieves a stream's current state. |
|
Notifies the pin when the filter is flushing. |
|
Retrieves information about the current streaming settings. |
|
Notifies the pin of what state your filter is in. |
|
Sets the event sink notification that your filter graph is using. |
|
Identifies the reference clock being used by the graph your filter is in. |
|
Informs the pin when to start sending streaming data. |
|
Informs the pin when to stop processing data and discard any new samples. |
Requirements
Windows Embedded CE | Windows CE 2.12 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |
Note | Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements For more information, see Setting Up the Build Environment |