CBaseStreamControl Class
Microsoft DirectShow 9.0 |
CBaseStreamControl Class
This class implements the IAMStreamControl interface for input and output pins. It provides control over starting and stopping an individual pin on the filter. A pin that supports IAMStreamControl should inherit from this base class. The following is a typical declaration for an input pin:
class CMyInputPin : public CBaseInputPin, public CBaseStreamControl
Be sure to override NonDelegatingQueryInteface to expose IAMStreamControl. For more information, see How to Implement IUnknown.
This class requires the pin and the owning filter to notify the class when various events occur, such as the filter joining the graph or receiving a new reference clock. You should call the following class methods:
- In the filter's IMediaFilter::SetSyncSource method, call the CBaseStreamControl::SetSyncSource method. This method notifies the class of the current reference clock.
- In the filter's CBaseFilter::JoinFilterGraph method, call the CBaseStreamControl::SetFilterGraph method. This method gives the class a pointer to the Filter Graph Manager, so that the class can send the right stream-control events.
- Whenever the filter changes state (to running, paused, or stopped), call the CBaseStreamControl::NotifyFilterState method.
- In the pin's IPin::BeginFlush and IPin::EndFlush methods, call the CBaseStreamControl::Flushing method.
The CBaseStreamControl class uses the filter graph's reference clock to determine which samples the filter should be deliver, and which it should discard. In your pin's IMemInputPin::Receive method, call the CBaseStreamControl::CheckStreamState method with a pointer to the incoming media sample. If the method returns the value STREAM_FLOWING, deliver the sample downstream. Otherwise, discard it.
Requirements
** Header:** Declared in Strmctl.h; include Streams.h.
** Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
Public Methods
Methods | Description |
CBaseStreamControl | Constructor method. |
~CBaseStreamControl | Destructor method. |
CheckStreamState | Determines whether a media sample should be delivered or discarded. |
Flushing | Notifies the base class that the pin has started or stopped flushing. |
NotifyFilterState | Notifies the pin when the filter's state changes. |
SetFilterGraph | Specifies the event sink for stream control events. |
SetSyncSource | Notifies the base class of the current reference clock. |
IAMStreamControl Methods
Method | Description |
GetInfo | Retrieves information about the current stream-control settings, including the start and stop times. |
StartAt | Informs the pin when to start delivering data. |
StopAt | Informs the pin when to stop delivering data. |