IWMEncAudienceObj::get_Property

Windows Media Encoder SDK banner art

The get_Property method retrieves the value of a named property for a particular stream in the current audience.

Syntax

HRESULT get_Property(
  WMENC_SOURCE_TYPE  enumSrcType,
  short  iRenderSiteIndex,
  BSTR  bstrProperty,
  VARIANT*  pvarProperty
);

Parameters

enumSrcType

[in]  Member of a WMENC_SOURCE_TYPE enumeration type identifying the media stream type.

iRenderSiteIndex

[in]  short containing the audience stream index. Because an audience can only contain one stream of each type, iRenderSiteIndex must be zero.

bstrProperty

[in]  BSTR containing the property. Currently the only properties supported are "BufferWindow" for HTML (WMENC_FILETRANSFER) streams, and "DeviceConformanceTarget" for video.

pvarProperty

[out]  Pointer to a VARIANT that indicates the property value.

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

Remarks

The BufferWindow property corresponds to the preroll value for HTML streaming to specify how far in advance (in milliseconds) to send HTML content. You determine the value of this setting according to the largest HTML file in your collection and the bit rate you specify. A preroll setting that is too small might prevent files from being transferred or might cause the stream to be out of sync.

The DeviceConformanceTarget property allows you to specify a complexity setting for video if you are targeting a hardware device other than a computer. During playback, a hardware device can determine if it supports the complexity setting you selected. For example, the simple setting is intended for low-battery and low-power CPU devices such as wireless hand-sets or PDAs, the complex setting supports all codec algorithms without limitations, and the main setting supports most algorithms. Typically, you should use Auto, which enables the correct complexity setting to be selected automatically during encoding. You can specify the following strings for the DeviceConformanceTarget property.

DeviceConformanceTarget Value
Auto " "
Main "MP"
Simple "SP"
Complex "CP"

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;
    IWMEncAudienceObj* pAudnc;

    // 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);
    }

    // Retrieve the first audience in the profile.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->get_Audience(0, &pAudnc);
    }

    // Retrieve the value for the file transfer stream's buffer window.  
    CComVariant vStreamBuffer;
    if ( SUCCEEDED( hr ) )
    {
        hr = pAudnc->get_Property(WMENC_FILETRANSFER, 0, CComBSTR("BufferWindow"), &vStreamBuffer);
    }
    // Release pointers.
    if ( pAudnc )
    {
        pAudnc->Release();
        pAudnc = NULL;
    }
    if ( pPro2 )
    {
        pPro2->Release();
        pPro2 = NULL;
    }

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also