[network/kaidan] src: Point GStreamer at bundled plugins via TARGET_GSTREAMER_PLUGINS
Linus Jahn <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit bf14d8c77ef6fb0566440471780089a00be776a0 by Linus Jahn. Committed on 30/07/2026 at 22:13. Pushed by lnj into branch 'master'. Point GStreamer at bundled plugins via TARGET_GSTREAMER_PLUGINS The TARGET_GSTREAMER_PLUGINS plumbing was an unfinished stub: The CMake `set()` was malformed (no space, so it never set the variable) and nothing read the resulting macro. This turns it into a proper, overwritable cache variable (empty by default) and uses it in main.cpp: If it is set (e.g., by the macOS Craft build, where the plugins are shipped in Contents/PlugIns/gstreamer-1.0 next to the app), it is resolved relative to the executable and GST_PLUGIN_SYSTEM_PATH_1_0 is exported before gst_init. If it is empty, GStreamer keeps using its default plugin search path, so system builds are unaffected. Co-Authored-By: Claude Opus 4.8 <[email protected]> M +1 -1 src/CMakeLists.txt M +11 -0 src/app/main.cpp https://invent.kde.org/network/kaidan/-/commit/bf14d8c77ef6fb0566440471780089a00be776a0 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4607de899..f9669e201 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ # Sources / Resources # -set(TARGET_GSTREAMER_PLUGINS="${TARGET_GSTREAMER_PLUGINS}") +set(TARGET_GSTREAMER_PLUGINS "" CACHE STRING "Custom GStreamer plugins directory, relative to the executable") configure_file(${CMAKE_SOURCE_DIR}/GlobalsGen.h.in ${CMAKE_BINARY_DIR}/GlobalsGen.h) diff --git a/src/app/main.cpp b/src/app/main.cpp index b95296faf..a646e72c4 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -17,6 +17,7 @@ #include <QCommandLineOption> #include <QCommandLineParser> #include <QDir> +#include <QFile> #include <QIcon> #include <QJsonArray> #include <QJsonDocument> @@ -512,6 +513,16 @@ Q_DECL_EXPORT int main(int argc, char *argv[]) } #endif + // If the GStreamer plugins are shipped next to the application (e.g., inside the macOS .app + // bundle), point GStreamer at them. TARGET_GSTREAMER_PLUGINS is empty otherwise, so GStreamer + // keeps using its default (system) plugin search path. + if (const QString gstreamerPlugins = QStringLiteral(TARGET_GSTREAMER_PLUGINS); !gstreamerPlugins.isEmpty()) { + const QString path = QDir::isAbsolutePath(gstreamerPlugins) + ? gstreamerPlugins + : QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1Char('/') + gstreamerPlugins); + qputenv("GST_PLUGIN_SYSTEM_PATH_1_0", QFile::encodeName(path)); + } + // Allow importing org.freedesktop.gstreamer.Qt6GLVideoItem and using GstGLQt6VideoItem in QML. gst_init(&argc, &argv); gst_element_factory_make("qml6glsink", NULL);