Configuring Codec DMOs
This topic describes the process of configuring the codec DMOs. Each codec has specific procedures, but the information common to all is described here.
Every DMO supports specific input and output types. You can retrieve supported types for inputs and outputs by calling IMediaObject::GetInputType for inputs and IMediaObject::GetOutputType for outputs. You can enumerate the supported formats by making repeated calls to either method, incrementing the type index with each call. When the index exceeds that of the final supported type, the call returns DMO_E_NO_MORE_ITEMS.
For the video codecs, only one output type or input type is enumerated for a given media subtype. For the audio codecs, each individual supported type is enumerated. For more information about supported types for individual codecs, see Working with Audio and Working with Video.
After you configure the media types for the input and output streams, set them by calling IMediaObject::SetInputType and IMediaObject::SetOutputType respectively. Both of these methods return DMO_E_TYPE_NOT_ACCEPTED if the specified type is invalid.
All of the Windows Media Audio and Video codecs support a variety of encoding features. These features are generally configured by setting properties on the DMO by using the methods of the IPropertyBag interface. Some properties are configured using specialized codec interfaces. These interfaces are listed for each codec in the section Codec Objects.
The general order of operations for configuring an encoding DMO is as follows:
- Configure codec features as desired by using the methods of IPropertyBag.
- Use the codec DMO interfaces to configure additional features, if needed.
- Configure the input and output types. The order in which the types should be configured varies for individual codecs. For more information, see Working with Audio and Working with Video.
Decoding is simpler than encoding, as fewer decoder features are supported.
The general order of operations for configuring a decoding DMO is as follows:
- Configure decoder features as desired by using the methods of IPropertyBag.
- Set the input type to the type used for the encoder output.
- Configure the output type. The supported output types are different for different inputs.