|Microsoft DirectX 9.0|
The GetBuffer method retrieves a media sample that contains a buffer. This method implements the IMemAllocator::GetBuffer method.
HRESULT GetBuffer( IMediaSample **ppBuffer, REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags );
Address of a variable that receives a pointer to the buffer's IMediaSample interface.
Pointer to the start time of the sample.
Pointer to the end time of the sample.
Bitwise combination of zero or more flags. The base class supports the following flag:
AM_GBF_NOWAIT: Do not wait for a buffer to become available.
Returns one of the following HRESULT values.
|VFW_E_NOT_COMMITTED||Allocator was not committed.|
Unless the caller specifies the AM_GBF_NOWAIT flag in dwFlags, this method blocks until the next sample is available.
The retrieved media sample has a valid pointer to the allocated buffer. The caller is responsible for setting any other properties on the sample, such as the time stamps, the media times, or the sync-point property. For more information, see IMediaSample.
In the base class, the pStartTime and pEndTime parameters are ignored. Derived classes can use these values. For example, the allocator for the Video Renderer filter uses these values to synchronize switching between Microsoft® DirectDraw® surfaces.
If the method needs to wait on a sample, it increments the count of waiting objects (CBaseAllocator::m_lCount) and the calls WaitForSingleObject function on the semaphore (CBaseAllocator::m_hSem). When a sample becomes available, it calls the CBaseAllocator::ReleaseBuffer method on the allocator, which increases the semaphore count by m_lCount (thereby releasing the waiting threads) and sets m_lCount back to zero.