IWMEncProfile2::put_BroadcastMode
The put_BroadcastMode method specifies the video format of the current profile.
Syntax
HRESULT put_BroadcastMode(
WMENC_PROFILE_BROADCAST_MODE enumBroadcastMode
);
Parameters
enumBroadcastMode
[in] A member of the WMENC_PROFILE_BROADCAST_MODE enumeration type specifying the broadcast mode.
Return Values
If the method succeeds, it returns S_OK. If it fails, it supports the IErrorInfo interface and returns an HRESULT error code.
Remarks
The get_BroadcastMode method detects which video format is used by the current profile, or you can specify which one you want to use. NTSC content uses a frame rate of 30 frames per second (fps), whiles PAL uses a frame rate of 25 fps. Specify a custom video format if you use a different frame rate.
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 string indicating the video format.
WMENC_PROFILE_BROADCAST_MODE eBMode;
if ( SUCCEEDED( hr ) )
{
hr = pPro2->get_BroadcastMode(&eBMode);
}
// Set the video format.
if ( SUCCEEDED( hr ) )
{
hr = pPro2->put_BroadcastMode(WMENC_PFM_PAL);
}
// Release pointers.
if ( pPro2 )
{
pPro2->Release();
pPro2 = NULL;
}
Requirements
Header: wmencode.h
Library: wmenc.exe
See Also