CSource Class

This class and its corresponding class, CSourceStream, simplify the construction of source filters that produce continuous streams of data comparable to the way the CTransformFilter class assists in the creation of transform filters.

The CSource class provides a wrapper for the CBaseFilter class that performs the pin management and works with the CSourceStream class to provide the pins.

To use the CSource class to build a filter:

Derive your filter-level class from the CSource class. Provide a CreateInstance member function in it to create a new object of the class.

Provide a means of adding objects that are derived from the CSourceStream class to support the output pins during construction of the class. You can either create them yourself during construction or provide the developer with a means of creating them later.

For an example of using the CSource class, see the Ball sample in the Samples\Multimedia\DShow\Src\Ball subdirectory of the DirectX Media Software Development Kit (SDK).

This class does not help build an asynchronous file reader source filter, which requires support of an IAsyncReader interface and a downstream parser filter that supports the CPullPin class.

Protected Data Members

Member Description
m_cStateLock Locks this data member to serialize access to the filter state.
m_iPins Number of pins on this filter; updated by the CSource::AddPin and CSource::RemovePin member functions.
m_paStreams Array of streams associated with this filter.

Member Functions

Member function Description
AddPin Adds a pin to the source filter.
CSource Constructs a CSource object.
FindPinNumber Retrieves the number of the pin through the IPin parameter.
GetPin Returns a pointer to a specified pin.
GetPinCount Gets the number of pins contained by the filter.
pStateLock Returns a pointer to the filter-critical section.
RemovePin Removes a pin from the source filter.

Implemented IBaseFilter Methods

Method Description
FindPin Retrieves a pointer to the pin with the specified identifier.

Requirements

DirectShow applications and DirectShow filters have different include file and link library requirements. See Setting Up the Build Environment for more information.

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header:

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.