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 SetInput method specifies the stream capture source.
Syntax
IWMEncSource.SetInput(strInput, strScheme, strStreamName)
Parameters
strInput
[in] String containing the full name of a plug-in or file from which the source stream is captured. Specify a plug-in name in the "scheme://resource name" format. Specify the full path name of a file. If you put only the resource name in pstrInput, the encoding process uses strScheme to find the scheme type.
strScheme
[in] String containing the scheme type. If you supply a value for this parameter, the encoding process uses strInput to form a "scheme://resource name" plug-in identifier without parsing the stream. This is useful if the resource part of the string contains special characters or symbols that cannot be interpreted as part of a standard URL.
strStreamName
[in] String containing the name of a stream. Use this parameter to identify specific information for a plug-in object. Currently, this parameter is not used.
Return Values
If this method fails, it returns an error number.
| Number | Description |
| 0xC00D0011 | This method cannot be called if the encoder engine is running. |
Remarks
Images with odd-sized dimensions are not supported. For example, an image that is 300 by 321 pixels generates an error, but an image that is 300 by 320 pixels does not.
When using HTML as a source, only the scheme is used; for example, use "FileTransfer://placeholdertext" as strInput.
Example Code
' Create a WMEncoder object.
Dim Encoder As WMEncoder
Set Encoder = New WMEncoder
' Declare objects and variables.
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup
Dim SrcAud As IWMEncSource
Dim SrcVid As IWMEncVideoSource
Dim ProColl As IWMEncProfileCollection
Dim Pro As IWMEncProfile
Dim i As Integer
' Create an IWMEncSourceGroupCollection object.
Set SrcGrpColl = Encoder.SourceGroupCollection
' Create an IWMEncSourceGroup object.
Set SrcGrp = SrcGrpColl.Add("SG_1")
' Create an audio and a video source object.
Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
' Loop through the collection of system profiles to set
' a specific profile into the source group object.
Set ProColl = Encoder.ProfileCollection
For i = 0 To ProColl.Count - 1
Set Pro = ProColl.Item(i)
If Pro.Name = "Windows Media Video 8 for Local Area Network (384 Kbps)") Then
SrcGrp.Profile = Pro
Exit For
End If
Next
' Specify live stream capture from the installed video
' and audio cards.
SrcVid.SetInput "DEVICE://Default_Video_Device"
SrcAud.SetInput("Device://Default_Audio_Device")
' 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)
Requirements
Reference: Windows Media Encoder
Library: wmenc.exe
See Also
.gif)