IWMEncProfile2::put_EnableTimecode
The put_EnableTimecode method specifies a Boolean value indicating whether time code is enabled for content created with the current profile.
Syntax
HRESULT put_EnableTimecode(
short iRenderSiteIndex,
VARIANT_BOOL fTimecode
);
Parameters
iRenderSiteIndex
[in] short containing the audience stream index. Because an audience can contain only one stream of each type, iRenderSiteIndex must be 0.
fTimecode
[in] VARIANT_BOOL indicating whether to enable the time code for the content created with the current profile.
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 time code is a way to enable frame-level seeking within video content sourced from digital video files in .avi format, capture devices, and digital devices. A time code generates a larger output file. Typically this feature is used with high-quality content for a download that uses variable bit rate (VBR) mode or is not compressed. You cannot preserve or create a time code when you are applying the inverse telecine filter.
When you want to enable the time code during an encoding session, you set IWMEncoder2::put_EnableTimecode to VARIANT_TRUE and then the time code is enabled for the profile automatically. So, you only need to set IWMEncProfile2::put_EnableTimecode to VARIANT_TRUE for a profile when you are using the profile with third-party applications based on the Windows Media Format SDK.
Use the IWMEncoder2::put_PreserveSourceTimecode method to indicate whether to preserve the original time code from the source video or to create a new one.
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);
}
// Determines whether the time code is enabled.
VARIANT_BOOL bTimecode;
if ( SUCCEEDED( hr ) )
{
hr = pPro2->get_EnableTimecode(0, &bTimecode);
}
// Enable time codes.
if ( SUCCEEDED( hr ) )
{
hr = pPro2->put_EnableTimecode(0, VARIANT_TRUE);
}
// Release pointers.
if ( pPro2 )
{
pPro2->Release();
pPro2 = NULL;
}
Requirements
Header: wmencode.h
Library: wmenc.exe
See Also