Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

A pin must expose methods so that the filter graph manager can connect the pin with a pin on another filter.

Pins also expose methods so that connected pins can negotiate what media type they will pass between them, and which pin will provide the shared memory allocator for transporting the media sample.

Additionally, the output pin is responsible for passing each media sample to its connected input pin; the input pin is responsible for receiving it.

Finally, pins must support interfaces so that quality-control messages and position information can be passed through the stream from pin to pin.

The following illustration shows the pin classes. All pin classes are derived from CBasePin, a base class derived from CUnknown.

CBasePinimplements the IPininterface. The IPininterface specifies methods for connecting to other pins, negotiating the media type to be used with the connected pin, querying internal connections on the pin, and informing the pin of stream activity.

In addition to implementing the IPinmethods, CBasePinalso implements IQualityControlmethods so that quality-control messages can be passed through the filter graph from one pin to the next.

Quality-control messages allow a filter, such as a renderer, to request another filter to adjust its sample rate.

Typically, quality-control messages travel upstream from renderer to source filter. However, in cases such as a video capture filter, the source filter (for example, a VCR reader) can send quality-control messages downstream to the renderer filter to adjust its rate.

The CBasePinclass provides several virtual member functions that can be overridden to provide handling of the connection, media type negotiation, and disconnection processes.

The following base classes derive from CBasePinto provide default handling for many of these tasks:

CBaseOutputPinis the base class for the CTransformOutputPinand CSourceStreamclasses. Likewise, CBaseInputPinis the base class for the CTransformInputPinclass.

The basic model that the CBaseInputPinand CBaseOutputPinclasses use clarifies these derived pin classes.

In the connection and transport model used by two pins, the input pin supports the IMemInputPininterface so it can receive a media sample. The CBaseInputPinclass implements the IMemInputPininterface.

Also, one of the two pins must supply a shared memory allocator object, which is an object that contains the IMemAllocatorinterface that generates media sample objects passed between pins.

An IMemInputPinmethod, implemented by the CBaseInputPinclass, supplies this allocator object, implemented by the CMemAllocatorclass. The connected output pin also has the option of supplying its own allocator; if this is the case, it notifies the input pin (through another IMemInputPinmethod) of the final decision of which allocator is used.

The CBaseOutputPinclass provides extra member functions to set the size and count of samples in the allocator, retrieve a media sample from the allocator, deliver that media sample to the connected input pin, and deliver end-of-stream and end-flush messages downstream. It also implements many of the IPinmethods.

CPullPinis a class that is used on the input pin of a parser filter. It is derived from the CAMThreadclass as is shown in the following illustration.

A parser filterpulls information from the disk, using the asynchronous file reader filter, or from the Internet, using the URL moniker filter. CPullPinworks with the IAsyncReaderinterface, which is implemented on the source reader filter upstream.

CPullPinstarts the thread, pulls data from the upstream filter, and then pushes the data downstream. CPullPincan call its own IMemInputPin::Receivemethod after pulling the sample from the source. It can also perform the equivalent routines elsewhere.