IWMEncProfileCollection.Count
The Count property retrieves the number of profiles in the collection.
Syntax
int = IWMEncProfileCollection.Count;
Parameters
This property takes no parameters.
Property Value
An Int32 type containing the number of profiles in the collection.
Remarks
This property is read-only. This method is the C# version of the JScript IWMEncProfileCollection.length method.
Example Code
using WMEncoderLib;
try
{
// Create a WMEncoder object.
WMEncoder Encoder;
Encoder = new WMEncoder();
// Declare objects and variables.
IWMEncSourceGroupCollection SrcGrpColl;
IWMEncSourceGroup SrcGrp;
IWMEncSource SrcAud;
IWMEncVideoSource SrcVid;
IWMEncProfileCollection ProColl;
IWMEncProfile Pro;
int i;
// Create an IWMEncSourceGroupCollection object.
SrcGrpColl = Encoder.SourceGroupCollection;
// Create an IWMEncSourceGroup object.
SrcGrp = SrcGrpColl.Add("SG_1");
// Create an audio and a video source object.
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcVid = (IWMEncVideoSource)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
// Specify the .avi source file.
SrcAud.SetInput("C:\\filename.avi", "", "");
SrcVid.SetInput("C:\\filename.avi", "", "");
// Loop through the collection of system profiles to set
// a specific profile into the source group object.
string sProDesc;
int lMaxPacketSz;
int iMediaCount;
bool bMultiBitRate;
ProColl = Encoder.ProfileCollection;
for (i = 0; i < ProColl.Count; i++)
{
Pro = ProColl.Item(i);
if (Pro.Name == "Windows Media Video 8 for Local Area Network (384 Kbps)")
{
SrcGrp.set_Profile(Pro);
sProDesc = Pro.Description;
lMaxPacketSz = Pro.MaxPacketSize;
iMediaCount = Pro.get_MediaCount(WMENC_SOURCE_TYPE.WMENC_VIDEO);
bMultiBitRate = Pro.MultipleBitrate;
break;
}
}
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
Requirements
Reference: Windows Media Encoder
Namespace: WMEncoderLib
Assembly: Interop.WMEncoderLib.dll
Library: WMEncoderLib.dll
See Also