[vlc-devel] commit: Qt: remove vlc_object_find for AOUTs in menu and extended settings. (Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Jan 19 16:40:59 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jan 19 16:40:11 2009 +0100| [875e25d50f0d4faed0066bc5fb44581ef4217f0d] | committer: Jean-Baptiste Kempf 

Qt: remove vlc_object_find for AOUTs in menu and extended settings.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=875e25d50f0d4faed0066bc5fb44581ef4217f0d
---

 modules/gui/qt4/components/extended_panels.cpp |   21 +++++++--------------
 modules/gui/qt4/input_manager.hpp              |    9 +++++++++
 modules/gui/qt4/menus.cpp                      |   11 ++++-------
 3 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index 07e6d07..3b30a40 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -875,8 +875,7 @@ void Equalizer::updateUIFromCore()
     float f_preamp;
     int i_preset;
 
-    aout_instance_t *p_aout = ( aout_instance_t * )vlc_object_find( p_intf,
-                                    VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout = THEMIM->getAout();
     if( p_aout )
     {
         psz_af = var_GetNonEmptyString( p_aout, "audio-filter" );
@@ -938,8 +937,7 @@ void Equalizer::enable( bool en )
 /* Function called when the set2Pass button is activated */
 void Equalizer::set2Pass()
 {
-    aout_instance_t *p_aout= ( aout_instance_t * )vlc_object_find( p_intf,
-                                 VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout= THEMIM->getAout();
     bool b_2p = ui.eq2PassCheck->isChecked();
 
     if( p_aout == NULL )
@@ -960,8 +958,7 @@ void Equalizer::set2Pass()
 void Equalizer::setPreamp()
 {
     const float f = ( float )(  ui.preampSlider->value() ) /10 - 20;
-    aout_instance_t *p_aout= ( aout_instance_t * )vlc_object_find( p_intf,
-                                       VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout = THEMIM->getAout();
 
     ui.preampLabel->setText( qtr( "Preamp\n" ) + QString::number( f, 'f', 1 )
                                                + qtr( "dB" ) );
@@ -990,8 +987,7 @@ void Equalizer::setCoreBands()
     }
     const char *psz_values = values.toAscii().constData();
 
-    aout_instance_t *p_aout= ( aout_instance_t * )vlc_object_find( p_intf,
-                                          VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout = THEMIM->getAout();
     if( p_aout )
     {
         //delCallbacks( p_aout );
@@ -1053,8 +1049,7 @@ void Equalizer::setCorePreset( int i_preset )
     char *psz_values = createValuesFromPreset( i_preset );
     if( !psz_values ) return ;
 
-    aout_instance_t *p_aout= ( aout_instance_t * )vlc_object_find( p_intf,
-                                               VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout= THEMIM->getAout();
     if( p_aout )
     {
         delCallbacks( p_aout );
@@ -1148,8 +1143,7 @@ Spatializer::Spatializer( intf_thread_t *_p_intf, QWidget *_parent ) :
     BUTTONACT( enableCheck, enable() );
 
     /* Write down initial values */
-    aout_instance_t *p_aout = ( aout_instance_t * )
-        vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout = THEMIM->getAout();
     char *psz_af;
 
     if( p_aout )
@@ -1204,8 +1198,7 @@ void Spatializer::setInitValues()
 
 void Spatializer::setValues( float *controlVars )
 {
-    aout_instance_t *p_aout= ( aout_instance_t * )
-        vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
+    aout_instance_t *p_aout = THEMIM->getAout();
 
     for( int i = 0 ; i < NUM_SP_CTRL ; i++ )
     {
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index ec6d6f5..90fa02a 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -31,6 +31,7 @@
 
 #include <vlc_input.h>
 #include <vlc_vout.h>
+#include <vlc_aout.h>
 
 #include "qt4.hpp"
 
@@ -220,6 +221,14 @@ public:
         return NULL;
     }
 
+    aout_instance_t *getAout()
+    {
+        aout_instance_t *p_aout;
+        if( p_input && !input_Control( p_input, INPUT_GET_AOUT, &p_aout ) )
+        {
+            return p_aout;
+        }
+    }
 private:
     MainInputManager( intf_thread_t * );
     static MainInputManager *instance;
diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 76dc6ee..81fe5ec 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -230,7 +230,7 @@ static int VideoAutoMenuBuilder( vout_thread_t *p_object,
     return VLC_SUCCESS;
 }
 
-static int AudioAutoMenuBuilder( vlc_object_t *p_object,
+static int AudioAutoMenuBuilder( aout_instance_t *p_object,
         input_thread_t *p_input,
         vector<vlc_object_t *> &objects,
         vector<const char *> &varnames )
@@ -477,7 +477,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
 {
     vector<vlc_object_t *> objects;
     vector<const char *> varnames;
-    vlc_object_t *p_aout;
+    aout_instance_t *p_aout;
     input_thread_t *p_input;
 
     if( !current ) current = new QMenu();
@@ -494,9 +494,7 @@ QMenu *QVLCMenu::AudioMenu( intf_thread_t *p_intf, QMenu * current )
     p_input = THEMIM->getInput();
     if( p_input )
         vlc_object_hold( p_input );
-    p_aout = ( vlc_object_t * ) vlc_object_find( p_intf,
-                                                 VLC_OBJECT_AOUT,
-                                                 FIND_ANYWHERE );
+    p_aout = THEMIM->getAout();
 
     AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
 
@@ -759,8 +757,7 @@ void QVLCMenu::AudioPopupMenu( intf_thread_t *p_intf )
     if( p_input )
     {
         vlc_object_hold( p_input );
-        vlc_object_t *p_aout = ( vlc_object_t * )vlc_object_find( p_input,
-                VLC_OBJECT_AOUT, FIND_ANYWHERE );
+        aout_instance_t *p_aout = THEMIM->getAout();
         AudioAutoMenuBuilder( p_aout, p_input, objects, varnames );
         if( p_aout )
             vlc_object_release( p_aout );




More information about the vlc-devel mailing list