diff --git a/.github/workflows/custom.yml b/.github/workflows/custom.yml index 18e2f2176825..dd06b4a2fb0d 100644 --- a/.github/workflows/custom.yml +++ b/.github/workflows/custom.yml @@ -36,7 +36,7 @@ jobs: env: ARTIFACT: QGroundControl-installer.exe QT_VERSION: 6.8.3 - GST_VERSION: 1.22.12 + GST_VERSION: 1.24.12 steps: - name: Checkout repo diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1276a1c7ac5b..e9e07136f773 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -38,7 +38,7 @@ jobs: ARTIFACT: QGroundControl-installer.exe PACKAGE: QGroundControl-installer QT_VERSION: 6.8.3 - GST_VERSION: 1.22.12 + GST_VERSION: 1.24.12 steps: - name: Checkout repo diff --git a/cmake/find-modules/FindGStreamer.cmake b/cmake/find-modules/FindGStreamer.cmake index 4c8fcb8b12f9..9d0babd98a42 100644 --- a/cmake/find-modules/FindGStreamer.cmake +++ b/cmake/find-modules/FindGStreamer.cmake @@ -1,6 +1,8 @@ if(NOT DEFINED GStreamer_FIND_VERSION) if(LINUX) set(GStreamer_FIND_VERSION 1.20) + elseif(WIN32 OR MACOS) + set(GStreamer_FIND_VERSION 1.24.12) else() set(GStreamer_FIND_VERSION 1.22.12) endif() @@ -225,18 +227,21 @@ endif() ################################################################################ -if(GStreamer_USE_STATIC_LIBS) - set(GSTREAMER_EXTRA_DEPS - gstreamer-base-1.0 - gstreamer-video-1.0 - gstreamer-gl-1.0 - gstreamer-gl-prototypes-1.0 - gstreamer-rtsp-1.0 - # gstreamer-gl-egl-1.0 - # gstreamer-gl-wayland-1.0 - # gstreamer-gl-x11-1.0 - ) +set(GSTREAMER_EXTRA_DEPS + gstreamer-base-1.0 + gstreamer-video-1.0 + gstreamer-rtsp-1.0 + # gstreamer-gl-egl-1.0 + # gstreamer-gl-wayland-1.0 + # gstreamer-gl-x11-1.0 +) +if(WIN32) + list(APPEND GSTREAMER_EXTRA_DEPS gstreamer-d3d11-1.0) +else() + list(APPEND GSTREAMER_EXTRA_DEPS gstreamer-gl-1.0 gstreamer-gl-prototypes-1.0) +endif() +if(GStreamer_USE_STATIC_LIBS) set(GSTREAMER_PLUGINS coreelements dav1d @@ -334,12 +339,19 @@ endfunction() find_gstreamer_component(Core gstreamer-1.0) find_gstreamer_component(Base gstreamer-base-1.0) find_gstreamer_component(Video gstreamer-video-1.0) -find_gstreamer_component(Gl gstreamer-gl-1.0) -find_gstreamer_component(GlPrototypes gstreamer-gl-prototypes-1.0) find_gstreamer_component(Rtsp gstreamer-rtsp-1.0) ################################################################################ +if(D3d11 IN_LIST GStreamer_FIND_COMPONENTS) + find_gstreamer_component(D3d11 gstreamer-d3d11-1.0) +endif() + +if(Gl IN_LIST GStreamer_FIND_COMPONENTS) + find_gstreamer_component(Gl gstreamer-gl-1.0) + find_gstreamer_component(GlPrototypes gstreamer-gl-prototypes-1.0) +endif() + if(GlEgl IN_LIST GStreamer_FIND_COMPONENTS) find_gstreamer_component(GlEgl gstreamer-gl-egl-1.0) endif() @@ -401,11 +413,25 @@ if(GStreamer_FOUND AND NOT TARGET GStreamer::GStreamer) GStreamer::Core GStreamer::Base GStreamer::Video - GStreamer::Gl - GStreamer::GlPrototypes GStreamer::Rtsp ) + if(TARGET GStreamer::Gl) + target_link_libraries(GStreamer::GStreamer + INTERFACE + GStreamer::Gl + GStreamer::GlPrototypes + ) + endif() + + if(TARGET GStreamer::D3d11) + target_compile_definitions(GStreamer::D3d11 INTERFACE GST_USE_UNSTABLE_API) + target_link_libraries(GStreamer::GStreamer + INTERFACE + GStreamer::D3d11 + ) + endif() + foreach(component IN LISTS GStreamer_FIND_COMPONENTS) if(GStreamer_${component}_FOUND) target_link_libraries(GStreamer::GStreamer INTERFACE GStreamer::${component}) diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index dec93db903cb..44ba1ed37e12 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -330,8 +330,13 @@ void QGCApplication::init() void QGCApplication::_initVideo() { #ifdef QGC_GST_STREAMING +#ifdef Q_OS_WIN + // Gstreamer video playback requires D3D11 + QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11); +#else // Gstreamer video playback requires OpenGL QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); +#endif #endif QGCCorePlugin::instance(); // CorePlugin must be initialized before VideoManager for Video Cleanup diff --git a/src/VideoManager/VideoManager.cc b/src/VideoManager/VideoManager.cc index a3c407a551bf..3232779cc617 100644 --- a/src/VideoManager/VideoManager.cc +++ b/src/VideoManager/VideoManager.cc @@ -74,7 +74,11 @@ void VideoManager::registerQmlTypes() (void) qmlRegisterUncreatableType("QGroundControl.VideoManager", 1, 0, "VideoManager", "Reference only"); (void) qmlRegisterUncreatableType("QGroundControl", 1, 0, "VideoReceiver","Reference only"); #ifndef QGC_GST_STREAMING - (void) qmlRegisterType("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem"); + #ifdef Q_OS_WIN + (void) qmlRegisterType("org.freedesktop.gstreamer.Qt6D3D11VideoItem", 1, 0, "GstD3D11Qt6VideoItem"); + #else + (void) qmlRegisterType("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem"); + #endif #endif } diff --git a/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt b/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt index 7a85b09c2ece..64e24d54f5e5 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt +++ b/src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt @@ -6,13 +6,13 @@ if(QGC_ENABLE_GST_VIDEOSTREAMING) # Using FindGStreamer.cmake is currently bypassed on MACOS since it doesn't work # So for now we hack in a simple hardwired setup which does work find_package(GStreamer + COMPONENTS Core Base Video Rtsp Gl GlPrototypes + OPTIONAL_COMPONENTS GlEgl GlWayland GlX11 D3d11 REQUIRED - COMPONENTS Core Base Video Gl GlPrototypes Rtsp - OPTIONAL_COMPONENTS GlEgl GlWayland GlX11) + ) endif() add_subdirectory(gstqml6gl) - # TODO: https://gstreamer.freedesktop.org/documentation/qt6d3d11/index.html#qml6d3d11sink-page endif() if(TARGET gstqml6gl) diff --git a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc index 4c884af775f4..9f1e79947c57 100644 --- a/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc +++ b/src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc @@ -43,6 +43,7 @@ GST_PLUGIN_STATIC_DECLARE(opengl); GST_PLUGIN_STATIC_DECLARE(openh264); GST_PLUGIN_STATIC_DECLARE(playback); GST_PLUGIN_STATIC_DECLARE(qml6); +GST_PLUGIN_STATIC_DECLARE(qml6d3d11); GST_PLUGIN_STATIC_DECLARE(qsv); GST_PLUGIN_STATIC_DECLARE(rtp); GST_PLUGIN_STATIC_DECLARE(rtpmanager); @@ -120,10 +121,16 @@ void _registerPlugins() #endif #endif -// #if !defined(GST_PLUGIN_qml6_FOUND) && defined(QGC_GST_STATIC_BUILD) - GST_PLUGIN_STATIC_REGISTER(qml6); +// #if !defined(GST_PLUGIN_qml6d3d11_FOUND) || defined(QGC_GST_STATIC_BUILD) + // GST_PLUGIN_STATIC_DECLARE(qml6d3d11); +// #endif + +// #if !defined(GST_PLUGIN_qml6_FOUND) || defined(QGC_GST_STATIC_BUILD) + // GST_PLUGIN_STATIC_REGISTER(qml6); // #endif + GST_PLUGIN_STATIC_REGISTER(qml6); + GST_PLUGIN_STATIC_REGISTER(qgc); }