Share via


IWMEncProfileCollection.Item

Windows Media Encoder SDK banner art

The Item method retrieves a specific profile from the collection.

Syntax

IWMEncProfile = IWMEncProfileCollection.Item(lIndex)

Parameters

lIndex

[in]  Long containing the index into the profile collection.

Return Values

This method returns an IWMEncProfile object corresponding to lIndex.

Remarks

The input parameter is an integer index into the collection of profiles. If you don't already know the index associated with profile you want, you must iterate through the collection starting at item 0. On each iteration increment lIndex, and use the Item method to retrieve a pointer to a profile. Call the IWMEncProfile.Name property to find the name of the current profile and compare the name retrieved to that needed. Exit the loop when a match is found.

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)

' Specify the .avi source file.
SrcAud.SetInput "C:\filename.avi"
SrcVid.SetInput "C:\filename.avi"

' Loop through the collection of system profiles to set
' a specific profile into the source group object.
Dim sProDesc As String
Dim lMaxPacketSz As Long
Dim iMediaCount As Integer
Dim bMultiBitRate As Boolean

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
        sProDesc = Pro.Description
        lMaxPacketSz = Pro.MaxPacketSize
        iMediaCount = Pro.MediaCount(WMENC_VIDEO)
        bMultiBitRate = Pro.MultipleBitrate
        Exit For
    End If
Next

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also