IWMEncAudienceObj::get_VideoPeakBitrate

Windows Media Encoder SDK banner art

The get_VideoPeakBitrate method retrieves the video bit rate in the current audience when using peak VBR mode.

Syntax

HRESULT get_VideoPeakBitrate(
  short  iRenderSiteIndex,
  long*  plBitrate
);

Parameters

iRenderSiteIndex

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

plBitrate

[out]  Pointer to a long that indicates the peak video bit rate (VBR), in bits per second (bps).

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 bit rate is NULL.

Remarks

This method is only relevant when the profile is using peak VBR mode for video. You can determine which mode is used with the IWMEncProfile2::get_VBRMode method.

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 a value indicating the video's peak bit rate.
    long lVidPeakBRate;
    if ( SUCCEEDED( hr ) )
    {
        hr = pAudnc->get_VideoPeakBitrate(0, &lVidPeakBRate);
    }
    // Release pointers.
    if ( pAudnc )
    {
        pAudnc->Release();
        pAudnc = NULL;
    }
    if ( pPro2 )
    {
        pPro2->Release();
        pPro2 = NULL;
    }

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also