共用方式為


CBasePin::AttemptConnection

 
Microsoft DirectShow 9.0

CBasePin::AttemptConnection

The AttemptConnection method connects to another pin using a specified media type.

Syntax

  virtual HRESULT AttemptConnection(
    IPin *pReceivePin,
    const CMediaType *pmt
);

Parameters

pReceivePin

Pointer to the receiving pin's IPin interface.

pmt

Pointer to a CMediaType object that specifies the media type.

Return Value

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

Value Description
S_OK Success.
VFW_E_TYPE_NOT_ACCEPTED The media type is not acceptable.

Remarks

This method attempts to connect the two pins with a specific media type. If the type is not acceptable, the method fails without trying other media types.

If the media type is acceptable, this method calls the receiving pin's IPin::ReceiveConnection method. Then it calls the CBasePin::CompleteConnect method to complete the connection.

Requirements

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

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

See Also