Data Source Plug-in Overview

Data source plug-ins create data container objects that are used to read data from a source. A data container can be implemented either as a byte-based or packet-based container. A byte-based implementation, like that used in the WMS File Data Source plug-in, reads byte data directly from the source and then passes it back to the media parser or playlist parser. A packet-based implementation, like that used in the WMS Push Data Source plug-in, retrieves data from a network or outside source and is dependent on that source to deliver data in a timely fashion. A packet-based implementation will continue buffering data until enough data has been received to pass back to the media parser. The following illustrates the data path used by the Windows Media server when using a data source plug-in that is reading from a media source:

  1. The server calls the data source plug-in.

  2. The plug-in creates an IWMSDataContainer object.

  3. The server calls OpenDataContainer on the IWMSDataSourcePlugin interface to open the content source.

  4. The data source plug-in calls OnOpenDataContainer on the IWMSDataSourcePluginCallback interface to indicate whether the content source was successfully opened.

  5. The server reads a small amount of data from the data container and examines it to determine what media parser to use.

  6. The server calls the media parser plug-in and sends it a pointer to the open data container.

  7. The server calls GetInfo on the IWMSDataContainer interface. The media parser calls OnGetInfo on the IWMSDataContainerCallBack interface to indicate the size of the container and whether it is seekable.

  8. The server calls GetTransferParameters on the IWMSDataContainer interface to determine the optimal offset and buffer size.

  9. The media parser calls Read on the IWMSDataContainer interface.

  10. The data container reads bytes into the buffer and calls OnRead on the IWMSDataContainerCallBack interface when finished.

The following diagram illustrates this process.

Diagram illustrating how a data source plug-in works.

Dd873804.wms8_datasrcplugin_final(en-us,VS.85).gif

After the buffer has been filled with data, the media parser creates a packet list of offsets into the buffer, as shown in the following diagram, and passes the list to the data sink. To optimize performance, the buffer is not passed between plug-in objects in the data path—only the packet list is passed down the data path.

Diagram showing how a packet list is created.

Dd873804.wms8_packetlist_final(en-us,VS.85).gif

The data sink uses the packet list to send the contents of the buffer to the client and, when finished, notifies the server that it is ready to write more data. The server again calls GetTransferParameters, and the media parser calls Read. The process is repeated until there is no more data to send to the client.

A data source plug-in can also be used to retrieve an IWMSDataContainerVersion interface that contains methods for specifying and retrieving information about cached content. Furthermore, you can use a data source plug-in to retrieve the path names of the directories on a computer. You can override the GetRootDirectories method on the IWMSDataSourcePlugin interface to send root directory information to the server, and you can override the IWMSDirectory interface to retrieve information about the subdirectories of a root.

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)

  • IWMSDataContainer::GetInfo

  • IWMSDataContainer::GetTransferParameters

  • IWMSDataContainer::Read

  • IWMSDataContainerCallBack::OnGetInfo

  • IWMSDataContainerCallBack::OnRead

  • IWMSDataSourcePlugin::OpenDataContainer

  • IWMSDataSourcePluginCallback::OnOpenDataContainer