Compartir a través de


Método IWMDMDevice3::GetFormatCapability (mswmdm.h)

El método GetFormatCapability recupera la compatibilidad del dispositivo con archivos de un formato especificado. Las funcionalidades se expresan como propiedades admitidas y sus valores permitidos.

Sintaxis

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

Parámetros

[in] format

Valor de la enumeración WMDM_FORMATCODE que representa el formato consultado.

[out] pFormatSupport

Puntero a la estructura de WMDM_FORMAT_CAPABILITY devuelta que contiene propiedades admitidas y sus valores permitidos. La aplicación debe liberar estos valores como se describe en Getting Format Capabilities on Devices That Support IWMDMDevice3 (Obtención de funcionalidades de formato en dispositivos compatibles con IWMDMDevice3).

Valor devuelto

El método devuelve un valor HRESULT. Todos los métodos de interfaz de Windows Media Administrador de dispositivos pueden devolver cualquiera de las siguientes clases de códigos de error:

  • Códigos de error COM estándar
  • Códigos de error de Windows convertidos en valores HRESULT
  • Códigos de error de windows Media Administrador de dispositivos
Para obtener una lista extensa de posibles códigos de error, consulte Códigos de error.

Comentarios

El cliente puede obtener la lista de formatos admitidos mediante el método IWMDMDevice3::GetProperty para consultar la propiedad de dispositivo g_wszWMDMFormatsSupported .

Para un formato determinado, un cliente puede llamar a esta función para obtener las propiedades admitidas y obtener información sobre las configuraciones de las propiedades admitidas (por ejemplo, combinaciones de velocidad de bits y frecuencia de muestreo). Esta información se expresa como una funcionalidad de formato.

Ejemplos

La siguiente función se pasa un puntero de dispositivo y un código de formato, y recupera las funcionalidades de formato del dispositivo para ese formato. La función usa una función personalizada para borrar los valores recuperados. Esta función personalizada se muestra en Obtención de funcionalidades de formato en dispositivos compatibles con 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;
}

Requisitos

Requisito Value
Plataforma de destino Windows
Encabezado mswmdm.h
Library Mssachlp.lib

Consulte también

Detección de funcionalidades de formato de dispositivo

IWMDMDevice3 (Interfaz)