From 011897da53083b6c2f394795c083e0a406089475 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 27 Apr 2020 15:54:37 +0200 Subject: [PATCH] Remove gstreamer registry file on startup for Windows Workaround for issue #266 --- src/engine/gststartup.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/engine/gststartup.cpp b/src/engine/gststartup.cpp index 64d1f81da..4de5d7593 100644 --- a/src/engine/gststartup.cpp +++ b/src/engine/gststartup.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #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"); }