[vlc-devel] [PATCH 10/16] qt: use video window handler in DirectComposition compositor

Pierre Lamot pierre at videolabs.io
Thu Aug 6 09:43:56 CEST 2020


---
 modules/gui/qt/maininterface/compositor_dcomp.cpp | 14 ++++++++------
 modules/gui/qt/maininterface/compositor_dcomp.hpp |  2 ++
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/modules/gui/qt/maininterface/compositor_dcomp.cpp b/modules/gui/qt/maininterface/compositor_dcomp.cpp
index b3b95aa8f1..19666a4b98 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp.cpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp.cpp
@@ -82,8 +82,7 @@ void CompositorDirectComposition::window_disable(struct vout_window_t * p_wnd)
     try
     {
         that->m_qmlVideoSurfaceProvider->disable();
-        that->m_rootWindow->askVideoOnTop(false);
-        that->m_rootWindow->askVideoSetFullScreen(false);
+        that->m_videoWindowHandler->disable();
         msg_Dbg(that->m_intf, "window_disable");
         HR(that->m_rootVisual->RemoveVisual(that->m_videoVisual.Get()), "remove video visual from root");
         HR(that->m_dcompDevice->Commit(), "commit");
@@ -99,7 +98,7 @@ void CompositorDirectComposition::window_resize(struct vout_window_t * p_wnd, un
     VoutWindowPriv* sys = static_cast<VoutWindowPriv*>(p_wnd->sys);
     CompositorDirectComposition* that = sys->that;
     msg_Dbg(that->m_intf, "window_resize %ux%u", width, height);
-    that->m_rootWindow->requestResizeVideo(width, height);
+    that->m_videoWindowHandler->requestResizeVideo(width, height);
 }
 
 void CompositorDirectComposition::window_destroy(struct vout_window_t * p_wnd)
@@ -120,7 +119,7 @@ void CompositorDirectComposition::window_set_state(struct vout_window_t * p_wnd,
     VoutWindowPriv* sys = static_cast<VoutWindowPriv*>(p_wnd->sys);
     CompositorDirectComposition* that = sys->that;
     msg_Dbg(that->m_intf, "window_set_state");
-    that->m_rootWindow->requestVideoState(static_cast<vout_window_state>(state));
+    that->m_videoWindowHandler->requestVideoState(static_cast<vout_window_state>(state));
 }
 
 void CompositorDirectComposition::window_unset_fullscreen(struct vout_window_t * p_wnd)
@@ -128,7 +127,7 @@ void CompositorDirectComposition::window_unset_fullscreen(struct vout_window_t *
     VoutWindowPriv* sys = static_cast<VoutWindowPriv*>(p_wnd->sys);
     CompositorDirectComposition* that = sys->that;
     msg_Dbg(that->m_intf, "window_unset_fullscreen");
-    that->m_rootWindow->requestVideoWindowed();
+    that->m_videoWindowHandler->requestVideoWindowed();
 }
 
 void CompositorDirectComposition::window_set_fullscreen(struct vout_window_t * p_wnd, const char *id)
@@ -136,7 +135,7 @@ void CompositorDirectComposition::window_set_fullscreen(struct vout_window_t * p
     VoutWindowPriv* sys = static_cast<VoutWindowPriv*>(p_wnd->sys);
     CompositorDirectComposition* that = sys->that;
     msg_Dbg(that->m_intf, "window_set_fullscreen");
-    that->m_rootWindow->requestVideoFullScreen(id);
+    that->m_videoWindowHandler->requestVideoFullScreen(id);
 }
 
 CompositorDirectComposition::CompositorDirectComposition( intf_thread_t* p_intf,  QObject *parent)
@@ -218,6 +217,9 @@ MainInterface* CompositorDirectComposition::makeMainInterface()
         m_rootWindow->winId();
         m_rootWindow->show();
 
+        m_videoWindowHandler = std::make_unique<VideoWindowHandler>(m_intf, m_rootWindow);
+        m_videoWindowHandler->setWindow( m_rootWindow->windowHandle() );
+
         m_qmlVideoSurfaceProvider = std::make_unique<VideoSurfaceProvider>();
         m_rootWindow->setVideoSurfaceProvider(m_qmlVideoSurfaceProvider.get());
 
diff --git a/modules/gui/qt/maininterface/compositor_dcomp.hpp b/modules/gui/qt/maininterface/compositor_dcomp.hpp
index 41d5678bea..51afc1843c 100644
--- a/modules/gui/qt/maininterface/compositor_dcomp.hpp
+++ b/modules/gui/qt/maininterface/compositor_dcomp.hpp
@@ -29,6 +29,7 @@
 #include "maininterface/mainui.hpp"
 #include "compositor_dcomp_uisurface.hpp"
 #include "videosurface.hpp"
+#include "video_window_handler.hpp"
 
 #include <QOpenGLContext>
 
@@ -65,6 +66,7 @@ private:
     std::unique_ptr<CompositorDCompositionUISurface> m_uiSurface;
     vout_window_t *m_window = nullptr;
     std::unique_ptr<MainUI> m_ui;
+    std::unique_ptr<VideoWindowHandler> m_videoWindowHandler;
     std::unique_ptr<VideoSurfaceProvider> m_qmlVideoSurfaceProvider;
 
     //main window composition
-- 
2.25.1



More information about the vlc-devel mailing list