// 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();
+}
/// "Quit" command
DEFINE_COMMAND( Quit, "quit" )
+/// "ExitLoop" command
+DEFINE_COMMAND( ExitLoop, "exitloop" )
+
#endif
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 );
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 );
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() );
VlcProc::~VlcProc()
{
- m_pTimer->stop();
- delete( m_pTimer );
-
if( m_pAout )
{
vlc_object_release( m_pAout );
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 )
{
#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;
virtual ~VlcProc();
private:
- /// Timer to call manage() regularly (via doManage())
- OSTimer *m_pTimer;
/// Playtree variable
VariablePtr m_cPlaytree;
VariablePtr m_cVarRandom;
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,
void *pParam );
};
-
#endif