Building WDM Streaming Drivers
It is nearly impossible to write directly to the WDM Streaming interface. Large areas are not documented and Microsoft strongly recommends against this. Most uses of WDM Streaming use a class driver - minidriver model to split out common code.
The mini-driver (device-specific component) is loaded by Windows and immediately calls the class driver. The class driver (supplied by Microsoft) creates the device objects and manages all the formal interfaces, calling specific interfaces in the mini-driver via a function table as necessary to access the device. Unlike the ndis/scsi models, however, the mini-driver is free to call WDM services as necessary rather than being restricted to services offered by the class driver.
There are three choices of class driver:
- The port class driver is designed for WDM Audio. Components are represented by COM interfaces. Normally a device-specific miniport object is combined with a system-supplied port object to make a combined filter. This model makes support for a range of audio devices very straightforward, including support for their volume and mixer properties. However, it cannot really be used for non-audio types.
- The stream class driver (stream.sys) is used by video capture devices, though it can also be used to develop audio devices (including combined video and audio capture devices). The minidriver registers callbacks with the class driver, and read, write and property requests are sent to these callbacks in the form of Stream Request Blocks (SRBs). The stream class driver supports only one filter type per driver binary (although it has support for loading child drivers). It does not support dynamic changes to the set of pins or formats, and provides very little help in some areas while being overprescriptive in other areas. The original implementation in Windows 98 Gold also had some serious limitations: for example, you could not connect two stream class filters directly together.
- AVStream is a new, unified class driver under development at Microsoft. A basic version was released as part of DirectX 8 and the full implementation is likely to be in Windows XP. This is a flexible, object-oriented class library providing the "same services as stream.sys with less code". It appears to be a much better model, creating small, simple and flexible minidrivers based on dispatch tables and typically written in C++. Consider AVStream for any new project in preference to stream.sys, but it is unlikely to be worth the effort of re-writing existing drivers.
|
|
Device Driver Topics
Windows NT Device Drivers
WDM - The Windows Driver Model
WDM Streaming
Related Topics
Microsoft's WDM Streaming white paper
Video Capture overview
|