[vlc-commits] qt4: Fix initial input probing
Hugo Beauzée-Luyssen
git at videolan.org
Thu Dec 10 16:11:36 CET 2015
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Thu Dec 10 15:01:47 2015 +0100| [45ecb6947875bef52ed5f7b40b884372da26d150] | committer: Hugo Beauzée-Luyssen
qt4: Fix initial input probing
inputChangedHandler only reads from the current MIM input, which isn't
set until the next playlist callback is received.
This actively probes the current input, sets it, and inform potential
listeners
refs #14162
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45ecb6947875bef52ed5f7b40b884372da26d150
---
modules/gui/qt4/input_manager.cpp | 4 ++++
modules/gui/qt4/input_manager.hpp | 3 +++
modules/gui/qt4/qt4.cpp | 7 ++-----
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index 0aac345..cae2735 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -1061,7 +1061,11 @@ void MainInputManager::customEvent( QEvent *event )
default:
if( type != IMEvent::ItemChanged ) return;
}
+ probeCurrentInput();
+}
+void MainInputManager::probeCurrentInput()
+{
if( p_input != NULL )
vlc_object_release( p_input );
p_input = playlist_CurrentInput( THEPL );
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 3b6f4c6..57dfd4d 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -271,6 +271,9 @@ public:
bool hasEmptyPlaylist();
void requestVoutUpdate() { return im->UpdateVout(); }
+ // Probe for initial input. Doing this from the constructor would cause
+ // the getInstance to call itself recursively from the inputChangedHandler
+ void probeCurrentInput();
protected:
QSignalMapper *menusAudioMapper;
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 6721021..43ba185 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -514,11 +514,8 @@ static void *Thread( void *obj )
/* Initialize the Dialog Provider and the Main Input Manager */
DialogsProvider::getInstance( p_intf );
- MainInputManager *mim = MainInputManager::getInstance( p_intf );
- /* initialize p_input (an input can already be running) */
- input_thread_t *p_input = playlist_CurrentInput( THEPL );
- if( p_input )
- mim->getIM()->inputChangedHandler();
+ MainInputManager* mim = MainInputManager::getInstance( p_intf );
+ mim->probeCurrentInput();
#ifdef UPDATE_CHECK
/* Checking for VLC updates */
More information about the vlc-commits
mailing list