IWMDMDevice3::GetFormatCapability メソッド (mswmdm.h)

GetFormatCapability メソッドは、指定された形式のファイルのデバイス サポートを取得します。 機能は、サポートされているプロパティとその許可される値として表されます。

構文

HRESULT GetFormatCapability(
  [in]  WMDM_FORMATCODE        format,
  [out] WMDM_FORMAT_CAPABILITY *pFormatSupport
);

パラメーター

[in] format

クエリ対象の形式を表す WMDM_FORMATCODE 列挙からの値。

[out] pFormatSupport

サポートされているプロパティとその許可される値を含む、返される WMDM_FORMAT_CAPABILITY 構造体へのポインター。 これらの値は、「 IWMDMDevice3 をサポートするデバイスでのフォーマット機能の取得」の説明に従って、アプリケーションによって解放される必要があります。

戻り値

このメソッドは HRESULT を返します。 Windows Media デバイス マネージャーのすべてのインターフェイス メソッドは、次のいずれかのエラー コード クラスを返すことができます。

  • 標準 COM エラー コード
  • HRESULT 値に変換された Windows エラー コード
  • Windows Media デバイス マネージャーエラー コード
考えられるエラー コードの詳細な一覧については、「 エラー コード」を参照してください。

注釈

クライアントは、 IWMDMDevice3::GetProperty メソッドを使用して、g_wszWMDMFormatsSupported デバイス プロパティに対してクエリを実行することで、サポートされている形式の一覧 取得できます。

特定の形式の場合、クライアントはこの関数を呼び出して、サポートされているプロパティを取得し、サポートされているプロパティの構成 (ビット レートとサンプル レートの組み合わせなど) に関する情報を取得できます。 この情報は、書式機能として表されます。

次の関数は、デバイス ポインターと書式コードを渡し、その形式のデバイスの書式機能を取得します。 関数は、カスタム関数を使用して取得した値をクリアします。 このカスタム関数は、「 IWMDMDevice3 をサポートするデバイスでのフォーマット機能の取得」に示されています。


// Each format configuration is described by a WMDM_FORMAT_CAPABILITY enum, and
// has a WMDM_FORMAT_CAPABILITY structure describing the device capabilities for that format.
//        Each WMDM_FORMAT_CAPABILITY structure has a WMDM_PROP_CONFIG structure listing configurations.
//            Each WMDM_PROP_CONFIG has a WMDM_PROP_DESC describing a specific format configuration.
//                Each WMDM_PROP_DESC holds specific values as a range, a set, or a flag meaning all values are accepted.
HRESULT myGetFormatCaps(WMDM_FORMATCODE formatCode, IWMDMDevice3* pDevice)
{
    HRESULT hr = S_OK;

    // Get a list of supported configurations for the format.
    WMDM_FORMAT_CAPABILITY formatCapList;
    hr = pDevice->GetFormatCapability(formatCode, &formatCapList);
    HANDLE_HR(hr, "Got a WMDM_FORMATCODE structure in GetCaps","Couldn't get a WMDM_FORMATCODE structure in GetCaps");

    // Print out the format name.
    // TODO: Display a banner for device formats.
    PrintWMDM_FORMATCODE(formatCode); // Custom function to print out the format code.
    

    // Loop through the configurations and examine each one.
    for(UINT iConfig = 0; iConfig < formatCapList.nPropConfig; iConfig++)
    {
        WMDM_PROP_CONFIG formatConfig = formatCapList.pConfigs[iConfig];

        // Preference level for this configuration (lower number means more preferred).
        // TODO: Display a banner for the preference-level output.

        // Loop through all properties for this configuration and get supported
        // values for the property. Values can be a single value, a range, 
        // or a list of enumerated values.
        for(UINT iDesc = 0; iDesc < formatConfig.nPropDesc; iDesc++)
        {
            WMDM_PROP_DESC propDesc = formatConfig.pPropDesc[iDesc];
            // TODO: Display the property name.

            // Three ways a value can be represented: any, a range, or a list.
            switch (propDesc.ValidValuesForm)
            {
                case WMDM_ENUM_PROP_VALID_VALUES_ANY:
                    // TODO: Display a message indicating that all values are valid.
                    break;
                case WMDM_ENUM_PROP_VALID_VALUES_RANGE:
                    {
                        // List these in the docs as the propvariants set.
                        WMDM_PROP_VALUES_RANGE rng = propDesc.ValidValues.ValidValuesRange;
                        // TODO: Display a banner for the values to follow
                        // TODO: Display the max value.
                        // TODO: Display the min value.
                        // TODO: Display the step value.
                    }
                    break;
                case WMDM_ENUM_PROP_VALID_VALUES_ENUM:
                    {
                        // TODO: Display a banner for the values to follow.
                        WMDM_PROP_VALUES_ENUM list = propDesc.ValidValues.EnumeratedValidValues;
                        PROPVARIANT pVal;
                        for(UINT iValue = 0; iValue < list.cEnumValues; iValue++)
                        {
                            pVal = list.pValues[iValue];
                            // TODO: Display the current value.
                            PropVariantClear(&pVal);
                            PropVariantInit(&pVal);
                        }
                    }

                    break;
                default:
                    HANDLE_HR(E_FAIL, "Undefined configuration type in GetCaps" << endl, "");
                    break;
            }
        }
    }
    // Now clear the memory used by WMDM_FORMAT_CAPABILITY.
    FreeFormatCapability(formatCapList);

e_Exit:
    return hr;
}

要件

要件
対象プラットフォーム Windows
ヘッダー mswmdm.h
Library Mssachlp.lib

こちらもご覧ください

デバイス形式の機能の検出

IWMDMDevice3 インターフェイス