]> git.sesse.net Git - vlc/commitdiff
skins2: remove vlc_object_alive (deprecated)
authorErwan Tulou <erwan10@videolan.org>
Wed, 27 Jun 2012 16:29:17 +0000 (18:29 +0200)
committerErwan Tulou <erwan10@videolan.org>
Wed, 27 Jun 2012 16:52:49 +0000 (18:52 +0200)
And better performance since we were still using the rest of a polling
 mechanism (every 100ms) just to ensure we were alive.

modules/gui/skins2/commands/cmd_quit.cpp
modules/gui/skins2/commands/cmd_quit.hpp
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.hpp

index b6d49fa6478cb575e77d53960166e446a03d2030..92a4b7465b7963a1244c76893bacbd90b52ab430 100644 (file)
@@ -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();
+}
index fd9fb0c80e9eae245049d73d4b82382eeebfeb98..f3bd03f5893f0c18d44ef27274a32aa5798351e5 100644 (file)
@@ -31,4 +31,7 @@
 /// "Quit" command
 DEFINE_COMMAND( Quit, "quit" )
 
+/// "ExitLoop" command
+DEFINE_COMMAND( ExitLoop, "exitloop" )
+
 #endif
index 095bf498ea1d1701344e5593c434d2d059f6e57b..b1b82c65d033c9ef751a8e1a4ff0851c4b2e055d 100644 (file)
@@ -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 );
index 83025299f77b3a2bb2fb8467aed0020b580a0a9b..9c15e8877e7a5b534f3c7c6593672d44889e3f71 100644 (file)
@@ -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 )
 {
index 72e9a147383fd42e8bf6fead23fe9a4e614d29cc..8cf36a24b477e198a471d718975088b321505c62 100644 (file)
@@ -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