Skip to content

GStreamer: Add qml6d3d11 Video Sink #12829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 41 additions & 15 deletions cmake/find-modules/FindGStreamer.cmake
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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})
Expand Down
5 changes: 5 additions & 0 deletions src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/VideoManager/VideoManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ void VideoManager::registerQmlTypes()
(void) qmlRegisterUncreatableType<VideoManager>("QGroundControl.VideoManager", 1, 0, "VideoManager", "Reference only");
(void) qmlRegisterUncreatableType<VideoReceiver>("QGroundControl", 1, 0, "VideoReceiver","Reference only");
#ifndef QGC_GST_STREAMING
(void) qmlRegisterType<VideoItemStub>("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem");
#ifdef Q_OS_WIN
(void) qmlRegisterType<GstVideoItemStub>("org.freedesktop.gstreamer.Qt6D3D11VideoItem", 1, 0, "GstD3D11Qt6VideoItem");
#else
(void) qmlRegisterType<GstVideoItemStub>("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem");
#endif
#endif
}

Expand Down
6 changes: 3 additions & 3 deletions src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
Loading