共用方式為


CBasePin::Connect

 
Microsoft DirectShow 9.0

CBasePin::Connect

The Connect method connects the pin to another pin. This method implements the IPin::Connect method.

Syntax

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

Parameters

pReceivePin

Pointer to the receiving pin's IPin interface.

pmt

Pointer to an AM_MEDIA_TYPE structure that specifies the media type for the connection.

Return Value

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

Value Description
S_OK Success.
VFW_E_ALREADY_CONNECTED The pin is already connected.
VFW_E_NO_ACCEPTABLE_TYPES Could not find an acceptable media type.
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.

In the base class, this method tests whether the pin is already connected and whether the filter is stopped. It delegates the rest of the connection process to the CBasePin::AgreeMediaType method.

Requirements

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

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

See Also