WMEncoder.GetWatermark

Windows Media Encoder SDK banner art

The GetWatermark method retrieves the name of a watermark used in the current encoding session.

Syntax

String = WMEncoder.GetWatermark(enumSourceType, iIndex, varConfigFile, varCLSID)

Parameters

enumSourceType

[in]  Specifies a member of the WMENC_SOURCE_TYPE enumeration type indicating the type of content.

iIndex

[in]  Integer containing the index.

varConfigFile

[out]  Variant specifying the configuration file.

varCLSID

[out]  Variant specifying the CLSID.

Return Values

This method returns a String containing the name of the watermark, a Variant specifying the configuration file, and a Variant specifying the CLSID.

If this method fails, it returns an error number.

Return code Number Description
E_INVALIDARG 0x80070057 Invalid argument:
  • iIndex is not 0.
  • The enumSourceType is invalid.

Remarks

Use this method to find out which watermarks are being used in the current encoding session. To determine the index, use the IWMEncWatermarkCollection.Count property.

Example Code

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

' Configure the encoding session, including the sources, output, and
' profile.

' Declare variables and create objects to hold the audio and video
' watermark collections.
  Dim WMCollAud As IWMEncWatermarkCollection
  Dim WMCollVid As IWMEncWatermarkCollection
  Set WMCollAud = Encoder.WatermarkCollection(WMENC_AUDIO)
  Set WMCollVid = Encoder.WatermarkCollection(WMENC_VIDEO)

' Retrieve the number of audio and video watermarks in the registry. 
  Dim lWatercountAud As Long, lWatercountVid As Long
  lWatercountAud = WMCollAud.Count
  lWatercountVid = WMCollVid.Count
 
' Declare variables for the name of the audio watermark, the name of the
' video watermark, the configuration file, and a placeholder for a CLSID.
  Dim sAudioWatermark As String
  Dim sVideoWatermark As String
  Dim sWatermarkConfig As String
  Dim vWatermarkID As Variant

' Retrieve the name of the first audio watermark in the collection.
  sAudioWatermark = WMCollAud.Item(0, vWatermarkID)

' Retrieve the name of the first video watermark in the collection.
  sVideoWatermark = WMCollVid.Item(0, vWatermarkID)

' Specify the location of the watermark configuration file.
  sWatermarkConfig = "REPLACE WITH A PATH AND FILENAME"

' Set the audio and video watermarks into the WMEncoder object.
  Encoder.SetWatermark WMENC_AUDIO, 0, sAudioWatermark, _
  vWatermarkID, sWatermarkConfig
  Encoder.SetWatermark WMENC_VIDEO, 0, sVideoWatermark, _
  vWatermarkID, sWatermarkConfig

' Retrieve the names of the watermarks being used in the current session.
  MsgBox Encoder.GetWatermark(WMENC_AUDIO, 0, sWatermarkConfig, sAudioWatermark)
  MsgBox Encoder.GetWatermark(WMENC_VIDEO, 0, sWatermarkConfig, sVideoWatermark)

Requirements

Reference: Windows Media Encoder

Library: wmenc.exe

See Also