Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IWMSActiveStream::get_Type
The get_Type method retrieves an enumeration value that indicates whether the stream is audio or video.
Syntax
HRESULT get_Type( WMS_ACTIVE_STREAM_TYPE* pVal );
Parameters
pVal
[out] Pointer to a member of a WMS_ACTIVE_STREAM_TYPE enumeration type indicating whether the stream is audio or video. This must be one of the following values.
| Value | Description |
| WMS_STREAM_TYPE_VIDEO | The stream is video. |
| WMS_STREAM_TYPE_AUDIO | The stream is audio. |
| WMS_STREAM_TYPE_OTHER | The stream is neither audio nor video. For example, it might be a script stream. |
Return Values
If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.
| Return code | Number | Description |
| E_POINTER | 0x80004003 | pVal is a NULL pointer argument. |
Example Code
#include <windows.h>
#include <atlbase.h> // Includes CComVariant.
#include "wmsserver.h"
// Declare variables and interfaces.
HRESULT hr;
IWMSServer *pServer;
IWMSPlayers *pPlayers;
IWMSPlayer *pPlayer;
IWMSPlaylist *pPlaylist;
IWMSActiveMedia *pActiveMedia;
IWMSActiveStreams *pActiveStreams;
IWMSActiveStream *pActiveStream;
CComVariant varIndex;
long lCount;
// Initialize the COM library and retrieve a pointer
// to the 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 IWMSPlayers interface
// and retrieve the number of connected players.
hr = pServer->get_Players(&pPlayers);
if (FAILED(hr)) goto EXIT;
hr = pPlayers->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// If players are connected, retrieve a pointer to
// an IWMSPlayer interface containing the first player.
if (lCount > 0)
{
varIndex = 0;
hr = pPlayers->get_Item(varIndex, &pPlayer);
if (FAILED(hr)) goto EXIT;
}
// Retrieve the playlist for the player.
// NOTE: A valid playlist file is not always returned. This may be
// the case, for example, if the user requested a specific content
// file or if a broadcast publishing point is being used.
hr = pPlayer->get_RequestedPlaylist(&pPlaylist);
if (FAILED(hr)) goto EXIT;
if (pPlaylist != NULL)
{
// Retrieve a pointer to the IWMSActiveMedia interface.
hr = pPlaylist->get_CurrentMediaInformation(&pActiveMedia);
if (FAILED(hr)) goto EXIT;
// Retrieve a pointer to the IWMSActiveStreams interface
// and retrieve the total number of active streams.
hr = pActiveMedia->get_Streams(&pActiveStreams);
if (FAILED(hr)) goto EXIT;
hr = pActiveStreams->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;
// Retrieve information about each active stream.
for (int x = 0; x < lCount; x++) {
// Retrieve a pointer to the IWMSActiveStream interface.
varIndex = x;
hr = pActiveStreams->get_Item(varIndex, &pActiveStream);
if (FAILED(hr)) goto EXIT;
// Retrieve the stream type.
WMS_ACTIVE_STREAM_TYPE astType;
hr = pActiveStream->get_Type(&astType);
if (FAILED(hr)) goto EXIT;
// Release temporary COM objects.
pActiveStream->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 |