This section describes the steps required to initialize an AVStream minidriver.
An AVStream minidriver that does not handle device initialization on its own calls KsInitializeDriver from the minidriver's DriverEntry routine. A driver that handles device initialization on its own will not call this function. KsInitializeDriver initializes the driver object of an AVStream driver. This function also initializes IRP dispatching, PNP add device messages, and unloading.
In calling KsInitializeDriver, the minidriver passes a pointer to the driver object to initialize a pointer to the registry path, and, optionally, a device descriptor. Note that passing the KSDEVICE_DESCRIPTOR object is not required. If the minidriver does pass a device descriptor, AVStream creates a device with the specified characteristics at AddDevice time.
The device descriptor object contains a pointer to a KSDEVICE_DISPATCH structure. The device descriptor object contains a pointer to an array of filter descriptors. Provide a KSFILTER_DESCRIPTOR for each filter type that your minidriver supports. When the minidriver calls KsInitializeDriver, AVStream creates a filter factory object for each type of filter exposed by the minidriver. Individual filters are then instantiated by the filter factory upon receipt of a create IRP for the associated create item. Each filter descriptor contains a pointer to an array of KSPIN_DESCRIPTOR_EX objects. AVStream creates a pin factory on the relevant filter for each type of pin the minidriver exposes through that filter.
When a connection is made to a given pin type on a filter, it is the AVStream pin factory that instantiates a pin object. Note that each filter must expose at least one pin. The minidriver uses the InstancesNecessary member of KSPIN_DESCRIPTOR_EX to specify a count of the number of instances of this pin type that are necessary for proper functioning of the filter. Similarly, the minidriver can impose a maximum on the number of pins that the pin factory can instantiate by using the InstancesPossible member of this structure.
When laying out the descriptors, a minidriver writer must decide what type of processing each filter type will perform. AVStream provides two distinct types of processing: Filter-Centric Processing, and Pin-Centric Processing.
To install an AVStream minidriver, follow the guidelines in Creating an INF File. Also see the INF files corresponding to AVStream sample drivers in the DDK.