Share via


CBasePin::Connect (Compact 2013)

3/26/2014

Initiates a connection from this pin to the other pin.

Syntax

HRESULT Connect(
  IPin* pReceivePin,
  const AM_MEDIA_TYPE* pmt
);

Parameters

  • pReceivePin
    Input pin to connect to.
  • pmt
    Optional media type parameter.

Return Value

Returns one of the following arguments by default; if overridden, should return standard HRESULT values.

Value

Description

VFW_E_ALREADY_CONNECTED

This output pin is already connected to another pin.

VFW_E_NOT_STOPPED

The filter graph is not in a stopped state and connection cannot be performed.

Other error value

Returned from CBasePin::AgreeMediaType or CBasePin::CheckConnect or overridden versions of these member functions.

Remarks

This member function implements the IPin::Connect method.

IPin::Connect is implemented on the output pin and calls the IPin::ReceiveConnection method for the connected input pin (implemented in the base classes as CBasePin::ReceiveConnection).

This member function calls the virtual CBasePin::CheckConnect member function, which can be overridden to verify that the connection is possible. CBasePin::CheckConnect then calls CBasePin::AgreeMediaType to negotiate a common media type with the connected pin.

CBasePin::AgreeMediaType calls CBasePin::TryMediaTypes twice, once for this pin's media type enumerator and once for the receiving pin's media type enumerator.

For each media type found, CBasePin::AttemptConnection is called, which in turn calls the receiving pin's IPin::ReceiveConnection method, and finally CBasePin::CompleteConnect if successful.

Requirements

Header

dshow.h,
Streams.h

Library

ole32.lib,
Ole32auth.lib,
Strmbase.lib,
Strmiids.lib,
uuid.lib

See Also

Reference

CBasePin Class