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. |
Transport classes share memory between pins, and they pass media samples using that memory. DirectShow provides the following classes to help implement shared memory transports:
CBaseAllocatoris a class that provides member functions to implement the IMemAllocatorinterface, as is shown in the following illustration.
The IMemAllocatorinterface on the input pin specifies methods to set the number and size of the buffers to allocate, allocates that memory, frees that memory, and returns a single buffer that contains an IMediaSampleinterface.
The output pin connected to the input pin calls the IMemAllocatormethods. CBaseAllocatorprovides the member functions Allocand Freethat are called from the Commitand Decommitmethods.
Derived classes override the Allocand Freemember functions to provide their own routines to allocate and free memory.
Because CBaseAllocatorperforms very little implementation by itself, most pins use the CMemAllocatorclass. This class is derived from CBaseAllocator.
CMemAllocatoroverrides the CBaseAllocator::Freemember function to provide allocation of media samples based on system memory. It provides its own member function, called ReallyFree, to be called when the allocator is finally released.
CMediaSampleis a class that contains the media sample data, and also provides member functions to access properties on the media sample, such as data type or beginning and ending time stamps. This class implements the IMediaSampleinterface, which provides the method specification.