IWMEncProfile2::DetectCompatibility

Windows Media Encoder SDK banner art

The DetectCompatibility method detects which version of Windows Media-based content the profile is compatible with, according to its current settings.

Syntax

HRESULT DetectCompatibility(
  WMENC_PROFILE_COMPATIBILITY*  penumCompat
);

Parameters

penumCompat

[out]  Pointer to a member of the WMENC_PROFILE_COMPATIBILITY enumeration type indicating whether the profiles are compatible.

Return Values

If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.

Return code Number Description
E_POINTER 0x80004003 The pointer to the profile compatibility type is NULL.

Remarks

The DetectCompatibility method indicates which version of Windows Media-based content the profile is currently compatible with. For example, if the profile uses a variable bit rate (VBR) for a stream, the profile is compatible with version 9.

Example Code

// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"

    // Declare variables.
    HRESULT hr;
    IWMEncoder* pEncoder;
    IWMEncProfileCollection* pProColl;
    IWMEncProfile* pPro;

    IWMEncProfile2* pPro2;

    // Initialize the COM library and retrieve a pointer to an IWMEncoder interface.
    hr = CoInitialize(NULL);
    if ( SUCCEEDED( hr ) )
    {
        hr = CoCreateInstance(CLSID_WMEncoder,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWMEncoder,
            (void**) &pEncoder);
    }

    // Retrieve a specific profile.
    if ( SUCCEEDED( hr ) )
    {
        hr = pEncoder->get_ProfileCollection(&pProColl);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pProColl->Item(11, &pPro);
    }

    if ( SUCCEEDED( hr ) )
    {
        hr = CoCreateInstance(CLSID_WMEncProfile2,
            NULL,
            CLSCTX_INPROC_SERVER,
            IID_IWMEncProfile2,
            (void**) &pPro2);
    }

    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->LoadFromIWMProfile(pPro);
    }

    // Retrieves a value indicating the Windows Media version that
    // the profile is compatible with.
    WMENC_PROFILE_COMPATIBILITY eCompat;
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->DetectCompatibility(&eCompat);
    }

    // Set the compatibility mode.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_CompatibilityMode(WMENC_ENCODER_V9); // v9
    }

    // Release pointers.
    if ( pPro2 )
    {
        pPro2->Release();
        pPro2 = NULL;
    }

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also