Commit b60ad66f authored by Pierre Lamot's avatar Pierre Lamot Committed by Pierre Lamot
Browse files

qt: allow to partially unload the interface

  this allows to unload the GUI part of the interface without destroying the
  windows that may still be used by the vout window part.
parent 2f53abd0
......@@ -51,6 +51,8 @@ public:
virtual MainInterface* makeMainInterface() = 0;
virtual void destroyMainInterface() = 0;
virtual void unloadGUI() = 0;
virtual bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) = 0;
virtual Type type() const = 0;
......
......@@ -277,12 +277,8 @@ void CompositorDirectComposition::destroyMainInterface()
if (m_videoVisual)
msg_Err(m_intf, "video surface still active while destroying main interface");
if (m_uiVisual)
{
m_rootVisual->RemoveVisual(m_uiVisual.Get());
m_uiVisual.Reset();
}
m_uiSurface.reset();
unloadGUI();
m_rootVisual.Reset();
m_dcompTarget.Reset();
m_qmlVideoSurfaceProvider.reset();
......@@ -291,6 +287,17 @@ void CompositorDirectComposition::destroyMainInterface()
delete m_rootWindow;
m_rootWindow = nullptr;
}
}
void CompositorDirectComposition::unloadGUI()
{
if (m_uiVisual)
{
m_rootVisual->RemoveVisual(m_uiVisual.Get());
m_uiVisual.Reset();
}
m_uiSurface.reset();
m_ui.reset();
}
......
......@@ -49,6 +49,7 @@ public:
MainInterface *makeMainInterface() override;
void destroyMainInterface() override;
void unloadGUI() override;
bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) override;
......
......@@ -56,11 +56,7 @@ MainInterface* CompositorDummy::makeMainInterface()
void CompositorDummy::destroyMainInterface()
{
if (m_qmlWidget)
{
delete m_qmlWidget;
m_qmlWidget = nullptr;
}
unloadGUI();
if (m_rootWindow)
{
delete m_rootWindow;
......@@ -68,6 +64,15 @@ void CompositorDummy::destroyMainInterface()
}
}
void CompositorDummy::unloadGUI()
{
if (m_qmlWidget)
{
delete m_qmlWidget;
m_qmlWidget = nullptr;
}
}
bool CompositorDummy::setupVoutWindow(vout_window_t*, VoutDestroyCb)
{
//dummy compositor doesn't handle window intergration
......
......@@ -38,8 +38,19 @@ public:
virtual ~CompositorDummy() = default;
virtual MainInterface *makeMainInterface() override;
/**
* @brief release all resources used by the compositor.
* this includes the GUI and the video surfaces.
*/
virtual void destroyMainInterface() override;
/**
* @brief unloadGUI unload the UI view from the composition
* video view might still be active
*/
virtual void unloadGUI() override;
bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) override;
Type type() const override;
......
......@@ -232,9 +232,7 @@ MainInterface* CompositorWin7::makeMainInterface()
void CompositorWin7::destroyMainInterface()
{
m_videoSurfaceProvider.reset();
m_videoWindowHandler.reset();
m_qmlView.reset();
unloadGUI();
if (m_rootWindow)
{
delete m_rootWindow;
......@@ -242,6 +240,13 @@ void CompositorWin7::destroyMainInterface()
}
}
void CompositorWin7::unloadGUI()
{
m_videoSurfaceProvider.reset();
m_videoWindowHandler.reset();
m_qmlView.reset();
}
bool CompositorWin7::setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb)
{
BOOL isCompositionEnabled;
......
......@@ -50,6 +50,7 @@ public:
virtual MainInterface *makeMainInterface() override;
virtual void destroyMainInterface() override;
virtual void unloadGUI() override;
virtual bool setupVoutWindow(vout_window_t*, VoutDestroyCb destroyCb) override;
Type type() const override;
......
......@@ -707,7 +707,7 @@ void MainInterface::closeEvent( QCloseEvent *e )
//after the main interface, and it requires (at least with OpenGL) that the OpenGL context
//from the main window is still valid.
//vout_window_ReportClose is currently stubbed
if (playerController->hasVideoOutput()) {
if (playerController && playerController->hasVideoOutput()) {
connect(playerController, &PlayerController::playingStateChanged, [this](PlayerController::PlayingState state){
if (state == PlayerController::PLAYING_STATE_STOPPED) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment