IWMSAnnouncementStreamFormats Interface

banner art

Previous Next

IWMSAnnouncementStreamFormats Interface

The IWMSAnnouncementStreamFormats object contains a collection of media file paths and URLs. The files contain format information used to configure a multicast broadcast. Format information includes the codecs, bit rate, screen size, and so on, contained in the file header. One file per format must be specified. For example, if the multicast is made up of three files encoded in one format and five files encoded in another format, only two file paths must be added to the IWMSAnnouncementStreamFormats object, one for each format.

If a file path is added to the collection, it must identify a Windows Media file, a multicast configuration (.nsc) file, or a stream format file from Windows Media Encoder. If a URL is added to the collection, it must identify a single source such as a live Windows Media Encoder stream or a Windows Media file on an upstream server. However, it is not recommended that you specify a server-side playlist. The format added to the collection will be that represented by only the first entry in the playlist.

When a path or URL is added to the collection, the associated file is parsed to extract the format that a player must use to receive and render the content. The IWMSBroadcastPublishingPoint::Announce method adds the parsed information to the multicast configuration for the broadcast publishing point, the IWMSBroadcastPublishingPoint.AnnounceToNSCFile method generates a multicast announcement (.nsc) file, and the IWMSBroadcastPublishingPoint.AnnounceToNSCStream method generates multicast announcement information in an IStream object.

  • Note   This interface is available only on Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition, and Windows Server 2008.

In addition to the methods inherited from IDispatch, the IWMSAnnouncementStreamFormats interface exposes the following methods.

Method Description
Add Adds a file name to the IWMSAnnouncementStreamFormats collection.
get_Count Retrieves the number of file names in the IWMSAnnouncementStreamFormats collection.
get_Item Retrieves a specific media file name, by index, from the IWMSAnnouncementStreamFormats collection.
get_length Retrieves the number of file names in the IWMSAnnouncementStreamFormats collection. This method is provided for JScript compatibility.
Remove Removes a file name, by index, from the IWMSAnnouncementStreamFormats collection.
RemoveAll Removes all file names from the IWMSAnnouncementStreamFormats collection.

Example Code

The following example illustrates how to retrieve a pointer to an IWMSAnnouncementStreamFormats interface.

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

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

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;
    hr = pPubPoint->QueryInterface(IID_IWMSBroadcastPublishingPoint,
                                  (void **)&pBCPubPoint);
    if (FAILED(hr)) goto EXIT;

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

    if (SUCCEEDED(hr))
        break;
}

// Retrieve a pointer to the IWMSAnnouncementStreamFormats
// interface.
hr = pBCPubPoint->get_AnnouncementStreamFormats(&pAnnounceStreamFormats);
if (FAILED(hr)) goto EXIT;

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

See Also

Previous Next