/*****************************************************************************
* qte_main.c : QT Embedded wrapper for gte_main
*****************************************************************************
- * Copyright (C) 2003 VideoLAN (Centrale Réseaux) and its contributors
+ * Copyright (C) 2003 the VideoLAN team
* $Id$
*
- * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
+ * Authors: Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
extern "C"
{
#include <vlc/vlc.h>
-#include <stdlib.h> /* atexit() */
}
#include <qapplication.h>
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
- vlc_value_t lockval;
+ vlc_mutex_t *lock;
- /* FIXME: put this in the module (de)initialization ASAP */
- var_Create( p_this->p_libvlc, "qte", VLC_VAR_MUTEX );
-
- var_Get( p_this->p_libvlc, "qte", &lockval );
- vlc_mutex_lock( (vlc_mutex_t *) lockval.p_address );
+ lock = var_GetGlobalMutex( "qte" );
+ vlc_mutex_lock( lockval );
if( i_refcount > 0 )
{
i_refcount++;
- vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
+ vlc_mutex_unlock( lock );
return VLC_SUCCESS;
}
{
vlc_object_destroy( p_qte_main );
i_refcount--;
- vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
- var_Destroy( p_this->p_libvlc, "qte" );
+ vlc_mutex_unlock( lock );
return VLC_ETHREAD;
}
i_refcount++;
- vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
+ vlc_mutex_unlock( lock );
vlc_object_attach( p_qte_main, p_this );
msg_Dbg( p_this, "qte_main running" );
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
- vlc_value_t lockval;
+ vlc_mutex_t *lock;
- var_Get( p_this->p_libvlc, "qte", &lockval );
- vlc_mutex_lock( (vlc_mutex_t *) lockval.p_address );
+ lock = var_GetGlobalMutex( "qte" );
+ vlc_mutex_lock( lock );
i_refcount--;
if( i_refcount > 0 )
{
- vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
- var_Destroy( p_this->p_libvlc, "qte" );
+ vlc_mutex_unlock( lock );
return;
}
p_qte_main->p_qte_application->quit();
vlc_object_destroy( p_qte_main );
p_qte_main = NULL;
- vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
- var_Destroy( p_this->p_libvlc, "qte" );
+ vlc_mutex_unlock( lock );
}
/*****************************************************************************
/* Run as standalone GuiServer or as GuiClient. */
QApplication* pApp = new QApplication(i_argc, NULL,
(p_this->b_gui_server ? (QApplication::GuiServer):(QApplication::GuiClient)) );
- if(pApp)
+ if( pApp )
{
p_this->p_qte_application = pApp;
}
QWidget* pWidget = new QWidget(0, _("video") );
- if(pWidget)
+ if( pWidget )
{
p_this->p_qte_widget = pWidget;
}
vlc_thread_ready( p_this );
p_this->p_qte_application->exec();
}
-