IMemInputPin::Receive method (strmif.h)
[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 Receive
method receives the next media sample in the stream.
Syntax
HRESULT Receive(
[in] IMediaSample *pSample
);
Parameters
[in] pSample
Pointer to the sample's IMediaSample interface.
Return value
Returns an HRESULT value. Possible values include those shown in the following table.
Return code | Description |
---|---|
|
Success. |
|
The sample was rejected. |
|
NULL pointer argument. |
|
Invalid media type. |
|
A run-time error occurred. |
|
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.
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
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | strmif.h (include Dshow.h) |
Library | Strmiids.lib |