IWMSPublishingPoints::Add
Previous | Next |
IWMSPublishingPoints::Add
The Add method creates a new IWMSPublishingPoint interface and adds it to the IWMSPublishingPoints collection.
Syntax
HRESULT Add( BSTR szName, WMS_PUBLISHING_POINT_CATEGORY Category, BSTR Path, IWMSPublishingPoint** ppNewVRoot );
Parameters
szName
[in] BSTR containing the name of a publishing point to be added. The maximum length is 250 characters.
Category
[in] Member of a WMS_PUBLISHING_POINT_CATEGORY enumeration value specifying the type of the publishing point. This must be one of the following values. There is no default value.
Value | Description |
WMS_PUBLISHING_POINT_ON_DEMAND | Specifies an on-demand publishing point object. |
WMS_PUBLISHING_POINT_BROADCAST | Specifies a broadcast publishing point object. |
Path
[in] BSTR containing the path to the content for the publishing point.
ppNewVRoot
[out] Pointer to a pointer to an IWMSPublishingPoint interface. This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
Return code | Number | Description |
E_INVALIDARG | 0x80070057 | Indicates that the value specified for Category is not valid or that Path is a zero-length string or NULL. |
E_POINTER | 0x80004003 | Indicates that pVal is a NULL pointer argument. |
NS_E_DUPLICATE_NAME | 0xC00D0036L | Indicates that pVal is already being used by another publishing point. |
NS_E_INVALID_PUBLISHING_POINT_NAME | 0xC00D1455L | Indicates that pVal contains an invalid character. Invalid characters are: & " ' < > \ and the ANSI characters 0-31 and 127. |
NS_E_NAMESPACE_NAME_TOO_LONG | 0xC00D1392L | Indicates that pVal is longer than the maximum length allowed. |
Remarks
The name of the publishing point must be unique. You can indicate the home publishing point by specifying only the forward slash character (/). There can be only one home publishing point, and it can be either a broadcast or on-demand publishing point. A home publishing point is not mandatory, but it enables clients to connect using the shorter URL formats such as protocol://server_name
and protocol://server_name/file_name
.
Publishing point names must not contain a leading or trailing /, but a / character is permitted in the middle of a name. The following characters are not permitted:
< > \ ? % & ' # { } | ^ [ ] `
White spaces are permitted in the name, but the server will strip leading and trailing white spaces.
The path must start with an appropriate prefix to indicate the data source plug-in to use. The following table illustrates valid paths.
Path | Example |
Media file | file:://C:\wmpub\wmroot\movie.wmv
file://\\server\directory\movie.wmv |
Playlist file | file:://C:\wmpub\wmroot\playlist.wsx
file://\\server\directory\playlist.wsx |
Stream from an encoder | https://encoder:port |
Stream pushed to an encoder | push: |
Content from a publishing point on a local server | lpp://pubpoint/media.wmv |
Stream from a publishing point on a local or remote server | rtsp://server/pubpoint
https://server/pubpoint |
Stream from a station or publishing point on a version 4.1 server | https://server/stationname
https://server/pubpoint |
Media file or playlist on a local or remote server | rtsp://server/pubpoint/movie.wmv |
Playlist file from a Web server | https://server/playlist.asp
https://server/playlist.wsx |
Directory of files | file://C:\wmpub\wmroot\directory |
When the server is installed, it creates a cache publishing point and a proxy publishing point. You cannot create or delete these.
Example Code
#include <windows.h> #include <atlbase.h> // Includes CComBSTR. #include "wmsserver.h" // Declare variables and interfaces. IWMSServer *pServer; IWMSPublishingPoints *pPubPoints; IWMSPublishingPoint *pPubPoint; HRESULT hr; CComBSTR bstrName; CComBSTR bstrPath; // 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; // Add a new publishing point to the server. bstrName = "New Pub Point"; bstrPath = "c:\\wmpub\\wmroot\\"; hr = pPubPoints->Add(bstrName, WMS_PUBLISHING_POINT_BROADCAST bstrPath, &pPubPoint); if (FAILED(hr)) goto EXIT; 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
- IWMSPublishingPoint Interface
- IWMSPublishingPoint::get_Name
- IWMSPublishingPoints Interface
- IWMSPublishingPoints::Remove
Previous | Next |