CPullPin.Connect 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 Connect method completes a connection to the output pin.

Syntax

HRESULT Connect(
   IUnknown      *pUnk,
   IMemAllocator *pAlloc,
   BOOL          bSync
);

Parameters

pUnk

Pointer to the IUnknown interface of the output pin.

pAlloc

Pointer to the IMemAllocator interface of the input pin's preferred allocator, or NULL.

bSync

Boolean value that specifies whether to use synchronous reads. If TRUE, the pin performs synchronous read operations on the output pin. If FALSE, the pin makes asynchronous read requests.

Return value

Returns an HRESULT. Possible values include the following.

Return code Description
S_OK
Success.
VFW_E_ALREADY_CONNECTED
The input pin is already connected.
E_NOINTERFACE
The output pin does not expose IAsyncReader.

Remarks

Call this method during the input pin's connection process. If the method fails, the pin should fail the connection.

This method queries the output pin for the IAsyncReader interface. If successful, it calls CPullPin::DecideAllocator to negotiate the allocator for the connection. If your input pin has a preferred allocator, specify it in the pAlloc parameter; the DecideAllocator method passes this pointer to the output pin's IAsyncReader::RequestAllocator method. Otherwise, set pAlloc to NULL.

If the value of bSync is TRUE, the CPullPin object makes synchronous read requests, by calling the output pin's IAsyncReader::SyncReadAligned. Otherwise, it calls the IAsyncReader::Request method to make overlapping read requests.

Requirements

Requirement Value
Header
Pullpin.h
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CPullPin Class