Encoder Implementation and Support

In Windows XP Service Pack 1, Microsoft defined three kernel streaming property sets and one enumeration in ksmedia.h to support video-only encoder devices. Each property set contains a single property. In other words, each property receives its own property set. If your driver makes get-property or Set-property calls, then specify the property set's GUID (as defined in ksmedia.h) in the Set member of the KSPROPERTY structure and zero in the Id member when you set up the call:

Property Set Description
ENCAPIPARAM_BITRATE

Implement this property set to specify the encoding bit rates supported by the encoder device. See Encoder Code Examples for more details.

ENCAPIPARAM_BITRATE_MODE

Implement this property set to specify the encoding modes supported by the device. This property set uses the VIDEOENCODER_BITRATE_MODE enumeration to specify the supported modes. See Encoder Code Examples for more details.

ENCAPIPARAM_PEAK_BITRATE

Implement this property set to specify the maximum encoding bit rate of the device.

Clients access these properties by deriving the IVideoEncoder COM interface from the IEncoderAPI COM interface (described in the Windows Software Development Kit (SDK) documentation).

A minidriver must specify default values for each of the ENCAPIPARAM_Xxx properties. The topic Encoder Code Examples demonstrates how to specify default property values. During the development and debugging of an encoder filter, the current property page can be triggered from a minidriver supporting the ENCAPIPARAM_BITRATE property set.

In DirectX 9.0, six additional property sets and one event set were defined in ksmedia.h to provide better support for a wider variety of encoders, including audio-only encoders. As with ENCAPIPARAM_Xxx properties, each property receives its own property set:

Property Set Description
CODECAPI_VIDEO_ENCODER

If your device supports encoding video streams (including auxiliary audio such as TV audio) then implement support for this property set.

CODECAPI_AUDIO_ENCODER

If your device is an audio-only encoder, then implement support for this property set instead of CODECAPI_VIDEO_ENCODER.

CODECAPI_SETALLDEFAULTS

Implement this property set to reset all the encoder device's internal settings, such as encoding bit rate and encoding mode to their default values.

CODECAPI_ALLSETTINGS

Implement this property set to communicate the current settings of the encoder device. This property set is used for communication to and from clients.

CODECAPI_SUPPORTSEVENTS

If your device supports events from user mode--such as to change the encoding mode, bit rate, or other settings--then implement this property set. If you implement this property set, then you must also implement support for the CODECAPI_CHANGELISTS event.

CODECAPI_CURRENTCHANGELIST

Implement this property set to determine which encoder parameters were changed in a previous call to set one or more encoder properties.

Event Set Description

CODECAPI_CHANGELISTS

If the device supports responding to user-mode events through the CODECAPI_SUPPORTSEVENTS property set, then implement this event set to return a list of encoder settings that have changed as the result of a client's prior Set-property call to either CODECAPI_SETALLDEFAULTS or CODECAPI_ALLSETTINGS.

Clients access these properties through the ICodecAPI COM interface (described in the Windows SDK documentation). See Encoder Installation and Registration for more information about the COM interfaces, including how to specify which interface KsProxy should expose.

A minidriver should implement support for basic get-property queries. The topic Encoder Code Examples demonstrates how to support get-property queries.

When developing an encoder filter, move encoding functionality into a separate filter from a video capture filter. Define your own private mediums so that graph builders can properly connect encoder and capture filters. If your hardware is capable of bus mastering non-encoded content, then you may also expose public mediums. If you implement both public and private mediums, then list the private mediums first because it reduces graph building time; to find the correct filter when building a filter graph.

For more information about using mediums and multiple instances of a filter (in separate filter graphs) see Mediums and Categories.