WMDM_FORMAT_CAPABILITY结构

WMDM_FORMAT_CAPABILITY结构描述设备针对特定格式的功能。 此结构在 WMDM_PROP_CONFIG 结构数组中包含一组属性配置。 每个属性配置表示一组兼容属性值,这些属性值跨给定格式支持的所有属性。 应用程序可以通过调用 IWMDMDevice3::GetFormatCapability 方法并传入格式代码来获取此结构。 有关格式代码的列表,请参阅 WMDM_FORMATCODE

语法

typedef struct _WMDM_FORMAT_CAPABILITY {
  UINT              nPropConfig;
  WMDM_PROP_CONFIG  *pConfigs;
} WMDM_FORMAT_CAPABILITY;

成员

nPropConfig

pConfigs 数组中的属性配置数。

pConfigs

指向 WMDM_PROP_CONFIG 结构的数组的指针。 数组的大小等于 nPropConfig 的值。

备注

WMDM_FORMAT_CAPABILITY结构提供了一种灵活的机制来表达设备针对特定格式的功能。

例如,如果内容将由设备 (要由设备) 播放的音频文件呈现,则内容的属性必须与 IWMDMDevice3::GetFormatCapabilityWMDM_FORMAT_CAPABILITY 结构中返回的属性配置之一匹配。 例如,对于音频文件,比特率和采样率必须满足返回的属性配置之一。

调用方负责释放为此结构分配的内存。 以下函数演示如何清除 WMDM_FORMAT_CAPABILITY 结构。

void FreeFormatCapability(WMDM_FORMAT_CAPABILITY formatCap)
{
    // Loop through all configurations.
    for (UINT i=0; i < formatCap.nPropConfig; i++) 
    {
        // Loop through all descriptions of a configuration and delete
        // the values particular to that description type.
        for (UINT j=0; j < formatCap.pConfigs[i].nPropDesc; j++) 
        {
            switch (formatCap.pConfigs[i].pPropDesc[j].ValidValuesForm)
            {
                case WMDM_ENUM_PROP_VALID_VALUES_ENUM:
                    for (UINT k=0; k < formatCap.pConfigs[i].pPropDesc[j].ValidValues.EnumeratedValidValues.cEnumValues; k++)
                    {
                        PropVariantClear (&(formatCap.pConfigs[i].pPropDesc[j].ValidValues.EnumeratedValidValues.pValues[k]));
                    }
                    CoTaskMemFree(formatCap.pConfigs[i].pPropDesc[j].ValidValues.EnumeratedValidValues.pValues);
                    break;
                case WMDM_ENUM_PROP_VALID_VALUES_RANGE:
                    PropVariantClear (&(formatCap.pConfigs[i].pPropDesc[j].ValidValues.ValidValuesRange.rangeMin));
                    PropVariantClear (&(formatCap.pConfigs[i].pPropDesc[j].ValidValues.ValidValuesRange.rangeMax));
                    PropVariantClear (&(formatCap.pConfigs[i].pPropDesc[j].ValidValues.ValidValuesRange.rangeStep));
                    break;
                case WMDM_ENUM_PROP_VALID_VALUES_ANY:
                    // No dynamically allocated memory for this value.
                default:
                    break;
            }

            // Free the memory for the description name.
            CoTaskMemFree(formatCap.pConfigs[i].pPropDesc[j].pwszPropName);
        }
        // Free the memory holding the array of description items for this configuration.
        CoTaskMemFree(formatCap.pConfigs[i].pPropDesc);
    }

    // Free the memory pointing to the array of configurations.
    CoTaskMemFree(formatCap.pConfigs);
    formatCap.nPropConfig = 0;
}

要求

要求
标头
Wmdm.idl

另请参阅

IWMDMDevice3::GetFormatCapability

WMDM_ENUM_PROP_VALID_VALUES_FORM

WMDM_PROP_CONFIG

WMDM_PROP_DESC

WMDM_PROP_VALUES_ENUM

WMDM_PROP_VALUES_RANGE

结构