IWMHeaderInfo2::GetCodecInfo 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 GetCodecInfo method retrieves information about a codec that is used to create the content of a file.

Syntax

HRESULT GetCodecInfo(
  [in]      DWORD               wIndex,
  [in, out] WORD                *pcchName,
  [out]     WCHAR               *pwszName,
  [in, out] WORD                *pcchDescription,
  [out]     WCHAR               *pwszDescription,
  [out]     WMT_CODEC_INFO_TYPE *pCodecType,
  [in, out] WORD                *pcbCodecInfo,
  [out]     BYTE                *pbCodecInfo
);

Parameters

[in] wIndex

DWORD that contains the zero-based codec index.

[in, out] pcchName

On input, pointer to the length of pwszName in wide characters. On output, pointer to a count of the characters that are used in pwszName.This includes the terminating null character.

[out] pwszName

Pointer to a wide-character null-terminated string buffer into which the name of the codec is copied.

[in, out] pcchDescription

On input, pointer to the length of pwszDescription in wide characters. On output, pointer to a count of the characters that are used in pwszDescription. This includes the terminating null character.

[out] pwszDescription

Pointer to a wide-character null-terminated string buffer into which the description of the codec is copied.

[out] pCodecType

Pointer to one member of the WMT_CODEC_INFO_TYPE enumeration type.

[in, out] pcbCodecInfo

On input, pointer to the length of pbCodecInfo, in bytes. On output, pointer to a count of the bytes used in pbCodecInfo.

[out] pbCodecInfo

Pointer to a byte array.

Return value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Remarks

You should make two calls to GetCodecInfo. On the first call, pass NULL for pwszName, pwszDescription, and pbCodecInfo. On return the values pointed to by pcchName and pcchDescription are set to the number of characters. These include the terminating null character, which is required to hold the name string in pcchName and the description string in pcchDescription. The value pointed to by pcbCodecInfo is set to the buffer size required to hold the codec information. With these sizes, you can allocate the required amount of memory to receive each value. Pass pointers to the buffers are pwszName, pwszDescription, and pbCodecInfo on the second call.

Use this method, and the GetCodecInfoCount method, to enumerate through the codec information.

Requirements

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

IWMHeaderInfo2 Interface

IWMHeaderInfo2::GetCodecInfoCount

IWMHeaderInfo3

WMT_CODEC_INFO_TYPE