IWMEncSourcePluginInfoManager.length

Windows Media Encoder SDK banner art

The length property retrieves the number of installed source plug-ins.

Syntax

int = IWMEncSourcePluginInfoManager.length;

Parameters

This property takes no parameters.

Property Value

An Int32 type that indicates the number of registered plug-ins.

Remarks

This property is read-only. This is the JScript version of the IWMEncSourcePluginInfoManager.Count method and is provided for JScript developers.

Example Code

using WMEncoderLib;

try
{
// Declare objects and variables.
WMEncoder Encoder;
int iPIndex;
int iRIndex;
string sScheme;
string sResource;
IWMEncSourcePluginInfoManager SrcPlugMgr;
IWMEncPluginInfo PlugInfo;

// Create a WMEncoder object and retrieve an
// IWMEncSourcePluginInfoManager object from it.
Encoder = new WMEncoder();
SrcPlugMgr = Encoder.SourcePluginInfoManager;

// Loop through the source plug-ins. Call the Item method on each
// plug-in to retrieve an IWMEncPluginInfo object. Use the
// SchemeType property to retrieve a string containing the scheme
// type of the plug-in. If the scheme type is "DEVICE" and if the
// plug-in supports resources, call the Item method to retrieve a
// string identifying the resource.
// To capture streams from an attached device, you must choose a
// specific device plug-in.
for (iPIndex = 0; iPIndex < SrcPlugMgr.Count; iPIndex++)
{
    PlugInfo = SrcPlugMgr.Item(iPIndex);
    sScheme = PlugInfo.SchemeType;
    if (sScheme == "DEVICE")
    {
        if (PlugInfo.Resources == true)
        {
            for (iRIndex = 0; iRIndex < PlugInfo.Count; iRIndex++)
            {
                sResource = PlugInfo.Item(iRIndex);
            }
        }
    }
}

// Choose one of the device plug-ins identified in the previous
// step. For example, you can choose "DEVICE://Default_Video_Device"
// if you have a video capture card attached to your computer.
// Declare a source group object and a source group collection object.
// Get the source group collection object from the WMEncoder object.
IWMEncSourceGroupCollection SrcGrpColl;
IWMEncSourceGroup SrcGrp;
SrcGrpColl = Encoder.SourceGroupCollection;

// Add an empty source group to the source group collection.
SrcGrp = SrcGrpColl.Add("SG_1");

// Add video and audio streams to the new source group.
IWMEncSource SrcAud;
IWMEncSource SrcVid;
SrcVid = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);

// Specify the plug-in to use for capturing streams from the
// video card.
SrcVid.SetInput("Default_Video_Device", "Device", "");
SrcAud.SetInput("Default_Audio_Device", "Device", "");

// Specify a broadcast port number, select a profile for
// the source group, and start the encoding process.
}

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

Requirements

Reference: Windows Media Encoder

Namespace: WMEncoderLib

Assembly: Interop.WMEncoderLib.dll

Library: WMEncoderLib.dll

See Also