1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-16 10:38:53 +01:00

Remove gstreamer registry file on startup for Windows

Workaround for issue #266
This commit is contained in:
Jonas Kvinge 2020-04-27 15:54:37 +02:00
parent 3fcaa58947
commit 011897da53

View File

@ -29,6 +29,7 @@
#include <QFuture>
#include <QString>
#include <QDir>
#include <QFile>
#include "core/utilities.h"
@ -61,16 +62,21 @@ void GstStartup::InitialiseGStreamer() {
void GstStartup::SetEnvironment() {
QString gio_path;
QString scanner_path;
QString plugin_path;
QString 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";
#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";
#elif defined(Q_OS_WIN32)
#endif
#if defined(Q_OS_WIN32)
plugin_path = QDir::toNativeSeparators(QCoreApplication::applicationDirPath() + "/gstreamer-plugins");
#endif
#endif
@ -79,6 +85,11 @@ void GstStartup::SetEnvironment() {
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()) {
@ -88,13 +99,15 @@ void GstStartup::SetEnvironment() {
}
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();
}
#endif
Utilities::SetEnv("GST_REGISTRY", registry_filename);
}
#if defined(Q_OS_MACOS) && defined(USE_BUNDLE)
Utilities::SetEnv("GIO_EXTRA_MODULES", QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR + "/gio-modules");
#endif
Utilities::SetEnv("PULSE_PROP_media.role", "music");
}