CBasePin Class (Windows Embedded CE 6.0)
1/6/2010
This is an abstract base class from which all pins are derived.
CBasePin supports the IPin interface. If your pin does not supply or use the IMemInputPin interface, derive from this; otherwise, derive from the CBaseInputPin class or the CBaseOutputPin class.
The connection process is crucial to the success of creating filter graphs. The filter graph finds two filters (and subsequently two pins) to connect.
It calls the IPin::Connect method on the output pin (and it can call Connect on the input pin at the same time). The output pin then calls the virtual pin member function CBasePin::CheckConnect.
Derived classes should override this member function to use QueryInterface to return any interfaces required.
The base class implementation of CheckConnect queries the IMemInputPin interface to establish the default transport protocol.
After calling CheckConnect, the output pin calls CBasePin::AgreeMediaType; this is a worker member function not intended for overriding in derived classes. This gets the input pin's enumerator and calls CBasePin::TryMediaTypes with it.
TryMediaTypes is another base pin worker member function that is not intended for derivation. It cycles through each media type provided by an enumerator to determine if a connection can be made with that type.
If that process fails, AgreeMediaType retrieves the output pin's media type enumerator and calls CBasePin::GetMediaType, which cycles through the media types to agree on a connection type. If there is agreement, a media type with the input and output pins becomes the type used in the connection.
If no media type can be agreed on, the connection between the pins cannot be made. The base pin calls CBasePin::SetMediaType to broadcast the format. The m_mt base pin variable is set during this process.
The IPin interface provides a method called QueryAccept. This method allows a connected filter to query whether the pin will accept a specified media type.
The method is asynchronous so that a filter can call it at any time — even when another filter is calling it. For this reason, its implementation in any override of the base class should not lock the filter.
The base class implementation of IPin::QueryAccept calls the overridden CBasePin::CheckMediaType member function on the derived pin class.
All member functions in this class that return HRESULT and accept a pointer as a parameter return E_POINTER when passed a null pointer.
Protected Data Members
Member | Description |
---|---|
m_bRunTimeError |
Run-time error generated. |
m_Connected |
Pin that this pin is connected to. |
m_dir |
Direction of this pin. |
m_dRate |
Rate from the CBasePin::NewSegment call. |
m_mt |
Media type that this pin is using. This is established during the connection process. |
m_pFilter |
Filter that created the pin. |
m_pLock |
Object used for locking. |
m_pQSink |
Target for quality messages. |
m_pName |
Name of the pin. |
m_tStart |
Start time from the CBasePin::NewSegment call. |
m_tStop |
Stop time from the CBasePin::NewSegment call. |
m_TypeVersion |
Current media type version (see CBasePin::GetMediaTypeVersion). |
Member Functions
Member function | Description |
---|---|
Attempts to make a connection to another pin using a specified media type. |
|
Constructs a CBasePin object. |
|
Returns the segment rate set by the CBasePin::NewSegment member function. |
|
Returns the segment start time set by the CBasePin::NewSegment member function. |
|
Returns the segment stop time set by the CBasePin::NewSegment member function. |
|
Displays pin information on the debugging monitor. |
|
Displays media type information on the debugging monitor. |
|
Returns the pin that is connected to this pin. |
|
Adds 1 to the current media type version. |
|
Determines whether the pin is connected. |
|
Determines whether the filter owning this pin is in the State_Stopped state. |
|
Returns the m_pName name of the pin. |
Overrideable Member Functions
Member function | Description |
---|---|
Switches the pin to the active (running) mode. |
|
Agrees on the media type to be used by the pin. |
|
Adds custom code when the connection quits. This is also called when a stage in the connection process fails, so this member function should also clean up partial connection states. |
|
Adds custom code when the connection is being made. This is called at the start of the connection process. |
|
Checks if the pin can support a specific media type. |
|
Completes the connection. |
|
Returns the media type used by the pin. |
|
Returns the version of the pins that were created dynamically. |
|
Switches the pin to the inactive (stopped) mode. |
|
Sets the m_mt data member to the established media type. |
|
Tries to find an acceptable media type for a connection from the list returned by a media type enumerator. |
Implemented IPin Methods
Method | Description |
---|---|
Initiates a connection to another pin. |
|
Returns a pointer to the connecting pin. |
|
Returns the media type of this pin's connection. |
|
Breaks a connection. |
|
Informs the input pin that no additional data is expected until a new run command is issued. (By default, returns S_FALSE.) |
|
Returns an enumerator for this pin's preferred media types. |
|
Specifies that samples following this call are grouped as a segment with a given start time, stop time, and rate. |
|
Determines whether this pin accepts the media type. |
|
Retrieves the pin direction of the pin. |
|
Retrieves an identifier for the pin. |
|
Returns an array of the pins that this pin connects to internally. |
|
Retrieves information about the pin (name, owning filter, or direction). |
|
Called by a connecting pin to make a connection to this pin. Usually this does not need to be overridden, because the default implementation calls CBasePin::CheckConnect, CBasePin::CheckMediaType, and CBasePin::BreakConnect. |
|
Notifies the pin that the filter has changed state from paused to running. |
Implemented IQualityControl Methods
Method | Description |
---|---|
Notifies the recipient that a quality change is requested. |
|
Sets the IQualityControl object that will receive quality messages. |
Implemented INonDelegatingUnknown Methods
Method | Description |
---|---|
Increments the owning filter's reference count. |
|
Retrieves CBasePin interfaces. To pass out pointers to interfaces added by the derived pin class, override this member function. |
|
Decrements the owning filter's reference count. |
Requirements
Windows Embedded CE | Windows CE 2.12 and later |
Note | Microsoft DirectShow applications and DirectShow filters have different include file and Library requirements For more information, see Setting Up the Build Environment |