IWMEncWatermarkCollection.Item
![]() |
The Item method retrieves a specific watermark item.
Syntax
string IWMEncWatermarkCollection.Item(
int iIndex,
out object pvarCLSID
);
Parameters
iIndex
[in] Int32 specifying the index.
pvarCLSID
[out] Object specifying the class ID.
Return Values
This method returns a String type.
Remarks
Use the WMEncoder.SetWatermark method to specify which watermarks to use for the current encoding session.
Example Code
using WMEncoderLib;
try
{
// Create a WMEncoder object.
WMEncoder Encoder;
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.
IWMEncWatermarkCollection WMCollAud;
IWMEncWatermarkCollection WMCollVid;
WMCollAud = Encoder.get_WatermarkCollection(WMENC_SOURCE_TYPE.WMENC_AUDIO);
WMCollVid = Encoder.get_WatermarkCollection(WMENC_SOURCE_TYPE.WMENC_VIDEO);
// Retrieve the number of audio and video watermarks in the registry.
int lWatercountAud;
int lWatercountVid;
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.
string sAudioWatermark;
string sVideoWatermark;
string sWatermarkConfig;
object vWatermarkID;
// Retrieve the name of the first audio watermark in the collection.
sAudioWatermark = WMCollAud.Item(0, out vWatermarkID);
// Retrieve the name of the first video watermark in the collection.
sVideoWatermark = WMCollVid.Item(0, out 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_SOURCE_TYPE.WMENC_AUDIO, 0, sAudioWatermark, vWatermarkID.ToString(), sWatermarkConfig);
Encoder.SetWatermark(WMENC_SOURCE_TYPE.WMENC_VIDEO, 0, sVideoWatermark, vWatermarkID.ToString(), sWatermarkConfig);
}
catch (Exception e)
{
// TODO: Handle exceptions.
}
Requirements
Reference: Windows Media Encoder
Namespace: WMEncoderLib
Assembly: Interop.WMEncoderLib.dll
Library: WMEncoderLib.dll
See Also
.gif)