Compartilhar via


IAsyncReader::BeginFlush

 
Microsoft DirectShow 9.0

IAsyncReader::BeginFlush

The BeginFlush method begins a flush operation.

Syntax

  HRESULT BeginFlush(void);

Parameters

This method takes no parameters.

Return Values

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.

Example Code

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

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

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also