Microsoft DirectX 9.0

IStreamSample::Update

Performs a synchronous or an asynchronous update on the current sample.

Syntax

HRESULT Update(
  DWORD dwFlags,
  HANDLE hEvent,
  PAPCFUNC pfnAPC,
  DWORD_PTR dwAPCData
  );

Parameters

dwFlags

[in] Flag that specifies whether the update is synchronous or asynchronous. The SSUPDATE_ASYNC flag specifies an asynchronous update, which you can set if both hEvent and pfnAPC are NULL. Use SSUPDATE_CONTINUOUS to continuously update the sample until you call the IStreamSample::CompletionStatus method.

hEvent

[in] Handle to an event that this method will trigger when the update is complete.

pfnAPC

[in] Pointer to a Win32 asynchronous procedure call (APC) function that this method will call after it completes the sample update.

dwAPCData

[in] Value that this method passes to the function specified by the pfnAPC parameter.

Return Values

Returns one of the following values.

Return code Description
E_ABORT The update aborted.
E_INVALIDARG One of the parameters is invalid.
E_POINTER One of the parameters is invalid.
MS_E_BUSY This sample already has a pending update.
MS_S_ENDOFSTREAM Reached the end of the stream; the sample wasn't updated.
MS_S_PENDING The asynchronous update is pending.
S_OK Success.
VFW_E_NOT_COMMITTED Cannot allocate a sample because the allocator is not committed.

Remarks

This method can be used to perform a synchronous or asynchronous update of a sample. If both hEvent and pfnAPC are NULL then the update will be synchronous unless either of the SSUPDATE_ASYNC or SSUPDATE_CONTINUOUS flags is specified. When a synchronous update returns, the result of the function contains the I/O completion status.

You can't specify values for both hEvent and pfnAPC; the method will fail.

Asynchronous updates might complete before the update returns; in that case, the return value is S_OK. If you specify an event and the update returns S_OK, this method sets the event on return. If you specify an APC function and the update returns S_OK, the APC will not be queued and the function will not be called.

Asynchronous updates that don't complete prior to returning will return a value of MS_S_PENDING.

If an application creates multiple streams, it must perform an asynchronous update on each stream. Call WaitForMultipleObjects to wait for each stream update to complete, before making the next update. Otherwise, the application might block.

See Also