Partager via


Transport Base Classes (Windows Embedded CE 6.0)

1/6/2010

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:

CBaseAllocator is a class that provides member functions to implement the IMemAllocator interface, as is shown in the following illustration.

Ee493352.cb84455b-05df-476b-8303-2320a43a7f93(en-US,WinEmbedded.60).gif

The IMemAllocator interface 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 IMediaSample interface.

The output pin connected to the input pin calls the IMemAllocator methods. CBaseAllocator provides the member functions Alloc and Free that are called from the Commit and Decommit methods.

Derived classes override the Alloc and Free member functions to provide their own routines to allocate and free memory.

Because CBaseAllocator performs very little implementation by itself, most pins use the CMemAllocator class. This class is derived from CBaseAllocator.

CMemAllocator overrides the CBaseAllocator::Free member 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.

CMediaSample is 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 IMediaSample interface, which provides the method specification.

See Also

Concepts

Base Classes that Implement Interfaces