Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
![]() |
The Item method retrieves the TV input identified by a specific integer index.
Syntax
string IWMEncInputCollection.Item(
int lIndex
);
Parameters
lIndex
[in] Int32 containing the index of the input item to retrieve.
Return Values
This method returns a String containing the item name.
Example Code
using WMEncoderLib;
try
{
// Create a WMEncoder object.
WMEncoder Encoder;
Encoder = new WMEncoder();
// Create a source group and add the sources.
IWMEncSourceGroupCollection SrcGrpColl;
IWMEncSourceGroup SrcGrp;
IWMEncSource SrcAud;
IWMEncVideoSource2 SrcVid;
SrcGrpColl = Encoder.SourceGroupCollection;
SrcGrp = SrcGrpColl.Add("SG_1");
SrcAud = SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_AUDIO);
SrcVid = (IWMEncVideoSource2)SrcGrp.AddSource(WMENC_SOURCE_TYPE.WMENC_VIDEO);
SrcAud.SetInput("Default_Audio_Device", "Device", "");
SrcVid.SetInput("Default_Video_Device", "Device", "");
// Configure the output and profile for the encoding session.
// Initialize the encoding process.
Encoder.PrepareToEncode(true);
// Enumerate the type of inputs supported by the TV-tuner capture card.
// Find and select the Video Tuner input.
IWMEncInputCollection InputColl;
InputColl = SrcVid.EnumerateInputs();
for (x = 0; x< InputColl.Count; x++)
{
if (InputColl.Item(x) == "Video Tuner")
{
SrcVid.Input = x;
break;
}
}
// Specify the TV channel, pixel format, and country/region (USA).
SrcVid.Channel = 5;
SrcVid.PixelFormat = WMENC_PIXELFORMAT_VIDEO.WMENC_PIXELFORMAT_UYVY;
SrcVid.Country = 1;
// Specify cable reception.
SrcVid.TVType = 0;
// Specify the NTSC TV format.
SrcVid.TVFormat = 1;
// Start encoding.
Encoder.Start();
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
Requirements
Reference: Windows Media Encoder
Namespace: WMEncoderLib
Assembly: Interop.WMEncoderLib.dll
Library: WMEncoderLib.dll
See Also
.gif)