IWMEncPluginInfo::get_Exclusive

Windows Media Encoder SDK banner art

The get_Exclusive method retrieves a Boolean value indicating whether the plug-in can be used more than once in an encoding session.

Syntax

HRESULT get_Exclusive(
  VARIANT_BOOL*  pbExclusive
);

Parameters

pbExclusive

[out]  Pointer to a VARIANT_BOOL that indicates whether the plug-in can be used more than once in a source group. The default value is VARIANT_FALSE.

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 Boolean value is NULL.

Remarks

For some physical devices, it may be necessary for get_Exclusive to return VARIANT_TRUE. By default, it returns VARIANT_FALSE.

Example Code

// Include libraries.

#include <windows.h>
#include <atlbase.h>
#include "wmencode.h"

// Declare variables.

    HRESULT hr;
    IWMEncoder* pEncoder;
    IWMEncSourcePluginInfoManager* pSrcPlugMgr;
    IWMEncPluginInfo* pPlugInfo;

    int i,j;
    long lPlugCount, lResCount;
    VARIANT_BOOL bResources, bExclusive, bHidden, bPropPage;
    WMENC_SOURCE_TYPE enumMediaType;
    WMENC_PLUGIN_TYPE enumPluginType;


// 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 an IWMEncSourcePluginInfoManager pointer.

if ( SUCCEEDED( hr ) )
{
    hr = pEncoder->get_SourcePluginInfoManager(&pSrcPlugMgr);
}

// Loop through the source plug-ins. Call the Item method on each
// plug-in to retrieve an IWMEncPluginInfo object. Use the
// SchemeType property to retrieve a string containing the scheme
// type of the plug-in. If the scheme type is "DEVICE" and if the
// plug-in supports resources, call the Item method to retrieve a
// string identifying the resource. If the resource indicates that
// the plug-in captures streams from the default video device,
// retrieve registry information about the plug-in.

if ( SUCCEEDED( hr ) )
{
    hr = pSrcPlugMgr->get_Count(&lPlugCount);
}
for (i=0; i<lPlugCount; i++)
{
    if ( SUCCEEDED( hr ) )
    {
        hr = pSrcPlugMgr->Item(i, &pPlugInfo);
    }
    CComBSTR bstrScheme;
    if ( SUCCEEDED( hr ) )
    {
        hr = pPlugInfo->get_SchemeType(&bstrScheme);
    }
    if (_wcsicmp(bstrScheme, CComBSTR("DEVICE"))==0)
    {
        if ( SUCCEEDED( hr ) )
        {
            hr = pPlugInfo->get_Resources(&bResources);
        }
        if (bResources==VARIANT_TRUE)
        {
            if ( SUCCEEDED( hr ) )
            {
                hr = pPlugInfo->get_Count(&lResCount);
            }
            for (j=0; j<lResCount; j++)
            {
                CComBSTR bstrResource;
                if ( SUCCEEDED( hr ) )
                {
                    hr = pPlugInfo->Item(j, &bstrResource);
                }
                if (_wcsicmp(bstrResource,
                    CComBSTR("Default_Video_Device"))==0)
                {
                    // Retrieve the GUID.
                    CComBSTRbstrCLSID;
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_CLSID(&bstrCLSID);
                    }

                    // Retrieve the copyright information.
                    CComBSTRbstrCopyright;
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_CLSID(&bstrCopyright);
                    }

                    // Determine whether the plug-in can be used
                    // more than once in a source group.
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_Exclusive(&bExclusive);
                    }

                    // Determine whether the plug-in is hidden
                    // from the UI.
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_Exclusive(&bHidden);
                    }

                    // Retrieve the URL, if any, of the Web site
                    // containing information about the plug-in.
                    CComBSTRbstrURL;
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_InfoURL(&bstrURL);
                    }

                    // Retrieve the media types supported by the
                    // plug-in. This is a bitwise OR of the
                    // WMENC_SOURCE_TYPE enumeration type.
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_MediaType(&enumMediaType);
                    }

                    // Retrieve the name of the plug-in.
                    CComBSTR bstrName;
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_Name(&bstrName);
                    }

                    // Determine whether the plug-in is a source or
                    // transform type.
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_PluginType(&enumPluginType);
                    }

                    // Determine whether the plug-in supports
                    // property pages.
                    if ( SUCCEEDED( hr ) )
                    {
                        hr = pPlugInfo->get_PropertyPage(&bPropPage);
                    }
                }
            }
        }
    }
}

// Continue configuring the encoding session.

// Release pointers.
if ( pSrcPlugMgr )
{
    pSrcPlugMgr->Release();
    pSrcPlugMgr = NULL;
}
if ( pPlugInfo )
{
    pPlugInfo->Release();
    pPlugInfo = NULL;
}
if ( pEncoder )
{
    pEncoder->Release();
    pEncoder = NULL;
}

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also