IWMEncDeviceControlPlugin::get_TotalEDLDurationInTimecode
![]() |
The get_TotalEDLDurationInTimecode method retrieves the total duration of the EDL segments in time code format.
Syntax
HRESULT get_TotalEDLDurationInTimecode(
long* plDuration
);
Parameters
plDuration
Pointer to a long containing the duration.
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 duration is NULL. |
Remarks
The total duration is returned in the time code format hhmmssff, so if the duration is 10 seconds and 21 frames, the duration is returned as 1021.
Example Code
// Include libraries.
#include <windows.h>
#include <atlbase.h>
#include <comdef.h>
#include "C:\WMSDK\WMEncSDK9\include\wmencode.h"
#include "C:\WMSDK\WMEncSDK9\include\wmdevctl.h"
// Declare variables.
HRESULT hr;
IWMEncoder2* pEncoder;
IWMEncSource* pSrcAud;
IWMEncSource* pSrcVid;
IWMEncDeviceControlCollection* pDCColl;
IWMEncDeviceControl* pDControl;
IWMEncDeviceControlPlugin* pDCPlugin;
IWMEncEditDecisionList* pEDList;
IWMEncEditDecisionData* pEDData;
// 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_IWMEncoder2,
(void**) &pEncoder);
}
// Configure the encoding session, including the sources, profile,
// and output file.
// Add the device as the audio source and video source.
if ( SUCCEEDED( hr ) )
{
hr = pSrcAud->SetInput(CComBSTR("Device://DEVICENAME"));
}
if ( SUCCEEDED( hr ) )
{
hr = pSrcVid->SetInput(CComBSTR("Device://DEVICENAME"));
}
// Retrieve the device control collection, then add a device to it.
if ( SUCCEEDED( hr ) )
{
hr = pSrcGrp2->get_DeviceControlCollection(&pDCColl);
}
if ( SUCCEEDED( hr ) )
{
hr = pDCColl->Add(&pDControl);
}
if ( SUCCEEDED( hr ) )
{
hr = pDControl->SetInput(CComBSTR("DeviceControl://DEVICENAME")); // Replace the device name
}
// Initialize the encoding session.
if ( SUCCEEDED( hr ) )
{
hr = pEncoder->PrepareToEncode(VARIANT_TRUE);
}
// Get the plug-in from the device. if ( SUCCEEDED( hr ) )
{
hr = pDControl->GetDeviceControlPlugin((IUnknown**)&pDCPlugin);
}
// Retrieve an IWMEncEditDecisionList object from the device control plug-in.
if ( SUCCEEDED( hr ) )
{
hr = pDCPlugin->get_EditDecisionList(&pEDList);
}
// Create an EDL entry.
if ( SUCCEEDED( hr ) )
{
hr = pEDList->Add(&pEDData);
}
// Add attributes to the EDL entry specifying mark-in, mark-out,
// tape ID, and description information.
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("MarkIn"), CComVariant(262295));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("MarkOut"), CComVariant(267268));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("TapeID"), CComVariant("A"));
}
if ( SUCCEEDED( hr ) )
{
hr = pEDData->Add(CComBSTR("Description"), CComVariant("Scene 1"));
}
// Retrieve the duration of the EDL in milliseconds.
long lDurationMS;
if ( pSrcAud )
{
hr = pDCPlugin->get_TotalEDLDurationInMilliseconds(&lDurationMS);
}
// Retrieve the duration of the EDL in time code format.
long lDurationTC;
if ( pSrcAud )
{
hr = pDCPlugin->get_TotalEDLDurationInTimecode(&lDurationTC);
}
// Release pointers.
if ( pSrcAud )
{
pSrcAud->Release();
pSrcAud = NULL;
}
if ( pSrcVid )
{
pSrcVid->Release();
pSrcVid = NULL;
}
if ( pDCColl )
{
pDCColl->Release();
pDCColl = NULL;
}
if ( pDControl )
{
pDControl->Release();
pDControl = NULL;
}
if ( pDCPlugin )
{
pDCPlugin->Release();
pDCPlugin = NULL;
}
if ( pEDList )
{
pEDList->Release();
pEDList = NULL;
}
if ( pEDData )
{
pEDData->Release();
pEDData = NULL;
}
if ( pEncoder )
{
pEncoder->Release();
pEncoder = NULL;
}
Requirements
Header: wmdevctl.h
Library: wmdevctl.dll
See Also
.gif)