IMFByteStream::BeginWrite method (mfobjects.h)

Begins an asynchronous write operation to the stream.

Syntax

HRESULT BeginWrite(
  [in] const BYTE       *pb,
  [in] ULONG            cb,
  [in] IMFAsyncCallback *pCallback,
  [in] IUnknown         *punkState
);

Parameters

[in] pb

Pointer to a buffer containing the data to write.

[in] cb

Size of the buffer in bytes.

[in] pCallback

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

[in] punkState

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

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

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.

Implementation notes:This method should update the current position in the stream by adding the number of bytes that will be written to the stream, which is specified by the value returned in the pcbWritten, to the current position. Other methods that can update the current position are Read, BeginRead, Write, Seek, and SetCurrentPosition.

This interface is available on the following platforms if the Windows Media Format 11 SDK redistributable components are installed:

  • Windows XP with Service Pack 2 (SP2) and later.
  • Windows XP Media Center Edition 2005 with KB900325 (Windows XP Media Center Edition 2005) and KB925766 (October 2006 Update Rollup for Windows XP Media Center Edition) installed.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header mfobjects.h (include Mfidl.h)
Library Mfuuid.lib

See also

IMFByteStream