IWMWriterSink::AllocateDataUnit method (wmsdkidl.h)
[The feature associated with this page, Windows Media Format 11 SDK, is a legacy feature. It has been superseded by Source Reader and Sink Writer. Source Reader and Sink Writer have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Source Reader and Sink Writer instead of Windows Media Format 11 SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The AllocateDataUnit method is called by the writer object when it needs a buffer to deliver a data unit. Your implementation of this method returns a buffer of at least the size passed in. You can manage buffers internally in any way that you like. The simplest method is to create a new buffer object for each call, but doing so is quite inefficient. Instead, most sinks maintain several buffers that are reused.
Syntax
HRESULT AllocateDataUnit(
[in] DWORD cbDataUnit,
[out] INSSBuffer **ppDataUnit
);
Parameters
[in] cbDataUnit
Size of the data unit that the writer needs to deliver, in bytes. The buffer you assign to ppDataUnit must be this size or bigger.
[out] ppDataUnit
On return, set to a pointer to the INSSBuffer interface of a buffer object.
Return value
This method is implemented by the application. It should always return S_OK.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only],Windows Media Format 7 SDK, or later versions of the SDK |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | wmsdkidl.h (include Wmsdk.h) |
Library | Wmvcore.lib; WMStubDRM.lib (if you use DRM) |