Qt: Create a getVout() in MIM to remove some vlc_object_find( p_intf, VLC_OBJECT_VOUT...
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Jan 2009 12:19:36 +0000 (13:19 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Jan 2009 12:19:36 +0000 (13:19 +0100)
Just used now for buttons.

modules/gui/qt4/actions_manager.cpp
modules/gui/qt4/input_manager.hpp

index ca7b3c6..f434a2f 100644 (file)
@@ -111,8 +111,7 @@ void ActionsManager::play()
  */
 void ActionsManager::fullscreen()
 {
-    vout_thread_t *p_vout =
-      (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+    vout_thread_t *p_vout = THEMIM->getVout();
     if( p_vout)
     {
         var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
@@ -122,8 +121,7 @@ void ActionsManager::fullscreen()
 
 void ActionsManager::snapshot()
 {
-    vout_thread_t *p_vout =
-      (vout_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
+    vout_thread_t *p_vout = THEMIM->getVout();
     if( p_vout )
     {
         vout_Control( p_vout, VOUT_SNAPSHOT );
index 777da8f..a55c3fd 100644 (file)
@@ -30,6 +30,7 @@
 #endif
 
 #include <vlc_input.h>
+#include <vlc_vout.h>
 
 #include "qt4.hpp"
 
@@ -206,6 +207,18 @@ public:
 
     input_thread_t *getInput() { return p_input; };
     InputManager *getIM() { return im; };
+    vout_thread_t * getVout()
+    {
+        vout_thread_t **pp_vout; int i_vout;
+        if( !input_Control( p_input, INPUT_GET_VOUTS, &pp_vout, &i_vout ) )
+        {
+            for( int i = 1; i < i_vout; i++ ) vlc_object_release( pp_vout[i]);
+            vout_thread_t *p_tmp = pp_vout[0];
+            free( pp_vout );
+            return p_tmp;
+        }
+        return NULL;
+    }
 
 private:
     MainInputManager( intf_thread_t * );