IMFByteStream::BeginWrite Method

Begins an asynchronous write operation to the stream.

Syntax

public:
HRESULT BeginWrite(
         const BYTE *pb,
         ULONG cb,
         IMFAsyncCallback *pCallback,
         IUnknown *punkState
)  

Parameters

pb
Type: BYTE *

[in] Pointer to a buffer containing the data to write.

cb
Type: ULONG 

Size of the buffer in bytes.

pCallback
Type: IMFAsyncCallback *

Pointer to the IMFAsyncCallback interface of a callback object. The caller 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 

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Refer to Media Foundation return codes.

Remarks

When all of the data has been written to the stream, the callback object’s IMFAsyncCallback::Invoke method is called. At that point, the application should call IMFByteStream::EndWrite to complete the asynchronous request.

Do not reallocate, free, or write to the buffer while an asynchronous write is still pending.

Requirements

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

Library: Use Mfuuid.lib.