共用方式為


CBaseFilter Class

 
Microsoft DirectShow 9.0

CBaseFilter Class

CBaseFilter Class Hierarchy

The CBaseFilter class is an abstract class for implementing filters. To implement a filter using this class, you must perform at least the following steps:

  • Derive a new class from CBaseFilter.
  • Include member variables that define the pins on the filter. The pins must inherit from the CBasePin class.
  • Override the pure virtual method CBaseFilter::GetPin, which retrieves pins on the filter.
  • Override the pure virtual method CBaseFilter::GetPinCount, which retrieves the number of pins.
  • Provide methods for generating, processing, or rendering media samples.

Several base classes derive from CBaseFilter, including CSource, CBaseRenderer, and CTransformFilter. It is usually easier to implement a filter with one of these specialized classes, rather than use CBaseFilter directly.

Requirements

Header: Declared in Amfilter.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Protected Member Variables  
m_State Current state of the filter.
m_pClock Pointer to the filter's reference clock.
m_tStart Reference time that corresponds to stream time 0.
m_clsid Class identifier (CLSID) of the filter.
m_pLock Pointer to a critical section that is used to serialize state changes.
m_pName Filter name.
m_pGraph Pointer to the filter graph manager.
m_pSink Pointer to the IMediaEventSink interface on the filter graph manager.
m_PinVersion Current version of the set of pins on this filter.
Public Methods  
CBaseFilter Constructor method.
~CBaseFilter Destructor method.
StreamTime Retrieves the current stream time. Virtual.
IsActive Determines whether the filter is currently active (running or paused).
IsStopped Determines whether the filter is currently stopped.
NotifyEvent Sends an event notification to the filter graph manager.
GetFilterGraph Retrieves a pointer to the filter graph manager.
ReconnectPin Breaks an existing pin connection and reconnects it to the same pin, using a specified media type.
GetPinVersion Retrieves a version number for the set of pins on this filter. Virtual.
IncrementPinVersion Increments the version number on the set of pins.
GetSetupData Retrieves the registration data for the filter. Virtual.
Pure Virtual Methods  
GetPinCount Retrieves the number of pins.
GetPin Retrieves a pin.
IPersist Methods  
GetClassID Retrieves the class identifier.
IMediaFilter Methods  
GetState Retrieves the filter's state (running, stopped, or paused).
SetSyncSource Sets a reference clock for the filter.
GetSyncSource Retrieves the reference clock that the filter is using.
Stop Stops the filter.
Pause Pauses the filter.
Run Runs the filter.
IBaseFilter Methods  
EnumPins Enumerates the pins on this filter.
FindPin Retrieves the pin with the specified identifier.
QueryFilterInfo Retrieves information about the filter.
JoinFilterGraph Notifies the filter that it has joined or left a filter graph.
QueryVendorInfo Retrieves a string containing vendor information.
IAMovieSetup Merthods  
Register Adds the filter to the registry.
Unregister Removes the filter from the registry.