IWMCodecInfo3::SetCodecEnumerationSetting method

The SetCodecEnumerationSetting method sets the value of one codec enumeration setting. Codec enumeration settings dictate the codec formats that can be enumerated by the methods of IWMCodecInfo.


HRESULT SetCodecEnumerationSetting(
  [in]       REFGUID           guidType,
  [in]       DWORD             dwCodecIndex,
  [in]       LPCWSTR           pszName,
  [in]       WMT_ATTR_DATATYPE Type,
  [inconst BYTE              *pValue,
  [in]       DWORD             dwSize


guidType [in]

GUID identifying the major type of digital media. This must be one of the following constants.

Constant Description
WMMEDIATYPE_VideoSpecifies a video codec.
WMMEDIATYPE_AudioSpecifies an audio codec.


dwCodecIndex [in]

DWORD containing the codec index ranging from zero to one less than the number of supported codecs of the type specified by guidType. To retrieve the number of individual codecs supporting a major type, use the IWMCodecInfo::GetCodecInfoCount method.

pszName [in]

Pointer to a wide-character null-terminated string containing the name of the enumeration setting. Use one of the following constants.

Constant Description
g_wszVBREnabledUse to enumerate the supported codec formats that use variable bit rate (VBR) encoding.

The value returned in pValue is a BOOL.

g_wszNumPassesUse to enumerate the supported codec formats that use a number of passes equal to the value in pValue.

The value returned in pValue is a DWORD specifying the number of passes.


Type [in]

A WMT_ATTR_DATATYPE value specifying the data type of the value in pValue.

pValue [in]

A pointer to a BYTE array containing the setting value.

dwSize [in]

DWORD containing the size of the pValue BYTE array.

Return value

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

Return codeDescription

The method succeeded; the feature is supported by the codec.


The enumeration setting specified is not valid for the codec.



The Windows Media Audio and Video 9 Series codecs can potentially enumerate four different sets of codec formats, as listed in the following table.

Constant bit rate (CBR) stream Two-pass CBR stream Quality-based variable bit rate (VBR) stream Bit-rate-based VBR stream (constrained or unconstrained)


Not all codecs support all formats.

If you make a call to this method and get the NS_E_UNSUPPORTED_PROPERTY error code, then the codec does not support that feature. For example, if an attempt to set g_wszNumPasses returns NS_E_UNSUPPORTED_PROPERTY, the codec does not support multiple encoding passes.

The return value of a call made to this method does not guarantee support of a codec feature. For example, the Windows Media Audio 9 Lossless codec does not return NS_E_UNSUPPORTED_PROPERTY for calls that set the number of passes, even though the codec does not support two-pass encoding.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]


Windows Media Format 9 Series SDK, or later versions of the SDK


Wmsdkidl.h (include Wmsdk.h)


WMStubDRM.lib (if you use DRM)

See also

IWMCodecInfo3 Interface