To Enumerate Codec Formats
A codec format is a stream configuration object populated with data from a codec. Each codec format contains a media configuration supported by the codec. Most audio codecs support a finite number of formats, each of which is enumerated by the codec and can be accessed using the methods of IWMCodecInfo. Video codecs, on the other hand, provide only a single format. This is because video streams have variables, like frame size, that are more flexible than the settings of an audio stream. With a video stream, you must fill in some of the stream configuration values; audio stream configurations should only be edited to assign a name, connection name, and stream number. For more information, see Configuration Common to All Streams.
The codec formats enumerated depend upon the current codec enumeration settings, which are set using IWMCodecInfo3::SetCodecEnumerationSetting. Currently, only two codec properties are supported: g_wszNumPasses, which specifies the number of encoding passes that the codec will perform, and g_wszVBREnabled, which specifies whether the codec will use variable bit rate encoding. The maximum number of encoding passes supported by any of the codecs is two, so there are four distinct configurations for which you can retrieve codecs, as shown in the following table.
|Constant bit rate (CBR) stream||2-pass CBR stream||Quality-based variable bit rate (VBR) stream||Bit-rate-based VBR stream (constrained or unconstrained)|
To enumerate the formats supported for a codec, use IWMCodecInfo::GetCodecFormatCount to find the number of supported codecs. Then call IWMCodecInfo::GetCodecFormat for each format. The format indexes range from zero, to one less than the total number of supported formats. You can retrieve a description of the format by calling IWMCodecInfo2::GetCodecFormatDesc. When using GetCodecFormatDesc, you do not need to use GetCodecFormat, because the stream configuration object is retrieved by both methods. Video codec formats do not include a description. Each video codec has only one format that is used for all streams of that type.
When you retrieve a codec format, you get the IWMStreamConfig interface of a stream configuration object containing the format settings.