IWMEncSourcePluginInfoManager.Refresh

Windows Media Encoder SDK banner art

The Refresh method removes the old collection and populates a new collection of source plug-in information structures.

Syntax

IWMEncSourcePluginInfoManager.Refresh

Parameters

This method takes no parameters.

Return Values

This method does not return a value.

Remarks

Use this method to re-create a plug-in registration collection when you either add or remove a plug-in.

Example Code

' Declare objects and variables.
Dim Encoder As WMEncoder
Dim iPIndex  As Integer
Dim iRIndex As Integer
Dim sScheme As String
Dim sResource As String
Dim SrcPlugMgr As IWMEncSourcePluginInfoManager
Dim PlugInfo As IWMEncPluginInfo

' Create a WMEncoder object and retrieve an
' IWMEncSourcePluginInfoManager object from it.
Set Encoder = New WMEncoder
Set SrcPlugMgr = Encoder.SourcePluginInfoManager

' Loop through the source plug-ins. Call the Item method on each
' plug-in to retrieve an IWMEncPluginInfo object. Use the
' SchemeType property to retrieve a string containing the scheme
' type of the plug-in. If the scheme type is "DEVICE" and if the
' plug-in supports resources, call the Item method to retrieve a
' string identifying the resource.
' To capture streams from an attached device, you must choose a
' specific device plug-in.
For iPIndex  = 0 To SrcPlugMgr.Count - 1
    Set PlugInfo = SrcPlugMgr.Item(iPIndex )
    sScheme = PlugInfo.SchemeType
    If sScheme = "DEVICE" Then
        If PlugInfo.Resources = True Then
            For iRIndex = 0 To PlugInfo.Count - 1
                sResource = PlugInfo.Item(iRIndex)
            Next
        End If
    End If
Next

' If you add or remove a plug-in, update the collection.
SrcPlugMgr.Refresh

' Choose one of the device plug-ins identified in the preceding
' step. For example, you can choose "DEVICE://Default_Video_Device"
' if you have a video capture card attached to your computer.
' Declare a source group object and a source group collection object.
' Get the source group collection object from the WMEncoder object.
Dim SrcGrpColl As IWMEncSourceGroupCollection
Dim SrcGrp As IWMEncSourceGroup
Set SrcGrpColl = Encoder.SourceGroupCollection

' Add an empty source group to the source group collection.
Set SrcGrp = SrcGrpColl.Add("SG_1")

' Add video and audio streams to the new source group.
Dim SrcAud As IWMEncSource
Dim SrcVid As IWMEncSource
Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)

' Specify the plug-in to use for capturing streams from the
' video card.
SrcVid.SetInput "DEVICE://Default_Video_Device"
SrcAud.SetInput "DEVICE://Default_Audio_Device"

' Specify a broadcast port number, select a profile for
' the source group, and start the encoding process.

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also