Rediger

Del via


CBaseStreamControl class

[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.]

cbasestreamcontrol class hierarchy

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.

Public 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 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.

Remarks

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:

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

Requirement Value
Header
Strmctl.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)