Microsoft Windows CE 3.0  

CBaseAllocator::GetBuffer

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.

Retrieves a container for a sample.

HRESULT GetBuffer(
IMediaSample **
ppBuffer
,
REFERENCE_TIME *
pStartTime
,
REFERENCE_TIME *
pEndTime
,
DWORD
dwFlags
);

Parameters

ppBuffer
Pointer to a retrieved media sample buffer.
pStartTime
Either NULL or set to the beginning time of the sample to retrieve.
pEndTime
Either NULL or set to the ending time of the sample to retrieve.
dwFlags
The following flags are supported.
AM_GBF_PREVFRAMESKIPPED The buffer returned will not be filled with data contiguous to any previous data sent.
AM_GBF_NOTASYNCPOINT Dynamic format changes are not allowed on this buffer because it is not a key frame.

Return Values

Returns an HRESULTvalue.

Remarks

This member function implements the IMemAllocator::GetBuffermethod.

This is a blocking, synchronous call to access the next free buffer (as represented by an IMediaSampleinterface). Upon return, properties (such as the time and so on) are invalid, but the buffer pointer and size are correct.

If no buffers are available, CBaseAllocator::GetBuffercalls CBaseAllocator::SetWaitingand then calls the Microsoft Win32 WaitForSingleObjectfunction to wait for the list to signal that a sample is available. The list signals by calling CBaseAllocator::ReleaseBuffer, which in turn calls CBaseAllocator::NotifySample, which sets m_lWaitingto zero and calls the Win32 ReleaseSemaphorefunction.

This member function also takes two time parameters. These parameters are used in certain advanced buffering scenarios, when it is necessary to have an idea of the amount of time a buffer is required. The only place this is currently used is in the video renderer, when the time stamps are used as a guide to when the primary surfaces of Display Control Interface (DCI) and Microsoft DirectDraw should be returned (this is because filling a primary surface buffer corresponds directly to the actual rendering of the data). In all other cases, these parameters can be safely set to NULL. If one is non-NULL, both should be non-NULL; these times will not be set on the sample when it is subsequently returned.