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(
  REFGUID           guidType,
  DWORD             dwCodecIndex,
  LPCWSTR           pszName,
  const BYTE        *pValue,
  DWORD             dwSize



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

Constant Description
WMMEDIATYPE_Video Specifies a video codec.
WMMEDIATYPE_Audio Specifies an audio codec.


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.


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

Constant Description
g_wszVBREnabled Use to enumerate the supported codec formats that use variable bit rate (VBR) encoding.The value returned in pValue is a BOOL.
g_wszNumPasses Use 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.


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


A pointer to a BYTE array containing the setting value.


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 code Description
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)
g_wszNumPasses 1 2 1 2

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],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


IWMCodecInfo3 Interface