Fix Show Rights for HLS content

In WVMDrmPlugin.cpp, the supported suffixes was only .wvm.  I changed this to
include .m3u8, .vob, .smil, and the empty extension.  This allows the
WVMDrmPlugin to register itself as handling these files.  If the plugin is not
registered, the "show rights" feature will not query the plugin.

related-to-bug: 6507440

Change-Id: Ib655760e46cfa4125d21beb9ff77e38b444ddc5a
This commit is contained in:
Fred Gylys-Colwell
2012-05-16 15:57:46 -07:00
parent 79e250e999
commit 87718450ac
2 changed files with 15 additions and 4 deletions

View File

@@ -131,6 +131,7 @@ private:
static Vector<Listener> *sNativeListeners;
static Vector<Listener> *sJavaAPIListeners;
static const char *sFileExtensions[];
WVDRMPluginAPI *mDrmPluginImpl;
};
@@ -138,4 +139,3 @@ private:
};
#endif /* __WVMDRMPLUGIN__ */

View File

@@ -41,6 +41,11 @@ extern "C" void destroy(IDrmEngine* pPlugIn) {
Vector<WVMDrmPlugin::Listener> *WVMDrmPlugin::sNativeListeners = NULL;
Vector<WVMDrmPlugin::Listener> *WVMDrmPlugin::sJavaAPIListeners = NULL;
// File extensions that Widevine can handle.
// Note: the empty extension is needed because some proxy servers will strip the extension.
const char *WVMDrmPlugin::sFileExtensions[] = {".wvm", ".m3u8", ".vob", ".smil", "", NULL};
WVMDrmPlugin::WVMDrmPlugin()
: DrmEngineBase(),
mDrmPluginImpl(WVDRMPluginAPI::create())
@@ -467,7 +472,9 @@ DrmSupportInfo* WVMDrmPlugin::onGetSupportInfo(int uniqueId) {
// Add mimetype's
drmSupportInfo->addMimeType(String8("video/wvm"));
// Add File Suffixes
drmSupportInfo->addFileSuffix(String8(".wvm"));
for (int i=0; sFileExtensions[i]; i++) {
drmSupportInfo->addFileSuffix(String8(sFileExtensions[i]));
}
// Add plug-in description
drmSupportInfo->setDescription(String8("Widevine DRM plug-in"));
return drmSupportInfo;
@@ -516,7 +523,12 @@ bool WVMDrmPlugin::onCanHandle(int uniqueId, const String8& path) {
//ALOGD("WVMDrmPlugin::canHandle('%s') ", path.string());
String8 extension = path.getPathExtension();
extension.toLower();
return (String8(".wvm") == extension || String8("") == extension);
for (int i=0; sFileExtensions[i]; i++) {
if (String8(sFileExtensions[i]) == extension) {
return true;
}
}
return false;
}
/**
@@ -894,4 +906,3 @@ DrmConvertedStatus* WVMDrmPlugin::onConvertData(
DrmConvertedStatus* WVMDrmPlugin::onCloseConvertSession(int uniqueId, int convertId) {
return NULL;
}