Commit 95967459 authored by Sam Hocevar's avatar Sam Hocevar

Beginning of Interface II

 ---------------------------

 * Plugins have completely disappeared, we now only use the new module API.
 * All intf and vout modules are now independant. So far, only the Gnome
   intf module and the SDL vout module have been ported. configure.in has
   been modified to reflect the changes (x11 and dummy aren't compiled by
   default anymore, while SDL and Gnome are).

  Note that this is _not_ Interface II, it's just a step forward. For
  instance, it lacks the whole message passing scheme.

  Things that should work:

 * Right-clicking on the SDL video output window brings the Gnome menu.
 * Pause, Play, Exit, About work from the menu or from the interface window.
 * The old SDL keys still work.

   Things that are broken or may be broken:

 * Xlib calls are not locked yet, which may lead to "Unexpected async reply"
   errors, and make the vlc segfault.
 * Sound only works for the first file.
 * The SDL vout_sdl.c file is absolutely ugly and kludgey.
 * The vlc immediately quits when no filename is given as an argument. Not
   a real bug, but still annoying.
 * The Gnome menu does not work in fullscreen mode.

   Things that will come soon, maybe tomorrow:

 * Complete navigation buttons (fast forward, slow, etc.).
 * File/Open menu to add files to the playlist.
 * Return of the X11 video output for those of us who do not have SDL.
 * Textmode interface for those of us who do not have Gnome.
 * aout and vout autospawn (maybe).
