Commit 41056c6e authored by Erwan Tulou's avatar 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.
parent 84b5c4ae
...@@ -49,3 +49,13 @@ void CmdQuit::execute() ...@@ -49,3 +49,13 @@ void CmdQuit::execute()
// Kill libvlc // Kill libvlc
libvlc_Quit( getIntf()->p_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();
}
...@@ -31,4 +31,7 @@ ...@@ -31,4 +31,7 @@
/// "Quit" command /// "Quit" command
DEFINE_COMMAND( Quit, "quit" ) DEFINE_COMMAND( Quit, "quit" )
/// "ExitLoop" command
DEFINE_COMMAND( ExitLoop, "exitloop" )
#endif #endif
...@@ -157,6 +157,18 @@ static void Close( vlc_object_t *p_this ) ...@@ -157,6 +157,18 @@ static void Close( vlc_object_t *p_this )
skin_load.intf = NULL; skin_load.intf = NULL;
vlc_mutex_unlock( &skin_load.mutex); 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_join( p_intf->p_sys->thread, NULL );
vlc_mutex_destroy( &p_intf->p_sys->init_lock ); 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 ) ...@@ -350,8 +362,7 @@ static int WindowOpen( vout_window_t *pWnd, const vout_window_cfg_t *cfg )
if( pIntf == NULL ) if( pIntf == NULL )
return VLC_EGENERIC; return VLC_EGENERIC;
if( !vlc_object_alive( pIntf ) || if( !var_InheritBool( pIntf, "skinned-video") ||
!var_InheritBool( pIntf, "skinned-video") ||
cfg->is_standalone ) cfg->is_standalone )
{ {
vlc_object_release( pIntf ); vlc_object_release( pIntf );
......
...@@ -83,13 +83,8 @@ void VlcProc::destroy( intf_thread_t *pIntf ) ...@@ -83,13 +83,8 @@ void VlcProc::destroy( intf_thread_t *pIntf )
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ), VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_varEqBands( pIntf ), m_pVout( NULL ), m_pAout( NULL ), 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 // Create and register VLC variables
VarManager *pVarManager = VarManager::instance( getIntf() ); VarManager *pVarManager = VarManager::instance( getIntf() );
...@@ -195,9 +190,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ), ...@@ -195,9 +190,6 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
VlcProc::~VlcProc() VlcProc::~VlcProc()
{ {
m_pTimer->stop();
delete( m_pTimer );
if( m_pAout ) if( m_pAout )
{ {
vlc_object_release( m_pAout ); vlc_object_release( m_pAout );
...@@ -234,28 +226,6 @@ VlcProc::~VlcProc() ...@@ -234,28 +226,6 @@ VlcProc::~VlcProc()
var_DelCallback( getIntf(), "interaction", onInteraction, this ); 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, int VlcProc::onInputNew( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldval, vlc_value_t newval, void *pParam ) vlc_value_t oldval, vlc_value_t newval, void *pParam )
{ {
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "../utils/position.hpp" #include "../utils/position.hpp"
#include "../utils/var_text.hpp" #include "../utils/var_text.hpp"
#include "../utils/var_string.hpp" #include "../utils/var_string.hpp"
#include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_video.hpp" #include "../controls/ctrl_video.hpp"
class OSTimer; class OSTimer;
...@@ -122,8 +121,6 @@ protected: ...@@ -122,8 +121,6 @@ protected:
virtual ~VlcProc(); virtual ~VlcProc();
private: private:
/// Timer to call manage() regularly (via doManage())
OSTimer *m_pTimer;
/// Playtree variable /// Playtree variable
VariablePtr m_cPlaytree; VariablePtr m_cPlaytree;
VariablePtr m_cVarRandom; VariablePtr m_cVarRandom;
...@@ -168,24 +165,12 @@ private: ...@@ -168,24 +165,12 @@ private:
audio_output_t *m_pAout; audio_output_t *m_pAout;
bool m_bEqualizer_started; 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 // reset variables when input is over
void reset_input(); void reset_input();
// init variables (libvlc and playlist levels) // init variables (libvlc and playlist levels)
void init_variables(); void init_variables();
/// Define the command that calls manage()
DEFINE_CALLBACK( VlcProc, Manage );
/// Callback for intf-show variable /// Callback for intf-show variable
static int onIntfShow( vlc_object_t *pObj, const char *pVariable, static int onIntfShow( vlc_object_t *pObj, const char *pVariable,
vlc_value_t oldVal, vlc_value_t newVal, vlc_value_t oldVal, vlc_value_t newVal,
...@@ -234,5 +219,4 @@ private: ...@@ -234,5 +219,4 @@ private:
void *pParam ); void *pParam );
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment