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
라이브러리 Mssachlp.lib

추가 정보

디바이스 형식 기능 검색

IWMDMDevice3 인터페이스