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

qt: allow passing a global vout close callback to the compositor

parent 5897ca4d
......@@ -50,4 +50,10 @@ Compositor* Compositor::createCompositor(qt_intf_t *p_intf)
return new CompositorDummy(p_intf);
}
void Compositor::onWindowDestruction(vout_window_t *p_wnd)
{
if (m_destroyCb)
m_destroyCb(p_wnd);
}
}
......@@ -43,17 +43,25 @@ public:
DirectCompositionCompositor
};
typedef void (*VoutDestroyCb)(vout_window_t *p_wnd);
public:
virtual ~Compositor() = default;
virtual MainInterface* makeMainInterface() = 0;
virtual void destroyMainInterface() = 0;
virtual bool setupVoutWindow(vout_window_t *p_wnd) = 0;
virtual bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) = 0;
virtual Type type() const = 0;
//factory
static Compositor* createCompositor(qt_intf_t *p_intf);
protected:
void onWindowDestruction(vout_window_t *p_wnd);
VoutDestroyCb m_destroyCb = nullptr;
};
......
......@@ -101,6 +101,7 @@ void CompositorDirectComposition::window_destroy(struct vout_window_t * p_wnd)
msg_Dbg(that->m_intf, "window_destroy");
that->m_window = nullptr;
that->m_videoVisual.Reset();
that->onWindowDestruction(p_wnd);
}
void CompositorDirectComposition::window_set_state(struct vout_window_t * p_wnd, unsigned state)
......@@ -293,8 +294,10 @@ void CompositorDirectComposition::destroyMainInterface()
m_ui.reset();
}
bool CompositorDirectComposition::setupVoutWindow(vout_window_t *p_wnd)
bool CompositorDirectComposition::setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb)
{
m_destroyCb = destroyCb;
//Only the first video is embedded
if (m_videoVisual.Get())
return false;
......
......@@ -50,7 +50,7 @@ public:
MainInterface *makeMainInterface() override;
void destroyMainInterface() override;
bool setupVoutWindow(vout_window_t *p_wnd) override;
bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) override;
Type type() const override;
......
......@@ -68,7 +68,7 @@ void CompositorDummy::destroyMainInterface()
}
}
bool CompositorDummy::setupVoutWindow(vout_window_t*)
bool CompositorDummy::setupVoutWindow(vout_window_t*, VoutDestroyCb)
{
//dummy compositor doesn't handle window intergration
return false;
......
......@@ -40,7 +40,7 @@ public:
virtual MainInterface *makeMainInterface() override;
virtual void destroyMainInterface() override;
bool setupVoutWindow(vout_window_t *p_wnd) override;
bool setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb) override;
Type type() const override;
......
......@@ -55,6 +55,7 @@ void CompositorWin7::window_destroy(struct vout_window_t * p_wnd)
{
CompositorWin7* that = static_cast<CompositorWin7*>(p_wnd->sys);
msg_Dbg(that->m_intf, "window_destroy");
that->onWindowDestruction(p_wnd);
}
void CompositorWin7::window_set_state(struct vout_window_t * p_wnd, unsigned state)
......@@ -241,7 +242,7 @@ void CompositorWin7::destroyMainInterface()
}
}
bool CompositorWin7::setupVoutWindow(vout_window_t *p_wnd)
bool CompositorWin7::setupVoutWindow(vout_window_t *p_wnd, VoutDestroyCb destroyCb)
{
BOOL isCompositionEnabled;
HRESULT hr = DwmIsCompositionEnabled(&isCompositionEnabled);
......
......@@ -50,7 +50,7 @@ public:
virtual MainInterface *makeMainInterface() override;
virtual void destroyMainInterface() override;
virtual bool setupVoutWindow(vout_window_t*) override;
virtual bool setupVoutWindow(vout_window_t*, VoutDestroyCb destroyCb) override;
Type type() const override;
......
......@@ -835,6 +835,11 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
QApplication::postEvent( THEDP, event );
}
static void WindowCloseCb( vout_window_t *p_wnd )
{
//FIXME
}
/**
* Video output window provider
*/
......@@ -864,6 +869,6 @@ static int WindowOpen( vout_window_t *p_wnd )
if (unlikely(open_state != OPEN_STATE_OPENED))
return VLC_EGENERIC;
return p_intf->p_compositor->setupVoutWindow( p_wnd ) ? VLC_SUCCESS : VLC_EGENERIC;
bool ret = p_intf->p_compositor->setupVoutWindow( p_wnd, &WindowCloseCb );
return ret ? VLC_SUCCESS : VLC_EGENERIC;
}
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