Rediger

Del via


CBasePin.ReceiveConnection 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 ReceiveConnection method accepts a connection from another pin. This method implements the IPin::ReceiveConnection method.

Syntax

HRESULT ReceiveConnection(
   IPin          *pConnector,
   AM_MEDIA_TYPE *pmt
);

Parameters

pConnector

Pointer to the connecting pin's IPin interface.

pmt

Pointer to an AM_MEDIA_TYPE structure that specifies the media type.

Return value

Returns an HRESULT value. Possible values include those in the following table.

Return code Description
S_OK
Success.
E_POINTER
NULL pointer argument.
VFW_E_ALREADY_CONNECTED
The pin is already connected.
VFW_E_NOT_STOPPED
The filter is active and the pin does not support dynamic reconnection.
VFW_E_TYPE_NOT_ACCEPTED
The specified media type is not acceptable.

Remarks

The output pin calls this method on the input pin. If the input pin returns an error code, the connection fails.

In the base class, this method performs the following steps:

  • Checks whether the pin is already connected.
  • Checks whether the filter is stopped.
  • Calls the CBasePin::CheckConnect method to test whether the connecting pin is suitable.
  • Calls the CBasePin::CheckMediaType method to test whether the media type is acceptable.

If all of these steps succeed, the method calls the CBasePin::CompleteConnect and SetMediaType methods to complete the connection. These methods store the media type and a pointer to the output pin.

If CheckConnect or CheckMediaType fail, the base class calls the CBasePin::BreakConnect method to break the connection and then returns an error code from ReceiveConnection.

Requirements

Requirement Value
Header
Amfilter.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBasePin Class