Microsoft DirectX 8.1 (C++)

IAsyncReader::WaitForNext

The WaitForNext method waits for the next pending read request to complete.

Syntax

HRESULT WaitForNext(
  DWORD dwTimeout,
  IMediaSample **ppSample,
  DWORD_PTR *pdwUser
);

Parameters

dwTimeout

[in] Specifies a time-out in milliseconds. Use the value INFINITE to wait indefinitely

ppSample

[out] Address of a variable that receives an IMediaSample interface pointer.

pdwUser

[out] Pointer to a variable that receives the value of the dwUser parameter specified in the IAsyncReader::Request method.

Return Values

Returns an HRESULT value. Possible values include the following.

Return code Description
VFW_E_TIMEOUT The time-out expired, or the pin is flushing.
VFW_E_WRONG_STATE The pin is flushing.
E_FAIL A read error occurred.
S_OK Success.
S_FALSE Reached the end of the file; retrieved fewer bytes than requested.

Remarks

If the method succeeds, the ppSample parameter contains a pointer to a media sample, whose buffer holds the requested data. Call the IMediaSample::GetTime method and divide the results by 10,000,000 to determine the start and stop bytes. Samples may be returned out of order. Release the sample when you are finished processing the data.

The method fails if the pin is flushing. However, it may return an empty sample in ppSample. If *ppSample is non-NULL, release the sample and discard it. For more information, see IAsyncReader::BeginFlush.

If a read error occurs, the source filter sends an error event to the Filter Graph Manager; the caller does not have to signal an error.

See Also