Commit f0ec49da authored by Sam Hocevar's avatar Sam Hocevar

* ./modules/misc/gtk_main.c: created the gtk_main module, which simply runs

    gtk_main() in its own thread, and does nothing on subsequent calls. This
    ensures that gtk_main is only running once.
  * ./modules/gui/familiar/*, modules/gui/gtk/*: the familiar, gtk and gnome
    modules are now fully reentrant thanks to their use of the gtk_main module.
  * ./src/libvlc.c: implemented vlc_set(), a wrapper for config_Put* available
    to external programs.
  * ./src/libvlc.c: removed vlc_stop() and vlc_end(), everything is now done
    by vlc_destroy().
  * ./modules/control/rc/rc.c: implemented a few new functions. For instance,
    run "vlc -I rc" and then type "intf gtk" or "intf gnome". You can even
    launch several of them. "segfault" works, too.
parent a890c0ee
......@@ -72,6 +72,7 @@ ffmpeg_CFLAGS = @ffmpeg_CFLAGS@
glide_CFLAGS = @glide_CFLAGS@
gnome_CFLAGS = @gnome_CFLAGS@
gtk_CFLAGS = @gtk_CFLAGS@
gtk_main_CFLAGS = @gtk_main_CFLAGS@
idctaltivec_CFLAGS = @idctaltivec_CFLAGS@
kde_CFLAGS = @kde_CFLAGS@
mad_CFLAGS = @mad_CFLAGS@
......@@ -113,6 +114,7 @@ ggi_LDFLAGS = @ggi_LDFLAGS@
glide_LDFLAGS = @glide_LDFLAGS@
gnome_LDFLAGS = @gnome_LDFLAGS@
gtk_LDFLAGS = @gtk_LDFLAGS@
gtk_main_LDFLAGS = @gtk_main_LDFLAGS@
http_LDFLAGS = @http_LDFLAGS@
idctaltivec_LDFLAGS = @idctaltivec_LDFLAGS@
imdct_LDFLAGS = @imdct_LDFLAGS@
......
This diff is collapsed.
......@@ -260,6 +260,9 @@ if test "x${x_libraries}" = "xNONE"; then
x_libraries="/usr/X11R6/lib"
fi
dnl Build the gtk_main plugin?
NEED_GTK_MAIN=no
dnl Check for DPMS
if test "x${SYS}" != "xmingw32"
then
......@@ -437,7 +440,7 @@ dnl
dnl default modules
dnl
BUILTINS="${BUILTINS}"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null/null"
PLUGINS="${PLUGINS} misc/dummy/dummy misc/null"
PLUGINS="${PLUGINS} control/rc/rc misc/logger/logger access/file misc/memcpy/memcpy"
PLUGINS="${PLUGINS} demux/mpeg/es demux/mpeg/audio demux/mpeg/mpeg_system demux/mpeg/ps demux/mpeg/ts"
PLUGINS="${PLUGINS} codec/mpeg_video/idct/idct codec/mpeg_video/idct/idctclassic codec/mpeg_video/motion/motion codec/mpeg_video/mpeg_video codec/spudec/spudec codec/spdif codec/mpeg_audio/mpeg_audio"
......@@ -1594,8 +1597,8 @@ then
then
AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-gtk.])
fi
gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk`"
gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
gtk_CFLAGS="${gtk_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
gtk_LDFLAGS="${gtk_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
# now look for the gtk.h header
CPPFLAGS="${save_CPPFLAGS} ${gtk_CFLAGS}"
ac_cv_gtk_headers=yes
......@@ -1606,6 +1609,7 @@ then
if test "x${ac_cv_gtk_headers}" = "xyes"
then
PLUGINS="${PLUGINS} gui/gtk/gtk"
NEED_GTK_MAIN=yes
ALIASES="${ALIASES} gvlc"
fi
CPPFLAGS="${save_CPPFLAGS}"
......@@ -1639,8 +1643,8 @@ then
then
AC_MSG_ERROR([Your development package for Gtk+ is too old, you need at least version 1.2.0. Please upgrade and try again. Alternatively you can also configure with --disable-familiar.])
fi
familiar_CFLAGS="${familiar_CFLAGS} `${GTK_CONFIG} --cflags gtk`"
familiar_LDFLAGS="${familiar_LDFLAGS} `${GTK_CONFIG} --libs gtk | sed 's,-rdynamic,,'`"
familiar_CFLAGS="${familiar_CFLAGS} `${GTK_CONFIG} --cflags gtk gthread`"
familiar_LDFLAGS="${familiar_LDFLAGS} `${GTK_CONFIG} --libs gtk gthread | sed 's,-rdynamic,,'`"
# now look for the gtk.h header
CPPFLAGS="${save_CPPFLAGS} ${familiar_CFLAGS}"
ac_cv_gtk_headers=yes
......@@ -1651,6 +1655,7 @@ then
if test "x${ac_cv_gtk_headers}" = "xyes"
then
PLUGINS="${PLUGINS} gui/familiar/familiar"
NEED_GTK_MAIN=yes
fi
CPPFLAGS="${save_CPPFLAGS}"
fi
......@@ -1673,6 +1678,7 @@ AC_ARG_ENABLE(gnome,
CPPFLAGS="${save_CPPFLAGS} ${gnome_CFLAGS}"
AC_CHECK_HEADERS(gnome.h, [
PLUGINS="${PLUGINS} gui/gtk/gnome"
NEED_GTK_MAIN=yes
ALIASES="${ALIASES} gnome-vlc"
],[
AC_MSG_ERROR([Can't find gnome headers. Please install the gnome
......@@ -1966,6 +1972,16 @@ then
fi
fi
dnl
dnl gtk_main plugin
dnl
if test "x${NEED_GTK_MAIN}" != "xno"
then
PLUGINS="${PLUGINS} misc/gtk_main"
gtk_main_CFLAGS="${gtk_main_CFLAGS} ${gtk_CFLAGS} ${familiar_CFLAGS} ${gnome_CFLAGS}"
gtk_main_LDFLAGS="${gtk_main_LDFLAGS} ${gtk_LDFLAGS} ${familiar_LDFLAGS} ${gnome_LDFLAGS}"
fi
dnl
dnl Plug-ins - this must be AT THE END
dnl
......@@ -2064,6 +2080,7 @@ AC_SUBST(ffmpeg_CFLAGS)
AC_SUBST(glide_CFLAGS)
AC_SUBST(gnome_CFLAGS)
AC_SUBST(gtk_CFLAGS)
AC_SUBST(gtk_main_CFLAGS)
AC_SUBST(kde_CFLAGS)
AC_SUBST(idctaltivec_CFLAGS)
AC_SUBST(macosx_CFLAGS)
......@@ -2104,6 +2121,7 @@ AC_SUBST(ggi_LDFLAGS)
AC_SUBST(glide_LDFLAGS)
AC_SUBST(gnome_LDFLAGS)
AC_SUBST(gtk_LDFLAGS)
AC_SUBST(gtk_main_LDFLAGS)
AC_SUBST(http_LDFLAGS)
AC_SUBST(idctaltivec_LDFLAGS)
AC_SUBST(imdct_LDFLAGS)
......
......@@ -11,7 +11,7 @@ export DH_COMPAT=3
# Compilation options
export FFMPEG_VERSION=cvs
export FAAD_VERSION=cvs
export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-fb --enable-ggi --enable-sdl --enable-esd --enable-qt --enable-mad --enable-arts --enable-alsa --enable-lirc --enable-a52 --enable-aa --enable-dvbpsi --enable-xosd --enable-mozilla --enable-kde --enable-ffmpeg --with-ffmpeg-tree=ffmpeg-$(FFMPEG_VERSION) --enable-mp4 --enable-dvb --enable-dv --enable-faad --with-faad-tree=faad-$(FAAD_VERSION)"
export CONFIG_FLAGS="--enable-release --prefix=/usr --enable-gnome --enable-gtk --enable-familiar --enable-fb --enable-ggi --enable-sdl --enable-esd --enable-qt --enable-mad --enable-arts --enable-alsa --enable-lirc --enable-a52 --enable-aa --enable-dvbpsi --enable-xosd --enable-mozilla --enable-kde --enable-ffmpeg --with-ffmpeg-tree=ffmpeg-$(FFMPEG_VERSION) --enable-mp4 --enable-dvb --enable-dv --enable-faad --with-faad-tree=faad-$(FAAD_VERSION)"
# Remove --without-dvdcss here in non-totalitarian countries
export DVDCSS_FLAGS="--enable-dvd --without-dvdcss"
......@@ -78,7 +78,7 @@ install: build
# Package: gnome-vlc
mv debian/vlc/usr/bin/gnome-vlc debian/gnome-vlc/usr/bin/
ln -s vlc debian/gnome-vlc/usr/share/doc/gnome-vlc
-mv debian/vlc/usr/lib/vlc/gui/gnome.so debian/gnome-vlc/usr/lib/vlc/gui/
mv debian/vlc/usr/lib/vlc/gui/gnome.so debian/gnome-vlc/usr/lib/vlc/gui/
ln -s vlc.1.gz debian/gnome-vlc/usr/share/man/man1/gnome-vlc.1.gz
mv debian/vlc/$(VIDDIR)/gnome-vlc32x32.xpm debian/gnome-vlc/$(VIDDIR)/gnome-vlc.xpm
mv debian/vlc/$(VIDDIR)/gnome-vlc48x48.png debian/gnome-vlc/$(PIXDIR)/gnome-vlc.png
......@@ -86,71 +86,72 @@ install: build
# Package: gvlc
mv debian/vlc/usr/bin/gvlc debian/gvlc/usr/bin/
ln -s vlc debian/gvlc/usr/share/doc/gvlc
-mv debian/vlc/usr/lib/vlc/gui/gtk.so debian/gvlc/usr/lib/vlc/gui/
mv debian/vlc/usr/lib/vlc/gui/gtk.so debian/gvlc/usr/lib/vlc/gui/
mv debian/vlc/usr/lib/vlc/gui/familiar.so debian/gvlc/usr/lib/vlc/gui/
ln -s vlc.1.gz debian/gvlc/usr/share/man/man1/gvlc.1.gz
mv debian/vlc/$(VIDDIR)/gvlc32x32.xpm debian/gvlc/$(VIDDIR)/gvlc.xpm
mv debian/vlc/$(VIDDIR)/gvlc48x48.png debian/gvlc/$(PIXDIR)/gvlc.png
# Package: vlc-plugin-esd
ln -s vlc debian/vlc-plugin-esd/usr/share/doc/vlc-plugin-esd
-mv debian/vlc/usr/lib/vlc/audio_output/esd.so \
mv debian/vlc/usr/lib/vlc/audio_output/esd.so \
debian/vlc-plugin-esd/usr/lib/vlc/audio_output/
# Package: vlc-plugin-alsa
ln -s vlc debian/vlc-plugin-alsa/usr/share/doc/vlc-plugin-alsa
-mv debian/vlc/usr/lib/vlc/audio_output/alsa.so \
mv debian/vlc/usr/lib/vlc/audio_output/alsa.so \
debian/vlc-plugin-alsa/usr/lib/vlc/audio_output/
# Package: vlc-plugin-sdl
ln -s vlc debian/vlc-plugin-sdl/usr/share/doc/vlc-plugin-sdl
-mv debian/vlc/usr/lib/vlc/audio_output/sdl.so \
mv debian/vlc/usr/lib/vlc/audio_output/sdl.so \
debian/vlc-plugin-sdl/usr/lib/vlc/audio_output/
-mv debian/vlc/usr/lib/vlc/video_output/sdl.so \
mv debian/vlc/usr/lib/vlc/video_output/sdl.so \
debian/vlc-plugin-sdl/usr/lib/vlc/video_output/
# Package: vlc-plugin-ggi
ln -s vlc debian/vlc-plugin-ggi/usr/share/doc/vlc-plugin-ggi
-mv debian/vlc/usr/lib/vlc/video_output/ggi.so \
mv debian/vlc/usr/lib/vlc/video_output/ggi.so \
debian/vlc-plugin-ggi/usr/lib/vlc/video_output/
# Package: vlc-plugin-glide
ifeq ($(DEB_BUILD_ARCH),i386)
ln -s vlc debian/vlc-plugin-glide/usr/share/doc/vlc-plugin-glide
-mv debian/vlc/usr/lib/vlc/video_output/glide.so \
mv debian/vlc/usr/lib/vlc/video_output/glide.so \
debian/vlc-plugin-glide/usr/lib/vlc/video_output/
endif
# Package: qvlc
mv debian/vlc/usr/bin/qvlc debian/qvlc/usr/bin/
ln -s vlc debian/qvlc/usr/share/doc/qvlc
-mv debian/vlc/usr/lib/vlc/gui/qt.so debian/qvlc/usr/lib/vlc/gui/
mv debian/vlc/usr/lib/vlc/gui/qt.so debian/qvlc/usr/lib/vlc/gui/
ln -s vlc.1.gz debian/qvlc/usr/share/man/man1/qvlc.1.gz
mv debian/vlc/$(VIDDIR)/qvlc32x32.xpm debian/qvlc/$(VIDDIR)/qvlc.xpm
mv debian/vlc/$(VIDDIR)/qvlc48x48.png debian/qvlc/$(PIXDIR)/qvlc.png
# Package: vlc-plugin-mad
ln -s vlc debian/vlc-plugin-mad/usr/share/doc/vlc-plugin-mad
-mv debian/vlc/usr/lib/vlc/codec/mad.so \
mv debian/vlc/usr/lib/vlc/codec/mad.so \
debian/vlc-plugin-mad/usr/lib/vlc/codec/
# Package: vlc-plugin-arts
ln -s vlc debian/vlc-plugin-arts/usr/share/doc/vlc-plugin-arts
-mv debian/vlc/usr/lib/vlc/audio_output/arts.so \
mv debian/vlc/usr/lib/vlc/audio_output/arts.so \
debian/vlc-plugin-arts/usr/lib/vlc/audio_output/
# Package: vlc-plugin-lirc
ln -s vlc debian/vlc-plugin-lirc/usr/share/doc/vlc-plugin-lirc
-mv debian/vlc/usr/lib/vlc/control/lirc.so \
mv debian/vlc/usr/lib/vlc/control/lirc.so \
debian/vlc-plugin-lirc/usr/lib/vlc/control/
# Package: vlc-plugin-aa
ln -s vlc debian/vlc-plugin-aa/usr/share/doc/vlc-plugin-aa
-mv debian/vlc/usr/lib/vlc/video_output/aa.so \
mv debian/vlc/usr/lib/vlc/video_output/aa.so \
debian/vlc-plugin-aa/usr/lib/vlc/video_output/
# Package: vlc-plugin-xosd
ln -s vlc debian/vlc-plugin-xosd/usr/share/doc/vlc-plugin-xosd
-mv debian/vlc/usr/lib/vlc/visualization/xosd.so \
mv debian/vlc/usr/lib/vlc/visualization/xosd.so \
debian/vlc-plugin-xosd/usr/lib/vlc/visualization/
# Package: mozilla-plugin-vlc
......@@ -160,7 +161,7 @@ endif
# Package: kvlc
mv debian/vlc/usr/bin/kvlc debian/kvlc/usr/bin/
ln -s vlc debian/kvlc/usr/share/doc/kvlc
-mv debian/vlc/usr/lib/vlc/gui/kde.so debian/kvlc/usr/lib/vlc/gui/
mv debian/vlc/usr/lib/vlc/gui/kde.so debian/kvlc/usr/lib/vlc/gui/
ln -s vlc.1.gz debian/kvlc/usr/share/man/man1/kvlc.1.gz
mv debian/vlc/$(VIDDIR)/kvlc32x32.xpm debian/kvlc/$(VIDDIR)/kvlc.xpm
mv debian/vlc/$(VIDDIR)/kvlc48x48.png debian/kvlc/$(PIXDIR)/kvlc.png
......
......@@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: main.h,v 1.44 2002/08/12 09:34:15 sam Exp $
* $Id: main.h,v 1.45 2002/08/20 18:08:51 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -38,6 +38,7 @@ struct vlc_t
/* The vlc structure status */
int i_status;
int i_instance; /* p_vlc instance # */
/* Global properties */
int i_argc; /* command line arguments count */
......@@ -72,7 +73,6 @@ struct vlc_t
vlc_mutex_t structure_lock; /* lock for the p_vlc tree */
/* Object structure data */
int i_unique; /* p_vlc occurence # */
int i_counter; /* object counter */
int i_objects; /* Attached objects count */
vlc_object_t ** pp_objects; /* Array of all objects */
......
......@@ -2,7 +2,7 @@
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.9 2002/08/19 11:13:44 sam Exp $
* $Id: vlc.h,v 1.10 2002/08/20 18:08:51 sam Exp $
*
* 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
......@@ -41,10 +41,12 @@ typedef int vlc_status_t;
* Error values
*****************************************************************************/
#define VLC_SUCCESS -0 /* No error */
#define VLC_EGENERIC -1 /* Generic error */
#define VLC_ENOMEM -2 /* Not enough memory */
#define VLC_ENOMEM -1 /* Not enough memory */
#define VLC_EMODULE -2 /* Module not found */
#define VLC_ESTATUS -3 /* Invalid status */
#define VLC_ETHREAD -4 /* Could not spawn thread */
#define VLC_EEXIT -255 /* Program exited */
#define VLC_EGENERIC -666 /* Generic error */
/*****************************************************************************
* Booleans
......@@ -115,10 +117,9 @@ vlc_error_t vlc_create ( void );
vlc_error_t vlc_init ( int, char *[] );
vlc_error_t vlc_run ( void );
vlc_error_t vlc_die ( void );
vlc_error_t vlc_stop ( void );
vlc_error_t vlc_end ( void );
vlc_error_t vlc_destroy ( void );
vlc_error_t vlc_set ( const char *, const char * );
vlc_error_t vlc_add_intf ( const char *, vlc_bool_t );
vlc_error_t vlc_add_target ( const char *, int, int );
......@@ -131,10 +132,9 @@ vlc_t * vlc_create_r ( void );
vlc_error_t vlc_init_r ( vlc_t *, int, char *[] );
vlc_error_t vlc_run_r ( vlc_t * );
vlc_error_t vlc_die_r ( vlc_t * );
vlc_error_t vlc_stop_r ( vlc_t * );
vlc_error_t vlc_end_r ( vlc_t * );
vlc_error_t vlc_destroy_r ( vlc_t * );
vlc_error_t vlc_set_r ( vlc_t *, const char *, const char * );
vlc_error_t vlc_add_intf_r ( vlc_t *, const char *, vlc_bool_t );
vlc_error_t vlc_add_target_r ( vlc_t *, const char *, int, int );
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.5 2002/08/20 12:32:01 sam Exp $
* $Id: familiar.c,v 1.6 2002/08/20 18:08:51 sam Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -39,54 +39,6 @@
#include "support.h"
#include "familiar.h"
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
/*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gtk+
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
intf_thread_t *p_intf;
int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_intf = (intf_thread_t *)*pp_global_data;
if( p_intf == NULL )
{
return;
}
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
msg_Err( p_intf, "too many atexit() callbacks to register" );
return;
}
p_intf->p_sys->pf_callback[i_dummy] = func;
p_intf->p_sys->pf_callback[i_dummy + 1] = NULL;
}
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
......@@ -94,7 +46,6 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static gint Manage ( gpointer );
/*****************************************************************************
* Module descriptor
......@@ -117,7 +68,14 @@ static int Open( vlc_object_t *p_this )
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
return( 1 );
return VLC_ENOMEM;
}
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
return VLC_EMODULE;
}
/* Initialize Gtk+ thread */
......@@ -127,7 +85,7 @@ static int Open( vlc_object_t *p_this )
p_intf->pf_run = Run;
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -142,8 +100,10 @@ static void Close( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input );
}
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
/* Destroy structure */
if (p_intf->p_sys) free( p_intf->p_sys );
free( p_intf->p_sys );
}
/*****************************************************************************
......@@ -151,27 +111,10 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* gtk_main() from within it without annoying the rest of the program.
* XXX: the approach may look kludgy, and probably is, but I could not find
* a better way to dynamically load a Gtk+ interface at runtime.
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
char **pp_args = p_args;
int i_args = 1;
int i_dummy;
/* Initialize Gtk+ */
gtk_set_locale ();
/* gtk_init will register stuff with g_atexit, so we need to take
* the global lock if we want to be able to intercept the calls */
vlc_mutex_lock( p_intf->p_vlc->p_global_lock );
*p_intf->p_vlc->pp_global_data = p_intf;
gtk_init( &i_args, &pp_args );
vlc_mutex_unlock( p_intf->p_vlc->p_global_lock );
gdk_threads_enter();
/* Create some useful widgets that will certainly be used */
// FIXME: magic path
......@@ -203,30 +146,17 @@ static void Run( intf_thread_t *p_intf )
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
/* Add a check for termination */
i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, Manage, p_intf );
/* Enter Gtk mode */
gtk_main();
/* Remove the timeout */
gtk_timeout_remove( i_dummy );
}
/*****************************************************************************
* Manage: check for termination
*****************************************************************************
* In this function, called approx. 10 times a second, we check whether the
* main program asked us to die by setting b_die to VLC_TRUE.
*****************************************************************************/
static gint Manage( gpointer p_data )
{
if( ((intf_thread_t *)p_data)->b_die )
/* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */
while( !p_intf->b_die )
{
gtk_main_quit();
return FALSE;
gdk_threads_leave();
msleep( INTF_IDLE_SLEEP );
gdk_threads_enter();
}
return TRUE;
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
gdk_threads_leave();
}
......@@ -2,7 +2,7 @@
* familiar.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.4 2002/08/18 20:36:04 jpsaman Exp $
* $Id: familiar.h,v 1.5 2002/08/20 18:08:51 sam Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -28,6 +28,9 @@
*****************************************************************************/
struct intf_sys_t
{
/* The gtk_main module */
module_t * p_gtk_main;
/* windows and widgets */
GtkWidget * p_window; /* main window */
GtkNotebook * p_notebook;
......@@ -39,9 +42,6 @@ struct intf_sys_t
vlc_bool_t b_autoplayfile;
/* The input thread */
input_thread_t * p_input;
/* XXX: Ugly kludge, see gtk.c */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
};
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* gtk_common.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: common.h,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: common.h,v 1.2 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -35,6 +35,9 @@
*****************************************************************************/
struct intf_sys_t
{
/* the gtk_main module */
module_t * p_gtk_main;
/* special actions */
vlc_bool_t b_playing;
vlc_bool_t b_popup_changed; /* display menu ? */
......@@ -82,9 +85,6 @@ struct intf_sys_t
GtkLabel * p_label_title;
GtkLabel * p_label_chapter;
gint i_part; /* current chapter */
/* XXX: Ugly kludge, see gtk.c */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
};
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* gnome.c : Gnome plugin for vlc
*****************************************************************************
* Copyright (C) 2000 VideoLAN
* $Id: gnome.c,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: gnome.c,v 1.2 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -47,12 +47,7 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static gint Manage ( gpointer );
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
static void Manage ( intf_thread_t * );
/*****************************************************************************
* Module descriptor
......@@ -74,9 +69,7 @@ vlc_module_begin();
#else
int i = getenv( "DISPLAY" ) == NULL ? 15 : 100;
#endif
pp_global_data = p_module->p_vlc->pp_global_data;
add_category_hint( N_("Miscellaneous"), NULL );
add_category_hint( N_("GNOME"), NULL );
add_bool( "gnome-tooltips", 1, GtkHideTooltips,
TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT );
add_bool( "gnome-toolbartext", 1, GtkHideToolbarText, TOOLBAR_TEXT,
......@@ -90,49 +83,6 @@ vlc_module_begin();
set_program( "gnome-vlc" );
vlc_module_end();
/*****************************************************************************
* g_atexit: kludge to avoid the Gnome thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gnome
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
intf_thread_t *p_intf;
int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_intf = (intf_thread_t *)*pp_global_data;
if( p_intf == NULL )
{
return;
}
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
msg_Err( p_intf, "too many atexit() callbacks to register" );
return;
}
p_intf->p_sys->pf_callback[i_dummy] = func;
p_intf->p_sys->pf_callback[i_dummy + 1] = NULL;
}
/*****************************************************************************
* Open: initialize and create window
*****************************************************************************/
......@@ -145,7 +95,14 @@ static int Open( vlc_object_t *p_this )
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
return( 1 );
return VLC_ENOMEM;
}
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gnome" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
return VLC_EMODULE;
}
p_intf->pf_run = Run;
......@@ -162,11 +119,9 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->i_playing = -1;
p_intf->p_sys->b_slider_free = 1;
p_intf->p_sys->pf_callback[0] = NULL;
p_intf->p_sys->i_part = 0;
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -183,6 +138,8 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
/* Destroy structure */
free( p_intf->p_sys );
}
......@@ -197,12 +154,6 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
/* gnome_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
int i_args = 1;
int i_dummy;
/* The data types we are allowed to receive */
static GtkTargetEntry target_table[] =
{
......@@ -211,20 +162,14 @@ static void Run( intf_thread_t *p_intf )
{ "text/plain", 0, DROP_ACCEPT_TEXT_PLAIN }
};
/* Initialize Gnome */
/* gnome_init will register stuff with g_atexit, so we need to take
* the global lock if we want to be able to intercept the calls */
vlc_mutex_lock( p_intf->p_vlc->p_global_lock );
*p_intf->p_vlc->pp_global_data = p_intf;
gnome_init( p_intf->p_vlc->psz_object_name, VERSION, i_args, p_args );
vlc_mutex_unlock( p_intf->p_vlc->p_global_lock );
gdk_threads_enter();
/* Create some useful widgets that will certainly be used */
p_intf->p_sys->p_window = create_intf_window( );
p_intf->p_sys->p_popup = create_intf_popup( );
p_intf->p_sys->p_playwin = create_intf_playlist();
p_intf->p_sys->p_messages = create_intf_messages();
p_intf->p_sys->p_tooltips = gtk_tooltips_new();
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
......@@ -267,8 +212,6 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->f_adj_oldvalue = 0;
#undef P_SLIDER
p_intf->p_sys->p_tooltips = gtk_tooltips_new();
/* We don't create these ones yet because we perhaps won't need them */
p_intf->p_sys->p_about = NULL;
p_intf->p_sys->p_modules = NULL;
......@@ -308,26 +251,25 @@ static void Run( intf_thread_t *p_intf )
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
/* Sleep to avoid using all CPU - since some interfaces needs to access
* keyboard events, a 100ms delay is a good compromise */
i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, Manage, p_intf );
/* Enter gnome mode */
gtk_main();
while( !p_intf->b_die )
{
Manage( p_intf );
/* Remove the timeout */
gtk_timeout_remove( i_dummy );
/* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */
gdk_threads_leave();
msleep( INTF_IDLE_SLEEP );
gdk_threads_enter();
}
/* Destroy the Tooltips structure */
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_tooltips) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_messages) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_playwin) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_popup) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
/* Get rid of stored callbacks so we can unload the plugin */
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
p_intf->p_sys->pf_callback[i_dummy]();
}
gdk_threads_leave();
}
/* following functions are local */
......@@ -338,9 +280,8 @@ static void Run( intf_thread_t *p_intf )
* In this function, called approx. 10 times a second, we check what the
* main program wanted to tell us.
*****************************************************************************/
static gint Manage( gpointer p_data )
static void Manage( intf_thread_t *p_intf )
{
#define p_intf ((intf_thread_t *)p_data)
int i_start, i_stop;
vlc_mutex_lock( &p_intf->change_lock );
......@@ -492,21 +433,8 @@ static gint Manage( gpointer p_data )
p_intf->p_sys->b_playing = 0;
}
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
/* Prepare to die, young Skywalker */
gtk_main_quit();
/* Just in case */
return( FALSE );
}
vlc_mutex_unlock( &p_intf->change_lock );
return( TRUE );
#undef p_intf
return;
}
......@@ -2,7 +2,7 @@
* gtk.c : Gtk+ plugin for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: gtk.c,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: gtk.c,v 1.2 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -49,12 +49,7 @@ static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * );
static gint Manage ( gpointer );
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
static void Manage ( intf_thread_t * );
/*****************************************************************************
* Module descriptor
......@@ -73,9 +68,7 @@ vlc_module_begin();
#else
int i = getenv( "DISPLAY" ) == NULL ? 10 : 90;
#endif
pp_global_data = p_module->p_vlc->pp_global_data;
add_category_hint( N_("Miscellaneous"), NULL );
add_category_hint( N_("Gtk+"), NULL );
add_bool( "gtk-tooltips", 1, GtkHideTooltips,
TOOLTIPS_TEXT, TOOLTIPS_LONGTEXT );
add_integer( "gtk-prefs-maxh", 480, NULL,
......@@ -87,49 +80,6 @@ vlc_module_begin();
set_program( "gvlc" );
vlc_module_end();
/*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gtk+
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
intf_thread_t *p_intf;
int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_intf = (intf_thread_t *)*pp_global_data;
if( p_intf == NULL )
{
return;
}
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
msg_Err( p_intf, "too many atexit() callbacks to register" );
return;
}
p_intf->p_sys->pf_callback[i_dummy] = func;
p_intf->p_sys->pf_callback[i_dummy + 1] = NULL;
}
/*****************************************************************************
* Open: initialize and create window
*****************************************************************************/
......@@ -142,7 +92,14 @@ static int Open( vlc_object_t *p_this )
if( p_intf->p_sys == NULL )
{
msg_Err( p_intf, "out of memory" );
return( 1 );
return VLC_ENOMEM;
}
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gtk_main", "gtk" );
if( p_intf->p_sys->p_gtk_main == NULL )
{
free( p_intf->p_sys );
return VLC_EMODULE;
}
p_intf->pf_run = Run;
......@@ -159,11 +116,9 @@ static int Open( vlc_object_t *p_this )
p_intf->p_sys->i_playing = -1;
p_intf->p_sys->b_slider_free = 1;
p_intf->p_sys->pf_callback[0] = NULL;
p_intf->p_sys->i_part = 0;
return( 0 );
return VLC_SUCCESS;
}
/*****************************************************************************
......@@ -180,6 +135,8 @@ static void Close( vlc_object_t *p_this )
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
/* Destroy structure */
free( p_intf->p_sys );
}
......@@ -189,18 +146,9 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* gtk_main() from within it without annoying the rest of the program.
* XXX: the approach may look kludgy, and probably is, but I could not find
* a better way to dynamically load a Gtk+ interface at runtime.
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "" };
char **pp_args = p_args;
int i_args = 1;
int i_dummy;
/* The data types we are allowed to receive */
static GtkTargetEntry target_table[] =
{
......@@ -209,14 +157,7 @@ static void Run( intf_thread_t *p_intf )
{ "text/plain", 0, DROP_ACCEPT_TEXT_PLAIN }
};
/* Initialize Gtk+ */
/* gtk_init will register stuff with g_atexit, so we need to take
* the global lock if we want to be able to intercept the calls */
vlc_mutex_lock( p_intf->p_vlc->p_global_lock );
*p_intf->p_vlc->pp_global_data = p_intf;
gtk_init( &i_args, &pp_args );
vlc_mutex_unlock( p_intf->p_vlc->p_global_lock );
gdk_threads_enter();
/* Create some useful widgets that will certainly be used */
p_intf->p_sys->p_window = create_intf_window();
......@@ -298,26 +239,25 @@ static void Run( intf_thread_t *p_intf )
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
/* Sleep to avoid using all CPU - since some interfaces needs to access
* keyboard events, a 100ms delay is a good compromise */
i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, Manage, p_intf );
/* Enter Gtk mode */
gtk_main();
while( !p_intf->b_die )
{
Manage( p_intf );
/* Remove the timeout */
gtk_timeout_remove( i_dummy );
/* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */
gdk_threads_leave();
msleep( INTF_IDLE_SLEEP );
gdk_threads_enter();
}
/* Destroy the Tooltips structure */
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_tooltips) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_messages) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_playwin) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_popup) );
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
/* Launch stored callbacks */
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_intf->p_sys->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
p_intf->p_sys->pf_callback[i_dummy]();
}
gdk_threads_leave();
}
/* following functions are local */
......@@ -328,9 +268,8 @@ static void Run( intf_thread_t *p_intf )
* In this function, called approx. 10 times a second, we check what the
* main program wanted to tell us.
*****************************************************************************/
static gint Manage( gpointer p_data )
static void Manage( intf_thread_t *p_intf )
{
#define p_intf ((intf_thread_t *)p_data)
int i_start, i_stop;
vlc_mutex_lock( &p_intf->change_lock );
......@@ -394,7 +333,7 @@ static gint Manage( gpointer p_data )
}
/* Update the playlist */
GtkPlayListManage( p_data );
GtkPlayListManage( p_intf );
/* Update the input */
if( p_intf->p_sys->p_input == NULL )
......@@ -475,20 +414,5 @@ static gint Manage( gpointer p_data )
p_intf->p_sys->b_playing = 0;
}
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
/* Prepare to die, young Skywalker */
gtk_main_quit();
/* Just in case */
return( FALSE );
}
vlc_mutex_unlock( &p_intf->change_lock );
return( TRUE );
#undef p_intf
}
null_SOURCES = null.c
gtk_main_SOURCES = gtk_main.c
/*****************************************************************************
* gtk_main.c : Gtk+ wrapper for gtk_main
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: gtk_main.c,v 1.1 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.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
* 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
*****************************************************************************/
#include <vlc/vlc.h>
#include <stdlib.h> /* atexit() */
#include <gtk/gtk.h>
#ifdef HAVE_GNOME_H
# include <gnome.h>
#endif
/*****************************************************************************
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
static void GtkMain ( vlc_object_t * );
/*****************************************************************************
* The gtk_main_t object.
*****************************************************************************/
#define MAX_ATEXIT 10
typedef struct gtk_main_t
{
VLC_COMMON_MEMBERS
/* XXX: Ugly kludge, see g_atexit */
void ( *pf_callback[MAX_ATEXIT] ) ( void );
} gtk_main_t;
/*****************************************************************************
* Local variables (mutex-protected).
*****************************************************************************/
static void ** pp_global_data = NULL;
static int i_refcount = 0;
static gtk_main_t * p_gtk_main = NULL;
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
pp_global_data = p_module->p_vlc->pp_global_data;
set_description( _("Gtk+ helper module") );
set_capability( "gtk_main", 100 );
add_shortcut( "gtk" );
#ifdef HAVE_GNOME_H
add_shortcut( "gnome" );
#endif
set_callbacks( Open, Close );
vlc_module_end();
/*****************************************************************************
* g_atexit: kludge to avoid the Gtk+ thread to segfault at exit
*****************************************************************************
* gtk_init() makes several calls to g_atexit() which calls atexit() to
* register tidying callbacks to be called at program exit. Since the Gtk+
* plugin is likely to be unloaded at program exit, we have to export this
* symbol to intercept the g_atexit() calls. Talk about crude hack.
*****************************************************************************/
void g_atexit( GVoidFunc func )
{
gtk_main_t *p_this;
int i_dummy;
if( pp_global_data == NULL )
{
atexit( func );
return;
}
p_this = (gtk_main_t *)*pp_global_data;
if( p_this == NULL )
{
/* Looks like this atexit() call wasn't for us. */
return;
}
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_this->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
;
}
if( i_dummy >= MAX_ATEXIT - 1 )
{
msg_Err( p_this, "too many atexit() callbacks to register" );
return;
}
p_this->pf_callback[i_dummy] = func;
p_this->pf_callback[i_dummy + 1] = NULL;
}
/*****************************************************************************
* Open: initialize and create window
*****************************************************************************/
static int Open( vlc_object_t *p_this )
{
/* Initialize Gtk+ */
vlc_mutex_lock( p_this->p_vlc->p_global_lock );
if( i_refcount > 0 )
{
i_refcount++;
vlc_mutex_unlock( p_this->p_vlc->p_global_lock );
return VLC_SUCCESS;
}
p_gtk_main = vlc_object_create( p_this, sizeof(gtk_main_t) );
p_gtk_main->pf_callback[0] = NULL;
/* Only initialize gthreads if it's the first time we do it */
if( !g_thread_supported() )
{
g_thread_init( NULL );
}
/* 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_gtk_main, "gtk_main", GtkMain, VLC_TRUE ) )
{
vlc_object_destroy( p_gtk_main );
i_refcount--;
vlc_mutex_unlock( p_this->p_vlc->p_global_lock );
return VLC_ETHREAD;
}
i_refcount++;
vlc_mutex_unlock( p_this->p_vlc->p_global_lock );
return VLC_SUCCESS;
}
/*****************************************************************************
* Close: destroy interface window
*****************************************************************************/
static void Close( vlc_object_t *p_this )
{
int i_dummy;
vlc_mutex_lock( p_this->p_vlc->p_global_lock );
i_refcount--;
if( i_refcount > 0 )
{
vlc_mutex_unlock( p_this->p_vlc->p_global_lock );
return;
}
gtk_main_quit();
vlc_thread_join( p_gtk_main );
/* Launch stored callbacks */
for( i_dummy = 0;
i_dummy < MAX_ATEXIT && p_gtk_main->pf_callback[i_dummy] != NULL;
i_dummy++ )
{
p_gtk_main->pf_callback[i_dummy]();
}
vlc_object_destroy( p_gtk_main );
p_gtk_main = NULL;
vlc_mutex_unlock( p_this->p_vlc->p_global_lock );
}
static gint foo(gpointer foo)
{
return TRUE;
}
/*****************************************************************************
* GtkMain: Gtk+ thread
*****************************************************************************
* this part of the interface is in a separate thread so that we can call
* gtk_main() from within it without annoying the rest of the program.
*****************************************************************************/
static void GtkMain( vlc_object_t *p_this )
{
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
static char *p_args[] = { "" };
static char **pp_args = p_args;
static int i_args = 1;
/* gtk_init will register stuff with g_atexit, so we need to have
* the global lock if we want to be able to intercept the calls */
*p_this->p_vlc->pp_global_data = p_gtk_main;
/* FIXME: deprecated ? */
/* gdk_threads_init(); */
#ifdef HAVE_GNOME_H
gnome_init( p_this->p_vlc->psz_object_name, VERSION, i_args, p_args );
#else
gtk_set_locale();
gtk_init( &i_args, &pp_args );
#endif
gdk_threads_enter();
vlc_thread_ready( p_this );
/* If we don't add this simple timeout, gtk_main remains stuck ... */
gtk_timeout_add( INTF_IDLE_SLEEP / 1000, foo, p_this );
/* Enter Gtk mode */
gtk_main();
gdk_threads_leave();
}
......@@ -2,7 +2,7 @@
* null.c : NULL module for vlc
*****************************************************************************
* Copyright (C) 2000-2001 VideoLAN
* $Id: null.c,v 1.1 2002/08/04 17:23:43 sam Exp $
* $Id: null.c,v 1.1 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......
......@@ -2,7 +2,7 @@
* vlcplugin.c: a VideoLAN Client plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcplugin.c,v 1.4 2002/08/08 22:28:23 sam Exp $
* $Id: vlcplugin.c,v 1.5 2002/08/20 18:08:51 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -137,10 +137,13 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
return NPERR_GENERIC_ERROR;
}
vlc_set_r( This->p_vlc, "vout", "xvideo,x11,dummy" );
vlc_set_r( This->p_vlc, "intf", "dummy" );
vlc_set_r( This->p_vlc, "audio", 0 );
i_ret = vlc_run_r( This->p_vlc );
if( i_ret )
{
vlc_end_r( This->p_vlc );
vlc_destroy_r( This->p_vlc );
This->p_vlc = NULL;
return NPERR_GENERIC_ERROR;
......@@ -159,7 +162,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
}
else
{
/*__config_PutPsz( This->psz_target, argn[i], argv[i] );*/
/*vlc_set_r( This->psz_target, argn[i], argv[i] );*/
}
}
......@@ -179,8 +182,6 @@ NPError NPP_Destroy( NPP instance, NPSavedData** save )
if( This->p_vlc != NULL )
{
vlc_stop_r( This->p_vlc );
vlc_end_r( This->p_vlc );
vlc_destroy_r( This->p_vlc );
This->p_vlc = NULL;
}
......@@ -211,8 +212,8 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
This = (PluginInstance*) instance->pdata;
__config_PutInt( This->p_vlc, "x11-drawable", window->window );
__config_PutInt( This->p_vlc, "xvideo-drawable", window->window );
vlc_set_r( This->p_vlc, "x11-drawable", window->window );
vlc_set_r( This->p_vlc, "xvideo-drawable", window->window );
/*
* PLUGIN DEVELOPERS:
* Before setting window to point to the
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* vlc.c: the vlc player
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vlc.c,v 1.9 2002/08/19 11:13:45 sam Exp $
* $Id: vlc.c,v 1.10 2002/08/20 18:08:51 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -103,13 +103,7 @@ int main( int i_argc, char *ppsz_argv[] )
/* Add a blocking interface and keep the return value */
err = vlc_add_intf( NULL, VLC_TRUE );
/* Finish the interface */
vlc_stop();
/* Finish all threads */
vlc_end();
/* Destroy the libvlc structure */
/* Finish the threads and destroy the libvlc structure */
vlc_destroy();
return err;
......
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