Skip to content

Commit 6a70327

Browse files
committed
GStreamer: Add qml6d3d11 Video Sink
1 parent 8cc7862 commit 6a70327

File tree

7 files changed

+65
-23
lines changed

7 files changed

+65
-23
lines changed

.github/workflows/custom.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
env:
3737
ARTIFACT: QGroundControl-installer.exe
3838
QT_VERSION: 6.8.3
39-
GST_VERSION: 1.22.12
39+
GST_VERSION: 1.24.12
4040

4141
steps:
4242
- name: Checkout repo

.github/workflows/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
ARTIFACT: QGroundControl-installer.exe
3939
PACKAGE: QGroundControl-installer
4040
QT_VERSION: 6.8.3
41-
GST_VERSION: 1.22.12
41+
GST_VERSION: 1.24.12
4242

4343
steps:
4444
- name: Checkout repo

cmake/find-modules/FindGStreamer.cmake

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
if(NOT DEFINED GStreamer_FIND_VERSION)
22
if(LINUX)
33
set(GStreamer_FIND_VERSION 1.20)
4+
elseif(WIN32 OR MACOS)
5+
set(GStreamer_FIND_VERSION 1.24.12)
46
else()
57
set(GStreamer_FIND_VERSION 1.22.12)
68
endif()
@@ -225,18 +227,21 @@ endif()
225227

226228
################################################################################
227229

228-
if(GStreamer_USE_STATIC_LIBS)
229-
set(GSTREAMER_EXTRA_DEPS
230-
gstreamer-base-1.0
231-
gstreamer-video-1.0
232-
gstreamer-gl-1.0
233-
gstreamer-gl-prototypes-1.0
234-
gstreamer-rtsp-1.0
235-
# gstreamer-gl-egl-1.0
236-
# gstreamer-gl-wayland-1.0
237-
# gstreamer-gl-x11-1.0
238-
)
230+
set(GSTREAMER_EXTRA_DEPS
231+
gstreamer-base-1.0
232+
gstreamer-video-1.0
233+
gstreamer-rtsp-1.0
234+
# gstreamer-gl-egl-1.0
235+
# gstreamer-gl-wayland-1.0
236+
# gstreamer-gl-x11-1.0
237+
)
238+
if(WIN32)
239+
list(APPEND GSTREAMER_EXTRA_DEPS gstreamer-d3d11-1.0)
240+
else()
241+
list(APPEND GSTREAMER_EXTRA_DEPS gstreamer-gl-1.0 gstreamer-gl-prototypes-1.0)
242+
endif()
239243

244+
if(GStreamer_USE_STATIC_LIBS)
240245
set(GSTREAMER_PLUGINS
241246
coreelements
242247
dav1d
@@ -334,12 +339,19 @@ endfunction()
334339
find_gstreamer_component(Core gstreamer-1.0)
335340
find_gstreamer_component(Base gstreamer-base-1.0)
336341
find_gstreamer_component(Video gstreamer-video-1.0)
337-
find_gstreamer_component(Gl gstreamer-gl-1.0)
338-
find_gstreamer_component(GlPrototypes gstreamer-gl-prototypes-1.0)
339342
find_gstreamer_component(Rtsp gstreamer-rtsp-1.0)
340343

341344
################################################################################
342345

346+
if(D3d11 IN_LIST GStreamer_FIND_COMPONENTS)
347+
find_gstreamer_component(D3d11 gstreamer-d3d11-1.0)
348+
endif()
349+
350+
if(Gl IN_LIST GStreamer_FIND_COMPONENTS)
351+
find_gstreamer_component(Gl gstreamer-gl-1.0)
352+
find_gstreamer_component(GlPrototypes gstreamer-gl-prototypes-1.0)
353+
endif()
354+
343355
if(GlEgl IN_LIST GStreamer_FIND_COMPONENTS)
344356
find_gstreamer_component(GlEgl gstreamer-gl-egl-1.0)
345357
endif()
@@ -401,11 +413,25 @@ if(GStreamer_FOUND AND NOT TARGET GStreamer::GStreamer)
401413
GStreamer::Core
402414
GStreamer::Base
403415
GStreamer::Video
404-
GStreamer::Gl
405-
GStreamer::GlPrototypes
406416
GStreamer::Rtsp
407417
)
408418

