IWMStreamConfig2::AddDataUnitExtension method

The AddDataUnitExtension method adds a data unit extension system to the stream. You can use data unit extension systems to attach custom data to samples in an output file.


HRESULT AddDataUnitExtension(
  GUID  guidExtensionSystemID,
  WORD  cbExtensionDataSize,
  BYTE  *pbExtensionSystemInfo,
  DWORD cbExtensionSystemInfo



A GUID that identifies the data unit extension system. This can be one of the predefined GUIDs listed in INSSBuffer3::SetProperty, or a GUID whose value is understood by a custom player application.


Size, in bytes, of the data unit extensions that will be attached to the packets in the stream. Set to 0xFFFF to specify data unit extensions of variable size. Each individual data unit extension can then be set to any size ranging from 0 to 65534.


Pointer to a byte buffer containing information about the data unit extension system. If you have no information, you can pass NULL. When passing NULL, cbExtensionSystemInfo must be zero.


Count of bytes in the buffer at pbExtensionSystemInfo. If you have no data unit extension system information, you can pass zero. When passing zero, pbExtensionSystemInfo must be NULL.

Return value

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

Return code Description
The method succeeded.
cbExtensionSystemInfo specifies a non-zero value, but pbExtensionSystemInfo is NULL.
The method cannot allocate memory to hold the new data unit extension.


Passing the GUID of an existing data unit extension system does not cause an error. The old system is destroyed and replaced by the new one.

The new value will not take effect in the profile until you call IWMProfile::ReconfigStream.


Minimum supported client Windows 2000 Professional [desktop apps only],Windows Media Format 9 Series 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)

See also

IWMStreamConfig2 Interface