Share via


IWMEncSource.Type

Windows Media Encoder SDK banner art

The Type property retrieves the media stream type.

Syntax

WMENC_SOURCE_TYPE = IWMEncSource.Type;

Parameters

This property takes no parameters.

Property Value

A member of the WMENC_SOURCE_TYPE enumeration that indicates the media type of the current source. This must be one of the following values.

Value Number Description
WMENC_AUDIO 1 Identifies an audio stream.
WMENC_VIDEO 2 Identifies a video stream.
WMENC_SCRIPT 4 Identifies a text stream.

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);

// Loop through the collection of system profiles to set
// a specific profile into the source group object.

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);
        break;
    }
}

// Specify audio and video sources.

SrcVid.SetInput("C:\\InputFile.mpg", "", "");
SrcAud.SetInput("C:\\InputFile.mpg", "", "");

// Verify that the repeat property is turned off. This is
// the default.

SrcVid.Repeat = false;
SrcAud.Repeat = false;

// Start the encoding process 10 seconds after the source
// has started, and stop the encoding process 25 seconds
// after the source has started.

SrcVid.MarkIn = 10000;
SrcAud.MarkIn = 10000;
SrcVid.MarkOut = 25000;
SrcAud.MarkOut = 25000;

// 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