summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-05-19 17:39:48 +0200
committerJani Heikkinen <jani.heikkinen@qt.io>2016-05-25 15:41:38 +0000
commit0a6c8a8871085dcd8b029553260031892be3603e (patch)
tree9b463efd2d009d6f5e95aeb79e452c8cff8ced59
parent3407b0a8545d84df4b941a5a3f5a5859dc51cd53 (diff)
Improve widevine plugin search
Search for Google Chrome's widevine plugin on Windows like we do on OS X. Also adds an OpenSUSE style /usr/lib64/chromium path to Linux. Change-Id: Icfbd27b24ca8a923420a249dec4b5d72d2bc6fd3 Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--src/core/content_client_qt.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 8a5dde70..0418873b 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -57,6 +57,18 @@
#include <QLibraryInfo>
#include <QString>
+#if defined(Q_OS_WIN)
+#include <shlobj.h>
+static QString getLocalAppDataDir()
+{
+ QString result;
+ wchar_t path[MAX_PATH];
+ if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE))
+ result = QDir::fromNativeSeparators(QString::fromWCharArray(path));
+ return result;
+}
+#endif
+
#if defined(ENABLE_PLUGINS)
// The plugin logic is based on chrome/common/chrome_content_client.cc:
@@ -199,10 +211,24 @@ void AddPepperWidevine(std::vector<content::PepperPluginInfo>* plugins)
pluginPaths << potentialWidevinePluginPath;
}
}
+#elif defined(Q_OS_WIN)
+ QDir potentialWidevineDir(getLocalAppDataDir() + "/Google/Chrome/User Data/WidevineCDM");
+ if (potentialWidevineDir.exists()) {
+ QFileInfoList widevineVersionDirs = potentialWidevineDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
+ for (int i = 0; i < widevineVersionDirs.size(); ++i) {
+ QString versionDirPath(widevineVersionDirs.at(i).absoluteFilePath());
+#ifdef WIN64
+ QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x64/" + QString::fromLatin1(kWidevineCdmAdapterFileName);
+#else
+ QString potentialWidevinePluginPath = versionDirPath + "/_platform_specific/win_x86/" + QString::fromLatin1(kWidevineCdmAdapterFileName);
#endif
-#if defined(Q_OS_LINUX)
+ pluginPaths << potentialWidevinePluginPath;
+ }
+ }
+#elif defined(Q_OS_LINUX)
pluginPaths << QStringLiteral("/opt/google/chrome/libwidevinecdmadapter.so") // Google Chrome
- << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so"); // Arch
+ << QStringLiteral("/usr/lib/chromium/libwidevinecdmadapter.so") // Arch
+ << QStringLiteral("/usr/lib64/chromium/libwidevinecdmadapter.so"); // OpenSUSE style
#endif
}