CBaseRenderer::Receive
Microsoft DirectShow 9.0 |
CBaseRenderer::Receive
The Receive method receives the next media sample in the stream.
Syntax
virtual HRESULT Receive( IMediaSample *pMediaSample );
Parameters
pMediaSample
Pointer to the sample's IMediaSample interface.
Return Value
Returns S_OK if successful, or an HRESULT value indicating the cause of the error.
Remarks
The input pin calls this method when it receives a sample from the upstream filter.
If the filter is running, this method performs the following steps:
- Schedules the sample for rendering (CBaseRenderer::PrepareReceive).
- Waits for the scheduled time (CBaseRenderer::WaitForRenderTime).
- Renders the sample (CBaseRenderer::Render).
- Releases the sample (CBaseRenderer::ClearPendingSample).
If the filter is paused, the method performs the following steps:
- Notifies the derived class that a sample is available (CBaseRenderer::OnReceiveFirstSample).
- Waits for the scheduled time.
- Renders the sample.
- Releases the sample.
While paused, the method waits in step 2 until the filter switches to a running state. At that point, the filter schedules the sample.
In the base class, the OnReceiveFirstSample method does nothing. The derived class can override it. For example, when a video renderer is paused, it displays the first sample as a still image.
Requirements
** Header:** Declared in Renbase.h; include Streams.h.
** Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
See Also