parent e4aec3d8
......@@ -185,6 +185,7 @@ INTERFACE = src/interface/main.o \
src/interface/intf_cmd.o \
src/interface/intf_ctrl.o \
src/interface/intf_plst.o \
src/interface/intf_channels.o \
src/interface/intf_console.o
INPUT = src/input/input_ext-dec.o \
......@@ -238,8 +239,7 @@ MISC = src/misc/mtime.o \
src/misc/tests.o \
src/misc/rsc_files.o \
src/misc/modules.o \
src/misc/netutils.o \
src/misc/plugins.o
src/misc/netutils.o
C_OBJ = $(INTERFACE) \
......@@ -314,7 +314,6 @@ PLUGIN_GGI = plugins/ggi/ggi.o \
plugins/ggi/vout_ggi.o
PLUGIN_SDL = plugins/sdl/sdl.o \
plugins/sdl/intf_sdl.o \
plugins/sdl/vout_sdl.o \
plugins/sdl/aout_sdl.o
......@@ -324,10 +323,9 @@ PLUGIN_GLIDE = plugins/glide/glide.o \
PLUGIN_GNOME = plugins/gnome/gnome.o \
plugins/gnome/intf_gnome.o \
plugins/gnome/intf_gnome_callbacks.o \
plugins/gnome/intf_gnome_interface.o \
plugins/gnome/intf_gnome_support.o \
plugins/gnome/vout_gnome.o
plugins/gnome/gnome_callbacks.o \
plugins/gnome/gnome_interface.o \
plugins/gnome/gnome_support.o
PLUGIN_MGA = plugins/mga/mga.o \
plugins/mga/intf_mga.o \
......
......@@ -22,7 +22,7 @@ ac_help="$ac_help
ac_help="$ac_help
--disable-optimizations Disable compiler optimizations (default enabled)"
ac_help="$ac_help
--disable-dummy dummy audio and video support (default enabled)"
--enable-dummy dummy audio and video support (default disabled)"
ac_help="$ac_help
--disable-null Null module (default enabled)"
ac_help="$ac_help
......@@ -34,13 +34,13 @@ ac_help="$ac_help
ac_help="$ac_help
--with-ggi[=name] GGI support (default disabled)"
ac_help="$ac_help
--with-sdl[=name] SDL support (default disabled)"
--with-sdl[=name] SDL support (default enabled)"
ac_help="$ac_help
--with-glide[=name] Glide (3dfx) support (default disabled)"
ac_help="$ac_help
--enable-gnome Gnome support (default disabled)"
--disable-gnome Gnome support (default enabled)"
ac_help="$ac_help
--disable-x11 X11 support (default enabled)"
--enable-x11 X11 support (default disabled)"
ac_help="$ac_help
--enable-alsa Alsa sound drivers support (Only for linux) (default disabled)"
......@@ -3419,10 +3419,9 @@ else
# Check whether --enable-dummy or --disable-dummy was given.
if test "${enable_dummy+set}" = set; then
enableval="$enable_dummy"
:
if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi
fi
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
# Check whether --enable-null or --disable-null was given.
if test "${enable_null+set}" = set; then
enableval="$enable_null"
......@@ -3473,6 +3472,11 @@ if test "${with_sdl+set}" = set; then
fi
fi
if test "x$withval" == "x";
then
PLUGINS=${PLUGINS}"sdl "
LIB_SDL="-lSDL"
fi
# Check whether --with-glide or --without-glide was given.
if test "${with_glide+set}" = set; then
withval="$with_glide"
......@@ -3488,32 +3492,33 @@ fi
# Check whether --enable-gnome or --disable-gnome was given.
if test "${enable_gnome+set}" = set; then
enableval="$enable_gnome"
if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
:
fi
if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
# Check whether --enable-x11 or --disable-x11 was given.
if test "${enable_x11+set}" = set; then
enableval="$enable_x11"
:
if test x$enable_x11 = xyes; then PLUGINS=${PLUGINS}"x11 "; fi
fi
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
# Check whether --enable-alsa or --disable-alsa was given.
if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa"
if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
echo "configure:3507: checking for sys/asoundlib.h" >&5
echo "configure:3512: checking for sys/asoundlib.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3512 "configure"
#line 3517 "configure"
#include "confdefs.h"
#include <sys/asoundlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3530,7 +3535,7 @@ fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
echo "configure:3534: checking for main in -lasound" >&5
echo "configure:3539: checking for main in -lasound" >&5
ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -3538,14 +3543,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lasound $LIBS"
cat > conftest.$ac_ext <<EOF
#line 3542 "configure"
#line 3547 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
if { (eval echo configure:3549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
......
......@@ -138,8 +138,8 @@ dnl default case
else
AC_ARG_ENABLE(dummy,
[ --disable-dummy dummy audio and video support (default enabled)])
if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
[ --enable-dummy dummy audio and video support (default disabled)],
[if test x$enable_dummy = xyes; then PLUGINS=${PLUGINS}"dummy "; fi])
AC_ARG_ENABLE(null,
[ --disable-null Null module (default enabled)])
if test x$enable_null != xno; then PLUGINS=${PLUGINS}"null "; fi
......@@ -162,7 +162,7 @@ AC_ARG_WITH(ggi,
LIB_GGI="-lggi"
fi ])
AC_ARG_WITH(sdl,
[ --with-sdl[=name] SDL support (default disabled)],
[ --with-sdl[=name] SDL support (default enabled)],
[ PLUGINS=${PLUGINS}"sdl ";
if test "x$withval" != "xyes";
then
......@@ -170,6 +170,11 @@ AC_ARG_WITH(sdl,
else
LIB_SDL="-lSDL"
fi ])
if test "x$withval" == "x";
then
PLUGINS=${PLUGINS}"sdl "
LIB_SDL="-lSDL"
fi
AC_ARG_WITH(glide,
[ --with-glide[=name] Glide (3dfx) support (default disabled)],
[ PLUGINS=${PLUGINS}"glide ";
......@@ -180,11 +185,12 @@ AC_ARG_WITH(glide,
LIB_GLIDE="-lglide2x"
fi ])
AC_ARG_ENABLE(gnome,
[ --enable-gnome Gnome support (default disabled)],
[if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi])
[ --disable-gnome Gnome support (default enabled)])
if test x$enable_gnome != xno; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
AC_ARG_ENABLE(x11,
[ --disable-x11 X11 support (default enabled)])
if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
[ --enable-x11 X11 support (default disabled)],
[if test x$enable_x11 = xyes; then PLUGINS=${PLUGINS}"x11 "; fi])
AC_ARG_ENABLE(alsa,
[ --enable-alsa Alsa sound drivers support (Only for linux) (default disabled)],
[if test x$enable_alsa = xyes; then AC_CHECK_HEADER(sys/asoundlib.h, AC_CHECK_LIB(asound, main, have_alsa="true", have_alsa="false"),have_alsa="false") if test $have_alsa = true; then PLUGINS=${PLUGINS}"alsa "; fi; fi])
......
......@@ -128,6 +128,9 @@
* Interface configuration
*****************************************************************************/
/* Environment variable containing the display method */
#define INTF_METHOD_VAR "vlc_intf"
/* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlcrc"
#define INTF_INIT_SCRIPT_DEFAULT ".vlcrc"
......
......@@ -43,11 +43,6 @@
* This structe describes all interface-specific data of the main (interface)
* thread.
*****************************************************************************/
typedef int ( intf_sys_create_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_destroy_t ) ( p_intf_thread_t p_intf );
typedef void ( intf_sys_manage_t ) ( p_intf_thread_t p_intf );
typedef struct _keyparam
{
int key;
......@@ -72,10 +67,14 @@ typedef struct intf_thread_s
p_intf_sys_t p_sys; /* system interface */
p_intf_key p_keys;
/* Plugin */
intf_sys_create_t * p_sys_create; /* create interface thread */
intf_sys_manage_t * p_sys_manage; /* main loop */
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */
/* Plugin used and shortcuts to access its capabilities */
struct module_s * p_module;
int ( *pf_open ) ( struct intf_thread_s * );
void ( *pf_close ) ( struct intf_thread_s * );
void ( *pf_run ) ( struct intf_thread_s * );
/* Interface callback */
void ( *pf_manage ) ( struct intf_thread_s * );
/* XXX: Channels array - new API */
//p_intf_channel_t * p_channel[INTF_MAX_CHANNELS];/* channel descriptions */
......@@ -84,24 +83,24 @@ typedef struct intf_thread_s
p_intf_channel_t p_channel; /* description of channels */
/* Main threads - NULL if not active */
p_vout_thread_t p_vout;
p_input_thread_t p_input;
/* Specific functions */
keyparm (*p_intf_get_key)(struct intf_thread_s *p_intf, int r_key) ;
/* XXX: new message passing stuff will go here */
vlc_mutex_t change_lock;
boolean_t b_menu_change;
boolean_t b_menu;
/* Warning messages level */
int i_warning_level;
} intf_thread_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
intf_thread_t * intf_Create ( void );
void intf_Run ( intf_thread_t * p_intf );
void intf_Destroy ( intf_thread_t * p_intf );
int intf_SelectChannel ( intf_thread_t * p_intf, int i_channel );
int intf_ProcessKey ( intf_thread_t * p_intf, int i_key );
void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key, int param);
......
......@@ -39,7 +39,9 @@ typedef struct
char ** ppsz_argv; /* command line arguments */
char ** ppsz_env; /* environment variables */
char * psz_arg0; /* program name (whithout path) */
int i_cpu_capabilities; /* CPU extensions */
int i_warning_level; /* warning messages level */
/* Generic settings */
boolean_t b_audio; /* is audio output allowed ? */
......@@ -48,13 +50,13 @@ typedef struct
boolean_t b_dvd; /* DVD mode ? */
/* Unique threads */
p_vout_thread_t p_vout; /* video output thread */
p_aout_thread_t p_aout; /* audio output thread */
p_intf_thread_t p_intf; /* main interface thread */
/* Shared data - these structures are accessed directly from p_main by
* several modules */
struct module_bank_s * p_module_bank; /* module bank */
p_plugin_bank_t p_bank; /* plugin bank */
struct module_bank_s * p_bank; /* module bank */
p_playlist_t p_playlist; /* playlist */
p_intf_msg_t p_msg; /* messages interface data */
p_input_vlan_t p_vlan; /* vlan library data */
......
......@@ -65,6 +65,14 @@ typedef struct function_list_s
union
{
/* Interface plugin */
struct
{
int ( * pf_open ) ( struct intf_thread_s * );
void ( * pf_close )( struct intf_thread_s * );
void ( * pf_run ) ( struct intf_thread_s * );
} intf;
/* Input plugin */
struct
{
......@@ -98,6 +106,19 @@ typedef struct function_list_s
void ( * pf_close ) ( struct aout_thread_s * );
} aout;
/* Video output plugin */
struct
{
int ( * pf_create ) ( struct vout_thread_s * );
int ( * pf_init ) ( struct vout_thread_s * );
void ( * pf_end ) ( struct vout_thread_s * );
void ( * pf_destroy ) ( struct vout_thread_s * );
int ( * pf_manage ) ( struct vout_thread_s * );
void ( * pf_display ) ( struct vout_thread_s * );
void ( * pf_setpalette ) ( struct vout_thread_s *, u16 *red,
u16 *green, u16 *blue, u16 *transp );
} vout;
/* Motion compensation plugin */
struct
{
......
......@@ -112,18 +112,6 @@ typedef struct vout_buffer_s
* is represented by a video output thread, and described using the following
* structure.
*****************************************************************************/
typedef int (vout_sys_create_t) ( p_vout_thread_t p_vout,
char *psz_display,
int i_root_window, void *p_data );
typedef int (vout_sys_init_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_end_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_destroy_t) ( p_vout_thread_t p_vout );
typedef int (vout_sys_manage_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_display_t) ( p_vout_thread_t p_vout );
typedef void (vout_set_palette_t) ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
typedef struct vout_thread_s
{
/* Thread properties and lock */
......@@ -165,15 +153,16 @@ typedef struct vout_thread_s
u32 i_gray_pixel; /* gray */
u32 i_blue_pixel; /* blue */
/* Plugins */
vout_sys_create_t * p_sys_create; /* allocate output method */
vout_sys_init_t * p_sys_init; /* initialize output method */
vout_sys_end_t * p_sys_end; /* terminate output method */
vout_sys_destroy_t * p_sys_destroy; /* destroy output method */
vout_sys_manage_t * p_sys_manage; /* handle events */
vout_sys_display_t * p_sys_display; /* display rendered image */
vout_set_palette_t * p_set_palette; /* set 8bpp palette */
/* Plugin used and shortcuts to access its capabilities */
struct module_s * p_module;
int ( *pf_create ) ( struct vout_thread_s * );
int ( *pf_init ) ( struct vout_thread_s * );
void ( *pf_end ) ( struct vout_thread_s * );
void ( *pf_destroy ) ( struct vout_thread_s * );
int ( *pf_manage ) ( struct vout_thread_s * );
void ( *pf_display ) ( struct vout_thread_s * );
void ( *pf_setpalette ) ( struct vout_thread_s *, u16 *red,
u16 *green, u16 *blue, u16 *transp );
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
......@@ -243,17 +232,16 @@ typedef struct vout_thread_s
/*****************************************************************************
* Prototypes
*****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status,
int i_method, void *p_data );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height );
void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
vout_thread_t * vout_CreateThread ( int *pi_status );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height );
void vout_DestroyPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DisplayPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_DatePicture ( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date );
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
subpicture_t * vout_CreateSubPicture ( vout_thread_t *p_vout, int i_type, int i_size );
void vout_DestroySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
void vout_DisplaySubPicture ( vout_thread_t *p_vout, subpicture_t *p_subpic );
......
......@@ -3,8 +3,8 @@
*****************************************************************************
* Copyright (C) 2000 VideoLAN
*
* Authors:
*
* 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
......@@ -20,6 +20,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME gnome
/*****************************************************************************
* Preamble
*****************************************************************************/
......@@ -27,109 +29,86 @@
#include <stdlib.h> /* malloc(), free() */
#include <X11/Xlib.h>
#include "config.h"
#include "common.h" /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "tests.h"
#include "plugins.h"
#include "interface.h"
#include "audio_output.h"
#include "video.h"
#include "video_output.h"
#include "main.h"
#include "modules.h"
#include "modules_inner.h"
/*****************************************************************************
* Exported prototypes
* Building configuration tree
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout );
static void intf_GetPlugin( p_intf_thread_t p_intf );
/* Video output */
int vout_GnomeCreate ( vout_thread_t *p_vout, char *psz_display,
int i_root_window, void *p_data );
int vout_GnomeInit ( p_vout_thread_t p_vout );
void vout_GnomeEnd ( p_vout_thread_t p_vout );
void vout_GnomeDestroy ( p_vout_thread_t p_vout );
int vout_GnomeManage ( p_vout_thread_t p_vout );
void vout_GnomeDisplay ( p_vout_thread_t p_vout );
void vout_GnomeSetPalette ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
/* Interface */
int intf_GnomeCreate ( p_intf_thread_t p_intf );
void intf_GnomeDestroy ( p_intf_thread_t p_intf );
void intf_GnomeManage ( p_intf_thread_t p_intf );
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for Gnome module" )
ADD_COMMENT( "For now, the Gnome module cannot be configured" )
MODULE_CONFIG_END
/*****************************************************************************
* GetConfig: get the plugin structure and configuration
* Capabilities defined in the other files.
******************************************************************************/
extern void intf_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
plugin_info_t * GetConfig( void )
int InitModule( module_t * p_module )
{
Display *p_display;
plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
p_info->psz_name = "Gnome";
p_info->psz_version = VERSION;
p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
p_info->aout_GetPlugin = NULL;
p_info->vout_GetPlugin = vout_GetPlugin;
p_info->intf_GetPlugin = intf_GetPlugin;
p_info->yuv_GetPlugin = NULL;
/* Check that we can open the X display */
if( (p_display = XOpenDisplay( XDisplayName(
main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) ) ))
== NULL )
{
p_info->i_score = 0;
}
else
{
XCloseDisplay( p_display );
p_info->i_score = 0x200;
}
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "Gnome interface module";
p_module->psz_version = VERSION;
if( TestProgram( "gvlc" ) )
{
p_info->i_score += 0x180;
}
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_INTF;
/* If this plugin was requested, score it higher */
if( TestMethod( VOUT_METHOD_VAR, "gnome" ) )
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
p_info->i_score += 0x200;
return( -1 );
}
return( p_info );
intf_getfunctions( &p_module->p_functions->intf );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* Following functions are only called through the p_info structure
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout )
int DeactivateModule( module_t * p_module )
{
p_vout->p_sys_create = vout_GnomeCreate;
p_vout->p_sys_init = vout_GnomeInit;
p_vout->p_sys_end = vout_GnomeEnd;
p_vout->p_sys_destroy = vout_GnomeDestroy;
p_vout->p_sys_manage = vout_GnomeManage;
p_vout->p_sys_display = vout_GnomeDisplay;
/* optional functions */
p_vout->p_set_palette = vout_GnomeSetPalette;
}
free( p_module->p_functions );
static void intf_GetPlugin( p_intf_thread_t p_intf )
{
p_intf->p_sys_create = intf_GnomeCreate;
p_intf->p_sys_destroy = intf_GnomeDestroy;
p_intf->p_sys_manage = intf_GnomeManage;
return( 0 );
}
......@@ -3,18 +3,24 @@
#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
#include <gnome.h>
#include "intf_gnome_thread.h"
#include "intf_gnome_callbacks.h"
#include "intf_gnome_interface.h"
#include "intf_gnome_support.h"
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "gnome_sys.h"
#include "gnome_callbacks.h"
#include "gnome_interface.h"
#include "gnome_support.h"
#define GET_GNOME_STRUCT( item, parent ) \
gtk_object_get_data( \
GTK_OBJECT( lookup_widget(GTK_WIDGET(item), parent) ), \
"p_gnome" );
"p_intf" );
void
on_modules_activate (GtkMenuItem *menuitem,
......@@ -28,11 +34,11 @@ void
on_exit_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gnome_thread_t *p_gnome;
intf_thread_t *p_intf;
p_gnome = GET_GNOME_STRUCT( menuitem, "intf_window" );
p_intf = GET_GNOME_STRUCT( menuitem, "intf_window" );
p_gnome->b_die = 1;
p_intf->b_die = 1;
}
......@@ -64,15 +70,15 @@ void
on_about_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gnome_thread_t *p_gnome;
intf_thread_t *p_intf;
p_gnome = GET_GNOME_STRUCT( menuitem, "intf_window" );
p_intf = GET_GNOME_STRUCT( menuitem, "intf_window" );
if( !GTK_IS_WIDGET( p_gnome->p_about ) )
if( !GTK_IS_WIDGET( p_intf->p_sys->p_about ) )
{
p_gnome->p_about = create_intf_about ();
p_intf->p_sys->p_about = create_intf_about ();
}
gtk_widget_show( p_gnome->p_about );
gtk_widget_show( p_intf->p_sys->p_about );
}
......@@ -80,6 +86,9 @@ void
on_stop_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf;
p_intf = GET_GNOME_STRUCT( button, "intf_window" );
}
......@@ -88,32 +97,32 @@ void
on_control_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gnome_thread_t *p_gnome;
intf_thread_t *p_intf;
p_gnome = GET_GNOME_STRUCT( menuitem, "intf_window" );
p_intf = GET_GNOME_STRUCT( menuitem, "intf_window" );
/* lock the change structure */
vlc_mutex_lock( &p_gnome->change_lock );
vlc_mutex_lock( &p_intf->p_sys->change_lock );
if( p_gnome->b_window )
if( p_intf->p_sys->b_window )
{
gtk_widget_hide( p_gnome->p_window );
p_gnome->b_window = 0;
gtk_widget_hide( p_intf->p_sys->p_window );
p_intf->p_sys->b_window = 0;
}
else
{
if( !GTK_IS_WIDGET( p_gnome->p_window ) )
if( !GTK_IS_WIDGET( p_intf->p_sys->p_window ) )
{
p_gnome->p_window = create_intf_window ();
p_intf->p_sys->p_window = create_intf_window ();
}
gtk_widget_show( p_gnome->p_window );
gtk_object_set_data( GTK_OBJECT(p_gnome->p_window),
"p_gnome", p_gnome );
p_gnome->b_window = 1;
gtk_widget_show( p_intf->p_sys->p_window );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf );
p_intf->p_sys->b_window = 1;
}
/* unlock the change structure */
vlc_mutex_unlock( &p_gnome->change_lock );
vlc_mutex_unlock( &p_intf->p_sys->change_lock );
}
......@@ -121,64 +130,64 @@ void
on_playlist_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gnome_thread_t *p_gnome;
intf_thread_t *p_intf;
p_gnome = GET_GNOME_STRUCT( menuitem, "intf_window" );
p_intf = GET_GNOME_STRUCT( menuitem, "intf_window" );
/* lock the change structure */
vlc_mutex_lock( &p_gnome->change_lock );
vlc_mutex_lock( &p_intf->p_sys->change_lock );
if( p_gnome->b_playlist )
if( p_intf->p_sys->b_playlist )
{
gtk_widget_hide( p_gnome->p_playlist );
p_gnome->b_playlist = 0;