Export (0) Print
Expand All

IMemAllocator::GetBuffer method

The GetBuffer method retrieves a media sample that contains an empty buffer.

Syntax


HRESULT GetBuffer(
  [out]  IMediaSample **ppBuffer,
  [in]   REFERENCE_TIME *pStartTime,
  [in]   REFERENCE_TIME *pEndTime,
  [in]   DWORD dwFlags
);

Parameters

ppBuffer [out]

Receives a pointer to the buffer's IMediaSample interface. The caller must release the interface.

pStartTime [in]

Pointer to the start time of the sample, or NULL.

pEndTime [in]

Pointer to the ending time of the sample, or NULL.

dwFlags [in]

Bitwise combination of zero or more of the following flags:

Flag Description
AM_GBF_NOTASYNCPOINTThis sample is not a synchronization point. Dynamic format changes are not allowed on this sample. When called on the Overlay Mixer or VMR, this flag implies that the buffer returned will contain an image that is identical to the last image delivered.
AM_GBF_PREVFRAMESKIPPEDThis sample is the first after a discontinuity. (Only the video renderer uses this flag.)
AM_GBF_NOWAITDo not wait for a buffer to become available.
AM_GBF_NODDSURFACELOCKUsed with the Video Mixing Renderer Filter 7 to request an unlocked DirectDraw surface. For more information, see Working with Direct3D Render Targets.

 

Return value

Returns an HRESULT value. Possible values include those shown in the following table.

Return codeDescription
S_OK

Success.

VFW_E_NOT_COMMITTED

Allocator is decommitted.

VFW_E_TIMEOUT

Timed out.

 

Remarks

By default, this method blocks until a free sample is available or the allocator is decommitted. If the caller specifies the AM_GBF_NOWAIT flag and no sample is available, the allocator can return immediately with a return value of VFW_E_TIMEOUT. However, allocators are not required to support this flag.

The sample returned in ppBuffer has a valid buffer pointer. 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.)

The pStartTime and pEndTime parameters are not applied to the sample. The allocator might use these values to determine which buffer it retrieves. For example, the Video Renderer filter uses these values to synchronize switching between DirectDraw surfaces. To set the time stamp on the sample, call the IMediaSample::SetTime method.

You must call the IMemAllocator::Commit method before calling this method. This method fails after the IMemAllocator::Decommit method is called.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Strmif.h (include Dshow.h)

Library

Strmiids.lib

See also

Error and Success Codes
IMemAllocator Interface

 

 

Community Additions

ADD
Show:
© 2014 Microsoft