IWMSCacheProxyServerCallback::OnCompareContentInformation
Previous | Next |
IWMSCacheProxyServerCallback::OnCompareContentInformation
The OnCompareContentInformation method is called by the server to respond when a cache plug-in calls IWMSCacheProxyServer::CompareContentInformation.
Syntax
HRESULT OnCompareContentInformation( HRESULT lHr , WMS_CACHE_VERSION_COMPARE_RESPONSE CompareResponse , IWMSContext* pNewContentInfo , VARIANT varContext );
Parameters
lHr
[in] HRESULT indicating whether the call to IWMSCacheProxyServer::CompareContentInformation succeeded.
CompareResponse
[in] Member of the WMS_CACHE_VERSION_COMPARE_RESPONSE enumeration type indicating the server response. This must be one of the following values.
Value | Description |
WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION | There was a problem in checking the version. The cache plug-in should either delete the cached content, or try to compare versions again. |
WMS_CACHE_VERSION_CACHE_STALE | The content is out of date. The cache plug-in must delete the cached content. |
WMS_CACHE_VERSION_CACHE_UP_TO_DATE | The content is current. The content can be streamed. |
pNewContentInfo
[in] Pointer to an IWMSContext interface containing a content description context. The context is associated with the URL passed when the plug-in calls CompareContentInformation.
varContext
[in] VARIANT containing a value defined by the plug-in when it called IWMSCacheProxyServer::CompareContentInformation. For example, your plug-in can use this parameter to persist state information. The server does not alter this value and passes it back when calling OnCompareContentInformation.
Return Values
If the method succeeds, the plug-in must return S_OK. To report an error, the plug-in can return any HRESULT other than S_OK. If the plug-in uses the IWMSEventLog interface to log error information directly to the Windows Event Viewer, it is recommended that it return NS_E_PLUGIN_ERROR_REPORTED. 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 interface to send custom error information to the Windows Event Viewer, returning NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about retrieving plug-in error information, see Identifying Plug-in Errors.
Example Code
HRESULT STDMETHODCALLTYPE CCachePlugin::OnCompareContentInformation( long lHr, WMS_CACHE_VERSION_COMPARE_RESPONSE CompareResponse, IWMSContext *pReserved, VARIANT varContext ) { HRESULT hr = (HRESULT) lHr; WMS_CACHE_QUERY_RESPONSE OpenResponse; CCacheEntry *pCacheEntry = NULL; CComBSTR bstrCacheUrl; IWMSContext* pContentInfo = NULL; CComBSTR bstrUrl; // The call to CompareContentInformation() failed if( FAILED( hr ) ) { goto callback; } // The call to CompareContentInformation() did not fail. // Specify the time at which version information was checked. // SetVersionCheckTime() is user-defined. pCacheEntry->SetVersionCheckTime( CCacheDatabase::GetTimeNow() ); // Retrieve the cache URL. if( NULL != pCacheEntry ) { pCacheEntry->GetCacheUrl( &bstrCacheUrl ); } switch ( CompareResponse ) { case WMS_CACHE_VERSION_CACHE_UP_TO_DATE: OpenResponse = WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND; break; case WMS_CACHE_VERSION_CACHE_STALE: hr = pCacheDatabase.DeleteEntry( pCacheEntry ); pCacheEntry = NULL; OpenResponse = WMS_CACHE_QUERY_MISS; break; case WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION: OpenResponse = WMS_CACHE_QUERY_MISS; hr = S_OK; break; } callback: // Call OnQueryCache() with a URL and a cache hit or miss. hr = m_pCacheProxyCallback->OnQueryCache( hr, OpenResponse, bstrCacheUrl, (IUnknown *) pCachePluginContext, varContext ); return( hr ); }
Requirements
Header: streamcache.h.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.
See Also
Previous | Next |