IWMEncEditDecisionData.Add

Windows Media Encoder SDK banner art

The Add method adds a name-value attribute to an EDL entry.

Syntax

void IWMEncEditDecisionData.Add(
  string  bstrName,
  object  varValue
);

Parameters

bstrName

[in]  String containing the attribute name (see the following table).

varValue

[in]  Object containing the attribute value (see the following table).

Return Values

This method does not return a value.

Remarks

Use the IWMEncEditDecisionList.Add method to create a new EDL entry, and then use this Add method to add the following attributes for an EDL entry.

strName varValue Description
MarkIn Long Indicates the beginning of a segment to encode. This attribute is required.
MarkOut Long Indicates the end of a segment to encode. This attribute is required.
TapeID String Identifies the video tape. Use this attribute when you encode from multiple video tapes.
Description String Describes the EDL entry.

Time for mark-in and mark-out values must be specified using the following formula:
TimeValue = ( ( ( ( hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds) * 10000

To control digital devices programmatically, you must add the Windows Media Encoder Device Control reference to the project. For more information, see Programming in C#.

Example Code

using WMEncoderLib;
using WMDEVICECONTROLLib;

try
{
// Create a WMEncoder object.
WMEncoder Encoder = new WMEncoder();

// Add the device as the audio source and the video source.
IWMEncSourceGroupCollection SrcGrpColl = Encoder.SourceGroupCollection;
IWMEncSourceGroup2 SrcGrp = (IWMEncSourceGroup2)SrcGrpColl.Add("SG_1");
IWMEncSource SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
IWMEncVideoSource SrcVid = (IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud.SetInput("Device resource name", "Device", "");
SrcVid.SetInput("Device resource name", "Device", "");

// Configure the output and profile. 

// Retrieve the device control collection, then add a device to it.
IWMEncDeviceControlCollection DCColl = SrcGrp.DeviceControlCollection;
IWMEncDeviceControl DControl = DCColl.Add();
// Replace the following name with the name of your device.
DControl.SetInput("Device resource name", "DeviceControl", "");

// Initialize the encoding session.
Encoder.PrepareToEncode(true);

// Get the plug-in from the device.
IWMEncDeviceControlPlugin DCPlugin;
DCPlugin = (IWMEncDeviceControlPlugin)DControl.GetDeviceControlPlugin();

// Retrieve a WMEncEditDecisionList object from the device control plug-in. 
WMEncEditDecisionList EDList = DCPlugin.EditDecisionList;

// Create an EDL entry. 
IWMEncEditDecisionData EDData;
EDData = EDList.Add();

// Add attributes to the EDL entry specifying mark-in, mark-out, 
// tape ID, and description information.
EDData.Add ("MarkIn", 262695);
EDData.Add ("MarkOut", 267268);
EDData.Add ("TapeID", "A");
EDData.Add ("Description", "Scene 1");
  
// Add another EDL entry.
EDData = EDList.Add();
EDData.Add ("MarkIn", 362695);
EDData.Add ("MarkOut", 367268);
EDData.Add ("TapeID", "B");
EDData.Add ("Description", "Scene 2");
}

catch (Exception e)
{
     // TODO: Handle exceptions.
}

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also