IAsyncReader::BeginFlush method (strmif.h)

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

   
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