views:

12

answers:

0

Hi, I am learning Media Foundation, and there is a parameter in MFCreateAttributes function I don't quite understand. The sample code as the following :


IMFAttributes *pAttributes = NULL;
const UINT32 cElements = 10;  // Starting size. <<<<<<<< I don't understand this parameter

// Create an empty attribute store
HRESULT hr = MFCreateAttributes(&pAttributes, cElements);

// Set the MY_ATTRIBUTE attribute with a string value.
if (SUCCEEDED(hr))
{
    hr = pAttributes->SetString(
        MY_ATTRIBUTE,
        L"This is a string value"
        );
}

// Return the IMFAttributes pointer to the caller.
if (SUCCEEDED(hr))
{
    *ppAttributes = pAttributes;
    (*ppAttributes)->AddRef();
}

SAFE_RELEASE(pAttributes);


The second parameter is the "initial number of elements" allocated for the attribute store.

But an attribute is a "Key-Value pair", why a key-value pair has an "initial number of elements"?

Thanks in advance.

(I think I took it wrong, MFCreateAttributes can create a list of attributes. But I can't find a button to delete this question....)