Remove gstreamer registry workaround for Windows
This commit is contained in:
parent
ae940a8681
commit
458efe9168
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Strawberry Music Player
|
||||
* This code was part of Clementine.
|
||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
*
|
||||
* Strawberry is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Strawberry is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "scangiomodulepath.h"
|
||||
|
||||
void ScanGIOModulePath() {
|
||||
|
||||
QString gio_module_path;
|
||||
|
||||
#if defined(Q_OS_WIN32)
|
||||
gio_module_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gio-modules");
|
||||
#endif
|
||||
|
||||
if (!gio_module_path.isEmpty()) {
|
||||
qLog(Debug) << "Adding GIO module path:" << gio_module_path;
|
||||
QByteArray bytes = gio_module_path.toLocal8Bit();
|
||||
g_io_modules_scan_all_in_directory(bytes.data());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Strawberry Music Player
|
||||
* This code was part of Clementine.
|
||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||
*
|
||||
* Strawberry is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Strawberry is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
void ScanGIOModulePath();
|
|
@ -31,6 +31,7 @@
|
|||
#include <QDir>
|
||||
#include <QFile>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#ifdef HAVE_MOODBAR
|
||||
|
@ -62,50 +63,73 @@ void GstStartup::InitialiseGStreamer() {
|
|||
|
||||
void GstStartup::SetEnvironment() {
|
||||
|
||||
QString gio_path;
|
||||
QString scanner_path;
|
||||
QString plugin_path;
|
||||
QString registry_filename;
|
||||
QString bundle_path = QCoreApplication::applicationDirPath();
|
||||
|
||||
#ifdef USE_BUNDLE_DIR
|
||||
QString bundle_dir = USE_BUNDLE_DIR;
|
||||
if (!bundle_dir.isEmpty()) {
|
||||
bundle_path.append("/" + bundle_dir);
|
||||
}
|
||||
#endif
|
||||
|
||||
QString gio_module_path;
|
||||
QString gst_plugin_scanner;
|
||||
QString gst_plugin_path;
|
||||
QString gst_registry_filename;
|
||||
|
||||
// On Windows and macOS we bundle the gstreamer plugins with strawberry
|
||||
#ifdef USE_BUNDLE
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
gio_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gio-modules";
|
||||
gio_module_path = bundle_path + "/gio-modules";
|
||||
#endif
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
|
||||
scanner_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gst-plugin-scanner";
|
||||
plugin_path = QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gstreamer";
|
||||
gst_plugin_scanner = bundle_path + "/gst-plugin-scanner";
|
||||
gst_plugin_path = bundle_path + "/gstreamer";
|
||||
#endif
|
||||
#if defined(Q_OS_WIN32)
|
||||
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
|
||||
//gst_plugin_scanner = bundle_path + "/gst-plugin-scanner.exe";
|
||||
gst_plugin_path = bundle_path + "/gstreamer-plugins";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_MACOS)
|
||||
registry_filename = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion());
|
||||
gst_registry_filename = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + QString("/gst-registry-%1-bin").arg(QCoreApplication::applicationVersion());
|
||||
#endif
|
||||
|
||||
if (!gio_path.isEmpty()) {
|
||||
//Utilities::SetEnv("GIO_MODULE_DIR", gio_path);
|
||||
Utilities::SetEnv("GIO_EXTRA_MODULES", gio_path);
|
||||
}
|
||||
|
||||
if (!scanner_path.isEmpty()) Utilities::SetEnv("GST_PLUGIN_SCANNER", scanner_path);
|
||||
|
||||
if (!plugin_path.isEmpty()) {
|
||||
Utilities::SetEnv("GST_PLUGIN_PATH", plugin_path);
|
||||
// Never load plugins from anywhere else.
|
||||
Utilities::SetEnv("GST_PLUGIN_SYSTEM_PATH", plugin_path);
|
||||
}
|
||||
|
||||
if (!registry_filename.isEmpty()) {
|
||||
#ifdef Q_OS_WIN32 // Workaround for issue #266 - TLS/SSL support not available; install glib-networking
|
||||
QFile registry_file(registry_filename);
|
||||
if (registry_file.exists()) {
|
||||
registry_file.remove();
|
||||
if (!gio_module_path.isEmpty()) {
|
||||
if (QDir(gio_module_path).exists()) {
|
||||
qLog(Debug) << "Setting GIO module path to" << gio_module_path;
|
||||
Utilities::SetEnv("GIO_EXTRA_MODULES", gio_module_path);
|
||||
}
|
||||
#endif
|
||||
Utilities::SetEnv("GST_REGISTRY", registry_filename);
|
||||
else {
|
||||
qLog(Debug) << "GIO module path does not exist:" << gio_module_path;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gst_plugin_scanner.isEmpty()) {
|
||||
if (QFile(gst_plugin_scanner).exists()) {
|
||||
qLog(Debug) << "Setting GST plugin scanner to" << gst_plugin_scanner;
|
||||
Utilities::SetEnv("GST_PLUGIN_SCANNER", gst_plugin_scanner);
|
||||
}
|
||||
else {
|
||||
qLog(Debug) << "GST plugin scanner does not exist:" << gst_plugin_scanner;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gst_plugin_path.isEmpty()) {
|
||||
if (QDir(gst_plugin_path).exists()) {
|
||||
qLog(Debug) << "Setting GST plugin path to" << gst_plugin_path;
|
||||
Utilities::SetEnv("GST_PLUGIN_PATH", gst_plugin_path);
|
||||
// Never load plugins from anywhere else.
|
||||
Utilities::SetEnv("GST_PLUGIN_SYSTEM_PATH", gst_plugin_path);
|
||||
}
|
||||
else {
|
||||
qLog(Debug) << "GST plugin path does not exist:" << gst_plugin_path;
|
||||
}
|
||||
}
|
||||
|
||||
if (!gst_registry_filename.isEmpty()) {
|
||||
qLog(Debug) << "Setting GST registry file to" << gst_registry_filename;
|
||||
Utilities::SetEnv("GST_REGISTRY", gst_registry_filename);
|
||||
}
|
||||
|
||||
Utilities::SetEnv("PULSE_PROP_media.role", "music");
|
||||
|
|
|
@ -93,7 +93,6 @@
|
|||
#include "core/systemtrayicon.h"
|
||||
#include "core/application.h"
|
||||
#include "core/networkproxyfactory.h"
|
||||
#include "core/scangiomodulepath.h"
|
||||
#ifdef HAVE_TRANSLATIONS
|
||||
# include "core/translations.h"
|
||||
#endif
|
||||
|
@ -280,9 +279,7 @@ int main(int argc, char* argv[]) {
|
|||
#ifdef Q_OS_MACOS
|
||||
mac::EnableFullScreen(w);
|
||||
#endif // Q_OS_MACOS
|
||||
#ifdef HAVE_GIO
|
||||
ScanGIOModulePath();
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
QObject::connect(&mpris, SIGNAL(RaiseMainWindow()), &w, SLOT(Raise()));
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue