Commit 5fec93e1 authored by Jean-Paul Saman's avatar Jean-Paul Saman

New "qte_main" module. It should be used by all plugins/modules that need QT...

New "qte_main" module. It should be used by all plugins/modules that need QT embedded. Also ported modules/qte/qte.{cpp,h} to use it.
parent 4e1cda09
...@@ -436,6 +436,9 @@ dnl Build the gtk_main plugins? ...@@ -436,6 +436,9 @@ dnl Build the gtk_main plugins?
NEED_GTK_MAIN=no NEED_GTK_MAIN=no
NEED_GNOME_MAIN=no NEED_GNOME_MAIN=no
dnl build the qte plugin ?
NEED_QTE_MAIN=no
dnl Check for DPMS dnl Check for DPMS
if test "x${SYS}" != "xmingw32" if test "x${SYS}" != "xmingw32"
then then
...@@ -1922,6 +1925,7 @@ then ...@@ -1922,6 +1925,7 @@ then
CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti" CPPFLAGS_qte="${CPPFLAGS_qte} -I${QTDIR}/include `echo -I${QTDIR}/include | sed 's,opt/QtPalmtop,usr,'` -DQT_QWS_IPAQ -DQWS -fno-exceptions -fno-rtti"
fi fi
PLUGINS="${PLUGINS} qte" PLUGINS="${PLUGINS} qte"
NEED_QTE_MAIN=yes
CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}" CPPFLAGS="${CPPFLAGS_save} ${CPPFLAGS_qte}"
AC_CHECK_HEADERS(qt.h jpeglib.h, ,[ AC_CHECK_HEADERS(qt.h jpeglib.h, ,[
AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."]) AC_MSG_ERROR([echo "Cannot find QT Embedded development headers."])
...@@ -2413,6 +2417,7 @@ AC_ARG_ENABLE(opie, ...@@ -2413,6 +2417,7 @@ AC_ARG_ENABLE(opie,
CPPFLAGS="${CPPFLAGS_save}" CPPFLAGS="${CPPFLAGS_save}"
PLUGINS="${PLUGINS} opie" PLUGINS="${PLUGINS} opie"
NEED_QTE_MAIN=yes
LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}" LDFLAGS_opie="${LDFLAGS_opie} -lqpe ${LDFLAGS_qte}"
CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}" CPPFLAGS_opie="${CPPFLAGS_opie} ${CPPFLAGS_qte}"
if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x" if test "x${with_qte}" != "xno" -a "x${with_qte}" != "x"
...@@ -2709,6 +2714,19 @@ then ...@@ -2709,6 +2714,19 @@ then
LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}" LDFLAGS_gnome_main="${LDFLAGS_gnome_main} ${LDFLAGS_gtk} ${LDFLAGS_familiar} ${LDFLAGS_gnome}"
fi fi
dnl
dnl qte_main plugin
dnl
if test "x${NEED_QTE_MAIN}" != "xno"
then
PLUGINS="${PLUGINS} qte_main"
CPPFLAGS_qte="${CPPFLAGS_qte} -DNEED_QTE_MAIN"
CPPFLAGS_opie="${CPPFLAGS_opie} -DNEED_QTE_MAIN"
CPPFLAGS_qte_main="${CFLAGS_qte_main} ${CPPFLAGS_qte}"
LDFLAGS_qte_main="${LDFLAGS_qte_main} ${LDFLAGS_qte}"
fi
dnl dnl
dnl Plugin and builtin checks dnl Plugin and builtin checks
dnl dnl
......
...@@ -2,7 +2,7 @@ Package: vlc ...@@ -2,7 +2,7 @@ Package: vlc
Section: graphics Section: graphics
Priority: optional Priority: optional
Version: 0.5.0 Version: 0.5.0
Release: 1 Release: test3
Architecture: arm Architecture: arm
Conflicts: task-opie, gpe-vlc, gpe Conflicts: task-opie, gpe-vlc, gpe
Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr> Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr>
......
...@@ -2,7 +2,7 @@ Package: gpe-vlc ...@@ -2,7 +2,7 @@ Package: gpe-vlc
Section: graphics Section: graphics
Priority: optional Priority: optional
Version: 0.5.0 Version: 0.5.0
Release: test2 Release: test3
Conflicts: task-opie, vlc Conflicts: task-opie, vlc
Architecture: arm Architecture: arm
Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr> Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr>
......
...@@ -2,11 +2,11 @@ Package: opie-vlc ...@@ -2,11 +2,11 @@ Package: opie-vlc
Section: graphics Section: graphics
Priority: optional Priority: optional
Version: 0.5.0 Version: 0.5.0
Release: 1 Release: test3
Conflicts: gpe, vlc Conflicts: gpe, vlc, libsdl
Architecture: arm Architecture: arm
Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr> Maintainer: Jean-Paul Saman <jpsaman@wxs.nl>, Christophe Massiot <massiot@via.ecp.fr>
Depends: libc6, task-opie Depends: libc6, task-opie, opie-libsdl
Copyright: GPL Copyright: GPL
Description: VideoLAN Client is a free network-aware MPEG and DVD player. Description: VideoLAN Client is a free network-aware MPEG and DVD player.
VideoLAN is a free MPEG1/2 software solution licensed under GPL. The original VideoLAN is a free MPEG1/2 software solution licensed under GPL. The original
......
...@@ -10,8 +10,6 @@ export AR=arm-linux-ar ...@@ -10,8 +10,6 @@ export AR=arm-linux-ar
export RANLIB=arm-linux-ranlib export RANLIB=arm-linux-ranlib
export STRIP=arm-linux-strip export STRIP=arm-linux-strip
#export CONFIG_FLAGS="--enable-release --prefix=/usr --disable-gtk --enable-fb --enable-sdl --disable-xvideo --disable-plugins --with-tuning=strongarm1100 --x-includes=/skiff/local/arm-linux/include --x-libraries=/skiff/local/arm-linux/lib/X11 --with-sdl-config-path=/skiff/local/bin --with-mad=/skiff/local/arm-linux"
export CONFIG_FLAGS="--enable-release --prefix=/usr \ export CONFIG_FLAGS="--enable-release --prefix=/usr \
--disable-plugins \ --disable-plugins \
--disable-gtk \ --disable-gtk \
...@@ -23,6 +21,7 @@ export CONFIG_FLAGS="--enable-release --prefix=/usr \ ...@@ -23,6 +21,7 @@ export CONFIG_FLAGS="--enable-release --prefix=/usr \
--enable-sdl \ --enable-sdl \
--enable-oss \ --enable-oss \
--disable-alsa \ --disable-alsa \
--enable-x11 \
--disable-xvideo \ --disable-xvideo \
--disable-dvd \ --disable-dvd \
--disable-dvdread \ --disable-dvdread \
......
...@@ -54,7 +54,7 @@ config: ...@@ -54,7 +54,7 @@ config:
--host=arm-linux \ --host=arm-linux \
--target=arm-linux \ --target=arm-linux \
$(shell echo $(CONFIG_FLAGS)) \ $(shell echo $(CONFIG_FLAGS)) \
LDFLAGS=/usr/local/arm/2.95.3/arm-linux/lib LDFLAGS="-L/usr/local/arm/2.95.3/arm-linux/lib"
build: build:
# This is ugly -- I know # This is ugly -- I know
......
...@@ -19,7 +19,7 @@ export CONFIG_FLAGS="--enable-release --prefix=/usr \ ...@@ -19,7 +19,7 @@ export CONFIG_FLAGS="--enable-release --prefix=/usr \
--enable-qte \ --enable-qte \
--disable-x11 \ --disable-x11 \
--enable-fb \ --enable-fb \
--disable-sdl \ --enable-sdl \
--disable-alsa \ --disable-alsa \
--disable-xvideo \ --disable-xvideo \
--disable-dvd \ --disable-dvd \
......
SOURCES_gtk_main = modules/misc/gtk_main.c SOURCES_gtk_main = modules/misc/gtk_main.c
SOURCES_gnome_main = modules/misc/gtk_main.c SOURCES_gnome_main = modules/misc/gtk_main.c
SOURCES_sap = modules/misc/sap.c SOURCES_sap = modules/misc/sap.c
SOURCES_qte_main = modules/misc/qte_main.cpp
/*****************************************************************************
* qte_main.c : QT Embedded wrapper for gte_main
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: qte_main.cpp,v 1.1 2003/01/19 22:16:13 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* 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.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
extern "C"
{
#include <vlc/vlc.h>
#include <stdlib.h> /* atexit() */
}
#include <qapplication.h>
extern "C"
{
typedef struct qte_thread_t
{
VLC_COMMON_MEMBERS
QApplication* p_qte_application;
} qte_thread_t;
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void QteMain ( qte_thread_t * );
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static int i_refcount = 0;
static qte_thread_t * p_qte_main = NULL;
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
set_description( _("Qt Embedded helper module") );
set_capability( "qte_main", 90 );
add_shortcut( "qte" );
set_callbacks( Open, Close );
vlc_module_end();
} /* extern "C" */
/*****************************************************************************
* Open: initialize and create window
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
vlc_value_t lockval;
/* 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 );
if( i_refcount > 0 )
{
i_refcount++;
vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
return VLC_SUCCESS;
}
p_qte_main = (qte_thread_t *) vlc_object_create( p_this, sizeof(qte_thread_t) );
/* Launch the gtk_main() thread. It will not return until it has
* called gdk_threads_enter(), which ensures us thread safety. */
if( vlc_thread_create( p_qte_main, "qte_main", QteMain,
VLC_THREAD_PRIORITY_LOW, VLC_TRUE ) )
{
vlc_object_destroy( p_qte_main );
i_refcount--;
vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
var_Destroy( p_this->p_libvlc, "qte" );
return VLC_ETHREAD;
}
i_refcount++;
vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
return VLC_SUCCESS;
}
/*****************************************************************************
* Close: destroy interface window
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
vlc_value_t lockval;
var_Get( p_this->p_libvlc, "qte", &lockval );
vlc_mutex_lock( (vlc_mutex_t *) lockval.p_address );
i_refcount--;
if( i_refcount > 0 )
{
vlc_mutex_unlock( (vlc_mutex_t *) lockval.p_address );
var_Destroy( p_this->p_libvlc, "qte" );
return;
}
p_qte_main->p_qte_application->quit();
vlc_thread_join( p_qte_main );
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" );
}
/*****************************************************************************
* QteMain: Qt Embedded thread
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* qte_main() from within it without annoying the rest of the program.
*****************************************************************************/
static void QteMain( qte_thread_t *p_this )
{
int argc = 0;
msg_Dbg( p_this, "qte_main: enter" );
QApplication* pApp = new QApplication(argc, NULL);
if(pApp)
{
p_this->p_qte_application = pApp;
}
msg_Dbg( p_this, "qte_main: qte application created" );
/* signal the creation of the window */
vlc_thread_ready( p_this );
msg_Dbg( p_this, "qte_main: qte application thread ready" );
p_this->p_qte_application->exec();
msg_Dbg( p_this, "qte_main: leaving" );
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* qte.cpp : QT Embedded plugin for vlc * qte.cpp : QT Embedded plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: qte.cpp,v 1.8 2002/12/24 19:25:54 jpsaman Exp $ * $Id: qte.cpp,v 1.9 2003/01/19 22:16:13 jpsaman Exp $
* *
* Authors: Gerald Hansink <gerald.hansink@ordain.nl> * Authors: Gerald Hansink <gerald.hansink@ordain.nl>
* Jean-Paul Saman <jpsaman@wxs.nl> * Jean-Paul Saman <jpsaman@wxs.nl>
...@@ -129,6 +129,7 @@ vlc_module_begin(); ...@@ -129,6 +129,7 @@ vlc_module_begin();
// add_integer( "qte-drawable", -1, NULL, NULL, NULL); //DRAWABLE_TEXT, DRAWABLE_LONGTEXT ); // add_integer( "qte-drawable", -1, NULL, NULL, NULL); //DRAWABLE_TEXT, DRAWABLE_LONGTEXT );
set_description( _("QT Embedded module") ); set_description( _("QT Embedded module") );
set_capability( "video output", 30 ); set_capability( "video output", 30 );
// add_shortcut( "qte" );
set_callbacks( Open, Close); set_callbacks( Open, Close);
vlc_module_end(); vlc_module_end();
...@@ -164,6 +165,15 @@ static int Open( vlc_object_t *p_this ) ...@@ -164,6 +165,15 @@ static int Open( vlc_object_t *p_this )
p_vout->pf_render = NULL; //Render; p_vout->pf_render = NULL; //Render;
p_vout->pf_display = Display; p_vout->pf_display = Display;
#ifdef NEED_QTE_MAIN
p_vout->p_sys->p_qte_main = module_Need( p_this, "qte_main", "qte" );
if( p_vout->p_sys->p_qte_main == NULL )
{
free( p_vout->p_sys );
return VLC_ENOMOD;
}
#endif
CreateQtWindow(p_vout); CreateQtWindow(p_vout);
return( 0 ); return( 0 );
} }
...@@ -190,6 +200,10 @@ static void Close ( vlc_object_t *p_this ) ...@@ -190,6 +200,10 @@ static void Close ( vlc_object_t *p_this )
vlc_object_destroy( p_vout->p_sys->p_event ); vlc_object_destroy( p_vout->p_sys->p_event );
} }
#ifdef NEED_QTE_MAIN
module_Unneed( p_vout, p_vout->p_sys->p_qte_main );
#endif
if( p_vout->p_sys ) if( p_vout->p_sys )
{ {
free( p_vout->p_sys ); free( p_vout->p_sys );
...@@ -528,14 +542,14 @@ static void DestroyQtWindow( vout_thread_t *p_vout ) ...@@ -528,14 +542,14 @@ static void DestroyQtWindow( vout_thread_t *p_vout )
// quit qt application loop // quit qt application loop
if(p_vout->p_sys->pcQApplication) if(p_vout->p_sys->pcQApplication)
{ {
#ifndef NEED_QTE_MAIN
if(p_vout->p_sys->bOwnsQApp) if(p_vout->p_sys->bOwnsQApp)
{ {
p_vout->p_sys->pcQApplication->quit(); p_vout->p_sys->pcQApplication->quit();
} }
else else
{ #endif
p_vout->p_sys->bRunning = FALSE; p_vout->p_sys->bRunning = FALSE;
}
while(p_vout->p_sys->pcVoutWidget) while(p_vout->p_sys->pcVoutWidget)
{ {
...@@ -566,6 +580,7 @@ static void RunQtThread(event_thread_t *p_event) ...@@ -566,6 +580,7 @@ static void RunQtThread(event_thread_t *p_event)
else else
{ {
p_event->p_vout->p_sys->pcQApplication = qApp; p_event->p_vout->p_sys->pcQApplication = qApp;
p_event->p_vout->p_sys->bOwnsQApp = FALSE;
msg_Dbg( p_event->p_vout, "RunQtThread applicaton attached" ); msg_Dbg( p_event->p_vout, "RunQtThread applicaton attached" );
} }
...@@ -584,6 +599,7 @@ static void RunQtThread(event_thread_t *p_event) ...@@ -584,6 +599,7 @@ static void RunQtThread(event_thread_t *p_event)
if(p_event->p_vout->p_sys->bOwnsQApp) if(p_event->p_vout->p_sys->bOwnsQApp)
{ {
// run the main loop of qtapplication until someone says: 'quit' // run the main loop of qtapplication until someone says: 'quit'
msg_Dbg( p_event->p_vout, "+qte::RunQtThread starting application" );
p_event->p_vout->p_sys->pcQApplication->exec(); p_event->p_vout->p_sys->pcQApplication->exec();
} }
else else
...@@ -603,6 +619,7 @@ static void RunQtThread(event_thread_t *p_event) ...@@ -603,6 +619,7 @@ static void RunQtThread(event_thread_t *p_event)
if(p_event->p_vout->p_sys->bOwnsQApp) if(p_event->p_vout->p_sys->bOwnsQApp)
{ {
msg_Dbg( p_event->p_vout, "+qte::RunQtThread deleting application" );
delete p_event->p_vout->p_sys->pcQApplication; delete p_event->p_vout->p_sys->pcQApplication;
p_event->p_vout->p_sys->pcQApplication = NULL; p_event->p_vout->p_sys->pcQApplication = NULL;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* qte.h : QT Embedded plugin for vlc * qte.h : QT Embedded plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: qte.h,v 1.3 2002/09/23 21:44:23 jpsaman Exp $ * $Id: qte.h,v 1.4 2003/01/19 22:16:13 jpsaman Exp $
* *
* Authors: Gerald Hansink <gerald.hansink@ordain.nl> * Authors: Gerald Hansink <gerald.hansink@ordain.nl>
* Jean-Paul Saman <jpsaman@wxs.nl> * Jean-Paul Saman <jpsaman@wxs.nl>
...@@ -56,6 +56,10 @@ struct vout_sys_t ...@@ -56,6 +56,10 @@ struct vout_sys_t
QApplication* pcQApplication; QApplication* pcQApplication;
QWidget* pcVoutWidget; QWidget* pcVoutWidget;
#ifdef NEED_QTE_MAIN
module_t * p_qte_main;
#endif
event_thread_t * p_event; event_thread_t * p_event;
}; };
......
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