[vlc-devel] commit: Do not access vout_thread_t fields when it can be avoided. ( Laurent Aimar )

git version control git at videolan.org
Sun May 31 02:13:42 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun May 31 02:12:51 2009 +0200| [cc4f67fe86359bae2db6fc631f0ef96e0c63c1d1] | committer: Laurent Aimar 

Do not access vout_thread_t fields when it can be avoided.

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

 modules/codec/cmml/intf.c                      |    2 +-
 modules/control/hotkeys.c                      |   11 ++++++-----
 modules/control/http/macro.c                   |    2 +-
 modules/gui/qt4/components/extended_panels.cpp |    2 +-
 modules/gui/skins2/commands/cmd_fullscreen.cpp |    2 +-
 modules/gui/skins2/src/vlcproc.cpp             |    2 +-
 modules/misc/lua/libs/osd.c                    |    4 ++--
 src/control/mediacontrol_audio_video.c         |    2 +-
 src/input/decoder.c                            |    8 ++++----
 src/input/resource.c                           |    2 +-
 10 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/modules/codec/cmml/intf.c b/modules/codec/cmml/intf.c
index a1019f1..8e554cb 100644
--- a/modules/codec/cmml/intf.c
+++ b/modules/codec/cmml/intf.c
@@ -157,7 +157,7 @@ void CloseIntf ( decoder_sys_t *p_intf )
     if( p_vout )
     {
         /* enable CMML as a subtitle track */
-        spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
+        spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
         vlc_object_release( p_vout );
     }
 
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 39842a6..49babd8 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -197,7 +197,7 @@ static void Run( intf_thread_t *p_intf )
             int i;
             for( i = 0; i < CHANNELS_NUMBER; i++ )
             {
-                spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER,
+                spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_REGISTER,
                              &p_intf->p_sys->p_channels[ i ] );
             }
         }
@@ -1068,7 +1068,7 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
         vout_OSDMessage( p_input, POSITION_TEXT_CHAN, "%s", psz_time );
     }
 
-    if( p_vout->b_fullscreen )
+    if( var_GetBool( p_vout, "fullscreen" ) )
     {
         var_Get( p_input, "position", &pos );
         vout_OSDSlider( VLC_OBJECT( p_input ), POSITION_WIDGET_CHAN,
@@ -1085,7 +1085,7 @@ static void DisplayVolume( intf_thread_t *p_intf, vout_thread_t *p_vout,
     }
     ClearChannels( p_intf, p_vout );
 
-    if( p_vout->b_fullscreen )
+    if( var_GetBool( p_vout, "fullscreen" ) )
     {
         vout_OSDSlider( VLC_OBJECT( p_vout ), VOLUME_WIDGET_CHAN,
             i_vol*100/AOUT_VOLUME_MAX, OSD_VERT_SLIDER );
@@ -1103,10 +1103,11 @@ static void ClearChannels( intf_thread_t *p_intf, vout_thread_t *p_vout )
 
     if( p_vout )
     {
-        spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
+        spu_t *p_spu = vout_GetSpu( p_vout );
+        spu_Control( p_spu, SPU_CHANNEL_CLEAR, DEFAULT_CHAN );
         for( i = 0; i < CHANNELS_NUMBER; i++ )
         {
-            spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR,
+            spu_Control( p_spu, SPU_CHANNEL_CLEAR,
                          p_intf->p_sys->p_channels[ i ] );
         }
     }
diff --git a/modules/control/http/macro.c b/modules/control/http/macro.c
index 4d55c8d..6fabb63 100644
--- a/modules/control/http/macro.c
+++ b/modules/control/http/macro.c
@@ -235,7 +235,7 @@ static void MacroDo( httpd_file_sys_t *p_args,
                         p_vout = input_GetVout( p_sys->p_input );
                         if( p_vout )
                         {
-                            p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                            var_SetBool( p_vout, "fullscreen", !var_GetBool( p_vout, "fullscreen" ) );
                             vlc_object_release( p_vout );
                             msg_Dbg( p_intf, "requested fullscreen toggle" );
                         }
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index c2d516e..e8feb49 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -347,7 +347,7 @@ void ExtVideo::ChangeVFiltersString( const char *psz_name, bool b_add )
     if( p_vout )
     {
         if( !strcmp( psz_filter_type, "sub-filter" ) )
-            var_SetString( p_vout->p_spu, psz_filter_type, psz_string );
+            var_SetString( vout_GetSpu( p_vout ), psz_filter_type, psz_string );
         else
             var_SetString( p_vout, psz_filter_type, psz_string );
         vlc_object_release( p_vout );
diff --git a/modules/gui/skins2/commands/cmd_fullscreen.cpp b/modules/gui/skins2/commands/cmd_fullscreen.cpp
index 74a920d..b3bae4f 100644
--- a/modules/gui/skins2/commands/cmd_fullscreen.cpp
+++ b/modules/gui/skins2/commands/cmd_fullscreen.cpp
@@ -37,7 +37,7 @@ void CmdFullscreen::execute()
     if( pVout )
     {
         // Switch to fullscreen
-        pVout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+        var_SetBool( pVout, "fullscreen", !var_GetBool( pVout, "fullscreen" ) );
         vlc_object_release( pVout );
     }
 }
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index a2dcd27..362c6d2 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -344,7 +344,7 @@ void VlcProc::refreshInput()
         pVarHasVout->set( pVout != NULL );
         if( pVout )
         {
-            pVarFullscreen->set( pVout->b_fullscreen );
+            pVarFullscreen->set( var_GetBool( pVout, "fullscreen" ) );
             vlc_object_release( pVout );
         }
 
diff --git a/modules/misc/lua/libs/osd.c b/modules/misc/lua/libs/osd.c
index 05c1aae..c723149 100644
--- a/modules/misc/lua/libs/osd.c
+++ b/modules/misc/lua/libs/osd.c
@@ -134,7 +134,7 @@ static int vlclua_spu_channel_register( lua_State *L )
     if( !p_vout )
         return luaL_error( L, "Unable to find vout." );
 
-    spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER, &i_chan );
+    spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_REGISTER, &i_chan );
     vlc_object_release( p_vout );
     lua_pushinteger( L, i_chan );
     return 1;
@@ -149,7 +149,7 @@ static int vlclua_spu_channel_clear( lua_State *L )
     if( !p_vout )
         return luaL_error( L, "Unable to find vout." );
 
-    spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, i_chan );
+    spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_CLEAR, i_chan );
     vlc_object_release( p_vout );
     return 0;
 }
