Microsoft DirectX 9.0

IAMVideoAccelerator::GetBuffer

The GetBuffer method retrieves the compressed buffer of a specified index and type.

Syntax

HRESULT GetBuffer(
  DWORD dwTypeIndex,
  DWORD dwBufferIndex,
  BOOL bReadOnly,
  LPVOID *ppBuffer,
  LONG *lpStride
);

Parameters

dwTypeIndex

[in] Zero-based index into the surface types supported by the video accelerator driver, or 0xFFFFFFFF. See Remarks.

dwBufferIndex

[in] Buffer index within the type. The valid range is from zero to the value of the dwNumCompBuffers member of the AMVACompBufferInfo structure.

bReadOnly

[in] Boolean value indicating whether the buffer will be updated. If TRUE, the buffer will not be updated, allowing access to busy reference frames.

ppBuffer

[out] Pointer to the buffer that will contain the compressed data. The size of this buffer is determined by the dwBytesToAllocate member of the AMVACompBufferInfo structure returned for the dwSurfaceTypeIndex entry from the IAMVideoAccelerator::GetInternalCompBufferInfo method.

lpStride

[out] Stride compatible with the compression type. Generally, this will be equal to the dwWidthToCreate member of the AMVACompBufferInfo structure. Note that this might not be equal to dwWidthToCreate for output display buffers or other uncompressed types.

Return Values

Returns an HRESULT value that depends on the implementation of the interface. HRESULT can include one of the following standard constants, or other values not listed.

Return code Description
E_FAIL Failure.
E_INVALIDARG Argument is invalid.
E_NOTIMPL Method is not supported.
E_POINTER Null pointer argument.
S_OK Success.

Remarks

This method locks and obtains access to a single buffer. Buffers are identified by type and by index within that type. The IAMVideoAccelerator::GetInternalCompBufferInfo method returns the number of types in its pdwNumTypesCompBuffers parameter, which defines the valid range for dwTypeIndex. For each type, the dwNumCompBuffers member of the AMVACompBufferInfo structure gives the number of buffers, which defines the valid range for dwBufferIndex. Note that dwTypeIndex and dwBufferIndex both specify zero-based offsets.

Alternatively, use a type index of 0xFFFFFFFF to retrieve a pointer to an output buffer. Currently, this is only valid between calls to IAMVideoAccelerator::BeginFrame and IAMVideoAccelerator::EndFrame. In this case the buffer index must equal the dwDestSurfaceIndex member of the AMVABeginFrameInfo structure that was passed to the last BeginFrame call.

This method will fail if the filter's pins are not connected.

Until all compressed buffers are released, it is possible that this thread will hold the Win16 lock or the DirectDraw lock.

See Also