Downloading Content
Previous | Next |
Downloading Content
This section builds on the information presented in Cache Hit with Expired Content and Cache Miss to identify specific tasks your plug-in must perform when downloading content from another server. You can download either a single file or a playlist of files. The following steps identify one possible way that the server and cache proxy plug-in can interact when a client requests digital media. The actual interaction between a server and a plug-in depends on how you implement the plug-in.
- Note When downloading content, your plug-in must persist metadata information for clients who later connect and stream from cache. Metadata is used to describe content. It can include information such as the name of the author, the rating, and the copyright, and it can originate from the file header or from external sources. Saving metadata is discussed in the following.
The plug-in calls DownloadContent on the IWMSCacheProxyServer interface.
The server calls OnDownloadContentProgress on the IWMSCacheProxyServerCallback interface once for each media element that you are downloading. If you are downloading a playlist, this method is called for each item in the list.
When the server calls OnDownloadContentProgress, it passes a pointer to an IWMSContext interface in the pArchiveContext parameter. The WMS_ARCHIVE_CONTENT_DESCRIPTION_LIST_BUFFER value of this context contains a pointer to an INSSBuffer interface that contains serialized metadata for the content. Your plug-in should not modify the metadata.
The plug-in must allocate an IWMSContext object that it can use to identify the individual INSSBuffer objects created by the server to persist metadata for the content being downloaded. For more information about creating contexts, see AllocIWMSContext on the IWMSClassObject interface.
The plug-in must create a playlist file that identifies the location of the cached content and an associated ID string. For example, if you are downloading a playlist that contains two media elements, your file must have a format similar to the following.
<seq> <media src="c:\archive_0" cacheID="id_0" /> <media src="c:\archive_1" cacheID="id_1" /> </seq>
Each time the server calls OnDownloadContentProgress, the plug-in must add another name-value pair to the context it allocated in step 4. The name must consist of the cacheID attribute (see the playlist in step 5), and the value must equal the INSSBuffer pointer passed by the server in the pArchiveContext parameter when it called OnDownloadContentProgress. For more information about specifying name-value pairs, see the IWMSContext interface.
The server calls OnDownloadContentFinished on the IWMSCacheProxyServerCallback interface when all files have been downloaded.
The following diagram illustrates the downloading process and highlights the steps needed to persist metadata.
After the content has been downloaded, if the plug-in is able to declare an on-demand cache hit the next time that a client requests the content, the plug-in must pass to the server the locations of the buffers used to store metadata for the content. This is accomplished by the following steps:
- The server calls QueryCache on the IWMSCacheProxy interface of the cache plug-in.
- The plug-in calls OnQueryCache on the IWMSCacheProxyCallback interface and passes WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND in the Response parameter. The plug-in must also pass a URL for the playlist (see step 5 of the preceding discussion) in the bstrCacheUrl parameter. Finally, the plug-in must return a pointer to the IWMSContext object it created to hold the content description list (see step 4). It must specify the pointer to this context in the WMS_CACHE_CONTENT_INFORMATION_CONTENT_DESCRIPTION_LISTS value of the IWMSContext object that it passes back to the server through the pContentInfo parameter.
See Also (General)
See Also (Visual Basic .NET)
- INSSBuffer Object (Visual Basic .NET)
- IWMSCacheProxy.QueryCache (Visual Basic .NET)
- IWMSCacheProxyCallback.OnQueryCache (Visual Basic .NET)
- IWMSCacheProxyServer.DownloadContent (Visual Basic .NET)
- IWMSCacheProxyServerCallback.OnDownloadContentProgress (Visual Basic .NET)
- IWMSCacheProxyServerCallback.OnDownloadContentFinished (Visual Basic .NET)
- IWMSClassObject.AllocIWMSContext (Visual Basic .NET)
- IWMSContext Object (Visual Basic .NET)
See Also (C#)
- INSSBuffer Object (C#)
- IWMSCacheProxy.QueryCache (C#)
- IWMSCacheProxyCallback.OnQueryCache (C#)
- IWMSCacheProxyServer.DownloadContent (C#)
- IWMSCacheProxyServerCallback.OnDownloadContentProgress (C#)
- IWMSCacheProxyServerCallback.OnDownloadContentFinished (C#)
- IWMSClassObject.AllocIWMSContext (C#)
- IWMSContext Object (C#)
See Also (C++)
- INSSBuffer Interface
- IWMSCacheProxy::QueryCache
- IWMSCacheProxyCallback::OnQueryCache
- IWMSCacheProxyServer::DownloadContent
- IWMSCacheProxyServerCallback::OnDownloadContentProgress
- IWMSCacheProxyServerCallback::OnDownloadContentFinished
- IWMSClassObject::AllocIWMSContext
- IWMSContext interface
Previous | Next |