diff --git a/src/control/mediacontrol_audio_video.c b/src/control/mediacontrol_audio_video.c
index cb28ccf..46e6da4 100644
--- a/src/control/mediacontrol_audio_video.c
+++ b/src/control/mediacontrol_audio_video.c
@@ -118,7 +118,7 @@ int mediacontrol_showtext( vout_thread_t *p_vout, int i_channel,
                            int i_flags, int i_hmargin, int i_vmargin,
                            mtime_t i_start, mtime_t i_stop )
 {
-    return osd_ShowTextAbsolute( p_vout->p_spu, i_channel,
+    return osd_ShowTextAbsolute( vout_GetSpu( p_vout ), i_channel,
                                  psz_string, p_style,
                                  i_flags, i_hmargin, i_vmargin,
                                  i_start, i_stop );
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 3b71c69..f4789d5 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1536,7 +1536,7 @@ static void DecoderPlaySpu( decoder_t *p_dec, subpicture_t *p_subpic,
         vlc_mutex_unlock( &p_owner->lock );
 
         if( !b_reject )
-            spu_DisplaySubpicture( p_vout->p_spu, p_subpic );
+            spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_subpic );
         else
             subpicture_Delete( p_subpic );
 
@@ -1877,7 +1877,7 @@ static void DecoderProcessSpu( decoder_t *p_dec, block_t *p_block, bool b_flush
         p_vout = input_resource_HoldVout( p_input->p->p_resource );
 
         if( p_vout && p_owner->p_spu_vout == p_vout )
-            spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR,
+            spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_CLEAR,
                          p_owner->i_spu_channel );
 
         if( p_vout )
@@ -2042,7 +2042,7 @@ static void DeleteDecoder( decoder_t * p_dec )
         if( p_vout )
         {
             if( p_owner->p_spu_vout == p_vout )
-                spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, p_owner->i_spu_channel );
+                spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_CLEAR, p_owner->i_spu_channel );
             vlc_object_release( p_vout );
         }
     }
@@ -2390,7 +2390,7 @@ static subpicture_t *spu_new_buffer( decoder_t *p_dec )
 
         vlc_mutex_unlock( &p_owner->lock );
 
-        spu_Control( p_vout->p_spu, SPU_CHANNEL_REGISTER,
+        spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_REGISTER,
                      &p_owner->i_spu_channel );
         p_owner->i_spu_order = 0;
         p_owner->p_spu_vout = p_vout;
diff --git a/src/input/resource.c b/src/input/resource.c
index 3f5f3b7..f4e57d5 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -262,7 +262,7 @@ static vout_thread_t *RequestVout( input_resource_t *p_resource,
         {
             msg_Dbg( p_resource->p_input, "saving a free vout" );
             vout_Flush( p_vout, 1 );
-            spu_Control( p_vout->p_spu, SPU_CHANNEL_CLEAR, -1 );
+            spu_Control( vout_GetSpu( p_vout ), SPU_CHANNEL_CLEAR, -1 );
 
             p_resource->p_vout_free = p_vout;
         }




More information about the vlc-devel mailing list