IWMHeaderInfo3::GetAttributeByIndexEx 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 GetAttributeByIndexEx method retrieves the value of an attribute specified by the attribute index. You can use this method in conjunction with the GetAttributeCountEx method to retrieve all of the attributes associated with a particular stream number.

Syntax

HRESULT GetAttributeByIndexEx(
  [in]      WORD              wStreamNum,
  [in]      WORD              wIndex,
  [out]     LPWSTR            pwszName,
  [in, out] WORD              *pwNameLen,
  [out]     WMT_ATTR_DATATYPE *pType,
  [out]     WORD              *pwLangIndex,
  [out]     BYTE              *pValue,
  [in, out] DWORD             *pdwDataLength
);

Parameters

[in] wStreamNum

WORD containing the stream number to which the attribute applies. Set to zero to retrieve a file-level attribute.

[in] wIndex

WORD containing the index of the attribute to be retrieved.

[out] pwszName

Pointer to a wide-character null-terminated string containing the attribute name. Pass NULL to retrieve the size of the string, which will be returned in pwNameLen.

[in, out] pwNameLen

Pointer to a WORD containing the size of pwszName, in wide characters. This size includes the terminating null character. Attribute names are limited to 1024 wide characters.

[out] pType

Type of data used for the attribute. For more information about the types of data supported, see WMT_ATTR_DATATYPE.

[out] pwLangIndex

Pointer to a WORD containing the language index of the language associated with the attribute. This is the index of the language in the language list for the file.

[out] pValue

Pointer to an array of bytes containing the attribute value. Pass NULL to retrieve the size of the attribute value, which will be returned in pdwDataLength.

[in, out] pdwDataLength

Pointer to a DWORD containing the length, in bytes, of the attribute value pointed to by pValue.

Return value

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

Return code Description
S_OK
The method succeeded.
NS_E_SDK_BUFFERTOOSMALL
The size specified for the name or value is too small.
NS_E_INVALID_REQUEST
wStreamNum is not a valid stream number, or there is no attribute at wIndex.
E_POINTER
A pointer is not valid.

Remarks

You can use 0xFFFF for the stream number to specify an attribute using its global index. Global index values range from 0 to one less than the count of attributes received from a call to IWMHeaderInfo3::GetAttributeCountEx where the stream number was set to 0xFFFF.

The objects of the Windows Media Format SDK perform type checking on some supported metadata attributes, but not all of them. You should ensure that any attributes you use are set using the data type specified in the Attributes section of this documentation. Likewise, you cannot assume that an attribute set by another application will use the correct data type.

Requirements

   
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

IWMHeaderInfo3 Interface