Browse Source

qt: add flag to orphan the video

The video widget is normally released when the window provider is
closed. But it can also be released when the main UI is closed, even
though the window provider is still active.
cherry-pick-c5513cf9
Rémi Denis-Courmont 4 years ago
parent
commit
958be95e2a
  1. 4
      modules/gui/qt/components/interface_widgets.cpp
  2. 2
      modules/gui/qt/components/interface_widgets.hpp
  3. 14
      modules/gui/qt/main_interface.cpp
  4. 4
      modules/gui/qt/main_interface.hpp

4
modules/gui/qt/components/interface_widgets.cpp

@ -402,9 +402,9 @@ void VideoWidget::mouseDoubleClickEvent( QMouseEvent *event )
}
void VideoWidget::release( void )
void VideoWidget::release( bool forced )
{
msg_Dbg( p_intf, "Video is not needed anymore" );
msg_Dbg( p_intf, "video widget is %s", forced ? "orphaned" : "released" );
if( stable )
{

2
modules/gui/qt/components/interface_widgets.hpp

@ -60,7 +60,7 @@ public:
virtual ~VideoWidget();
bool request( struct vout_window_t * );
void release( void );
void release( bool forced );
void sync( void );
protected:

14
modules/gui/qt/main_interface.cpp

@ -205,8 +205,8 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
connect( this, SIGNAL(askGetVideo(struct vout_window_t*, unsigned, unsigned, bool, bool*)),
this, SLOT(getVideoSlot(struct vout_window_t*, unsigned, unsigned, bool, bool*)),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL(askReleaseVideo( void )),
this, SLOT(releaseVideoSlot( void )),
connect( this, SIGNAL(askReleaseVideo( bool )),
this, SLOT(releaseVideoSlot( bool )),
Qt::BlockingQueuedConnection );
CONNECT( this, askVideoOnTop(bool), this, setVideoOnTop(bool));
@ -274,7 +274,7 @@ MainInterface::~MainInterface()
showTab( bgWidget );
if( videoWidget )
releaseVideoSlot();
releaseVideoSlot(true);
/* Be sure to kill the actionsManager... Only used in the MI and control */
ActionsManager::killInstance();
@ -771,17 +771,17 @@ void MainInterface::getVideoSlot( struct vout_window_t *p_wnd,
/* Asynchronous call from the WindowClose function */
void MainInterface::releaseVideo( void )
{
emit askReleaseVideo();
emit askReleaseVideo(false);
}
/* Function that is CONNECTED to the previous emit */
void MainInterface::releaseVideoSlot( void )
void MainInterface::releaseVideoSlot( bool forced )
{
/* This function is called when the embedded video window is destroyed,
* or in the rare case that the embedded window is still here but the
* Qt interface exits. */
assert( videoWidget );
videoWidget->release();
videoWidget->release( forced );
setVideoOnTop( false );
setVideoFullScreen( false );
hideResumePanel();
@ -1674,7 +1674,7 @@ void MainInterface::closeEvent( QCloseEvent *e )
if ( b_minimalView )
setMinimalView( false );
if( videoWidget )
releaseVideoSlot();
releaseVideoSlot( true );
emit askToQuit(); /* ask THEDP to quit, so we have a unique method */
/* Accept session quit. Otherwise we break the desktop mamager. */
e->accept();

4
modules/gui/qt/main_interface.hpp

@ -217,7 +217,7 @@ public slots:
/* Manage the Video Functions from the vout threads */
void getVideoSlot( struct vout_window_t *,
unsigned i_width, unsigned i_height, bool, bool * );
void releaseVideoSlot( void );
void releaseVideoSlot( bool forced );
void emitBoss();
void emitRaise();
@ -270,7 +270,7 @@ protected slots:
signals:
void askGetVideo( struct vout_window_t *, unsigned, unsigned, bool,
bool * );
void askReleaseVideo( );
void askReleaseVideo( bool );
void askVideoToResize( unsigned int, unsigned int );
void askVideoSetFullScreen( bool );
void askHideMouse( bool );

Loading…
Cancel
Save