IMFMediaEventGenerator::BeginGetEvent Method

Begins an asynchronous request for the next event in the queue.

Syntax

public:
HRESULT BeginGetEvent(
         IMFAsyncCallback *pCallback,
         IUnknown *punkState
)  

Parameters

pCallback
Type: IMFAsyncCallback *

Pointer to the IMFAsyncCallback interface of a callback object. The client must implement this interface.

punkState
Type: IUnknown *

Pointer to the IUnknown interface of a state object, defined by the caller. This parameter can be NULL. You can use this object to hold state information. The object is returned to the caller when the callback is invoked.

Return value

Type: HRESULT 

The method returns an HRESULT. Possible values include, but are not limited to, those in the following table.

Return codes
Return code Description
S_OK The method succeeded.
E_INVALIDARG NULL pointer argument.
MF_E_MULTIPLE_BEGIN There is a pending request with the same callback pointer and a different state object.
MF_E_MULTIPLE_SUBSCRIBERS There is a pending request with a different callback pointer.
MF_E_SHUTDOWN The object was shut down.
MF_S_MULTIPLE_BEGIN There is a pending request with the same callback pointer and state object.

Refer to Media Foundation return codes.

Remarks

When a new event is available, the event generator calls the IMFAsyncCallback::Invoke method. The Invoke method should call IMFMediaEventGenerator::EndGetEvent to get a pointer to the IMFMediaEvent interface, and use that interface to examine the event.

Do not call BeginGetEvent a second time before calling EndGetEvent. While the first call is still pending, additional calls to the same object will fail. Also, the IMFMediaEventGenerator::GetEvent method fails if an asynchronous request is still pending.

Requirements

Header: Declared in mfobjects.h (include mfidl.h).

Library: Use mfuuid.lib.