共用方式為


IWMSDataSourcePlugin.OpenDataContainer (C#)

The server calls the OpenDataContainer method to open or create a data container.

void IWMSDataSourcePlugin.OpenDataContainer(
  IWMSCommandContext pCommandContext,
  IWMSContext pUserContext,
  IWMSContext pPresentationContext,
  string pszContainerName,
  uint dwFlags,
  IWMSBufferAllocator pBufferAllocator,
  IWMSDataSourcePluginCallback pCallback,
  ulong qwContext
);

Arguments

IWMSCommandContextIWMSCommandContext Object (C#) that specifies the request Command Context.

IWMSContextIWMSContext Object (C#) that specifies the User Context.

IWMSContext object that specifies the Presentation Context.

string containing the name of the container to be opened.

uint containing a member of the WMS_DATA_CONTAINER_OPEN_FLAGS enumeration type that indicates the type of access requested. This must be a bitwise OR of one or more of the following values.

Values

Description

WMS_DATA_CONTAINER_READ_ACCESS

The server requested read access.

WMS_DATA_CONTAINER_WRITE_ACCESS

The server requested write access.

WMS_DATA_CONTAINER_CREATE_NEW_CONTAINER

The server requested that a new data container be created.

WMS_DATA_CONTAINER_ALLOW_BUFFER_IO

The buffered data does not need to be page-aligned.

WMS_DATA_CONTAINER_SHARED_SOURCE

The server requested that the data container be used for a shared resource such as a broadcast. If the plug-in determines that the data path must not be shared, it can return COMADMIN_E_PRIVATE_ACCESSDENIED when it calls IWMSDataSourcePluginCallback.OnOpenDataContainer.

IWMSBufferAllocatorIWMSBufferAllocator Object (C#) that can be used by the data source plug-in to allocate additional buffers for reading or writing data.

IWMSDataSourcePluginCallbackIWMSDataSourcePluginCallback Object (C#) containing the callback function. The plug-in calls IWMSDataSourcePluginCallback.OnOpenDataContainer to return the results to the server.

ulong containing a value defined by the server to identify which OpenDataContainer request the plug-in is responding to when it calls IWMSDataSourcePluginCallback.OnOpenDataContainer. The plug-in must pass this value back unaltered.

Return Value

This method does not return a value. To report an error, the plug-in can throw a COMException object to the server. If the plug-in uses the IWMSEventLogIWMSEventLog Object (C#) to log error information, it is recommended that it throw NS_E_PLUGIN_ERROR_REPORTED (0xC00D157D). Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog object to send custom error information to the Windows Event Viewer, throwing NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about plug-in error information, see Identifying Plug-in Errors.

Remarks

If the server requests that the data container be used for a shared broadcast by sending WMS_DATA_CONTAINER_SHARED_SOURCE in the dwFlags parameter when it calls OpenDataContainer, and the plug-in determines that the source cannot be shared, the plug-in can return COMADMIN_E_PRIVATE_ACCESSDENIED to the server in the hr parameter of IWMSDataSourcePluginCallback.OnOpenDataContainer. The COMADMIN_E_PRIVATE_ACCESSDENIED error is defined in the WinError.h file. A plug-in can decide that a source must not be shared if, for example, a distribution connection requires authentication or the content must be personalized for a specific end user. When the server receives this error, it deletes the shared data path and creates an on-demand (non-shared) data path instead.

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices.

Namespace: Microsoft.WindowsMediaServices.Interop.

Assembly: Microsoft.WindowsMediaServices.dll.

Library: WMSServerTypeLib.dll.

Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.

See Also

Concepts

IWMSDataSourcePlugin Object (C#)