IWMEncInputCollection.Count

Windows Media Encoder SDK banner art

The Count property retrieves the number of TV inputs in the input collection.

Syntax

Long = IWMEncInputCollection.Count

Parameters

This property takes no parameters.

Property Value

A Long that indicates the number of items in the collection.

Remarks

This property is read-only.

Example Code

' Create a WMEncoder object.
  Dim Encoder As WMEncoder
  Set Encoder = New WMEncoder

' Create a source group and add the sources.
  Dim SrcGrpColl As IWMEncSourceGroupCollection
  Dim SrcGrp As IWMEncSourceGroup
  Dim SrcAud As IWMEncAudioSource
  Dim SrcVid As IWMEncVideoSource2
  Set SrcGrpColl = Encoder.SourceGroupCollection
  Set SrcGrp = SrcGrpColl.Add("SG_1")
  Set SrcAud = SrcGrp.AddSource(WMENC_AUDIO)
  Set SrcVid = SrcGrp.AddSource(WMENC_VIDEO)
  SrcAud.SetInput "Device://Default_Audio_Device"
  SrcVid.SetInput "Device://Default_Video_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.
  Dim InputColl As IWMEncInputCollection
  Set InputColl = SrcVid.EnumerateInputs
  For x = 0 To InputColl.Count - 1
    If InputColl.Item(x) = "Video Tuner" Then
      SrcVid.Input = x
      Exit For
    End If
  Next x

' Specify the TV channel, pixel format, and country or region (USA).
  SrcVid.Channel = 5
  SrcVid.PixelFormat = WMENC_PIXELFORMAT_UYVY
  SrcVid.Country = 1
 
' Specify cable reception.
  SrcVid.TVType = 0

' Specify the NTSC TV format.
  SrcVid.TVFormat = 1

' Start encoding.
  Encoder.Start

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also