Share via


WMEncStreamEdit.AddStream

Windows Media Encoder SDK banner art

The AddStream method adds a stream from a specified file.

Syntax

WMEncStreamEdit.AddStream(strInputFile, enumSrcType, lInputAudienceIndex, iInputRenderSite, strlInputLangId, lOutputAudienceIndex, iOutputRenderSite)

Parameters

strInputFile

[in]  String containing the file name and path of a source file.

enumSrcType

[in]  Member of a WMENC_SOURCE_TYPE enumeration type identifying the media stream type. This must be a bitwise OR 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.

lInputAudienceIndex

[in]  Long containing the audience index of the source stream.

iInputRenderSite

 [in]  Integer containing the audience stream index of the source. Because an audience can only contain one stream of each type, iRenderSiteIndex must be 0.

strlInputLangId

[in]  Long containing the input language locale ID. For example, English is 1033.

lOutputAudienceIndex

[in]  Long containing the audience index of the destination stream.

iOutputRenderSite

[in]  Integer containing the audience stream index of the destination. Because an audience can only contain one stream of each type, iRenderSiteIndex must be 0.

Return Values

This method does not return a value.

Remarks

Use the AddStream method to add streams from one or more source files, and specify where you want the stream to be in the output file. For example, your source is an MBR file with two audiences and you want to separate the second audience into a separate file. You need to add the audio and video streams from the second audience and specify their destination as the first audience of the output file.

Example Code

' Create a WMEncStreamEdit object.
  Dim Stream As WMEncStreamEdit
  Set Stream = New WMEncStreamEdit

' This example assumes that you have a source file with two audiences.
' Create a new file using the audio from the first audience and the
' video from the second audience, as follows:

' Add the audio stream from the first audience.
  Stream.AddStream "C:\Source.wmv", WMENC_AUDIO, 0, 0, 1033, 0, 0

' Add the video stream from the second audience.
  Stream.AddStream "C:\Source.wmv", WMENC_VIDEO, 1, 0, 1033, 0, 0

' Specify the output file.
  Stream.OutputFile = "C:\Output.wmv"

' Validate the current settings. 
  Stream.Validate

' Start the stream edit process.
  Stream.Start

' Retrieve the run state.
  Dim SERunState as WMENC_BASICEDIT_STATE
  SERunState = Stream.RunState

' You can use a timer to retrieve the percentage complete.
  Dim lPercentComplete As Long
  lPercentComplete = Stream.ProgressPercent

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also