When writing an AVStream minidriver, you provide filters that use one of two processing paradigms: pin-centric processing or filter-centric processing.
Pin-centric processing means that AVStream calls the minidriver's pin process dispatch routine when new frames arrive in the pin queue.
Filter-centric processing means that AVStream calls the minidriver's filter process dispatch routine when there are data frames available on each instantiated pin. Note that these definitions specify default behavior; minidrivers can modify the default behavior by setting flags in the KSPIN_DESCRIPTOR_EX structure.
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.
To supply a pin-centric filter, the minidriver provides a pointer to an AVStrMiniPinProcess callback routine in each KSPIN_DISPATCH structure; do not supply a processing dispatch in the KSFILTER_DISPATCH structure.
If the minidriver does not modify flag settings in the KSPIN_DESCRIPTOR_EX structure, AVStream calls the vendor-supplied AVStrMiniPinProcess callback routine in three situations:
The pin transitions into the minimum processing state. Frames must already exist in the queue, and the pin must transition from less than the minimum processing state into at least the minimum processing state.
New frames arrive. The pin must be in at least the minimum processing state and there must be no frames at or ahead of the leading edge.
Minidriver explicitly calls KsPinAttemptProcessing.
By default, pause is the minimum processing state.
In addition, AVStream does not call the pin process dispatch if the pin's AND gate is closed. If you use the KSGATEXxx routines to add additional off inputs to the pin's AND gate, for instance, your process dispatch will not be called.
When AVStream calls AVStrMiniPinProcess, it provides a pointer to the pin object that has available data. The minidriver's processing dispatch can then acquire a leading edge pointer by calling KsPinGetLeadingEdgeStreamPointer. Minidrivers then manipulate stream data using the stream pointer API.
Minidrivers that use pin-centric processing can modify when AVStream calls the AVStrMiniPinProcess dispatch by setting flags in the relevant KSPIN_DESCRIPTOR_EX structure. Flag descriptions on the KSPIN_DESCRIPTOR_EX reference page are particularly relevant to vendors who are implementing pin-centric filters.
Processing attempts may 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.
The AVStream Simulated Hardware Sample Driver (AVSHwS) in the MSDN Code Gallery is a pin-centric capture driver for a simulated piece of hardware. The Avshws sample shows how to implement DMA through AVStream.