KS Allocators

An Allocator is a KS object that instantiates data buffers called frames for I/O requests. A frame is a chunk of continuous memory, the size of which is vendor-specified through the AllocatorFraming member of KSPIN_DESCRIPTOR_EX.

Minidrivers can support allocators for multiple buffer types, for instance on-board RAM in a video card. However, most minidrivers use the default allocator to allocate system memory. Minidrivers can specify frame size, maximum number of frames, and alignment requirements. The default allocator takes care of meeting the requirements, and may optimize performance by reusing discarded frames.

A minidriver creates an allocator by calling the KsCreateAllocator routine or related functions. In this call, the minidriver passes a pointer to a KSALLOCATOR_FRAMING structure. This structure contains parameters describing the requested allocator.

In the stream class model, minidrivers that create allocators support the KSPROPERTY_CONNECTION_ALLOCATORFRAMING property. This is a read-only request that returns a pointer to the relevant KSALLOCATOR_FRAMING structure for the specified sink handle.

Minidrivers that provide allocators should also support the KSPROPERTY_STREAM_ALLOCATOR property. This property provides read/write access to the handle of the allocator currently assigned to the stream connection point.

Minidrivers running under AVStream may include pins that implement their own allocators. Do this by setting the KSALLOCATOR_DISPATCH member of the KSPIN_DISPATCH structure. Specify NULL for this member if you do not want to specify an allocator for this pin.

In addition, AVStream minidrivers use the KSALLOCATOR_FRAMING_EX structure to specify allocator requirements. Clients then use the KSPROPERTY_CONNECTION_ALLOCATORFRAMING_EX property to retrieve framing requirements for a pin. See AVStream Allocators for more information.

This section contains the following additional information:

Default Allocators

Filter Specific Allocators

Allocation Schemes