Share via


IWMSBroadcastPublishingPoint::Start

banner art

Previous Next

IWMSBroadcastPublishingPoint::Start

The Start method starts the broadcasting publishing point.

Syntax

  HRESULT Start( );

Parameters

This method takes no parameters.

Return Values

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 that was 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_INVALID_PUSH_PUBLISHING_POINT_START_REQUEST 0xC00D145BL The publishing point is configured for push distribution and it can be started only by an encoder.
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.

Remarks

The Start method begins streaming the content that is referenced in the IWMSPublishingPoint::get_Path method. If the Path property references a playlist, an IWMSPlaylist interface interface is created, and the publishing point begins streaming the content that was indicated by the playlist. If the Path property references a file, the server begins streaming content from the file. If the Path property references a directory, the server begins streaming the media files in that directory and subdirectories as if the directory is a playlist.

Example Code

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer                    *pServer;
IWMSPublishingPoints          *pPubPoints;
IWMSPublishingPoint           *pPubPoint;
IWMSBroadcastPublishingPoint  *pBCPubPoint;

HRESULT         hr;
CComVariant     varIndex;
long            lCount;

// 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 number of publishing points.
hr = pServer->get_PublishingPoints(&pPubPoints);
if (FAILED(hr)) goto EXIT;
hr = pPubPoints->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Retrieve each publishing point and query the
// IWMSBroadcastPublishingPoint interface.
for (long x = 0; x < lCount; x++)
{
    varIndex = x;
    hr = pPubPoints->get_Item(varIndex, &pPubPoint);
    if (FAILED(hr)) goto EXIT;

    // Retrieve the type of publishing point.
    WMS_PUBLISHING_POINT_TYPE pptType;
    hr = pPubPoint->get_Type(&pptType);
    if (FAILED(hr)) goto EXIT;

    if (pptType == WMS_PUBLISHING_POINT_TYPE_BROADCAST)
    {
        hr = pPubPoint->QueryInterface(IID_IWMSBroadcastPublishingPoint,
                                      (void **)&pBCPubPoint);
        if (FAILED(hr)) goto EXIT;

        // Retrieve the current status of the publishing point.
        // The status is reported as the result of a bitwise OR
        // of any of the designated values.
        WMS_BROADCAST_PUBLISHING_POINT_STATUS ppsStatus;
        hr = pBCPubPoint->get_BroadcastStatus(&ppsStatus);
        if (FAILED(hr)) goto EXIT;

        // If the publishing point is currently stopped, start it.
        if (ppsStatus == WMS_BROADCAST_PUBLISHING_POINT_STOPPED)
        {
            hr = pBCPubPoint->Start();
            if (FAILED(hr)) goto EXIT;
        }
        pBCPubPoint->Release();
    }

    // Release temporary COM objects.
    pPubPoint->Release();
}

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.

See Also

Previous Next