WMS Archive Data Writer Plug-in Properties
You can use the WMS Archive Data Writer plug-in to write digital content from a broadcast publishing point to a file. For administration information about this plug-in, see Windows Media Services Help.
You can use the IWMSAdminArchiveSink interface to configure the plug-in. This interface exposes the following properties.
Property |
Description |
---|---|
ActivePath |
Retrieves the path to the content that is being archived. |
AutoStart |
Specifies and retrieves a Boolean value indicating whether archiving begins automatically when streaming begins. |
AvailableDiskSpace |
Retrieves the amount of remaining disk space that can be used for archiving. |
Bandwidth |
Retrieves the current bandwidth of the content being archived. |
ElapsedTime |
Retrieves the amount of time that the archiving process has been running. |
IsRecording |
Retrieves a Boolean value indicating whether the archiving process is running. |
Path |
Specifies and retrieves the template path to which content is being archived. |
The IWMSAdminArchiveSink interface also exposes the following methods.
Method |
Description |
---|---|
ExpandTemplate |
Retrieves the expanded form of a tokenized template path. |
StartRecord |
Starts the archiving process. |
StopRecord |
Stops the archiving process. |
The following examples illustrate how to specify the archive path. This is any valid path that can be passed to the Win32 CreateFile function. The path consists internally of a file name template and a path template. For more information, see IWMSAdminArchiveSink.PathIWMSAdminArchiveSink.Path (Visual Basic .NET).
Visual Basic .NET Example
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Private Sub SetArchivePluginProps()
' Declare variables.
Dim Server As WMSServer
Dim Plugin As IWMSPlugin
Dim AdminArchiveSink As IWMSAdminArchiveSink
Dim BCPubPoint As IWMSBroadcastPublishingPoint
Try
' Create a new WMSServer object.
Server = New WMSServer()
' Retrieve an existing broadcast publishing point.
BCPubPoint = Server.PublishingPoints("Sample_Broadcast")
' Retrieve the WMS Archive Data Writer plug-in.
Plugin = BCPubPoint.BroadcastDataSinks("WMS Archive Data Writer")
' Retrieve the administration interface for the plug-in.
AdminArchiveSink = Plugin.CustomInterface
' Set a Boolean value indicating whether to
' start archiving when the broadcast begins.
AdminArchiveSink.AutoStart = True
' Set the default path for archived content.
AdminArchiveSink.Path = "%SystemDrive%\WMPub\WMArchive\<V>\Archive_<Y><m><d>.wmv"
Catch excCom As COMException
' TODO: Handle COM exceptions.
Catch exc As Exception
' TODO: Handle exceptions here.
Finally
' TODO: Perform clean-up here.
End Try
End Sub
C# Example
using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;
// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSAdminArchiveSink AdminArchiveSink;
IWMSBroadcastPublishingPoint BCPubPoint;
try
{
// Create a new WMSServer object.
Server = new WMSServerClass();
// Retrieve an existing broadcast publishing point.
BCPubPoint = (IWMSBroadcastPublishingPoint)Server.PublishingPoints["Sample_Broadcast"];
// Retrieve the WMS Archive Data Writer plug-in.
Plugin = BCPubPoint.BroadcastDataSinks["WMS Archive Data Writer"];
// Retrieve the administrative interface for the plug-in.
AdminArchiveSink = (IWMSAdminArchiveSink)Plugin.CustomInterface;
// Set a Boolean value indicating whether to
// start archiving when the broadcast begins.
AdminArchiveSink.AutoStart = true;
// Set the default path for archived content.
AdminArchiveSink.Path = "%SystemDrive%\\WMPub\\WMArchive\\<V>\\Archive_<Y><m><d>.wmv";
}
catch (COMException comExc) {
// TODO: Handle COM exceptions.
}
catch (Exception exc)
{
// TODO: Handle exceptions here.
}
finally
{
// TODO: Perform clean-up here.
}
C++ Example
#include <windows.h>
#include <atlbase.h>
// To access system plug-in interfaces, the
// type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
raw_interfaces_only
// Declare variables and interface pointers.
IWMSServer* pServer = NULL;
IWMSPlugins* pPlugins = NULL;
IWMSPlugin* pPlugin = NULL;
IDispatch* pDispatch = NULL;
IWMSAdminArchiveSink* pAdminArchiveSink = NULL;
IWMSBroadcastPublishingPoint* pBCPubPoint = NULL;
IWMSPublishingPoints* pPubPoints = NULL;
IWMSPublishingPoint* pPubPoint = NULL;
CComVariant varIndex;
CComBSTR bstrPath;
HRESULT hr = S_OK;
// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
NULL,
CLSCTX_ALL,
IID_IWMSServer,
(void **)&pServer);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSPublishingPoints interface.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;
// Retrieve an existing broadcast publishing point.
varIndex = "Sample_Broadcast";
hr = pPubPoints->get_Item(varIndex, &pPubPoint);
if (FAILED(hr)) goto EXIT;
// Query the IWMSBroadcastPublishingPoint interface from
// the newly created publishing point.
hr = pPubPoint->QueryInterface(IID_IWMSBroadcastPublishingPoint,
(void **)&pBCPubPoint);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to an IWMSPlugins interface
// containing the collection of broadcast data sink plug-ins.
hr = pBCPubPoint->get_BroadcastDataSinks(&pPlugins);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSPlugin interface
// of the plug-in to be configured.
varIndex = "WMS Archive Data Writer";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the custom interface
// of the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;
// Query the specific administration interface
// for the plug-in.
hr = pDispatch->QueryInterface(IID_IWMSAdminArchiveSink,
(void **)&pAdminArchiveSink);
if (FAILED(hr)) goto EXIT;
// Set a Boolean value indicating whether to
// start archiving when the broadcast begins.
hr = pAdminArchiveSink->put_AutoStart(VARIANT_TRUE);
if (FAILED(hr)) goto EXIT;
// Set the default path for archived content.
bstrPath = "%SystemDrive%\\wmpub\\wmarchive\\<V>\\Archive_<Y><m><d>.wmv";
hr = pAdminArchiveSink->put_Path(bstrPath);
if (FAILED(hr)) goto EXIT;
EXIT:
// TODO: Release temporary COM objects and uninitialize COM.
See Also
Reference
IWMSAdminArchiveSink Interface
IWMSAdminArchiveSink Object (C#)
IWMSAdminArchiveSink Object (Visual Basic .NET)