Previous Next

Pin-Centric Processing

The AVStream minidriver writer provides filters that use one of two processing paradigms: pin-centric processing or filter-centric processing.

In a pin-centric filter, AVStream attempts processing when new data (or a new buffer) arrives into a previously empty queue.

A filter that uses pin-centric processing provides a processing dispatch in each KSPIN_DISPATCH table and omits the processing dispatch in the KSFILTER_DISPATCH table. Once you have supplied the descriptor structures and registered them by calling KsInitializeDriver, you can instantiate and use your filter.

When it sends a pin-centric dispatch, AVStream provides a pointer to the pin object that has available data. The minidriver’s processing dispatch can then acquire a pointer into the data stream with KsPinGetLeadingEdgeStreamPointer. Minidrivers should perform all data manipulation using the stream pointer API.

A pin-centric minidriver can force processing regardless of the existing queue contents by specifying the KSPIN_FLAG_INITIATE_PROCESSING_ON_EVERY_ARRIVAL flag in KSPIN_DESCRIPTOR_EX. If this flag is set, AVStream attempts processing every time a data frame or buffer arrives into the queue, .

If the minidriver exposes a pin that AVStream should never directly call to process, the vendor should specify KSPIN_FLAG_DO_NOT_INITIATE_PROCESSING on KSPIN_DESCRIPTOR_EX. In this case, the minidriver can call KsPinAttemptProcessing to initiate a pin process dispatch.

A processing attempt can fail if the minidriver is holding the processing mutex through KsPinAcquireProcessingMutex. Problems may also arise if the minidriver directly manipulates a gate by using the KsGate* calls.

In general, software filters use filter-centric processing and hardware filters use pin-centric processing. For instance, hardware that transforms or renders data could route data on a pin-centric filter. There are rare cases in which these roles may be reversed.

The Avshws sample in the DDK is a pin-centric capture driver for a simulated piece of hardware. This sample shows how to implement DMA through AVStream.