From c466b512fb21886133fba07bc86275aa3346592a Mon Sep 17 00:00:00 2001 From: Holden Date: Thu, 17 Oct 2024 11:44:45 -0400 Subject: [PATCH] Linux: Fix AppRun for GStreamer --- deploy/linux/AppRun | 28 +++++++++---------- .../VideoReceiver/GStreamer/GStreamer.cc | 13 +++++---- .../GStreamer/gstqml6gl/CMakeLists.txt | 2 ++ 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/deploy/linux/AppRun b/deploy/linux/AppRun index 1373a15a9da..bd0dfee5214 100755 --- a/deploy/linux/AppRun +++ b/deploy/linux/AppRun @@ -1,21 +1,21 @@ #!/bin/bash -set -e +if [ -z "$APPDIR" ]; then + APPDIR="$(dirname "$(readlink -f "$0")")" +fi -HERE="$(dirname "$(readlink -f "${0}")")" - -# export LD_LIBRARY_PATH="$HERE/usr/lib:${LD_LIBRARY_PATH}" +export LD_LIBRARY_PATH="${APPDIR}/usr/lib:${APPDIR}/usr/lib/gstreamer-1.0:${LD_LIBRARY_PATH}" export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no" -export GIO_EXTRA_MODULES="$HERE/usr/lib/gio/modules" +export GIO_EXTRA_MODULES="${APPDIR}/usr/lib/gio/modules" -export GST_PLUGIN_SYSTEM_PATH="$HERE/usr/lib/gstreamer-1.0" -export GST_PLUGIN_SYSTEM_PATH_1_0="$HERE/usr/lib/gstreamer-1.0" -export GST_PLUGIN_PATH="$HERE/usr/lib/gstreamer-1.0" -export GST_PLUGIN_PATH_1_0="$HERE/usr/lib/gstreamer-1.0" -export GST_PLUGIN_SCANNER="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" -export GST_PLUGIN_SCANNER_1_0="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" -export GST_PTP_HELPER="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" -export GST_PTP_HELPER_1_0="$HERE/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" +export GST_PLUGIN_SYSTEM_PATH="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_PATH="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_SCANNER="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" +export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" +export GST_PTP_HELPER="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" +export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" -exec "$HERE/usr/bin/QGroundControl" "$@" +exec "${APPDIR}/usr/bin/QGroundControl" "$@" diff --git a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc index 7635b30d1ad..483455db17a 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc +++ b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc @@ -39,9 +39,9 @@ GST_PLUGIN_STATIC_DECLARE(mpegtsdemux); GST_PLUGIN_STATIC_DECLARE(opengl); GST_PLUGIN_STATIC_DECLARE(tcp); GST_PLUGIN_STATIC_DECLARE(asf); -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC) -GST_PLUGIN_STATIC_DECLARE(va); -#endif +// #ifndef Q_OS_ANDROID +// GST_PLUGIN_STATIC_DECLARE(va); +// #endif #ifdef Q_OS_ANDROID GST_PLUGIN_STATIC_DECLARE(androidmedia); #elif defined(Q_OS_IOS) @@ -115,6 +115,7 @@ static void _setGstEnvVars() _qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0"); _qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0"); _qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/lib/gstreamer-1.0"); + _qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0"); #elif defined(Q_OS_WIN) _qgcputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no"); _qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../libexec/gstreamer-1.0/gst-plugin-scanner"); @@ -145,9 +146,9 @@ static void _registerPlugins() GST_PLUGIN_STATIC_REGISTER(opengl); GST_PLUGIN_STATIC_REGISTER(tcp); GST_PLUGIN_STATIC_REGISTER(asf); -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC) - GST_PLUGIN_STATIC_REGISTER(va); -#endif +// #ifndef Q_OS_ANDROID +// GST_PLUGIN_STATIC_REGISTER(va); +// #endif #ifdef Q_OS_ANDROID GST_PLUGIN_STATIC_REGISTER(androidmedia); #elif defined(Q_OS_IOS) diff --git a/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt index ae73d784916..d6ebe5ee367 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt +++ b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt @@ -168,6 +168,8 @@ endif() if(LINUX) install(DIRECTORY ${GSTREAMER_LIB_PATH}/gstreamer1.0 DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner\")") + install(CODE "execute_process(COMMAND chmod +x \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/gstreamer1.0/gstreamer-1.0/gst-ptp-helper\")") install(DIRECTORY ${GSTREAMER_LIB_PATH}/gio DESTINATION ${CMAKE_INSTALL_LIBDIR}) get_target_property(LINKED_PLUGINS GStreamer::Plugins INTERFACE_LINK_LIBRARIES) install(FILES ${LINKED_PLUGINS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/gstreamer-1.0)