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()
// 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();
}
......@@ -31,4 +31,7 @@
/// "Quit" command
DEFINE_COMMAND( Quit, "quit" )
/// "ExitLoop" command
DEFINE_COMMAND( ExitLoop, "exitloop" )
#endif
......@@ -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 );
......
......@@ -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 )
{
......
......@@ -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
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