CBasePin.AttemptConnection method

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

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.

Return code 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

Requirement Value
Header
Amfilter.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBasePin Class