共用方式為


IPin::Connect

 
Microsoft DirectShow 9.0

IPin::Connect

The Connect method connects the pin to another pin.

Applications should not call this method. Use IGraphBuilder methods instead. This method is called by the Filter Graph Manager to connect pins.

Syntax

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

Parameters

pReceivePin

[in] Pointer to the receiving pin's IPin interface.

pmt

[in] Pointer to an AM_MEDIA_TYPE structure that specifies the media type for the connection. Can be NULL.

Return Value

Returns an HRESULT value. Possible values include the following.

Value Description
S_OK Success.
VFW_E_ALREADY_CONNECTED The pin is already connected.
VFW_E_NO_ACCEPTABLE_TYPES Cannot find an acceptable media type.
VFW_E_NO_TRANSPORT Pins cannot agree on a transport, or there is no allocator for the connection.
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 pmt parameter can be NULL. It can also specify a partial media type, with a value of GUID_NULL for the major type, subtype, or format.

This method verifies that the connection is possible. If the pin rejects the connection, the method fails. The connecting pin proposes media types by calling IPin::ReceiveConnection on the receiving pin.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also