Important:
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
4/8/2010

The EC_REPAINTnotification is sent only when the renderer is either paused or stopped. This notification signals to the filter graph manager that the renderer needs data.

If the filter graph is stopped when it receives one of these notifications, it will pause the filter graph, wait for all filters to receive data (by calling GetState), and then stop it again. When stopped, a video renderer should hold on to the image so that subsequent WM_PAINT messages can be handled.

Therefore, if a video renderer receives a WM_PAINT message when stopped or paused, and it has nothing with which to paint its window, then it should send EC_REPAINTto the filter graph manager.

If an EC_REPAINTnotification is received while paused, then the filter graph manager calls IMediaPosition::put_CurrentPositionwith the current position (that is, seeks to the current position). This causes the source filters to flush the filter graph and causes new data to be sent through the filter graph.

A renderer must send only one of these notifications at a time. Therefore, once the renderer sends a notification, it should ensure no more are sent until some samples are delivered.

The conventional way to do this is to have a flag to signify that a repaint can be sent, which is turned off after an EC_REPAINTnotification is sent. This flag should be reset once data is delivered or when the input pin is flushed, but not if end-of-stream is signaled on the input pin.

If the renderer does not monitor its EC_REPAINTnotifications, it will flood the filter graph manager with EC_REPAINTrequests (which are relatively expensive to process).

For example, if a renderer has no image to draw, and another window is dragged across the window of the renderer in a full-drag operation, the renderer receives multiple WM_PAINT messages. Only the first of these should generate an EC_REPAINTevent notification from the renderer to the filter graph manager.

A renderer should send its input pin as the first parameter to the EC_REPAINTnotification. By doing this, the attached output pin will be queried for IMediaEventSink, and if supported, the EC_REPAINTnotification will be sent there first. This enables output pins to handle repaints before the filter graph must be touched. This will not be done if the filter graph is stopped, because no buffers would be available from the decommitted renderer allocator.

If the output pin cannot handle the request and the filter graph is running, then the EC_REPAINTnotification is ignored. An output pin must return NOERROR (S_OK) from IMediaEventSink::Notifyto signal that it processed the repaint request successfully. The output pin will be called on the filter graph manager worker thread, which avoids having the renderer call the output pin directly, and so sidesteps any deadlock issues.

If the filter graph is stopped or paused and the output does not handle the request, then the default processing is done.