IWMSBroadcastPublishingPoint::StartArchive
The StartArchive method begins saving the streamed content to a file.
HRESULT StartArchive( );
Arguments
This method takes no parameters.
Return Value
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code |
Number |
Description |
---|---|---|
E_ACCESSDENIED |
0x8007000E |
The account that the WMS service is running under does not have access rights to the content requested. |
ERROR_FILE_NOT_FOUND |
0x00000002 |
The server was not able to find the file that was referenced by the Path property of the publishing point. |
ERROR_PATH_NOT_FOUND |
0x00000003 |
The server was not able to find the path that was referenced by the Path property of the publishing point. |
NS_E_CANNOTCONNECT |
0xC00D0006L |
The destination server that was indicated in the path property exists but the server was unable to establish a connection to the destination server. |
NS_E_EMPTY_PLAYLIST |
0xC00D14B5L |
The playlist that the server is attempting to stream does not reference any media streams or files. |
NS_E_FILE_NOT_FOUND |
0xC00D001AL |
The server was not able to find the file that was referenced by the Path property of the publishing point. |
NS_E_INCOMPATIBLE_SERVER |
0xC00D2EE8L |
The server that the publishing point attempted to connect to does not support the requested action. |
NS_E_MEDIA_PARSER_INVALID_FORMAT |
0xC00D1581L |
The server cannot stream the selected file because it is either damaged or corrupted. |
NS_E_MMS_NOT_SUPPORTED |
0xC00D2EFAL |
The MMS protocol is not supported. |
NS_E_PLAYLIST_PARSE_FAILURE |
0xC00D14B6L |
The playlist that the server is attempting to parse contains a syntax error. |
NS_E_PLAYLIST_PLUGIN_NOT_FOUND |
0xC00D157FL |
The server was not able to find a playlist parser plug-in to access the playlist that was referenced by the Path property of the publishing point. |
NS_E_PUBLISHING_POINT_REMOVED |
0xC00D145AL |
The publishing point has already been removed. |
NS_E_SERVER_NOT_FOUND |
0xC00D0035L |
The server was not able to find the server that was specified in the Path property of the publishing point. |
NS_E_SOURCE_PLUGIN_NOT_FOUND |
0xC00D157EL |
The server was not able to find a data source plug-in to access the data that was referenced by the Path property of the publishing point. |
NS_E_WSX_INVALID_VERSION |
0xC00D151EL |
The version of the playlist that the server is attempting to stream is either not supported by the server or is not valid. Version information in a playlist is indicated by the <WSX> element. |
NS_S_PUBLISHING_POINT_STARTED_WITH_FAILED_SINKS |
0x000D1519L |
At least one data sink started but one or more failed to start. |
E_NOTIMPL |
0x80004001 |
The default archiving plug-in is not enabled. |
Remarks
If the broadcast publishing point is stopped and you call the StartArchive method before calling IWMSBroadcastPublishingPoint::Start, the server automatically starts the publishing point.
Example
#include <windows.h>
#include <atlbase.h>
#include "wmsserver.h"
// Declare variables and interfaces.
IWMSServer *pServer;
IWMSPublishingPoints *pPubPoints;
IWMSPublishingPoint *pPubPoint;
IWMSBroadcastPublishingPoint *pBCPubPoint;
IWMSPlugins *pPlugins;
IWMSPlugin *pPlugin;
HRESULT hr;
CComVariant varIndex;
CComBSTR bstrPath;
VARIANT_BOOL bEnabled = VARIANT_FALSE;
// 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 and retrieve the sample broadcast
// publishing point.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;
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;
// Stop the publishing point.
hr = pBCPubPoint->Stop();
if (FAILED(hr)) goto EXIT;
// Specify the publishing point path.
bstrPath = "C:\\WMPub\\WMRoot\\Serverside_Playlist.wsx";
hr = pBCPubPoint->put_Path(bstrPath);
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 WMS Archive Data Writer plug-in. This is the
// default archive plug-in for the publishing point.
varIndex = "WMS Archive Data Writer";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;
// Make sure the plug-in is enabled.
hr = pPlugin->get_Enabled(&bEnabled);
if (FAILED(hr)) goto EXIT;
if (!bEnabled)
{
hr = pPlugin->put_Enabled(VARIANT_TRUE);
if (FAILED(hr)) goto EXIT;
}
// Restart the publishing point and begin archiving.
hr = pBCPubPoint->StartArchive();
if (FAILED(hr)) goto EXIT;
// Record for 10 seconds.
Sleep(10000);
// Stop archiving. This does stop the publishing point.
hr = pBCPubPoint->StopArchive();
EXIT:
// TODO: Release temporary COM objects and uninitialize COM.
Requirements
Header: wmsserver.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003 family, Windows Server 2008 family.