Partager via


CBasePin::ReceiveConnection

 
Microsoft DirectShow 9.0

CBasePin::ReceiveConnection

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.

Value 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

**  Header:** Declared in Amfilter.h; include Streams.h.

**  Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

See Also