IWMEncProfile2::put_ContentType

Windows Media Encoder SDK banner art

The put_ContentType method specifies the type of content streams that the current profile supports.

Syntax

HRESULT put_ContentType(
  long  lSrcType
);

Parameters

lSrcType

[in]  long that indicates which types of streams the profile supports.

Number Description
0 Does not support any content.
1 Supports audio content.
16 Supports video content.
256 Supports script content.
17 Supports audio and video content.
257 Supports audio and script content.
272 Supports video and script content.
273 Supports audio, video, and script content.
4113 Supports audio, video, and HTML content.
4369 Supports audio, video, script, and HTML content.

Return Values

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

Example Code

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

    HRESULT hr;
    IWMEncProfile2* pPro2;
    IWMEncAudienceObj* pAudnc;
    long lAudCount;
    int i;

    // Initialize the COM library and retrieve a pointer to an IWMEncProfile2 interface.
    hr = CoInitialize(NULL);

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

    // Verify profile settings immediately as they are set.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_ValidateMode(VARIANT_TRUE);
    }

    // Provide a name and description.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_ProfileName(CComBSTR("Sample MBR Profile"));
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_ProfileDescription(CComBSTR("A video profile with three audiences"));
    }

    // Specify video content.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_ContentType(16);
    }

    // Specify constant bit rate (CBR) mode.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->put_VBRMode(WMENC_VIDEO, 0, WMENC_PVM_NONE);
    }

    // Add audiences for 200, 400, and 600 Kbps.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->AddAudience(200000, &pAudnc);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->AddAudience(400000, &pAudnc);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->AddAudience(600000, &pAudnc);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->get_AudienceCount(&lAudCount);
    }

    // Create an audience object then loop through all of the audiences
    // in the current profile, making the same changes to each audience.
    for (i = 0; i < lAudCount; i++)
    {
        if ( SUCCEEDED( hr ) )
        {
            hr = pPro2->get_Audience(i, &pAudnc);
        }
        // The Windows Media 9 codec is used by default, but you can change
        // it as follows. Be sure to make this change for each audience.
        if ( SUCCEEDED( hr ) )
        {
            hr = pAudnc->put_VideoCodec(0, 2);
        }

        // Make the video output size match the input size by setting height and width to 0.
        if ( SUCCEEDED( hr ) )
        {
            hr = pAudnc->put_VideoHeight(0, 0);
        }
        if ( SUCCEEDED( hr ) )
        {
            hr = pAudnc->put_VideoWidth(0, 0);
        }

        // Change the buffer size to 5 seconds. By default, the end user's default setting is used.
        if ( SUCCEEDED( hr ) )
        {
            hr = pAudnc->put_VideoBufferSize(0, 5000);
        }
    }

    // Change the video image sharpness for the first audience only.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->get_Audience(0, &pAudnc);
    }
    if ( SUCCEEDED( hr ) )
    {
        hr = pAudnc->put_VideoImageSharpness(0, 70);
    }

    // Validate the settings to make sure the profile has no errors.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->Validate();
    }

    // Save the profile to a .prx file.
    if ( SUCCEEDED( hr ) )
    {
        hr = pPro2->SaveToFile(CComBSTR("C:\\Program Files\\Windows Media Components\\Encoder\\Profiles\\CPPprofile.prx"));
    }

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

Requirements

Header: wmencode.h

Library: wmenc.exe

See Also