IAsyncReader::BeginFlush method (strmif.h)

[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 BeginFlush method begins a flush operation.

Syntax

HRESULT BeginFlush();

Return value

Returns S_OK if successful, or S_FALSE otherwise.

Remarks

This method interrupts all pending read requests. While the pin is flushing, the IAsyncReader::Request method fails and the IAsyncReader::WaitForNext method returns immediately, possibly with the return code VFW_E_TIMEOUT.

The downstream input pin should call this method whenever the downstream filter flushes the filter graph. After calling this method, call the WaitForNext method until it returns NULL in the ppSample parameter, to clear out the queue of pending samples. Ignore error codes, and release each sample. Then call the IAsyncReader::EndFlush method to end the flush operation.

For more information, see Flushing.

Examples

The following example shows how a downstream input pin should call this method:

C++
m_pReader->BeginFlush(); 
while (1) {
    IMediaSample *pSample;
    DWORD_PTR dwUnused;
    m_pReader->WaitForNext(0, &pSample, &dwUnused);
    if(pSample) { 
        pSample->Release();  
    } 
    else {  // No more samples.
        break;
    }
}
m_pReader->EndFlush();

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header strmif.h (include Dshow.h)
Library Strmiids.lib

See also

Error and Success Codes

IAsyncReader Interface