Microsoft Windows CE 3.0  

IMemAllocator Interface

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The IMemAllocatorinterface allocates IMediaSampleblocks to be used for data transfer between pins. The blocks can be provided by the input pin, output pin, or a third party. Release the IMediaSampleobject by calling the IUnknown::Releasemethod.

When to Implement

Implement this interface if you are providing a buffer for media samples. This is typically done by filters that originate, copy, or provide a destination for the media stream. For example, a source filter provides an allocator corresponding to the incoming media, and a renderer filter provides an allocator corresponding to the hardware memory (DirectX, for example). Intermediate transform filters can create their own allocator if copying samples and not writing directly to the renderer's allocator. Use the CBaseAllocatorclass to implement the IMemAllocatorinterface.

When to Use

Filters use this interface when retrieving or sending media samples. The allocator used might actually belong to a filter further upstream or downstream than the next filter, because many filters choose to pass the allocators through and simply modify the data in place.

Methods in Vtable Order

IUnknown methods Description
QueryInterface Returns pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IMemAllocator methods Description
SetProperties Specifies a desired number of blocks, size of the blocks, and block alignment figure. This method returns the actual values for the same.
GetProperties Determines the size, number, and alignment of blocks.
Commit Commits the memory for the specified buffers.
Decommit Releases the memory for the specified buffers.
GetBuffer Retrieves a container for a sample.
ReleaseBuffer Releases a container for a sample.