struktur WMDM_FORMAT_CAPABILITY
Struktur WMDM_FORMAT_CAPABILITY menjelaskan kemampuan perangkat untuk format tertentu. Struktur ini berisi sekumpulan konfigurasi properti dalam array struktur WMDM_PROP_CONFIG . Setiap konfigurasi properti mewakili sekumpulan nilai properti yang kompatibel di semua properti yang didukung untuk format tertentu. Aplikasi bisa mendapatkan struktur ini dengan memanggil metode IWMDMDevice3::GetFormatCapability dan meneruskan kode format. Untuk daftar kode format, lihat WMDM_FORMATCODE.
Sintaks
typedef struct _WMDM_FORMAT_CAPABILITY {
UINT nPropConfig;
WMDM_PROP_CONFIG *pConfigs;
} WMDM_FORMAT_CAPABILITY;
Anggota
-
nPropConfig
-
Jumlah konfigurasi properti dalam array pConfigs .
-
pConfigs
-
Penunjuk ke array struktur WMDM_PROP_CONFIG . Ukuran array sama dengan nilai nPropConfig.
Keterangan
Struktur WMDM_FORMAT_CAPABILITY menyediakan mekanisme yang fleksibel untuk mengekspresikan kemampuan perangkat untuk format tertentu.
Jika konten dimaksudkan untuk dirender oleh perangkat (misalnya, file audio yang akan diputar oleh perangkat), properti konten harus cocok dengan salah satu konfigurasi properti yang dikembalikan oleh IWMDMDevice3::GetFormatCapability dalam struktur WMDM_FORMAT_CAPABILITY . Misalnya, untuk file audio, laju bit dan laju sampel harus memenuhi salah satu konfigurasi properti yang dikembalikan.
Pemanggil bertanggung jawab untuk membebaskan memori yang dialokasikan untuk struktur ini. Fungsi berikut menunjukkan cara menghapus struktur 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;
}
Persyaratan
Persyaratan | Nilai |
---|---|
Header |
|