This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for

This section describes how source filters generate media samples.

Push Model

In the push model, the source filter initiates the process, as follows:

  • The source filter calls IMemAllocator::GetBufferto retrieve an empty media sample.

  • The source filter fills the media sample with data. How this occurs depends entirely on the nature of the source.

  • The source filter calls IMemInputPin::Receiveon the downstream input pin, passing it a pointer to the sample's IMediaSampleinterface.

  • The downstream filter can either process the sample before returning from Receive, or else hold the sample and process it afterward. If the downstream filter holds the sample, it calls IUnknown::AddRefon the sample.

  • The source filter calls IUnknown::Releaseon the sample.

At this point, the downstream filter might hold a reference count on the sample, so the source filter cannot simply re-use the sample. To deliver the next sample, it must call IMemAlloctor::GetBufferagain, as described in step 1.

To deliver multiple samples, in step 3 the source filter could call IMemInputPin::ReceiveMultipleinstead.

Pull Model

In the pull model, the parser filter requests data from the source filter. The parser filter uses the IAsyncReaderinterface on the source filter's output pin, as follows:

  1. The parser filter calls IMemAllocator::GetBufferto retrieve an empty media sample.

  2. It calls IAsyncReader::Requestto request data from the source filter.

  3. While the source filter is retrieving the data, the parser calls IAsyncReader::WaitForNext. This method waits until the request from step 2 is completed.

  4. The parser filter processes the data (possibly by calling IMemInputPin::Receiveon its own input pin) and delivers it downstream.

Steps 2 and 3 perform an asynchronous read operation. The parser can request a synchronous read operation instead, using the IAsyncReader::SyncReador IAsyncReader::SyncReadAlignedmethod.