Commit 9f553534 authored by Sam Hocevar's avatar Sam Hocevar

 . complete commenting of modules_core.h and small modifications
 . separated MODULE_CONFIG_START and ADD_WINDOW (Henri, beware)
 . fixed a very, very old bug that caused namespace collision between
   plugins (Henri, beware: call your aout_getplugin function like this,
   not alsa_aout_getplugin)
 . removed the Debian specific clean rules from the Makefile, since they
   are already handled by the debian/rules script.
 . tidied a few compilation rules (-lfoo should always be at the end)
parent 9451c9b9
......@@ -398,8 +398,6 @@ distclean: clean
rm -f config.status config.cache config.log
rm -f gmon.out core build-stamp
rm -rf .dep
rm -rf debian/tmp debian/files debian/*.debhelper debian/*.substvars
find debian/* -type d -maxdepth 0 -name 'vlc-*' | xargs rm -rf
install:
mkdir -p $(prefix)/bin
......@@ -480,8 +478,9 @@ $(PLUGIN_GLIDE): %.o: %.c
$(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/glide -c -o $@ $<
#
# Real targets
# Main application target
#
vlc: $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
ifeq ($(SYS),beos)
$(CC) $(CFLAGS) $(LCFLAGS) -Xlinker -soname=_APP_ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
......@@ -491,61 +490,65 @@ else
$(CC) $(CFLAGS) $(LCFLAGS) --export-dynamic @DYNAMIC_FLAG@ -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)
endif
#
# Plugin targets
#
lib/beos.so: $(PLUGIN_BEOS)
$(CC) $(CFLAGS) $(LCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
$(CC) $(PCFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
lib/esd.so: $(PLUGIN_ESD)
ifneq (,$(findstring bsd,$(SYS)))
$(CC) -shared -lesd -o $@ $^ $(LCFLAGS) -lesd
$(CC) $(PCFLAGS) -shared -o $@ $^ -lesd
else
$(CC) -shared -o $@ $^ $(LCFLAGS) -laudiofile -lesd
$(CC) $(PCFLAGS) -shared -o $@ $^ -laudiofile -lesd
endif
lib/dsp.so: $(PLUGIN_DSP)
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/alsa.so: $(PLUGIN_ALSA)
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/null.so: $(PLUGIN_NULL)
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/dummy.so: $(PLUGIN_DUMMY)
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/fb.so: $(PLUGIN_FB)
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
lib/x11.so: $(PLUGIN_X11)
$(CC) -shared -L/usr/X11R6/lib -o $@ $^ $(LCFLAGS) -lX11 -lXext
$(CC) $(PCFLAGS) -shared -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
lib/mga.so: $(PLUGIN_MGA)
$(CC) -shared -L/usr/X11R6/lib -o $@ $^ $(LCFLAGS) -lX11 -lXext
$(CC) $(PCFLAGS) -shared -o $@ $^ -L/usr/X11R6/lib -lX11 -lXext
lib/gnome.so: $(PLUGIN_GNOME)
$(CC) -shared -o $@ $^ $(LCFLAGS) `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
$(CC) $(PCFLAGS) -shared -o $@ $^ `gnome-config --libs gnomeui | sed 's,-rdynamic,,'`
lib/glide.so: $(PLUGIN_GLIDE)
$(CC) -shared $(LIB_GLIDE) -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_GLIDE)
lib/ggi.so: $(PLUGIN_GGI)
$(CC) -shared $(LIB_GGI) -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_GGI)
lib/sdl.so: $(PLUGIN_SDL)
$(CC) -shared $(LIB_SDL) -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^ $(LIB_SDL)
lib/yuv.so: $(PLUGIN_YUV)
ifeq ($(SYS),beos)
$(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
else
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
endif
lib/yuvmmx.so: $(PLUGIN_YUVMMX)
ifeq ($(SYS),beos)
$(CC) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
$(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
else
$(CC) -shared -o $@ $^ $(LCFLAGS)
$(CC) $(PCFLAGS) -shared -o $@ $^
endif
################################################################################
......
......@@ -21,7 +21,7 @@
*****************************************************************************/
/* Number of tries before we unload an unused module */
#define MODULE_HIDE_DELAY 50
#define MODULE_HIDE_DELAY 100
/* The module handle type. */
#ifdef SYS_BEOS
......@@ -100,20 +100,21 @@ typedef struct module_functions_s * p_module_functions_t;
*****************************************************************************/
/* Mandatory first and last parts of the structure */
#define MODULE_CONFIG_ITEM_START 0x01 /* The main window */
#define MODULE_CONFIG_ITEM_END 0x00 /* End of the window */
#define MODULE_CONFIG_ITEM_START 0xdead /* The main window */
#define MODULE_CONFIG_ITEM_END 0xbeef /* End of the window */
/* Configuration widgets */
#define MODULE_CONFIG_ITEM_PANE 0x02 /* A notebook pane */
#define MODULE_CONFIG_ITEM_FRAME 0x03 /* A frame */
#define MODULE_CONFIG_ITEM_COMMENT 0x04 /* A comment text */
#define MODULE_CONFIG_ITEM_STRING 0x05 /* A string */
#define MODULE_CONFIG_ITEM_FILE 0x06 /* A file selector */
#define MODULE_CONFIG_ITEM_CHECK 0x07 /* A checkbox */
#define MODULE_CONFIG_ITEM_CHOOSE 0x08 /* A choose box */
#define MODULE_CONFIG_ITEM_RADIO 0x09 /* A radio box */
#define MODULE_CONFIG_ITEM_SCALE 0x0a /* A horizontal ruler */
#define MODULE_CONFIG_ITEM_SPIN 0x0b /* A numerical selector */
#define MODULE_CONFIG_ITEM_WINDOW 0x0001 /* The main window */
#define MODULE_CONFIG_ITEM_PANE 0x0002 /* A notebook pane */
#define MODULE_CONFIG_ITEM_FRAME 0x0003 /* A frame */
#define MODULE_CONFIG_ITEM_COMMENT 0x0004 /* A comment text */
#define MODULE_CONFIG_ITEM_STRING 0x0005 /* A string */
#define MODULE_CONFIG_ITEM_FILE 0x0006 /* A file selector */
#define MODULE_CONFIG_ITEM_CHECK 0x0007 /* A checkbox */
#define MODULE_CONFIG_ITEM_CHOOSE 0x0008 /* A choose box */
#define MODULE_CONFIG_ITEM_RADIO 0x0009 /* A radio box */
#define MODULE_CONFIG_ITEM_SCALE 0x000a /* A horizontal ruler */
#define MODULE_CONFIG_ITEM_SPIN 0x000b /* A numerical selector */
typedef struct module_config_s
{
......
......@@ -24,20 +24,33 @@
* Inline functions for handling dynamic modules
*****************************************************************************/
/* Function to load a dynamic module, returns 0 if successful. */
/*****************************************************************************
* module_load: load a dynamic library
*****************************************************************************
* This function loads a dynamically linked library using a system dependant
* method, and returns a non-zero value on error, zero otherwise.
*****************************************************************************/
static __inline__ int
module_load( char * psz_filename, module_handle_t * handle )
{
#ifdef SYS_BEOS
*handle = load_add_on( psz_filename );
return( *handle >= 0 );
return( *handle < 0 );
#else
*handle = dlopen( psz_filename, RTLD_NOW | RTLD_GLOBAL );
return( *handle != NULL );
/* Do not open modules with RTLD_GLOBAL, or we are going to get namespace
* collisions when two modules have common public symbols */
*handle = dlopen( psz_filename, RTLD_NOW );
return( *handle == NULL );
#endif
}
/* Unload a dynamic module. */
/*****************************************************************************
* module_unload: unload a dynamic library
*****************************************************************************
* This function unloads a previously opened dynamically linked library
* using a system dependant method. No return value is taken in consideration,
* since some libraries sometimes refuse to close properly.
*****************************************************************************/
static __inline__ void
module_unload( module_handle_t handle )
{
......@@ -49,7 +62,15 @@ module_unload( module_handle_t handle )
return;
}
/* Get a given symbol from a module. */
/*****************************************************************************
* module_getsymbol: get a symbol from a dynamic library
*****************************************************************************
* This function queries a loaded library for a symbol specified in a
* string, and returns a pointer to it.
* FIXME: under Unix we should maybe check for dlerror() instead of the
* return value of dlsym, since we could have loaded a symbol really set
* to NULL (quite unlikely, though).
*****************************************************************************/
static __inline__ void *
module_getsymbol( module_handle_t handle, char * psz_function )
{
......@@ -62,8 +83,14 @@ module_getsymbol( module_handle_t handle, char * psz_function )
#endif
}
/* Wrapper to dlerror() for systems that don't have it. */
static __inline__ char *
/*****************************************************************************
* module_error: wrapper for dlerror()
*****************************************************************************
* This function returns the error message of the last module operation. It
* returns the string "failed" on systems which do not have the dlerror()
* function.
*****************************************************************************/
static __inline__ const char *
module_error( void )
{
#ifdef SYS_BEOS
......
......@@ -67,14 +67,16 @@
/*****************************************************************************
* Macros used to build the configuration structure.
*****************************************************************************/
#define MODULE_CONFIG_START( text ) \
#define MODULE_CONFIG_START \
static module_config_t p_config[] = { \
{ MODULE_CONFIG_ITEM_START, text, NULL, NULL, NULL },
{ MODULE_CONFIG_ITEM_START, NULL, NULL, NULL, NULL },
#define MODULE_CONFIG_END \
{ MODULE_CONFIG_ITEM_END, NULL, NULL, NULL, NULL } \
};
#define ADD_WINDOW( text ) \
{ MODULE_CONFIG_ITEM_WINDOW, text, NULL, NULL, NULL },
#define ADD_FRAME( text ) \
{ MODULE_CONFIG_ITEM_FRAME, text, NULL, NULL, NULL },
#define ADD_PANE( text ) \
......
......@@ -90,7 +90,7 @@ static void aout_Close ( aout_thread_t *p_aout );
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void dsp_aout_getfunctions( function_list_t * p_function_list )
void aout_getfunctions( function_list_t * p_function_list )
{
p_function_list->p_probe = aout_Probe;
p_function_list->functions.aout.p_open = aout_Open;
......
......@@ -43,7 +43,8 @@
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START( "Configuration for dsp module" )
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for dsp module" )
ADD_FRAME( "OSS Device" )
ADD_FILE( "Device name: ", MODULE_VAR(device), NULL )
MODULE_CONFIG_END
......@@ -51,7 +52,7 @@ MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void dsp_aout_getfunctions( function_list_t * p_function_list );
extern void aout_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
......@@ -89,7 +90,7 @@ int ActivateModule( module_t * p_module )
return( -1 );
}
dsp_aout_getfunctions( &p_module->p_functions->aout );
aout_getfunctions( &p_module->p_functions->aout );
p_module->p_config = p_config;
......
......@@ -80,7 +80,7 @@ static void aout_Close ( aout_thread_t *p_aout );
* Functions exported as capabilities. They are declared as static so that
* we don't pollute the namespace too much.
*****************************************************************************/
void esd_aout_getfunctions( function_list_t * p_function_list )
void aout_getfunctions( function_list_t * p_function_list )
{
p_function_list->p_probe = aout_Probe;
p_function_list->functions.aout.p_open = aout_Open;
......
......@@ -42,7 +42,8 @@
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START( "Configuration for esd module" )
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for esd module" )
ADD_FRAME( "EsounD" )
ADD_COMMENT( "This module does not need configuration" )
MODULE_CONFIG_END
......@@ -50,7 +51,7 @@ MODULE_CONFIG_END
/*****************************************************************************
* Capabilities defined in the other files.
*****************************************************************************/
void esd_aout_getfunctions( function_list_t * p_function_list );
extern void aout_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* InitModule: get the module structure and configuration.
......@@ -88,7 +89,7 @@ int ActivateModule( module_t * p_module )
return( -1 );
}
esd_aout_getfunctions( &p_module->p_functions->aout );
aout_getfunctions( &p_module->p_functions->aout );
p_module->p_config = p_config;
......
......@@ -42,7 +42,8 @@
/*****************************************************************************
* Build configuration tree.
*****************************************************************************/
MODULE_CONFIG_START( "Configuration for null module" )
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for null module" )
ADD_PANE( "First pane" )
ADD_FRAME( "First frame" )
ADD_COMMENT( "You can put whatever you want here." )
......
......@@ -350,10 +350,10 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename )
module_handle_t handle;
/* Try to dynamically load the module. */
if( ! module_load( psz_filename, &handle ) )
if( module_load( psz_filename, &handle ) )
{
/* The dynamic module couldn't be opened */
intf_DbgMsg( "module error: cannot open %s (%s)",
intf_DbgMsg( "module warning: cannot open %s (%s)",
psz_filename, module_error() );
return( -1 );
}
......@@ -603,7 +603,7 @@ static int LockModule( module_t * p_module )
}
/* i_usage == -1, which means that the module isn't in memory */
if( ! module_load( p_module->psz_filename, &p_module->handle ) )
if( module_load( p_module->psz_filename, &p_module->handle ) )
{
/* The dynamic module couldn't be opened */
intf_ErrMsg( "module error: cannot open %s (%s)",
......
......@@ -176,7 +176,7 @@ char * TestPlugin ( plugin_id_t *p_plugin_id, char * psz_name )
}
close( i_fd );
*p_plugin_id = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
*p_plugin_id = dlopen( psz_plugin, RTLD_NOW );
#endif
#ifdef SYS_BEOS
......
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