CBasePin.GetConnected method
[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.]
The GetConnected
method retrieves the pin connected to this pin.
Syntax
IPin* GetConnected();
Parameters
This method has no parameters.
Return value
Returns a pointer to the other pin's IPin interface.
Remarks
If the pin is not connected, this method returns NULL. Call the CBasePin::IsConnected method to determine whether the pin is connected.
The method does not call AddRef on the IPin interface, so the caller should not release the interface.
Examples
Because the reference count is not incremented on the returned pointer, you can chain method calls together:
if (m_MyPin->IsConnected())
{
m_MyPin->GetConnected()->EndOfStream();
}
This coding pattern is very convenient; but as the example shows, you must be careful not to dereference a NULL pointer when the pin is unconnected.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|