IMFSourceReader::Flush Method

Flushes one or more streams.

Syntax

public:
HRESULT Flush(
         DWORD dwStreamIndex
)  

Parameters

dwStreamIndex
Type: DWORD 

[in] The stream to flush. The value can be any of the following.

Return value

Type: HRESULT 

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Refer to Media Foundation return codes.

Remarks

The Flush method discards all queued samples and cancels all pending sample requests.

This method can complete either synchronously or asynchronously. If you provide a callback pointer when you create the source reader, the method is asynchronous. Otherwise, the method is synchronous. For more information about the setting the callback pointer, see MF_SOURCE_READER_ASYNC_CALLBACK.

In synchronous mode, the method blocks until the operation is complete.

In asynchronous mode, the application’s IMFSourceReaderCallback::OnFlush method is called when the flush operation completes. While a flush operation is pending, the IMFSourceReader::ReadSample method returns MF_E_NOTACCEPTING.

Note

In Windows 7, there was a bug in the implementation of this method, which causes OnFlush to be called before the flush operation completes. A hotfix is available that fixes this bug. For more information, see http://support.microsoft.com/kb/979567.

This interface is available on Windows Vista if Platform Update Supplement for Windows Vista is installed.

Requirements

Header: Declared in mfreadwrite.h.