vlc | branch: master | Rémi Denis-Courmont <r...@remlab.net> | Sun Dec 2 17:40:45 2018 +0200| [47afe1dcb21761ae91f5a4657bedcdf087164969] | committer: Rémi Denis-Courmont
qt: implement window enable & disable callbacks > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47afe1dcb21761ae91f5a4657bedcdf087164969 --- modules/gui/qt/main_interface.cpp | 41 ++++++++++++++++++++++++++------------- modules/gui/qt/main_interface.hpp | 7 +++++-- modules/gui/qt/qt.cpp | 7 ++----- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp index cd279b6610..2362d1c178 100644 --- a/modules/gui/qt/main_interface.cpp +++ b/modules/gui/qt/main_interface.cpp @@ -726,13 +726,11 @@ void MainInterface::toggleFSC() * All window provider queries must be handled through signals or events. * That's why we have all those emit statements... */ -bool MainInterface::getVideo( struct vout_window_t *p_wnd, - unsigned int i_width, unsigned int i_height, - bool fullscreen ) +bool MainInterface::getVideo( struct vout_window_t *p_wnd ) { static const struct vout_window_operations ops = { - NULL, - NULL, + MainInterface::enableVideo, + MainInterface::disableVideo, MainInterface::resizeVideo, MainInterface::releaseVideo, MainInterface::requestVideoState, @@ -743,12 +741,6 @@ bool MainInterface::getVideo( struct vout_window_t *p_wnd, if( videoActive.test_and_set() ) return false; - msg_Dbg( p_wnd, "requesting video window..." ); - - /* This is a blocking call signal. Results are stored directly in the - * vout_window_t and boolean pointers. Beware of deadlocks! */ - emit askGetVideo( p_wnd, i_width, i_height, fullscreen ); - p_wnd->ops = &ops; p_wnd->info.has_double_click = true; p_wnd->sys = this; @@ -986,6 +978,27 @@ void MainInterface::setInterfaceAlwaysOnTop( bool on_top ) } /* Asynchronous calls for video window contrlos */ +int MainInterface::enableVideo( vout_window_t *p_wnd, + const vout_window_cfg_t *cfg ) +{ + MainInterface *p_mi = (MainInterface *)p_wnd->sys; + + msg_Dbg( p_wnd, "requesting video window..." ); + /* This is a blocking call signal. Results are stored directly in the + * vout_window_t and boolean pointers. Beware of deadlocks! */ + emit p_mi->askGetVideo( p_wnd, cfg->width, cfg->height, + cfg->is_fullscreen ); + return VLC_SUCCESS; +} + +void MainInterface::disableVideo( vout_window_t *p_wnd ) +{ + MainInterface *p_mi = (MainInterface *)p_wnd->sys; + + msg_Dbg( p_wnd, "releasing video..." ); + emit p_mi->askReleaseVideo(); +} + void MainInterface::resizeVideo( vout_window_t *p_wnd, unsigned i_width, unsigned i_height ) { @@ -1020,9 +1033,9 @@ void MainInterface::releaseVideo( vout_window_t *p_wnd ) { MainInterface *p_mi = (MainInterface *)p_wnd->sys; - msg_Dbg( p_wnd, "releasing video..." ); - emit p_mi->askReleaseVideo(); - /* Releasing video is a blocking call. The video is no longer active. */ + /* Releasing video (in disableVideo()) was a blocking call. + * The video is no longer active by this point. + */ p_mi->videoActive.clear(); } diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp index 997678f8c7..5f4cd339d8 100644 --- a/modules/gui/qt/main_interface.hpp +++ b/modules/gui/qt/main_interface.hpp @@ -55,6 +55,7 @@ class QScreen; class QTimer; class StandardPLPanel; struct vout_window_t; +struct vout_window_cfg_t; class MainInterface : public QVLCMW { @@ -70,10 +71,12 @@ public: static const QEvent::Type ToolbarsNeedRebuild; /* Video requests from core */ - bool getVideo( struct vout_window_t *, - unsigned int i_width, unsigned int i_height, bool ); + bool getVideo( struct vout_window_t * ); private: std::atomic_flag videoActive; + static int enableVideo( struct vout_window_t *, + const struct vout_window_cfg_t * ); + static void disableVideo( struct vout_window_t * ); static void releaseVideo( struct vout_window_t * ); static void resizeVideo( struct vout_window_t *, unsigned, unsigned ); static void requestVideoState( struct vout_window_t *, unsigned ); diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp index 4e8ceb5c66..55fb0cf603 100644 --- a/modules/gui/qt/qt.cpp +++ b/modules/gui/qt/qt.cpp @@ -689,7 +689,7 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg, /** * Video output window provider */ -static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg ) +static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t * ) { if( !var_InheritBool( p_wnd, "embedded-video" ) ) return VLC_EGENERIC; @@ -717,8 +717,5 @@ static int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg ) MainInterface *p_mi = p_intf->p_sys->p_mi; - if( !p_mi->getVideo( p_wnd, cfg->width, cfg->height, cfg->is_fullscreen ) ) - return VLC_EGENERIC; - - return VLC_SUCCESS; + return p_mi->getVideo( p_wnd ) ? VLC_SUCCESS : VLC_EGENERIC; } _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits