Retrieving Metadata Attributes
[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.]
To retrieve an attribute from a file header, you must know the stream number and index of the attribute. You can use the IWMHeaderInfo3::GetAttributeIndices method to get the indexes for all attributes with the same name or all indexes in the same language. Like the other methods of IWMHeaderInfo3, GetAttributeIndices deals with a single stream, or with all file-level attributes using stream 0. You can use 0xFFFF for the stream number to get global indexes matching your criteria throughout the entire file, regardless of stream number.
When you know the index of the attribute you want to retrieve, call IWMHeaderInfo3::GetAttributeByIndexEx to get the attribute. You need to make two calls to GetAttributeByIndexEx for each attribute retrieved. On the first call, pass NULL for the name and data buffer pointers to get the size needed. Then allocate buffers of the size indicated and make the second call to retrieve the name and data.
For example code showing how to retrieve metadata attributes, see To Retrieve All Metadata in a File.
Related topics