419+
if(TARGET GStreamer::Gl)
420+
target_link_libraries(GStreamer::GStreamer
421+
INTERFACE
422+
GStreamer::Gl
423+
GStreamer::GlPrototypes
424+
)
425+
endif()
426+
427+
if(TARGET GStreamer::D3d11)
428+
target_compile_definitions(GStreamer::D3d11 INTERFACE GST_USE_UNSTABLE_API)
429+
target_link_libraries(GStreamer::GStreamer
430+
INTERFACE
431+
GStreamer::D3d11
432+
)
433+
endif()
434+
409435
foreach(component IN LISTS GStreamer_FIND_COMPONENTS)
410436
if(GStreamer_${component}_FOUND)
411437
target_link_libraries(GStreamer::GStreamer INTERFACE GStreamer::${component})

src/QGCApplication.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,13 @@ void QGCApplication::init()
330330
void QGCApplication::_initVideo()
331331
{
332332
#ifdef QGC_GST_STREAMING
333+
#ifdef Q_OS_WIN
334+
// Gstreamer video playback requires D3D11
335+
QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
336+
#else
333337
// Gstreamer video playback requires OpenGL
334338
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
339+
#endif
335340
#endif
336341

337342
QGCCorePlugin::instance(); // CorePlugin must be initialized before VideoManager for Video Cleanup

src/VideoManager/VideoManager.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ void VideoManager::registerQmlTypes()
7474
(void) qmlRegisterUncreatableType<VideoManager>("QGroundControl.VideoManager", 1, 0, "VideoManager", "Reference only");
7575
(void) qmlRegisterUncreatableType<VideoReceiver>("QGroundControl", 1, 0, "VideoReceiver","Reference only");
7676
#ifndef QGC_GST_STREAMING
77-
(void) qmlRegisterType<VideoItemStub>("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem");
77+
#ifdef Q_OS_WIN
78+
(void) qmlRegisterType<GstVideoItemStub>("org.freedesktop.gstreamer.Qt6D3D11VideoItem", 1, 0, "GstD3D11Qt6VideoItem");
79+
#else
80+
(void) qmlRegisterType<GstVideoItemStub>("org.freedesktop.gstreamer.Qt6GLVideoItem", 1, 0, "GstGLQt6VideoItem");
81+
#endif
7882
#endif
7983
}
8084

src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ if(QGC_ENABLE_GST_VIDEOSTREAMING)
66
# Using FindGStreamer.cmake is currently bypassed on MACOS since it doesn't work
77
# So for now we hack in a simple hardwired setup which does work
88
find_package(GStreamer
9+
COMPONENTS Core Base Video Rtsp Gl GlPrototypes
10+
OPTIONAL_COMPONENTS GlEgl GlWayland GlX11 D3d11
911
REQUIRED
10-
COMPONENTS Core Base Video Gl GlPrototypes Rtsp
11-
OPTIONAL_COMPONENTS GlEgl GlWayland GlX11)
12+
)
1213
endif()
1314

1415
add_subdirectory(gstqml6gl)
15-
# TODO: https://gstreamer.freedesktop.org/documentation/qt6d3d11/index.html#qml6d3d11sink-page
1616
endif()
1717

1818
if(TARGET gstqml6gl)

src/VideoManager/VideoReceiver/GStreamer/GStreamer.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ GST_PLUGIN_STATIC_DECLARE(opengl);
4343
GST_PLUGIN_STATIC_DECLARE(openh264);
4444
GST_PLUGIN_STATIC_DECLARE(playback);
4545
GST_PLUGIN_STATIC_DECLARE(qml6);
46+
GST_PLUGIN_STATIC_DECLARE(qml6d3d11);
4647
GST_PLUGIN_STATIC_DECLARE(qsv);
4748
GST_PLUGIN_STATIC_DECLARE(rtp);
4849
GST_PLUGIN_STATIC_DECLARE(rtpmanager);
@@ -120,10 +121,16 @@ void _registerPlugins()
120121
#endif
121122
#endif
122123

123-
// #if !defined(GST_PLUGIN_qml6_FOUND) && defined(QGC_GST_STATIC_BUILD)
124-
GST_PLUGIN_STATIC_REGISTER(qml6);
124+
// #if !defined(GST_PLUGIN_qml6d3d11_FOUND) || defined(QGC_GST_STATIC_BUILD)
125+
// GST_PLUGIN_STATIC_DECLARE(qml6d3d11);
126+
// #endif
127+
128+
// #if !defined(GST_PLUGIN_qml6_FOUND) || defined(QGC_GST_STATIC_BUILD)
129+
// GST_PLUGIN_STATIC_REGISTER(qml6);
125130
// #endif
126131

132+
GST_PLUGIN_STATIC_REGISTER(qml6);
133+
127134
GST_PLUGIN_STATIC_REGISTER(qgc);
128135
}
129136

0 commit comments

Comments
 (0)