Muokkaa

Jaa


CBaseRenderer.Receive 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 Receive method receives the next media sample in the stream.

Syntax

virtual 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:

  1. Schedules the sample for rendering (CBaseRenderer::PrepareReceive).
  2. Waits for the scheduled time (CBaseRenderer::WaitForRenderTime).
  3. Renders the sample (CBaseRenderer::Render).
  4. Releases the sample (CBaseRenderer::ClearPendingSample).

If the filter is paused, the method performs the following steps:

  1. Notifies the derived class that a sample is available (CBaseRenderer::OnReceiveFirstSample).
  2. Waits for the scheduled time.
  3. Renders the sample.
  4. 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

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

See also

CBaseRenderer Class