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:
The server calls the data source plug-in.
The plug-in creates an IWMSDataContainer object.
The server calls OpenDataContainer on the IWMSDataSourcePlugin interface to open the content source.
The data source plug-in calls OnOpenDataContainer on the IWMSDataSourcePluginCallback interface to indicate whether the content source was successfully opened.
The server reads a small amount of data from the data container and examines it to determine what media parser to use.
The server calls the media parser plug-in and sends it a pointer to the open data container.
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.
The server calls GetTransferParameters on the IWMSDataContainer interface to determine the optimal offset and buffer size.
The media parser calls Read on the IWMSDataContainer interface.
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.
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.
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)
IWMSDataContainer.GetInfoIWMSDataContainer.GetInfo (Visual Basic .NET)
IWMSDataContainer.GetTransferParametersIWMSDataContainer.GetTransferParameters (Visual Basic .NET)
IWMSDataContainer.ReadIWMSDataContainer.Read (Visual Basic .NET)
IWMSDataContainerCallBack.OnGetInfoIWMSDataContainerCallback.OnGetInfo (Visual Basic .NET)
IWMSDataContainerCallBack.OnReadIWMSDataContainerCallback.OnRead (Visual Basic .NET)
IWMSDataSourcePlugin.OpenDataContainerIWMSDataSourcePlugin.OpenDataContainer (Visual Basic .NET)
IWMSDataSourcePluginCallback.OnOpenDataContainerIWMSDataSourcePluginCallback.OnOpenDataContainer (Visual Basic .NET)
See Also (C#)
IWMSDataContainer.GetInfo IWMSDataContainer.GetInfo (C#)
IWMSDataContainer.Read IWMSDataContainer.Read (C#)
See Also (C++)