From 5180f41a72991253917a569129fee41e8dec204f Mon Sep 17 00:00:00 2001 From: Holden Date: Wed, 21 Aug 2024 12:54:02 -0400 Subject: [PATCH] CMake: Improve GStreamer Inclusion --- CMakeLists.txt | 6 + cmake/BuildGstQtPlugin.cmake | 89 ----- cmake/CreateAppImage.cmake | 15 +- cmake/DownloadGStreamer.cmake | 35 -- cmake/FindGStreamer.cmake | 377 ++++++++++++++++++ cmake/GStreamer.cmake | 239 ----------- deploy/linux/AppRun | 12 + .../apprun-hooks/linux-deploy-gstreamer.sh | 8 + src/API/CMakeLists.txt | 2 + src/VideoManager/CMakeLists.txt | 8 +- .../VideoReceiver/GStreamer/CMakeLists.txt | 11 +- .../VideoReceiver/GStreamer/GStreamer.cc | 43 +- .../GStreamer/gstqml6gl/CMakeLists.txt | 269 +++++++++++++ .../{qmlglsink => gstqml6gl}/qt6/gstplugin.cc | 0 .../qt6/gstqml6glsink.cc | 0 .../qt6/gstqml6glsink.h | 0 .../qt6/gstqsg6glnode.cc | 0 .../qt6/gstqsg6glnode.h | 0 .../qt6/gstqt6element.cc | 0 .../qt6/gstqt6elements.h | 0 .../{qmlglsink => gstqml6gl}/qt6/gstqt6gl.h | 0 .../qt6/gstqt6glutility.cc | 0 .../qt6/gstqt6glutility.h | 0 .../{qmlglsink => gstqml6gl}/qt6/meson.build | 0 .../{qmlglsink => gstqml6gl}/qt6/qt6glitem.cc | 0 .../{qmlglsink => gstqml6gl}/qt6/qt6glitem.h | 0 .../GStreamer/qmlglsink/CMakeLists.txt | 10 - .../VideoReceiver/QtMultimedia/CMakeLists.txt | 4 +- tools/setup/install-dependencies-debian.sh | 2 + 29 files changed, 731 insertions(+), 399 deletions(-) delete mode 100644 cmake/BuildGstQtPlugin.cmake delete mode 100644 cmake/DownloadGStreamer.cmake create mode 100644 cmake/FindGStreamer.cmake delete mode 100644 cmake/GStreamer.cmake create mode 100755 deploy/linux/AppRun create mode 100644 deploy/linux/apprun-hooks/linux-deploy-gstreamer.sh create mode 100644 src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstplugin.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqml6glsink.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqml6glsink.h (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqsg6glnode.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqsg6glnode.h (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqt6element.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqt6elements.h (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqt6gl.h (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqt6glutility.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/gstqt6glutility.h (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/meson.build (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/qt6glitem.cc (100%) rename src/VideoManager/VideoReceiver/GStreamer/{qmlglsink => gstqml6gl}/qt6/qt6glitem.h (100%) delete mode 100644 src/VideoManager/VideoReceiver/GStreamer/qmlglsink/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 81892e82acf..143ac8bd159 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,12 @@ elseif(WIN32) endif() endif() +if(CMAKE_CROSSCOMPILING AND ANDROID) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH) +endif() + set(BUILD_SHARED_LIBS OFF) # include(CMakePrintSystemInformation) diff --git a/cmake/BuildGstQtPlugin.cmake b/cmake/BuildGstQtPlugin.cmake deleted file mode 100644 index c2e450338a7..00000000000 --- a/cmake/BuildGstQtPlugin.cmake +++ /dev/null @@ -1,89 +0,0 @@ -if(NOT GST_QT6_PLUGIN_PATH) - set(GST_QT6_PLUGIN_PATH ${CMAKE_SOURCE_DIR}/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6) -endif() -cmake_print_variables(GST_QT6_PLUGIN_PATH) - -if(EXISTS ${GST_QT6_PLUGIN_PATH}) - set(GST_QT6_PLUGIN_FOUND TRUE CACHE INTERNAL "") - - file(GLOB GST_SOURCES ${GST_QT6_PLUGIN_PATH}/*.cc) - file(GLOB GST_HEADERS ${GST_QT6_PLUGIN_PATH}/*.h) - target_sources(qmlglsink - PRIVATE - ${GST_SOURCES} - ${GST_HEADERS} - ) - - find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Qml Quick) - target_link_libraries(qmlglsink - PUBLIC - Qt6::Core - Qt6::Gui - Qt6::GuiPrivate - Qt6::OpenGL - Qt6::Qml - Qt6::Quick - ) - if(WIN32) - find_package(OpenGL) - target_link_libraries(qmlglsink PUBLIC OpenGL::GL) - elseif(LINUX) - # find_package(Qt6 COMPONENTS WaylandClient) - if(Qt6WaylandClient_FOUND) - target_link_libraries(qmlglsink PRIVATE Qt6::WaylandClient) - endif() - endif() - - target_include_directories(qmlglsink PRIVATE ${GST_QT6_PLUGIN_PATH}) - - # set(GST_RESOURCES) - # qt_add_resources(GST_RESOURCES ${GST_QT6_PLUGIN_PATH}/resources.qrc) - # target_sources(qmlglsink - # PRIVATE - # ${GST_RESOURCES} - # ) - - # file(GLOB GST_RESOURCES_FRAG ${GST_QT6_PLUGIN_PATH}/*.frag) - # file(GLOB GST_RESOURCES_VERT ${GST_QT6_PLUGIN_PATH}/*.vert) - # qt_add_resources(qmlglsink "qmlglsink_res" - # PREFIX "/org/freedesktop/gstreamer/qml6" - # FILES - # ${GST_RESOURCES_FRAG} - # ${GST_RESOURCES_VERT} - # ) - - target_compile_definitions(qmlglsink - PRIVATE - HAVE_QT_QPA_HEADER - QT_QPA_HEADER= - ) - if(LINUX) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_X11) - if(EGL_FOUND) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_EGLFS) - endif() - if(Qt6WaylandClient_FOUND) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_WAYLAND) - endif() - elseif(ANDROID) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_ANDROID) - elseif(WIN32) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_WIN32) - elseif(MACOS) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_MAC) - elseif(IOS) - target_compile_definitions(qmlglsink PRIVATE HAVE_QT_IOS) - message(WARNING "qmlglsink not supported for IOS") - endif() - - if(UNIX) - target_compile_options(qmlglsink - PRIVATE - -Wno-unused-parameter - -Wno-implicit-fallthrough - -Wno-unused-private-field - ) - endif() -else() - message(WARNING "GST Qt Plugin Not Found") -endif() diff --git a/cmake/CreateAppImage.cmake b/cmake/CreateAppImage.cmake index 71e9e29fd4f..34c57ef5030 100644 --- a/cmake/CreateAppImage.cmake +++ b/cmake/CreateAppImage.cmake @@ -29,4 +29,17 @@ endif() # execute_process(COMMAND chmod a+x "${LD_GSTPLUGIN_PATH}") # endif() -execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage) # --plugin qt --plugin gtk --plugin gstreamer +execute_process(COMMAND ${LD_PATH} --appdir ${APPDIR_PATH} --output appimage) +# --exclude-library "libX*" +# --exclude-library "libglib*" +# --exclude-library "libgobject*" +# --exclude-library "libgdk_pixbuf*" +# --exclude-library "libwayland*" +# --exclude-library "libgmodule*" +# --exclude-library "libgio*" +# --exclude-library "libxcb*" +# --exclude-library "libxkbcommon*" +# --exclude-library "libdb*" +# --exclude-library "libgst*" +# --exclude-library "libgthread*" +# --plugin qt --plugin gtk --plugin gstreamer diff --git a/cmake/DownloadGStreamer.cmake b/cmake/DownloadGStreamer.cmake deleted file mode 100644 index fd0f1916277..00000000000 --- a/cmake/DownloadGStreamer.cmake +++ /dev/null @@ -1,35 +0,0 @@ -function(download_gstreamer version) - # TODO: Verify Version Number - set(GST_VERSION ${version}) - - include(CMakePrintHelpers) - - if(ANDROID) - FetchContent_Declare(gstreamer - URL https://gstreamer.freedesktop.org/data/pkg/android/${GST_VERSION}/gstreamer-1.0-android-universal-${GST_VERSION}.tar.xz - DOWNLOAD_EXTRACT_TIMESTAMP true - ) - FetchContent_MakeAvailable(gstreamer) - cmake_print_variables(gstreamer_SOURCE_DIR) - - if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL armeabi-v7a) - set(GSTREAMER_ROOT ${gstreamer_SOURCE_DIR}/armv7 PARENT_SCOPE) - elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL arm64-v8a) - set(GSTREAMER_ROOT ${gstreamer_SOURCE_DIR}/arm64 PARENT_SCOPE) - elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL x86) - set(GSTREAMER_ROOT ${gstreamer_SOURCE_DIR}/x86 PARENT_SCOPE) - elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL x86_64) - set(GSTREAMER_ROOT ${gstreamer_SOURCE_DIR}/x86_64 PARENT_SCOPE) - endif() - endif() - - if(NOT LINUX) - FetchContent_Declare(gstreamer_good_plugins - URL https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${GST_VERSION}.tar.xz - DOWNLOAD_EXTRACT_TIMESTAMP true - ) - FetchContent_MakeAvailable(gstreamer_good_plugins) - cmake_print_variables(gstreamer_good_plugins_SOURCE_DIR) - set(GST_QT6_PLUGIN_PATH ${gstreamer_good_plugins_SOURCE_DIR}/ext/qt6 PARENT_SCOPE) - endif() -endfunction() diff --git a/cmake/FindGStreamer.cmake b/cmake/FindGStreamer.cmake new file mode 100644 index 00000000000..5d761571265 --- /dev/null +++ b/cmake/FindGStreamer.cmake @@ -0,0 +1,377 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +# FindGStreamer +# --------- +# +# Locate the gstreamer-1.0 library and some of its plugins. +# Defines the following imported target: +# +# ``GStreamer::GStreamer`` +# If the gstreamer-1.0 library is available and target GStreamer::Base, +# GStreamer::Audio, GStreamer::Video, GStreamer::Pbutils and +# GStreamer::Allocators exist +# +# If target GStreamer::GStreamer exists, the following targets may be defined: +# +# ``GStreamer::App`` +# If the gstapp-1.0 library is available and target GStreamer::GStreamer exists +# ``GStreamer::Photography`` +# If the gstphotography-1.0 library is available and target GStreamer::GStreamer exists +# ``GStreamer::Gl`` +# If the gstgl-1.0 library is available and target GStreamer::GStreamer exists +# + +################################################################################ + +if(ANDROID) + set(QGC_GST_STATIC_BUILD ON) + list(APPEND PKG_CONFIG_ARGN --static) +endif() + +if(ANDROID OR IOS) + if(DEFINED ENV{GST_VERSION}) + set(QGC_GST_TARGET_VERSION $ENV{GST_VERSION} CACHE STRING "Environment Provided GStreamer Version") + else() + set(QGC_GST_TARGET_VERSION 1.22.12 CACHE STRING "Requested GStreamer Version") + endif() +endif() + +################################################################################ + +# NOTE: CMP0144 in regards to GSTREAMER_ROOT +set(GSTREAMER_PREFIX) +if(WIN32) + if(DEFINED ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64} AND EXISTS $ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64}) + set(GSTREAMER_PREFIX $ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64}) + elseif(DEFINED ENV{GSTREAMER_PREFIX_X86_64} AND EXISTS $ENV{GSTREAMER_PREFIX_X86_64}) + set(GSTREAMER_PREFIX $ENV{GSTREAMER_PREFIX_X86_64}) + else() + set(GSTREAMER_PREFIX "C:/gstreamer/1.0/msvc_x86_64") + endif() + set(PKG_CONFIG_EXECUTABLE ${GSTREAMER_PREFIX}/bin/pkg-config.exe) + set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/lib/pkgconfig;${GSTREAMER_PREFIX}/lib/gstreamer-1.0/pkgconfig;$ENV{PKG_CONFIG_PATH}") + # cmake_path(CONVERT "${GSTREAMER_PREFIX}/lib/pkgconfig;${GSTREAMER_PREFIX}/lib/gstreamer-1.0/pkgconfig;$ENV{PKG_CONFIG_PATH}" TO_NATIVE_PATH_LIST PKG_CONFIG_PATH NORMALIZE) + # cmake_print_variables(PKG_CONFIG_PATH) + # set(ENV{PKG_CONFIG_PATH} "${PKG_CONFIG_PATH}") + cmake_path(CONVERT "${GSTREAMER_PREFIX}" TO_CMAKE_PATH_LIST PREFIX_PATH NORMALIZE) + cmake_path(CONVERT "${GSTREAMER_PREFIX}/lib" TO_CMAKE_PATH_LIST LIBDIR_PATH NORMALIZE) + cmake_path(CONVERT "${GSTREAMER_PREFIX}/include" TO_CMAKE_PATH_LIST INCLUDE_PATH NORMALIZE) + list(APPEND PKG_CONFIG_ARGN + --dont-define-prefix + --define-variable=prefix=${PREFIX_PATH} + --define-variable=libdir=${LIBDIR_PATH} + --define-variable=includedir=${INCLUDE_PATH} + ) + cmake_print_variables(PKG_CONFIG_ARGN) +elseif(MACOS) + set(GSTREAMER_PREFIX "/Library/Frameworks/GStreamer.framework") + set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/Versions/Current/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") +elseif(LINUX) + set(GSTREAMER_PREFIX "/usr") + set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/lib/pkgconfig:${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu/pkgconfig:$ENV{PKG_CONFIG_PATH}") +elseif(IOS) + set(GSTREAMER_PREFIX "~/Library/Developer/GStreamer/iPhone.sdk/GStreamer.framework") + if(DEFINED ENV{GSTREAMER_PREFIX_IOS} AND EXISTS $ENV{GSTREAMER_PREFIX_IOS}) + set(GSTREAMER_PREFIX_IOS $ENV{GSTREAMER_PREFIX_IOS}) + else() + FetchContent_Declare(gstreamer + URL "https://gstreamer.freedesktop.org/data/pkg/ios/${QGC_GST_TARGET_VERSION}/gstreamer-1.0-devel-${QGC_GST_TARGET_VERSION}-ios-universal.pkg" + DOWNLOAD_EXTRACT_TIMESTAMP true + ) + FetchContent_MakeAvailable(gstreamer) + set(GSTREAMER_PREFIX_IOS ${gstreamer_SOURCE_DIR}) + endif() + # TODO: set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_IOS}/) +elseif(ANDROID) + set(GSTREAMER_PREFIX_ANDROID) + if(DEFINED ENV{GSTREAMER_PREFIX_ANDROID} AND EXISTS $ENV{GSTREAMER_PREFIX_ANDROID}) + set(GSTREAMER_PREFIX_ANDROID $ENV{GSTREAMER_PREFIX_ANDROID}) + else() + FetchContent_Declare(gstreamer + URL "https://gstreamer.freedesktop.org/data/pkg/android/${QGC_GST_TARGET_VERSION}/gstreamer-1.0-android-universal-${QGC_GST_TARGET_VERSION}.tar.xz" + DOWNLOAD_EXTRACT_TIMESTAMP true + ) + FetchContent_MakeAvailable(gstreamer) + set(GSTREAMER_PREFIX_ANDROID ${gstreamer_SOURCE_DIR}) + endif() + if(${CMAKE_ANDROID_ARCH_ABI} STREQUAL armeabi-v7a) + set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_ANDROID}/armv7) + elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL arm64-v8a) + set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_ANDROID}/arm64) + elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL x86) + set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_ANDROID}/x86) + elseif(${CMAKE_ANDROID_ARCH_ABI} STREQUAL x86_64) + set(GSTREAMER_PREFIX ${GSTREAMER_PREFIX_ANDROID}/x86_64) + endif() + set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_PREFIX}/lib/pkgconfig:${GSTREAMER_PREFIX}/lib/gstreamer-1.0/pkgconfig:$ENV{PKG_CONFIG_PATH}") + set(ENV{PKG_CONFIG_LIBDIR} "${GSTREAMER_PREFIX}/lib/pkgconfig:${GSTREAMER_PREFIX}/lib/gstreamer-1.0/pkgconfig") + # set(ENV{PKG_CONFIG_SYSROOT_DIR} "${GSTREAMER_PREFIX}") + message(STATUS "PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH}") + message(STATUS "PKG_CONFIG_LIBDIR $ENV{PKG_CONFIG_LIBDIR}") + # message(STATUS "PKG_CONFIG_SYSROOT_DIR $ENV{PKG_CONFIG_SYSROOT_DIR}") + list(APPEND PKG_CONFIG_ARGN + --dont-define-prefix + --define-variable=prefix=${GSTREAMER_PREFIX} + --define-variable=libdir=${GSTREAMER_PREFIX}/lib + --define-variable=includedir=${GSTREAMER_PREFIX}/include + ) + cmake_print_variables(PKG_CONFIG_ARGN) +endif() +cmake_print_variables(GSTREAMER_PREFIX) +list(PREPEND CMAKE_PREFIX_PATH ${GSTREAMER_PREFIX}) + +################################################################################ + +include(CMakeFindDependencyMacro) +find_dependency(GObject) + +set(GStreamer_VERSION ${QGC_GST_TARGET_VERSION}) +find_package(PkgConfig QUIET) +if(NOT PkgConfig_FOUND) + find_file(GStreamer_VERSION_HEADER + NAMES gst/gstversion.h + PATHS ${GSTREAMER_PREFIX}/include/gstreamer-1.0 + ) + if(GStreamer_VERSION_HEADER) + file(READ "${GStreamer_VERSION_HEADER}" _gstversion_header_contents) + string(REGEX MATCH + "GST_VERSION_MAJOR \\([0-9]+" + _gst_major_version_line + "${_gstversion_header_contents}" + ) + string(SUBSTRING "${_gst_major_version_line}" 19 -1 GStreamer_VERSION_MAJOR) + string(REGEX MATCH + "GST_VERSION_MINOR \\([0-9]+" + _gst_minor_version_line + "${_gstversion_header_contents}" + ) + string(SUBSTRING "${_gst_minor_version_line}" 19 -1 GStreamer_VERSION_MINOR) + string(REGEX MATCH + "GST_VERSION_MICRO \\([0-9]+" + _gst_micro_version_line + "${_gstversion_header_contents}" + ) + string(SUBSTRING "${_gst_micro_version_line}" 19 -1 GStreamer_VERSION_PATCH) + unset(_gstversion_header_contents) + set(GStreamer_VERSION "${GStreamer_VERSION_MAJOR}.${GStreamer_VERSION_MINOR}.${GStreamer_VERSION_PATCH}") + cmake_print_variables(GStreamer_VERSION) + endif() +endif() + +function(find_gstreamer_component component prefix header library) + if(NOT TARGET GStreamer::${component}) + string(TOUPPER ${component} upper) + # if(ANDROID) + # pkg_check_modules(PC_GSTREAMER_${upper} ${prefix} IMPORTED_TARGET NO_CMAKE_ENVIRONMENT_PATH) + # else() + pkg_check_modules(PC_GSTREAMER_${upper} ${prefix} IMPORTED_TARGET) + # endif() + if(TARGET PkgConfig::PC_GSTREAMER_${upper}) + add_library(GStreamer::${component} INTERFACE IMPORTED) + target_link_libraries(GStreamer::${component} INTERFACE PkgConfig::PC_GSTREAMER_${upper}) + set_target_properties(GStreamer::${component} PROPERTIES VERSION ${PC_GSTREAMER_${upper}_VERSION}) + else() + find_path(GStreamer_${component}_INCLUDE_DIR + NAMES ${header} + PATH_SUFFIXES gstreamer-1.0 + PATHS ${GSTREAMER_PREFIX}/include + ) + find_library(GStreamer_${component}_LIBRARY + NAMES ${library} + PATHS ${GSTREAMER_PREFIX}/lib + ) + if(${component} STREQUAL "Gl") + # search the gstglconfig.h include dir under the same root where the library is found + # TODO: replace with cmake_path + get_filename_component(gstglLibDir "${GStreamer_Gl_LIBRARY}" PATH) + find_path(GStreamer_GlConfig_INCLUDE_DIR + NAMES gst/gl/gstglconfig.h + PATH_SUFFIXES gstreamer-1.0/include + HINTS ${PC_GSTREAMER_GL_INCLUDE_DIRS} ${PC_GSTREAMER_GL_INCLUDEDIR} "${gstglLibDir}" + ) + if(GStreamer_GlConfig_INCLUDE_DIR) + list(APPEND GStreamer_Gl_INCLUDE_DIR "${GStreamer_GlConfig_INCLUDE_DIR}") + list(REMOVE_DUPLICATES GStreamer_Gl_INCLUDE_DIR) + endif() + endif() + if(GStreamer_${component}_LIBRARY AND GStreamer_${component}_INCLUDE_DIR) + add_library(GStreamer::${component} INTERFACE IMPORTED) + target_include_directories(GStreamer::${component} INTERFACE ${GStreamer_${component}_INCLUDE_DIR}) + target_link_libraries(GStreamer::${component} INTERFACE ${GStreamer_${component}_LIBRARY}) + set_target_properties(GStreamer::${component} PROPERTIES VERSION ${GStreamer_VERSION}) + endif() + mark_as_advanced(GStreamer_${component}_INCLUDE_DIR GStreamer_${component}_LIBRARY) + endif() + endif() + + if(TARGET GStreamer::${component}) + # TODO; define_property + set(GStreamer_${component}_FOUND TRUE PARENT_SCOPE) + get_target_property(Component_VERSION GStreamer::${component} VERSION) + set(GStreamer_${component}_VERSION ${Component_VERSION} PARENT_SCOPE) + endif() +endfunction() + +################################################################################ + +# GStreamer required dependencies +find_gstreamer_component(Core gstreamer-1.0 gst/gst.h gstreamer-1.0) +find_gstreamer_component(Base gstreamer-base-1.0 gst/gst.h gstbase-1.0) +find_gstreamer_component(Video gstreamer-video-1.0 gst/video/video.h gstvideo-1.0) +find_gstreamer_component(Gl gstreamer-gl-1.0 gst/gl/gl.h gstgl-1.0) + +if(TARGET GStreamer::Core) + target_link_libraries(GStreamer::Core INTERFACE GObject::GObject) +endif() +if(TARGET GStreamer::Base AND TARGET GStreamer::Core) + target_link_libraries(GStreamer::Base INTERFACE GStreamer::Core) +endif() +if(TARGET GStreamer::Video AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Video INTERFACE GStreamer::Base) +endif() +if(TARGET GStreamer::Gl AND TARGET GStreamer::Video) + target_link_libraries(GStreamer::Gl INTERFACE GStreamer::Video) +endif() + +################################################################################ + +# GStreamer optional components +foreach(component ${GStreamer_FIND_COMPONENTS}) + if (${component} STREQUAL "App") + find_gstreamer_component(App gstreamer-app-1.0 gst/app/gstappsink.h gstapp-1.0) + if(TARGET GStreamer::App AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::App INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Audio") + find_gstreamer_component(Audio gstreamer-audio-1.0 gst/audio/audio.h gstaudio-1.0) + if(TARGET GStreamer::Audio AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Audio INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Allocators") + find_gstreamer_component(Allocators gstreamer-allocators-1.0 gst/allocators/allocators.h gstallocators-1.0) + if(TARGET GStreamer::Allocators AND TARGET GStreamer::Core) + target_link_libraries(GStreamer::Allocators INTERFACE GStreamer::Core) + endif() + elseif (${component} STREQUAL "Pbutils") + find_gstreamer_component(Pbutils gstreamer-pbutils-1.0 gst/pbutils/pbutils.h gstpbutils-1.0) + if(TARGET GStreamer::Pbutils AND TARGET GStreamer::Audio AND TARGET GStreamer::Video) + target_link_libraries(GStreamer::Pbutils INTERFACE GStreamer::Audio GStreamer::Video) + endif() + elseif (${component} STREQUAL "Photography") + find_gstreamer_component(Photography gstreamer-photography-1.0 gst/interfaces/photography.h gstphotography-1.0) + if(TARGET GStreamer::Photography AND TARGET GStreamer::Core) + target_link_libraries(GStreamer::Photography INTERFACE GStreamer::Core) + endif() + elseif (${component} STREQUAL "Controller") + find_gstreamer_component(Controller gstreamer-controller-1.0 gst/controller/controller.h gstcontroller-1.0) + if(TARGET GStreamer::Controller AND TARGET GStreamer::Core) + target_link_libraries(GStreamer::Controller INTERFACE GStreamer::Core) + endif() + elseif (${component} STREQUAL "Codecparsers") + find_gstreamer_component(Codecparsers gstreamer-codecparsers-1.0 gst/codecparsers/codecparsers-prelude.h gstcodecparsers-1.0) + if(TARGET GStreamer::Codecparsers AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Codecparsers INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Net") + find_gstreamer_component(Net gstreamer-net-1.0 gst/net/net.h gstnet-1.0) + if(TARGET GStreamer::Net AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Net INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Fft") + find_gstreamer_component(Fft gstreamer-fft-1.0 gst/fft/fft.h gstfft-1.0) + if(TARGET GStreamer::Fft AND TARGET GStreamer::Core) + target_link_libraries(GStreamer::Fft INTERFACE GStreamer::Core) + endif() + elseif (${component} STREQUAL "Riff") + find_gstreamer_component(Riff gstreamer-riff-1.0 gst/riff/riff.h gstriff-1.0) + if(TARGET GStreamer::Riff AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Riff INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Rtp") + find_gstreamer_component(Rtp gstreamer-rtp-1.0 gst/rtp/rtp.h gstrtp-1.0) + if(TARGET GStreamer::Rtp AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Rtp INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Rtsp") + find_gstreamer_component(Rtsp gstreamer-rtsp-1.0 gst/rtsp/rtsp.h gstrtsp-1.0) + if(TARGET GStreamer::Rtsp AND TARGET GStreamer::Rtp) + target_link_libraries(GStreamer::Rtsp INTERFACE GStreamer::Rtp) + endif() + elseif (${component} STREQUAL "Mpegts") + find_gstreamer_component(Mpegts gstreamer-mpegts-1.0 gst/mpegts/mpegts.h gstmpegts-1.0) + if(TARGET GStreamer::Mpegts AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Mpegts INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Sdp") + find_gstreamer_component(Sdp gstreamer-sdp-1.0 gst/sdp/sdp.h gstsdp-1.0) + if(TARGET GStreamer::Sdp AND TARGET GStreamer::Rtp) + target_link_libraries(GStreamer::Sdp INTERFACE GStreamer::Rtp) + endif() + elseif (${component} STREQUAL "Tag") + find_gstreamer_component(Tag gstreamer-tag-1.0 gst/tag/tag.h gsttag-1.0) + if(TARGET GStreamer::Tag AND TARGET GStreamer::Base) + target_link_libraries(GStreamer::Tag INTERFACE GStreamer::Base) + endif() + elseif (${component} STREQUAL "Prototypes") + find_gstreamer_component(Prototypes gstreamer-gl-prototypes-1.0 gst/gl/glprototypes/all_functions.h gstglproto-1.0) + if(TARGET GStreamer::Prototypes AND TARGET GStreamer::Gl) + target_link_libraries(GStreamer::Prototypes INTERFACE GStreamer::Gl) + endif() + elseif (${component} STREQUAL "X11") + find_gstreamer_component(X11 gstreamer-gl-x11-1.0 gst/gl/x11/x11.h x11-xcb) + if(TARGET GStreamer::X11 AND TARGET GStreamer::Gl) + target_link_libraries(GStreamer::X11 INTERFACE GStreamer::Gl) + endif() + elseif (${component} STREQUAL "EGL") + find_gstreamer_component(EGL gstreamer-gl-egl-1.0 gst/gl/egl/egl.h egl) + if(TARGET GStreamer::EGL AND TARGET GStreamer::Gl) + target_link_libraries(GStreamer::EGL INTERFACE GStreamer::Gl) + endif() + elseif (${component} STREQUAL "Wayland") + find_gstreamer_component(Wayland gstreamer-gl-wayland-1.0 gst/gl/wayland/wayland.h wayland-egl) + if(TARGET GStreamer::Wayland AND TARGET GStreamer::Gl) + target_link_libraries(GStreamer::Wayland INTERFACE GStreamer::Gl) + endif() + else() + message(WARNING "FindGStreamer.cmake: Invalid Gstreamer component \"${component}\" requested") + endif() +endforeach() + +################################################################################ + +# Create target GStreamer::GStreamer +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GStreamer + REQUIRED_VARS + GStreamer_Core_FOUND + GStreamer_Base_FOUND + GStreamer_Video_FOUND + GStreamer_Gl_FOUND + HANDLE_COMPONENTS +) + +if(GStreamer_FOUND AND NOT TARGET GStreamer::GStreamer) + add_library(GStreamer::GStreamer INTERFACE IMPORTED) + target_link_libraries(GStreamer::GStreamer INTERFACE + GStreamer::Core + GStreamer::Base + GStreamer::Video + GStreamer::Gl + ) + set_target_properties(GStreamer::GStreamer PROPERTIES VERSION ${GStreamer_Core_VERSION}) + set(GStreamer_VERSION ${GStreamer_Core_VERSION}) +endif() + +if(TARGET PkgConfig::PC_GSTREAMER_GL) + get_target_property(_qt_incs PkgConfig::PC_GSTREAMER_GL INTERFACE_INCLUDE_DIRECTORIES) + set(__qt_fixed_incs) + foreach(path IN LISTS _qt_incs) + if(IS_DIRECTORY "${path}") + list(APPEND __qt_fixed_incs "${path}") + endif() + endforeach() + set_property(TARGET PkgConfig::PC_GSTREAMER_GL PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${__qt_fixed_incs}") +endif() + +################################################################################ diff --git a/cmake/GStreamer.cmake b/cmake/GStreamer.cmake deleted file mode 100644 index 18503839f98..00000000000 --- a/cmake/GStreamer.cmake +++ /dev/null @@ -1,239 +0,0 @@ -if(ANDROID) - set(GST_STATIC_BUILD ON) -else() - set(GST_STATIC_BUILD OFF) -endif() - -if(DEFINED ENV{GST_VERSION}) - set(GST_TARGET_VERSION $ENV{GST_VERSION}) -elseif(LINUX) - set(GST_TARGET_VERSION 1.16) -else() - set(GST_TARGET_VERSION 1.22.12) -endif() -# TODO: Download using ${GST_gstreamer-1.0_VERSION} - -include(DownloadGStreamer) -download_gstreamer(${GST_TARGET_VERSION}) - -set(GST_TARGET_PLUGINS - gstcoreelements - gstplayback - gstudp - gstrtp - gstrtsp - gstx264 - gstlibav - gstsdpelem - gstvideoparsersbad - gstrtpmanager - gstisomp4 - gstmatroska - gstmpegtsdemux - gstopengl - gsttcp -) -if(ANDROID) - list(APPEND GST_TARGET_PLUGINS gstandroidmedia) -elseif(IOS) - list(APPEND GST_TARGET_PLUGINS gstapplemedia) -endif() - -set(GST_TARGET_MODULES - gstreamer-1.0 - gstreamer-gl-1.0 - gstreamer-video-1.0 -) -if(LINUX) - list(APPEND GST_TARGET_MODULES - # gstreamer-gl-x11-1.0 - # gstreamer-gl-egl-1.0 - # gstreamer-gl-wayland-1.0 - egl - ) -endif() - -if(NOT GSTREAMER_ROOT) - set(GSTREAMER_ROOT) - if(WIN32) - if(DEFINED ENV{GSTREAMER_ROOT_X86_64} AND EXISTS $ENV{GSTREAMER_ROOT_X86_64}) - set(GSTREAMER_ROOT $ENV{GSTREAMER_ROOT_X86_64}) - elseif(DEFINED ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64} AND EXISTS $ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64}) - set(GSTREAMER_ROOT $ENV{GSTREAMER_1_0_ROOT_MSVC_X86_64}) - else() - set(GSTREAMER_ROOT "C:/gstreamer/1.0/msvc_x86_64") - endif() - elseif(MACOS) - set(GSTREAMER_ROOT "/Library/Frameworks/GStreamer.framework") - # elseif(LINUX) - # set(GSTREAMER_ROOT "/usr") - elseif(ANDROID) - set(ANDROID_GSTREAMER_ROOT ${CMAKE_SOURCE_DIR}/gstreamer-1.0-android-universal-${GST_TARGET_VERSION}) - if(${ANDROID_ABI} STREQUAL armeabi-v7a) - set(GSTREAMER_ROOT ${ANDROID_GSTREAMER_ROOT}/armv7) - elseif(${ANDROID_ABI} STREQUAL arm64-v8a) - set(GSTREAMER_ROOT ${ANDROID_GSTREAMER_ROOT}/arm64) - elseif(${ANDROID_ABI} STREQUAL x86) - set(GSTREAMER_ROOT ${ANDROID_GSTREAMER_ROOT}/x86) - elseif(${ANDROID_ABI} STREQUAL x86_64) - set(GSTREAMER_ROOT ${ANDROID_GSTREAMER_ROOT}/x86_64) - endif() - endif() - cmake_print_variables(GSTREAMER_ROOT) -endif() - -find_package(PkgConfig) -if(PkgConfig_FOUND) - if(NOT EXISTS ${GSTREAMER_ROOT}) - message(STATUS "Searching for gstreamer-1.0") - pkg_check_modules(GSTREAMER gstreamer-1.0>=${GST_TARGET_VERSION}) - if(GSTREAMER_FOUND) - set(GSTREAMER_ROOT ${GSTREAMER_PREFIX}) - endif() - endif() - - if(EXISTS ${GSTREAMER_ROOT}) - message(STATUS "GStreamer found") - cmake_print_variables(GSTREAMER_ROOT) - - if(GST_STATIC_BUILD) - list(APPEND PKG_CONFIG_ARGN --static) - endif() - - list(PREPEND CMAKE_PREFIX_PATH ${GSTREAMER_ROOT}) - if(ANDROID) - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/pkgconfig:${GSTREAMER_ROOT}/lib/gstreamer-1.0/pkgconfig:$ENV{PKG_CONFIG_PATH}") - set(ENV{PKG_CONFIG_LIBDIR} "${GSTREAMER_ROOT}/lib/pkgconfig:${GSTREAMER_ROOT}/lib/gstreamer-1.0/pkgconfig") - # set(ENV{PKG_CONFIG_SYSROOT_DIR} "${GSTREAMER_ROOT}") - message(STATUS "PKG_CONFIG_PATH $ENV{PKG_CONFIG_PATH}") - message(STATUS "PKG_CONFIG_LIBDIR $ENV{PKG_CONFIG_LIBDIR}") - # message(STATUS "PKG_CONFIG_SYSROOT_DIR $ENV{PKG_CONFIG_SYSROOT_DIR}") - list(APPEND PKG_CONFIG_ARGN - --dont-define-prefix - --define-variable=prefix=${GSTREAMER_ROOT} - --define-variable=libdir=${GSTREAMER_ROOT}/lib - --define-variable=includedir=${GSTREAMER_ROOT}/include - ) - cmake_print_variables(PKG_CONFIG_ARGN) - pkg_check_modules(GST - IMPORTED_TARGET - NO_CMAKE_ENVIRONMENT_PATH - ${GST_TARGET_MODULES} - ${GST_TARGET_PLUGINS} - ) - elseif(LINUX) - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/pkgconfig:${GSTREAMER_ROOT}/x86_64-linux-gnu/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") - pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) - elseif(MACOS) - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/Versions/Current/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") - pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) - else() - set(ENV{PKG_CONFIG_PATH} "${GSTREAMER_ROOT}/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}") - pkg_check_modules(GST IMPORTED_TARGET ${GST_TARGET_MODULES}) - endif() - - if(TARGET PkgConfig::GST) - target_link_libraries(qmlglsink PUBLIC PkgConfig::GST) - target_include_directories(qmlglsink PUBLIC ${GSTREAMER_ROOT}/include/gstreamer-1.0) - message(STATUS "GStreamer version: ${GST_gstreamer-1.0_VERSION}") - message(STATUS "GStreamer prefix: ${GST_gstreamer-1.0_PREFIX}") - message(STATUS "GStreamer include dir: ${GST_gstreamer-1.0_INCLUDEDIR}") - message(STATUS "GStreamer libdir: ${GST_gstreamer-1.0_LIBDIR}") - if(GST_STATIC_BUILD) - target_link_libraries(qmlglsink PUBLIC ${GST_STATIC_LINK_LIBRARIES}) - target_link_directories(qmlglsink PUBLIC ${GST_STATIC_LIBRARY_DIRS}) - target_link_options(qmlglsink PUBLIC ${GST_STATIC_LDFLAGS} ${GST_STATIC_LDFLAGS_OTHER}) - target_compile_options(qmlglsink PUBLIC ${GST_STATIC_CFLAGS} ${GST_STATIC_CFLAGS_OTHER}) - target_include_directories(qmlglsink PUBLIC ${GST_STATIC_INCLUDE_DIRS}) - if(ANDROID) - target_link_options(PkgConfig::GST INTERFACE "-Wl,-Bsymbolic") - endif() - list(REMOVE_DUPLICATES GST_STATIC_LIBRARIES) - list(REMOVE_DUPLICATES GST_STATIC_LINK_LIBRARIES) - list(REMOVE_DUPLICATES GST_STATIC_LIBRARY_DIRS) - list(REMOVE_DUPLICATES GST_STATIC_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS) - list(REMOVE_DUPLICATES GST_STATIC_LDFLAGS_OTHER) - list(REMOVE_DUPLICATES GST_STATIC_CFLAGS) - list(REMOVE_DUPLICATES GST_STATIC_CFLAGS_OTHER) - message(VERBOSE "GStreamer static libs: ${GST_STATIC_LIBRARIES}") - message(VERBOSE "GStreamer static link libs: ${GST_STATIC_LINK_LIBRARIES}") - message(VERBOSE "GStreamer static link dirs: ${GST_STATIC_LIBRARY_DIRS}") - message(VERBOSE "GStreamer static include dirs: ${GST_STATIC_INCLUDE_DIRS}") - message(VERBOSE "GStreamer static ldflags: ${GST_STATIC_LDFLAGS}") - message(VERBOSE "GStreamer static ldflags other: ${GST_STATIC_LDFLAGS_OTHER}") - message(VERBOSE "GStreamer static cflags: ${GST_STATIC_CFLAGS}") - message(VERBOSE "GStreamer static cflags other: ${GST_STATIC_CFLAGS_OTHER}") - else() - target_link_libraries(qmlglsink PUBLIC ${GST_LINK_LIBRARIES}) - target_link_directories(qmlglsink PUBLIC ${GST_LIBRARY_DIRS}) - target_link_options(qmlglsink PUBLIC ${GST_LDFLAGS} ${GST_LDFLAGS_OTHER}) - target_compile_options(qmlglsink PUBLIC ${GST_CFLAGS} ${GST_CFLAGS_OTHER}) - target_include_directories(qmlglsink PUBLIC ${GST_INCLUDE_DIRS}) - if(WIN32) - cmake_path(CONVERT "${GSTREAMER_ROOT}/bin/*.dll" TO_CMAKE_PATH_LIST GST_WIN_BINS_PATH) - file(GLOB GST_WIN_BINS ${GST_WIN_BINS_PATH}) - cmake_print_variables(GST_WIN_BINS_PATH GST_WIN_BINS) - # TODO: Only install needed libs - install(FILES ${GST_WIN_BINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - endif() - list(REMOVE_DUPLICATES GST_LIBRARIES) - list(REMOVE_DUPLICATES GST_LINK_LIBRARIES) - list(REMOVE_DUPLICATES GST_LIBRARY_DIRS) - list(REMOVE_DUPLICATES GST_INCLUDE_DIRS) - list(REMOVE_DUPLICATES GST_LDFLAGS) - list(REMOVE_DUPLICATES GST_LDFLAGS_OTHER) - list(REMOVE_DUPLICATES GST_CFLAGS) - list(REMOVE_DUPLICATES GST_CFLAGS_OTHER) - message(VERBOSE "GStreamer libs: ${GST_LIBRARIES}") - message(VERBOSE "GStreamer link libs: ${GST_LINK_LIBRARIES}") - message(VERBOSE "GStreamer link dirs: ${GST_LIBRARY_DIRS}") - message(VERBOSE "GStreamer include dirs: ${GST_INCLUDE_DIRS}") - message(VERBOSE "GStreamer ldflags: ${GST_LDFLAGS}") - message(VERBOSE "GStreamer ldflags other: ${GST_LDFLAGS_OTHER}") - message(VERBOSE "GStreamer cflags: ${GST_CFLAGS}") - message(VERBOSE "GStreamer cflags other: ${GST_CFLAGS_OTHER}") - endif() - endif() - else() - message(WARNING "GStreamer Not Found") - endif() -elseif(WIN32) - find_library(GSTREAMER NAMES gstreamer-1.0 HINTS ${GSTREAMER_ROOT}/lib) - if(GSTREAMER) - target_link_libraries(qmlglsink - PUBLIC - ${GSTREAMER_ROOT}/lib/gstreamer-1.0.lib - ${GSTREAMER_ROOT}/lib/gstgl-1.0.lib - ${GSTREAMER_ROOT}/lib/gstvideo-1.0.lib - ${GSTREAMER_ROOT}/lib/gstbase-1.0.lib - ${GSTREAMER_ROOT}/lib/glib-2.0.lib - ${GSTREAMER_ROOT}/lib/intl.lib - ${GSTREAMER_ROOT}/lib/gobject-2.0.lib - ) - - # find_path(GSTREAMER_INCLUDE_DIR gst/gst.h) - target_include_directories(qmlglsink - PUBLIC - ${GSTREAMER_ROOT}/include - ${GSTREAMER_ROOT}/include/gstreamer-1.0 - ${GSTREAMER_ROOT}/include/glib-2.0 - ${GSTREAMER_ROOT}/lib/gstreamer-1.0/include - ${GSTREAMER_ROOT}/lib/glib-2.0/include - ) - - # TODO: Only install needed libs - - cmake_path(CONVERT "${GSTREAMER_ROOT}/bin/*.dll" TO_CMAKE_PATH_LIST GST_WIN_BINS_PATH) - file(GLOB GST_WIN_BINS ${GST_WIN_BINS_PATH}) - cmake_print_variables(GST_WIN_BINS_PATH GST_WIN_BINS) - install(FILES ${GST_WIN_BINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) - - cmake_path(CONVERT "${GSTREAMER_ROOT}/lib/gstreamer-1.0/*.dll" TO_CMAKE_PATH_LIST GST_WIN_LIBS_PATH) - file(GLOB GST_WIN_LIBS ${GST_WIN_LIBS_PATH}) - cmake_print_variables(GST_WIN_LIBS_PATH GST_WIN_LIBS) - install(FILES ${GST_WIN_LIBS} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - - set(GST_FOUND TRUE) - endif() -endif() diff --git a/deploy/linux/AppRun b/deploy/linux/AppRun new file mode 100755 index 00000000000..aab85507839 --- /dev/null +++ b/deploy/linux/AppRun @@ -0,0 +1,12 @@ +#! /usr/bin/env bash + +# autogenerated by linuxdeploy + +# make sure errors in sourced scripts will cause this script to stop +set -e + +this_dir="$(readlink -f "$(dirname "$0")")" + +source "$this_dir"/apprun-hooks/"linuxdeploy-plugin-gstreamer.sh" + +exec "$this_dir"/AppRun.wrapped "$@" diff --git a/deploy/linux/apprun-hooks/linux-deploy-gstreamer.sh b/deploy/linux/apprun-hooks/linux-deploy-gstreamer.sh new file mode 100644 index 00000000000..eba949d216a --- /dev/null +++ b/deploy/linux/apprun-hooks/linux-deploy-gstreamer.sh @@ -0,0 +1,8 @@ +#! /bin/bash + +export GST_REGISTRY_REUSE_PLUGIN_SCANNER="no" +export GST_PLUGIN_SYSTEM_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" +export GST_PLUGIN_PATH_1_0="${APPDIR}/usr/lib/gstreamer-1.0" + +export GST_PLUGIN_SCANNER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner" +export GST_PTP_HELPER_1_0="${APPDIR}/usr/lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper" diff --git a/src/API/CMakeLists.txt b/src/API/CMakeLists.txt index b048eefe8df..ee8040eb105 100644 --- a/src/API/CMakeLists.txt +++ b/src/API/CMakeLists.txt @@ -15,7 +15,9 @@ target_link_libraries(API PRIVATE Qt6::Qml FactSystem + GStreamerReceiver Joystick + QtMultimediaReceiver Settings Utilities VideoManager diff --git a/src/VideoManager/CMakeLists.txt b/src/VideoManager/CMakeLists.txt index c6f7ce52e60..2923492daec 100644 --- a/src/VideoManager/CMakeLists.txt +++ b/src/VideoManager/CMakeLists.txt @@ -8,10 +8,12 @@ qt_add_library(VideoManager STATIC ) # option(QGC_ENABLE_VIDEOSTREAMING "Enable video streaming" ON) +# cmake_print_variables(QGC_ENABLE_VIDEOSTREAMING) # if(NOT QGC_ENABLE_VIDEOSTREAMING) +# message(STATUS "Video streaming support disabled") # return() # endif() -# message(STATUS "Enabling video streaming support") +# message(STATUS "Video streaming support enabled") add_subdirectory(VideoReceiver) @@ -20,15 +22,15 @@ target_link_libraries(VideoManager API Camera FactSystem + GStreamerReceiver QmlControls + QtMultimediaReceiver Settings Utilities Vehicle VideoReceiver PUBLIC Qt6::Core - GStreamerReceiver - QtMultimediaReceiver QGC ) diff --git a/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt index 3ce2e2177a6..4802963b29b 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt +++ b/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt @@ -1,7 +1,9 @@ find_package(Qt6 REQUIRED COMPONENTS Core Quick) qt_add_library(GStreamerReceiver STATIC GLVideoItemStub.h) + target_link_libraries(GStreamerReceiver PUBLIC Qt6::Quick) + target_include_directories(GStreamerReceiver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) option(QGC_ENABLE_GST_VIDEOSTREAMING "Enable GStreamer Video Streaming Backend" ON) @@ -10,9 +12,9 @@ if(NOT QGC_ENABLE_GST_VIDEOSTREAMING) return() endif() -add_subdirectory(qmlglsink) +add_subdirectory(gstqml6gl) -if(NOT GST_QT6_PLUGIN_FOUND) +if(NOT TARGET gstqml6gl) return() endif() @@ -34,17 +36,18 @@ if(IOS) ) endif() + target_link_libraries(GStreamerReceiver PRIVATE Utilities PUBLIC Qt6::Core - qmlglsink + gstqml6gl Settings VideoReceiver ) -target_compile_definitions(GStreamerReceiver PUBLIC QGC_GST_STREAMING) +target_compile_definitions(QGC PUBLIC QGC_GST_STREAMING) if(CMAKE_BUILD_TYPE STREQUAL "Release") target_compile_definitions(GStreamerReceiver PRIVATE QGC_INSTALL_RELEASE) endif() diff --git a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc index 2d421c9d597..804f66afeef 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc +++ b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc @@ -74,7 +74,7 @@ static void qt_gst_log(GstDebugCategory * category, G_BEGIN_DECLS // The static plugins we use -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +#ifdef QGC_GST_STATIC_BUILD GST_PLUGIN_STATIC_DECLARE(coreelements); GST_PLUGIN_STATIC_DECLARE(playback); GST_PLUGIN_STATIC_DECLARE(libav); @@ -171,9 +171,11 @@ GStreamer::initialize(int argc, char* argv[], int debuglevel) #ifdef Q_OS_MAC #ifdef QGC_INSTALL_RELEASE - QString currentDir = QCoreApplication::applicationDirPath(); - qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../Frameworks/GStreamer.framework/Versions/1.0/libexec/gstreamer-1.0/gst-plugin-scanner"); - qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current"); + const QString currentDir = QCoreApplication::applicationDirPath(); + qgcputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no", ""); + qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/libexec/gstreamer-1.0/gst-plugin-scanner"); + qgcputenv("GST_PTP_HELPER_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/libexec/gstreamer-1.0/gst-ptp-helper"); + // qgcputenv("GTK_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current"); qgcputenv("GIO_EXTRA_MODULES", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gio/modules"); qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); @@ -181,19 +183,26 @@ GStreamer::initialize(int argc, char* argv[], int debuglevel) qgcputenv("GST_PLUGIN_PATH", currentDir, "/../Frameworks/GStreamer.framework/Versions/Current/lib/gstreamer-1.0"); #endif #elif defined(Q_OS_WIN) - QString currentDir = QCoreApplication::applicationDirPath(); - qgcputenv("GST_PLUGIN_PATH", currentDir, "/gstreamer-plugins"); -#elif defined(Q_OS_LINUX) const QString currentDir = QCoreApplication::applicationDirPath(); - qgcputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no", ""); - qgcputenv("GST_PLUGIN_SCANNER", "/usr/lib/x86_64-linux-gnu", "/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"); - qgcputenv("GST_PTP_HELPER_1_0", "/usr/lib/x86_64-linux-gnu", "/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"); - qgcputenv("GTK_PATH", "/usr", ""); - qgcputenv("GIO_EXTRA_MODULES", "/usr/lib/x86_64-linux-gnu", "/gio/modules"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", "/usr/lib/x86_64-linux-gnu", "/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_SYSTEM_PATH", "/usr/lib/x86_64-linux-gnu", "/gstreamer-1.0"); - qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "../lib"); - qgcputenv("GST_PLUGIN_PATH", currentDir, "../lib"); + // qgcputenv("GST_PLUGIN_SCANNER", "C:/gstreamer/1.0/msvc_x86_64", "/libexec/gstreamer-1.0/gst-plugin-scanner"); + // qgcputenv("GST_PTP_HELPER_1_0", "C:/gstreamer/1.0/msvc_x86_64", "/libexec/gstreamer-1.0/gst-ptp-helper"); + // qgcputenv("GTK_PATH", "C:/gstreamer/1.0/msvc_x86_64", ""); + // qgcputenv("GIO_EXTRA_MODULES", "C:/gstreamer/1.0/msvc_x86_64", "/lib/gio/modules"); + // qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", "C:/gstreamer/1.0/msvc_x86_64", "/lib/gstreamer-1.0"); + // qgcputenv("GST_PLUGIN_SYSTEM_PATH", "C:/gstreamer/1.0/msvc_x86_64", "/lib/gstreamer-1.0"); + qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, ""); + qgcputenv("GST_PLUGIN_PATH", currentDir, ""); +#elif defined(Q_OS_LINUX) + // const QString currentDir = QCoreApplication::applicationDirPath(); + // qgcputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no", ""); + // qgcputenv("GST_PLUGIN_SCANNER", currentDir, "/../lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner"); + // qgcputenv("GST_PTP_HELPER_1_0", currentDir, "/../lib/gstreamer1.0/gstreamer-1.0/gst-ptp-helper"); + // qgcputenv("GTK_PATH", currentDir, ""); + // qgcputenv("GIO_EXTRA_MODULES", currentDir, "/../lib/gio/modules"); + // qgcputenv("GST_PLUGIN_SYSTEM_PATH_1_0", currentDir, "/../lib"); + // qgcputenv("GST_PLUGIN_SYSTEM_PATH", currentDir, "/../lib"); + // qgcputenv("GST_PLUGIN_PATH_1_0", currentDir, "/../lib"); + // qgcputenv("GST_PLUGIN_PATH", currentDir, "/../lib"); #endif //-- If gstreamer debugging is not configured via environment then use internal QT logging @@ -216,7 +225,7 @@ GStreamer::initialize(int argc, char* argv[], int debuglevel) } // The static plugins we use -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +#ifdef QGC_GST_STATIC_BUILD GST_PLUGIN_STATIC_REGISTER(coreelements); GST_PLUGIN_STATIC_REGISTER(playback); GST_PLUGIN_STATIC_REGISTER(libav); diff --git a/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt new file mode 100644 index 00000000000..21b678266d5 --- /dev/null +++ b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/CMakeLists.txt @@ -0,0 +1,269 @@ +find_package(GStreamer REQUIRED COMPONENTS OPTIONAL_COMPONENTS X11 EGL Wayland) + +# Use Latest Revisions for each minor version: 1.16.3, 1.18.6, 1.20.7, 1.22.12, 1.24.7 + +string(REPLACE "." ";" GST_VERSION_LIST ${GStreamer_VERSION}) +list(GET GST_VERSION_LIST 0 GST_VERSION_MAJOR) +list(GET GST_VERSION_LIST 1 GST_VERSION_MINOR) +list(GET GST_VERSION_LIST 2 GST_VERSION_PATCH) +cmake_print_variables(GST_VERSION_MAJOR GST_VERSION_MINOR GST_VERSION_PATCH) + +if(GST_VERSION_MINOR EQUAL 16) + set(GST_VERSION_PATCH 3) +elseif(GST_VERSION_MINOR EQUAL 18) + set(GST_VERSION_PATCH 6) +elseif(GST_VERSION_MINOR EQUAL 20) + set(GST_VERSION_PATCH 7) +elseif(GST_VERSION_MINOR EQUAL 22) + set(GST_VERSION_PATCH 12) +elseif(GST_VERSION_MINOR EQUAL 24) + set(GST_VERSION_PATCH 7) +endif() + +set(GST_PLUGINS_VERSION ${GST_VERSION_MAJOR}.${GST_VERSION_MINOR}.${GST_VERSION_PATCH}) +cmake_print_variables(GST_PLUGINS_VERSION) + +if(GStreamer_VERSION VERSION_GREATER_EQUAL 1.22) + FetchContent_Declare(gstreamer_good_plugins + # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/archive/${GST_PLUGINS_VERSION}/gstreamer-${GST_PLUGINS_VERSION}.zip?path=subprojects/gst-plugins-good/ext/qt6 + URL https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-${GST_PLUGINS_VERSION}.tar.xz + DOWNLOAD_EXTRACT_TIMESTAMP true + ) + FetchContent_MakeAvailable(gstreamer_good_plugins) + set(QGC_GST_QT6_PLUGIN_PATH "${gstreamer_good_plugins_SOURCE_DIR}/ext/qt6" CACHE PATH "Location of downloaded GST Qt6 plugin sources") +else() + set(QGC_GST_QT6_PLUGIN_PATH "${CMAKE_CURRENT_SOURCE_DIR}/qt6" CACHE PATH "Location of custom local GST plugin") +endif() +cmake_print_variables(QGC_GST_QT6_PLUGIN_PATH) + +################################################################################ + +file(READ ${QGC_GST_QT6_PLUGIN_PATH}/qt6glitem.h FILE_CONTENTS) +string(FIND "${FILE_CONTENTS}" "#include " GST_FIX_INCLUDES) +if(GST_FIX_INCLUDES EQUAL -1) + string(REPLACE "#include " "#include \n#include " FILE_CONTENTS "${FILE_CONTENTS}") + file(WRITE ${QGC_GST_QT6_PLUGIN_PATH}/qt6glitem.h "${FILE_CONTENTS}") +endif() + +################################################################################ + +file(GLOB gstqml6gl_SRCS + ${QGC_GST_QT6_PLUGIN_PATH}/*.cc + ${QGC_GST_QT6_PLUGIN_PATH}/*.h +) +qt_add_library(gstqml6gl STATIC ${gstqml6gl_SRCS}) + +find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick) + +target_link_libraries(gstqml6gl + PRIVATE + Qt6::GuiPrivate + PUBLIC + Qt6::Core + Qt6::Gui + Qt6::Qml + Qt6::Quick + GStreamer::GStreamer +) + +target_include_directories(gstqml6gl PUBLIC ${QGC_GST_QT6_PLUGIN_PATH}) + +if(GStreamer_X11_FOUND) + # X11, XCB, X11_XCB, GLX + target_link_libraries(gstqml6gl PUBLIC GStreamer::X11) + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_X11) +endif() + +if(GStreamer_EGL_FOUND) + # EGL + target_link_libraries(gstqml6gl PUBLIC GStreamer::EGL) + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_EGLFS) +endif() + +if(GStreamer_Wayland_FOUND) + # find_package(Wayland COMPONENTS Client Cursor Egl) + # find_package(WaylandProtocols) + # find_package(WaylandScanner) + find_package(Qt6 COMPONENTS WaylandClient) + if(Qt6WaylandClient_FOUND) + target_link_libraries(gstqml6gl PUBLIC GStreamer::Wayland Qt6::WaylandClient) + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_WAYLAND) + endif() +endif() + +if(ANDROID) + # GLESv2, egl + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_ANDROID) +elseif(WIN32) + # GDI32, egl, GLESv2 + find_package(OpenGL) + if(OpenGL_FOUND) + target_link_libraries(gstqml6gl PUBLIC OpenGL::GL) + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_WIN32) + endif() +elseif(MACOS) + # appleframeworks + # Foundation, QuartzCore, CoreFoundation + # Cocoa + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_MAC) +elseif(IOS) + # appleframeworks + # Foundation, CoreFoundation, CoreGraphics, QuartzCore, UIkit + target_compile_definitions(gstqml6gl PRIVATE HAVE_QT_IOS) +endif() + +target_compile_definitions(gstqml6gl + PRIVATE + HAVE_QT_QPA_HEADER + QT_QPA_HEADER= +) + +if(EXISTS "${QGC_GST_QT6_PLUGIN_PATH}/resources.qrc") + find_package(Qt6 REQUIRED COMPONENTS ShaderTools) + + set(SHADERS + ${QGC_GST_QT6_PLUGIN_PATH}/vertex.vert + ${QGC_GST_QT6_PLUGIN_PATH}/YUV_TRIPLANAR.frag + ${QGC_GST_QT6_PLUGIN_PATH}/RGBA.frag + ) + set(OUTPUTS + vertex.vert.qsb + YUV_TRIPLANAR.frag.qsb + RGBA.frag.qsb + ) + if(EXISTS "${QGC_GST_QT6_PLUGIN_PATH}/YUV_BIPLANAR.frag") + LIST(APPEND SHADERS ${QGC_GST_QT6_PLUGIN_PATH}/YUV_BIPLANAR.frag) + LIST(APPEND OUTPUTS YUV_BIPLANAR.frag.qsb) + endif() + if(EXISTS "${QGC_GST_QT6_PLUGIN_PATH}/RGBA_gles.frag") + LIST(APPEND SHADERS ${QGC_GST_QT6_PLUGIN_PATH}/RGBA.frag@glsl,100es,${QGC_GST_QT6_PLUGIN_PATH}/RGBA_gles.frag) + LIST(APPEND OUTPUTS RGBA_gles.frag.qsb) + # file(COPY_FILE RGBA_gles.frag RGBA_gles.frag.qsb) + # LIST(APPEND OUTPUTS RGBA_gles.frag.qsb.external) + endif() + qt6_add_shaders(gstqml6gl "gstqml6gl_shaders" + PREFIX "/org/freedesktop/gstreamer/qml6" + GLSL "100 es,120,330" + OUTPUT_TARGETS gstqml6gl_shaders + FILES ${SHADERS} + OUTPUTS ${OUTPUTS} + BATCHABLE + ) +endif() + +if(UNIX) + target_compile_options(gstqml6gl + PRIVATE + -Wno-unused-parameter + -Wno-implicit-fallthrough + -Wno-unused-private-field + ) +endif() + +set(GST_TARGET_PLUGINS + gstcoreelements + gstisomp4 + gstlibav + gstmatroska + gstmpegtsdemux + gstopengl + gstplayback + gstrtp + gstrtpmanager + gstrtsp + gstsdpelem + gsttcp + gstudp + gstvideoparsersbad + gstx264 +) +if(ANDROID) + list(APPEND GST_TARGET_PLUGINS gstandroidmedia) +elseif(IOS) + list(APPEND GST_TARGET_PLUGINS gstapplemedia) +endif() + +find_package(PkgConfig QUIET) +if(PkgConfig_FOUND) + pkg_check_modules(GST_PLUGINS IMPORTED_TARGET ${GST_TARGET_PLUGINS}) + if(GST_PLUGINS_FOUND) + target_link_libraries(gstqml6gl PUBLIC PkgConfig::GST_PLUGINS) + if(WIN32) + # install(FILES ${GST_PLUGINS_LIBRARIES} DESTINATION ${CMAKE_INSTALL_BINDIR}) + elseif(LINUX) + install(FILES ${GST_PLUGINS_LIBRARIES} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() +endif() + +if(NOT GST_PLUGINS_FOUND) + foreach(plugin IN LISTS GST_TARGET_PLUGINS) + find_library(GStreamer_${plugin}_LIBRARY + NAMES ${plugin} + PATHS + ${GSTREAMER_PREFIX}/lib + ${GSTREAMER_PREFIX}/lib/gstreamer-1.0 + ${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu + ${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu/gstreamer-1.0 + ${GSTREAMER_PREFIX}/Versions/Current/lib + ${GSTREAMER_PREFIX}/Versions/Current/lib/gstreamer-1.0 + ) + cmake_print_variables(GStreamer_${plugin}_LIBRARY) + if(GStreamer_${plugin}_LIBRARY) + target_link_libraries(gstqml6gl PUBLIC ${GStreamer_${plugin}_LIBRARY}) + if(WIN32) + # install(FILES ${GStreamer_${plugin}_LIBRARY} DESTINATION ${CMAKE_INSTALL_BINDIR}) + elseif(LINUX) + install(FILES ${GStreamer_${plugin}_LIBRARY} DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + endif() + endforeach() +endif() + +if(ANDROID) + target_link_options(gstqml6gl PUBLIC "-Wl,-Bsymbolic") +endif() + +if(QGC_GST_STATIC_BUILD) + target_compile_definitions(gstqml6gl PUBLIC QGC_GST_STATIC_BUILD) +endif() + +if(LINUX) + install(DIRECTORY ${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu/gstreamer1.0 DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(DIRECTORY ${GSTREAMER_PREFIX}/lib/x86_64-linux-gnu/gio DESTINATION ${CMAKE_INSTALL_LIBDIR}) +elseif(WIN32) + # install(FILES ${GSTREAMER_PREFIX}/libexec/gstreamer-1.0/gst-plugin-scanner DESTINATION ${CMAKE_INSTALL_BINDIR}) + # install(FILES ${GSTREAMER_PREFIX}/libexec/gstreamer-1.0/gst-ptp-helper DESTINATION ${CMAKE_INSTALL_BINDIR}) + # install(DIRECTORY ${GSTREAMER_PREFIX}/lib/gio DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() + +if(WIN32) + cmake_path(CONVERT "${GSTREAMER_PREFIX}/bin/*.dll" TO_CMAKE_PATH_LIST GST_WIN_BINS_PATH) + file(GLOB GST_WIN_BINS ${GST_WIN_BINS_PATH}) + install(FILES ${GST_WIN_BINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) + + cmake_path(CONVERT "${GSTREAMER_PREFIX}/lib/*.dll" TO_CMAKE_PATH_LIST GST_WIN_LIBS_PATH) + file(GLOB GST_WIN_LIBS ${GST_WIN_LIBS_PATH}) + install(FILES ${GST_WIN_LIBS} DESTINATION ${CMAKE_INSTALL_BINDIR}) + + cmake_path(CONVERT "${GSTREAMER_PREFIX}/lib/gstreamer-1.0/*.dll" TO_CMAKE_PATH_LIST GST_WIN_PLUGINS_PATH) + file(GLOB GST_WIN_PLUGINS ${GST_WIN_PLUGINS_PATH}) + install(FILES ${GST_WIN_PLUGINS} DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() + +# if(ANDROID) + # configure_file( + # ${GSTREAMER_PREFIX}/share/gst-android/ndk-build/gstreamer_android-1.0.c.in + # ${CMAKE_BINARY_DIR}/gstreamer_android-1.0.c + # @ONLY + # ) + # target_sources(gstqml6gl PRIVATE ${CMAKE_BINARY_DIR}/gstreamer_android-1.0.c) + # install( + # DIRECTORY ${GSTREAMER_PREFIX}/share/gst-android/ndk-build/androidmedia + # DESTINATION ${CMAKE_SOURCE_DIR}/android/src/org/freedesktop/gstreamer/androidmedia + # ) + # install( + # FILES ${GSTREAMER_PREFIX}/share/gst-android/ndk-build/GStreamer.java + # DESTINATION ${CMAKE_SOURCE_DIR}/android/src/org/freedesktop/gstreamer/androidmedia/GStreamer.java + # ) +# endif() diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstplugin.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstplugin.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstplugin.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstplugin.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqml6glsink.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqml6glsink.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqml6glsink.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqml6glsink.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqml6glsink.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqml6glsink.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqml6glsink.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqml6glsink.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqsg6glnode.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqsg6glnode.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqsg6glnode.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqsg6glnode.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqsg6glnode.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqsg6glnode.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqsg6glnode.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqsg6glnode.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6element.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6element.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6element.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6element.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6elements.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6elements.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6elements.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6elements.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6gl.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6gl.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6gl.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6gl.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6glutility.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6glutility.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6glutility.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6glutility.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6glutility.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6glutility.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/gstqt6glutility.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/gstqt6glutility.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/meson.build b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/meson.build similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/meson.build rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/meson.build diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/qt6glitem.cc b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/qt6glitem.cc similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/qt6glitem.cc rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/qt6glitem.cc diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/qt6glitem.h b/src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/qt6glitem.h similarity index 100% rename from src/VideoManager/VideoReceiver/GStreamer/qmlglsink/qt6/qt6glitem.h rename to src/VideoManager/VideoReceiver/GStreamer/gstqml6gl/qt6/qt6glitem.h diff --git a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/CMakeLists.txt deleted file mode 100644 index cd6895d7151..00000000000 --- a/src/VideoManager/VideoReceiver/GStreamer/qmlglsink/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -find_package(Qt6 REQUIRED COMPONENTS Core) -qt_add_library(qmlglsink STATIC) - -include(GStreamer) -if(GST_FOUND) - message(STATUS "GST Modules Found") - include(BuildGstQtPlugin) -else() - message(WARNING "GST Modules Not Found") -endif() diff --git a/src/VideoManager/VideoReceiver/QtMultimedia/CMakeLists.txt b/src/VideoManager/VideoReceiver/QtMultimedia/CMakeLists.txt index 7156c559128..76fbd8638a7 100644 --- a/src/VideoManager/VideoReceiver/QtMultimedia/CMakeLists.txt +++ b/src/VideoManager/VideoReceiver/QtMultimedia/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(Qt6 REQUIRED COMPONENTS Core) + qt_add_library(QtMultimediaReceiver STATIC) option(QGC_ENABLE_QT_VIDEOSTREAMING "Enable QtMultimedia Video Streaming Backend" ON) @@ -6,7 +8,7 @@ if(NOT QGC_ENABLE_QT_VIDEOSTREAMING) return() endif() -find_package(Qt6 REQUIRED COMPONENTS Core Multimedia MultimediaQuickPrivate Quick) +find_package(Qt6 REQUIRED COMPONENTS Multimedia MultimediaQuickPrivate Quick) target_sources(QtMultimediaReceiver PRIVATE diff --git a/tools/setup/install-dependencies-debian.sh b/tools/setup/install-dependencies-debian.sh index 3aa8308d353..d1a1f4e75b7 100755 --- a/tools/setup/install-dependencies-debian.sh +++ b/tools/setup/install-dependencies-debian.sh @@ -88,6 +88,7 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \ libgbm-dev \ libgl1-mesa-dev \ libgles2-mesa-dev \ + libglu1-mesa-dev \ libglfw3-dev \ libopenal-dev \ libpulse-dev \ @@ -99,6 +100,7 @@ DEBIAN_FRONTEND=noninteractive apt -y --quiet install \ libwayland-dev \ libx11-dev \ libzstd-dev \ + mesa-common-dev \ mesa-va-drivers \ speech-dispatcher \ speech-dispatcher-espeak \