Compartir a través de


WMS Network Data Source Plug-in Properties

Windows Media Services uses the WMS Network Data Source plug-in to pull a distribution stream from an upstream server or encoder. Digital content can originate from a network data source using either the HTTP or RTSP protocol. For administration information about this plug-in, see Windows Media Services Help.

You can use the IWMSAdminNetworkDataSourcePlugin interface to configure the plug-in programmatically. This interface exposes the following properties.

Property

Description

BufferingTime

Specifies and retrieves the amount of time that the plug-in buffers data before sending it along the data path.

NumProtocolsSupported

Retrieves the number of networking protocols supported by the plug-in.

NumUDPPortRanges

Retrieves the number of UDP/TCP port number ranges that can be used by the plug-in to receive data.

ProxyHostName

Retrieves the name of the proxy server.

ProxyPassword

Retrieves a Boolean value indicating whether a proxy password has been set for a particular protocol.

ProxyPort

Retrieves the port number used for streaming content to the proxy server.

ProxySettings

Retrieves an enumeration value indicating the proxy mode for a given protocol.

ProxyUserName

Retrieves a user name that can be sent to the proxy server in response to an authentication challenge.

SupportedProtocolName

Retrieves the name of a specific protocol from a list of supported protocols.

TCPEnabled

Retrieves a Boolean value indicating whether the plug-in can use TCP when selecting a streaming protocol.

UDPEnabled

Specifies and retrieves a Boolean value indicating whether the plug-in can use UDP when selecting a streaming protocol.

UDPPortRangeLowerBound

Retrieves the lower bound of a specific UDP port range.

UDPPortRangeUpperBound

Retrieves the upper bound of a specific UDP port range.

The IWMSAdminNetworkDataSourcePlugin interface also exposes the following methods.

Method

Description

AddUDPPortRange

Adds a range of UDP/TCP port numbers that can be used by the plug-in to receive data.

DeleteAllUDPPortRanges

Removes all of the UDP/TCP port number ranges that can be used by the plug-in to receive data.

SetProxyCredentials

Specifies a user name and password that can be used to connect to a proxy.

SetProxyHostName

Specifies the name of the proxy server.

SetProxyPort

Specifies the port number used for streaming content to the proxy server.

SetProxySettings

Specifies an enumeration value indicating the proxy mode for a given protocol.

The following examples illustrate how to use the IWMSAdminNetworkDataSourcePlugin interface to configure the WMS Network Data Source plug-in.

Visual Basic .NET Example

Imports Microsoft.WindowsMediaServices.Interop 
Imports System.Runtime.InteropServices

Private Sub SetNetDSPluginProps() 

' Declare variables.
Dim Server As WMSServer
Dim Plugin As IWMSPlugin
Dim NetDataSrcAdmin As IWMSAdminNetworkDataSourcePlugin

Try
    ' Create a new WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlugin object for the
    ' WMS Network Data Source plug-in.
    Plugin = Server.DataSources("WMS Network Data Source")

    ' Retrieve the administrative interface for the plug-in.
    NetDataSrcAdmin = Plugin.CustomInterface()

    ' Set a Boolean value indicating whether UDP
    ' can be used as a streaming protocol.
    NetDataSrcAdmin.UDPEnabled = True

    ' Set the proxy host name associated
    ' with the HTTP protocol.
    NetDataSrcAdmin.SetProxyHostName("HTTP", "PROXY_ADDRESS")
Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle exceptions here.
Finally
    ' TODO: Perform clean-up here.
End Try

End Sub 

C# Example

using Microsoft.WindowsMediaServices.Interop; 
using System.Runtime.InteropServices;

// Declare variables.
WMSServer Server;
IWMSPlugin Plugin;
IWMSAdminNetworkDataSourcePlugin NetDataSrcAdmin;

try
{
    // Create a new WMSServer object.
    Server = new WMSServerClass();
    
    // Retrieve the IWMSPlugin object for the 
    // WMS Network Data Source plug-in.
    Plugin = Server.DataSources["WMS Network Data Source"];
    
    // Retrieve the administrative interface for the plug-in.
    NetDataSrcAdmin = (IWMSAdminNetworkDataSourcePlugin)Plugin.CustomInterface;
    
    // Set a Boolean value indicating whether UDP
    // can be used as a streaming protocol.
    NetDataSrcAdmin.UDPEnabled = true;
    
    // Set the proxy host name associated
    // with the HTTP protocol.
    NetDataSrcAdmin.SetProxyHostName("HTTP", "PROXY_ADDRESS");
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception exc)
{
    // TODO: Handle exceptions here.
}
finally
{
    // TODO: Perform clean-up here.
}

C++ Example

#include <windows.h>
#include <atlbase.h>

// To access system plug-in interfaces, the
// type library must be imported as shown.
#import "WMSServerTypeLib.dll" no_namespace named_guids \
                               raw_interfaces_only

// Declare variables and interface pointers.
IWMSServer*                          pServer = NULL;
IWMSPlugins*                         pPlugins = NULL;
IWMSPlugin*                          pPlugin = NULL;
IDispatch*                           pDispatch = NULL;
IWMSAdminNetworkDataSourcePlugin*    pNetDataSrcAdmin = NULL;
CComVariant                          varIndex;
CComBSTR                             bstrProtocol;
CComBSTR                             bstrName;
HRESULT                              hr = S_OK;

// 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 an IWMSPlugins interface
// containing the collection of data source plug-ins.
hr = pServer->get_DataSources(&pPlugins);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to the IWMSPlugin interface for the
// WMS Network Data Source plug-in.
varIndex = "WMS Network Data Source";
hr = pPlugins->get_Item(varIndex, &pPlugin);
if (FAILED(hr)) goto EXIT;

// Retrieve an IDispatch pointer to the administration
// interface for the plug-in.
hr = pPlugin->get_CustomInterface(&pDispatch);
if (FAILED(hr)) goto EXIT;

// Call QueryInterface() to retrieve a pointer to the
// IWMSAdminNetworkDataSourcePlugin interface.
hr = pDispatch->QueryInterface(IID_IWMSAdminNetworkDataSourcePlugin, 
                               (void**)&pNetDataSrcAdmin);
if (FAILED(hr)) goto EXIT;

// Set a Boolean value indicating whether UDP
// can be used as a streaming protocol.
hr = pNetDataSrcAdmin->put_UDPEnabled(VARIANT_TRUE);
if (FAILED(hr)) goto EXIT;

// Set the proxy host name associated
// with the HTTP protocol.
bstrProtocol = "HTTP";
bstrName = "PROXY_ADDRESS";
hr = pNetDataSrcAdmin->SetProxyHostName(bstrProtocol, bstrName);
if (FAILED(hr)) goto EXIT;

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

See Also

Reference

IWMSAdminNetworkDataSourcePlugin Interface

IWMSAdminNetworkDataSourcePlugin Object (C#)

IWMSAdminNetworkDataSourcePlugin Object (Visual Basic .NET)

Concepts

Programming System Plug-in Properties