WMEncoder.SetWatermark
The SetWatermark method specifies the watermark to use in the current encoding session.
Syntax
WMEncoder.SetWatermark(enumSourceType, iIndex, strWatermarkName, strCLSID, strConfigFile)
Parameters
enumSourceType
[in] Specifies a member of the WMENC_SOURCE_TYPE enumeration type.
iIndex
[in] Integer containing the index.
strWatermarkName
[in] String containing the watermark name.
strCLSID
[in] String containing the CLSID.
strConfigFile
[in] String specifying the configuration file.
Return Values
If this method fails, it returns an error number.
Return code | Number | Description |
NS_E_INVALIDCALL_WHILE_ENCODER_RUNNING | 0xC00D1B66L | The encoding process must be stopped before calling this method. |
E_INVALIDARG | 0x80070057 | Invalid argument:
|
Remarks
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
Requirements
Reference: Windows Media Encoder
Library: wmenc.exe
See Also