IWMEncSourceGroup.get_Source
The get_Source method retrieves a specific media stream from the source group.
Syntax
IWMEncSource IWMEncSourceGroup.get_Source(
WMENC_SOURCE_TYPE enumType,
short iIndex
);
Parameters
enumType
[in] Member of a WMENC_SOURCE_TYPE enumeration type identifying the type of source stream.
iIndex
[in] Int16 containing an index used to identify a stream when multiple streams of the same type exist. Since a source group cannot currently support multiple streams of the same type, this parameter must be 0.
Return Values
An IWMEncSource object.
If this property fails, it returns an error number.
Number | Description |
0xC00D1B5A | No matching media source is found in source group. |
Remarks
This property is read-only.
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;
IWMEncSource Src;
IWMEncProfileCollection ProColl;
IWMEncProfile Pro;
// 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("Default_Audio_Device", "Device", "");
SrcVid.SetInput("Default_Video_Device", "Device", "");
// Set the profile to the first one in the collection.
Pro = Encoder.ProfileCollection.Item(0);
SrcGrp.set_Profile(Pro);
// Retrieve the audio source.
Src = SrcGrp.get_Source(WMENC_SOURCE_TYPE.WMENC_AUDIO, 0);
// Start the encoding process.
SrcGrp.PrepareToEncode(true);
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
Requirements
Reference: Windows Media Encoder
Namespace: WMEncoderLib
Assembly: Interop.WMEncoderLib.dll
Library: WMEncoderLib.dll
See Also