This topic has not yet been rated - Rate this topic

IMemInputPin::Receive method

Applies to: desktop apps only

The Receive method receives the next media sample in the stream.

Syntax

HRESULT Receive(
  [in]  IMediaSample *pSample
);

Parameters

pSample [in]

Pointer to the sample's IMediaSample interface.

Return value

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

Return codeDescription
S_OK

Success.

S_FALSE

The sample was rejected.

E_POINTER

NULL pointer argument.

VFW_E_INVALIDMEDIATYPE

Invalid media type.

VFW_E_RUNTIME_ERROR

A run-time error occurred.

VFW_E_WRONG_STATE

The pin is stopped.

 

Remarks

This method is synchronous and possibly blocking. The pin does one of the following:

  • Rejects the sample.
  • Returns immediately and processes the sample in a worker thread.
  • Processes the sample before returning.

In the last case, the method might block indefinitely. If this might happen, the IMemInputPin::ReceiveCanBlock method returns S_OK.

If the pin uses a worker thread to process the sample, it holds a reference count on the sample. In any case, the output pin cannot directly re-use this sample. It must call the IMemAllocator::GetBuffer method to obtain a new sample.

If this method returns S_FALSE or an error code, the upstream filter should stop sending samples until the graph stops or completes a flush operation. Typical reasons for an S_FALSE return value include:

  • The downstream pin is flushing; that is, it received a BeginFlush call and has not yet received an EndFlush call.
  • The downstream filter detected the end of the stream. (See End-of-Stream Notifications.)

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Strmif.h (include Dshow.h)

Library

Strmiids.lib

See also

Error and Success Codes
IMemInputPin Interface

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