[vlc-commits] skins2: remove vlc_object_alive (deprecated)
Erwan Tulou
git at videolan.org
Wed Jun 27 18:57:25 CEST 2012
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Jun 27 18:29:17 2012 +0200| [41056c6e72ef585f150ab5c8b53dccb8ec9bdeda] | committer: Erwan Tulou
skins2: remove vlc_object_alive (deprecated)
And better performance since we were still using the rest of a polling
mechanism (every 100ms) just to ensure we were alive.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=41056c6e72ef585f150ab5c8b53dccb8ec9bdeda
---
modules/gui/skins2/commands/cmd_quit.cpp | 10 ++++++++++
modules/gui/skins2/commands/cmd_quit.hpp | 3 +++
modules/gui/skins2/src/skin_main.cpp | 15 ++++++++++++--
modules/gui/skins2/src/vlcproc.cpp | 32 +-----------------------------
modules/gui/skins2/src/vlcproc.hpp | 16 ---------------
5 files changed, 27 insertions(+), 49 deletions(-)
diff --git a/modules/gui/skins2/commands/cmd_quit.cpp b/modules/gui/skins2/commands/cmd_quit.cpp
index b6d49fa..92a4b74 100644
--- a/modules/gui/skins2/commands/cmd_quit.cpp
+++ b/modules/gui/skins2/commands/cmd_quit.cpp
@@ -49,3 +49,13 @@ void CmdQuit::execute()
// Kill libvlc
libvlc_Quit( getIntf()->p_libvlc );
}
+
+
+void CmdExitLoop::execute()
+{
+ // Get the instance of OSFactory
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+
+ // Exit the main OS loop
+ pOsFactory->getOSLoop()->exit();
+}
diff --git a/modules/gui/skins2/commands/cmd_quit.hpp b/modules/gui/skins2/commands/cmd_quit.hpp
index fd9fb0c..f3bd03f 100644
--- a/modules/gui/skins2/commands/cmd_quit.hpp
+++ b/modules/gui/skins2/commands/cmd_quit.hpp
@@ -31,4 +31,7 @@
/// "Quit" command
DEFINE_COMMAND( Quit, "quit" )
+/// "ExitLoop" command
+DEFINE_COMMAND( ExitLoop, "exitloop" )
+
#endif
diff --git a/modules/gui/skins2/src/skin_main.cpp b/modules/gui/skins2/src/skin_main.cpp
index 095bf49..b1b82c6 100644
--- a/modules/gui/skins2/src/skin_main.cpp
+++ b/modules/gui/skins2/src/skin_main.cpp
@@ -157,6 +157,18 @@ static void Close( vlc_object_t *p_this )
skin_load.intf = NULL;
vlc_mutex_unlock( &skin_load.mutex);
+ AsyncQueue *pQueue = p_intf->p_sys->p_queue;
+ if( pQueue )
+ {
+ CmdGeneric *pCmd = new CmdExitLoop( p_intf );
+ if( pCmd )
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ }
+ else
+ {
+ msg_Err( p_intf, "thread found already stopped (weird!)" );
+ }
+
vlc_join( p_intf->p_sys->thread, NULL );
vlc_mutex_destroy( &p_intf->p_sys->init_lock );
@@ -350,8 +362,7 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
if( pIntf == NULL )
return VLC_EGENERIC;
- if( !vlc_object_alive( pIntf ) ||
- !var_InheritBool( pIntf, "skinned-video") ||
+ if( !var_InheritBool( pIntf, "skinned-video") ||
cfg->is_standalone )
{
vlc_object_release( pIntf );
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 8302529..9c15e88 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -83,13 +83,8 @@ void VlcProc::destroy( intf_thread_t *pIntf )
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_varEqBands( pIntf ), m_pVout( NULL ), m_pAout( NULL ),
- m_bEqualizer_started( false ), m_cmdManage( this )
+ m_bEqualizer_started( false )
{
- // Create a timer to poll the status of the vlc
- OSFactory *pOsFactory = OSFactory::instance( pIntf );
- m_pTimer = pOsFactory->createOSTimer( m_cmdManage );
- m_pTimer->start( 100, false );
-
// Create and register VLC variables
VarManager *pVarManager = VarManager::instance( getIntf() );
@@ -195,9 +190,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
VlcProc::~VlcProc()
{
- m_pTimer->stop();
- delete( m_pTimer );
-
if( m_pAout )
{
vlc_object_release( m_pAout );
@@ -234,28 +226,6 @@ VlcProc::~VlcProc()
var_DelCallback( getIntf(), "interaction", onInteraction, this );
}
-void VlcProc::manage()
-{
- // Did the user request to quit vlc ?
- if( !vlc_object_alive( getIntf() ) )
- {
- // Get the instance of OSFactory
- OSFactory *pOsFactory = OSFactory::instance( getIntf() );
-
- // Exit the main OS loop
- pOsFactory->getOSLoop()->exit();
-
- return;
- }
-}
-
-void VlcProc::CmdManage::execute()
-{
- // Just forward to VlcProc
- m_pParent->manage();
-}
-
-
int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldval, vlc_value_t newval, void *pParam )
{
diff --git a/modules/gui/skins2/src/vlcproc.hpp b/modules/gui/skins2/src/vlcproc.hpp
index 72e9a14..8cf36a2 100644
--- a/modules/gui/skins2/src/vlcproc.hpp
+++ b/modules/gui/skins2/src/vlcproc.hpp
@@ -37,7 +37,6 @@
#include "../utils/position.hpp"
#include "../utils/var_text.hpp"
#include "../utils/var_string.hpp"
-#include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_video.hpp"
class OSTimer;
@@ -122,8 +121,6 @@ protected:
virtual ~VlcProc();
private:
- /// Timer to call manage() regularly (via doManage())
- OSTimer *m_pTimer;
/// Playtree variable
VariablePtr m_cPlaytree;
VariablePtr m_cVarRandom;
@@ -168,24 +165,12 @@ private:
audio_output_t *m_pAout;
bool m_bEqualizer_started;
- /**
- * Poll VLC internals to update the status (volume, current time in
- * the stream, current filename, play/pause/stop status, ...)
- * This function should be called regurlarly, since there is no
- * callback mechanism (yet?) to automatically update a variable when
- * the internal status changes
- */
- void manage();
-
// reset variables when input is over
void reset_input();
// init variables (libvlc and playlist levels)
void init_variables();
- /// Define the command that calls manage()
- DEFINE_CALLBACK( VlcProc, Manage );
-
/// Callback for intf-show variable
static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal,
@@ -234,5 +219,4 @@ private:
void *pParam );
};
-
#endif
More information about the vlc-commits
mailing list