Commit a71b1c8c authored by Gildas Bazin's avatar Gildas Bazin

* ALL: added a new vlc_list_t common type. vlc_list_find() and vlc_list_release() have been modified
to use this new type.
parent 270c4994
......@@ -2,7 +2,7 @@
* variables.h: variables handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: variables.h,v 1.9 2002/12/07 15:25:26 gbazin Exp $
* $Id: variables.h,v 1.10 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -87,7 +87,9 @@ struct variable_t
#define VLC_VAR_HASMAX 0x0400
#define VLC_VAR_HASSTEP 0x0800
#define VLC_VAR_ISCOMMAND 0x1000
#define VLC_VAR_ISLIST 0x1000
#define VLC_VAR_ISCOMMAND 0x2000
#define VLC_VAR_ISCONFIG 0x2000
/*****************************************************************************
* Variable actions
......
......@@ -2,7 +2,7 @@
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.18 2002/12/03 16:29:04 gitan Exp $
* $Id: vlc.h,v 1.19 2002/12/13 01:56:29 gbazin 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
......@@ -30,20 +30,30 @@ extern "C" {
* Our custom types
*****************************************************************************/
typedef int vlc_bool_t;
typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t;
typedef union
{
int i_int;
vlc_bool_t b_bool;
float f_float;
char * psz_string;
void * p_address;
int i_int;
vlc_bool_t b_bool;
float f_float;
char * psz_string;
void * p_address;
vlc_object_t * p_object;
/* Make sure the structure is at least 64bits */
struct { char a, b, c, d, e, f, g, h; } padding;
} vlc_value_t;
struct vlc_list_t
{
int i_count;
vlc_value_t * p_values;
};
/*****************************************************************************
* Error values
*****************************************************************************/
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.42 2002/11/28 23:24:14 massiot Exp $
* $Id: vlc_common.h,v 1.43 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -178,8 +178,6 @@ typedef uint32_t vlc_fourcc_t;
/* Internal types */
typedef struct libvlc_t libvlc_t;
typedef struct vlc_t vlc_t;
typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t;
typedef struct variable_t variable_t;
/* Messages */
......
......@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.13 2002/10/14 16:46:55 sam Exp $
* $Id: vlc_objects.h,v 1.14 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -50,19 +50,6 @@ struct vlc_object_t
VLC_COMMON_MEMBERS
};
/*****************************************************************************
* The vlc_list_t object list type
*****************************************************************************/
struct vlc_list_t
{
int i_count;
vlc_object_t ** pp_objects;
/* Private */
int _i_extra;
vlc_object_t * _p_first;
};
/*****************************************************************************
* Prototypes
*****************************************************************************/
......@@ -74,7 +61,7 @@ VLC_EXPORT( void *, __vlc_object_get, ( vlc_object_t *, int ) );
VLC_EXPORT( void *, __vlc_object_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_object_yield, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_release, ( vlc_object_t * ) );
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( vlc_list_t, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, vlc_list_release, ( vlc_list_t * ) );
#define vlc_object_create(a,b) \
......
......@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.12 2002/12/12 12:24:23 sam Exp $
* $Id: familiar.c,v 1.13 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
......@@ -198,36 +198,37 @@ static void Run( intf_thread_t *p_intf )
void GtkAutoPlayFile( vlc_object_t *p_this )
{
GtkWidget *cbautoplay;
intf_thread_t **pp_intf;
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
*pp_intf ;
pp_intf++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
cbautoplay = GTK_WIDGET( gtk_object_get_data(
GTK_OBJECT( (*pp_intf)->p_sys->p_window ),
GTK_OBJECT( p_intf->p_sys->p_window ),
"cbautoplay" ) );
if( !config_GetInt( p_this, "familiar-autoplayfile" ) )
{
(*pp_intf)->p_sys->b_autoplayfile = VLC_FALSE;
p_intf->p_sys->b_autoplayfile = VLC_FALSE;
}
else
{
(*pp_intf)->p_sys->b_autoplayfile = VLC_TRUE;
p_intf->p_sys->b_autoplayfile = VLC_TRUE;
}
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( cbautoplay ),
(*pp_intf)->p_sys->b_autoplayfile );
p_intf->p_sys->b_autoplayfile );
}
vlc_list_release( p_list );
vlc_list_release( &list );
}
......@@ -2,7 +2,7 @@
* display.c: Gtk+ tools for main interface
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: display.c,v 1.4 2002/09/30 11:05:38 sam Exp $
* $Id: display.c,v 1.5 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr>
......@@ -237,32 +237,33 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
*****************************************************************************/
void E_(GtkHideTooltips)( vlc_object_t *p_this )
{
intf_thread_t **pp_intf;
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
vlc_bool_t b_enable = config_GetInt( p_this, "gnome-tooltips" );
for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
*pp_intf ;
pp_intf++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
p_intf = (intf_thread_t *)list.p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
if( b_enable )
{
gtk_tooltips_enable( (*pp_intf)->p_sys->p_tooltips );
gtk_tooltips_enable( p_intf->p_sys->p_tooltips );
}
else
{
gtk_tooltips_disable( (*pp_intf)->p_sys->p_tooltips );
gtk_tooltips_disable( p_intf->p_sys->p_tooltips );
}
}
vlc_list_release( p_list );
vlc_list_release( &list );
}
#ifdef MODULE_NAME_IS_gnome
......@@ -276,28 +277,29 @@ void GtkHideToolbarText( vlc_object_t *p_this )
{
GtkToolbarStyle style;
GtkToolbar * p_toolbar;
intf_thread_t **pp_intf;
vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
intf_thread_t *p_intf;
int i_index;
vlc_list_t list = vlc_list_find( p_this, VLC_OBJECT_INTF,
FIND_ANYWHERE );
style = config_GetInt( p_this, "gnome-toolbartext" )
? GTK_TOOLBAR_BOTH
: GTK_TOOLBAR_ICONS;
for( pp_intf = (intf_thread_t **)p_list->pp_objects ;
*pp_intf ;
pp_intf++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( strcmp( MODULE_STRING, (*pp_intf)->p_module->psz_object_name ) )
p_intf = (module_t *)list.p_values[i_index].p_object ;
if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )
{
continue;
}
p_toolbar = GTK_TOOLBAR(lookup_widget( (*pp_intf)->p_sys->p_window,
p_toolbar = GTK_TOOLBAR(lookup_widget( p_intf->p_sys->p_window,
"toolbar" ));
gtk_toolbar_set_style( p_toolbar, style );
}
vlc_list_release( p_list );
vlc_list_release( &list );
}
#endif
......@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: preferences.c,v 1.5 2002/12/06 16:34:07 sam Exp $
* $Id: preferences.c,v 1.6 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
......@@ -118,9 +118,10 @@ void GtkPreferencesShow( GtkMenuItem * menuitem, gpointer user_data )
static void GtkCreateConfigDialog( char *psz_module_name,
intf_thread_t *p_intf )
{
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser = NULL;
vlc_list_t list;
module_config_t *p_item;
int i_index;
guint rows = 0;
......@@ -174,23 +175,22 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* Look for the selected module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
if( !(*pp_parser) )
if( !p_parser || i_index == list.i_count )
{
vlc_list_release( p_list );
vlc_list_release( &list );
return;
}
......@@ -198,12 +198,12 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* Create the configuration dialog box */
#ifdef MODULE_NAME_IS_gnome
config_dialog = gnome_dialog_new( (*pp_parser)->psz_longname, NULL );
config_dialog = gnome_dialog_new( p_parser->psz_longname, NULL );
config_dialog_vbox = GNOME_DIALOG(config_dialog)->vbox;
#else
config_dialog = gtk_dialog_new();
gtk_window_set_title( GTK_WINDOW(config_dialog),
(*pp_parser)->psz_longname );
p_parser->psz_longname );
config_dialog_vbox = GTK_DIALOG(config_dialog)->vbox;
#endif
......@@ -225,7 +225,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
gtk_container_add( GTK_CONTAINER(config_dialog_vbox), config_notebook );
/* Enumerate config options and add corresponding config boxes */
p_item = (*pp_parser)->p_config;
p_item = p_parser->p_config;
if( p_item ) do
{
......@@ -329,15 +329,16 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* build a list of available modules */
{
gchar * entry[2];
pp_parser = (module_t **)p_list->pp_objects;
for( ; *pp_parser ; pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( !strcmp( (*pp_parser)->psz_capability,
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
{
entry[0] = (*pp_parser)->psz_object_name;
entry[1] = (*pp_parser)->psz_longname;
entry[0] = p_parser->psz_object_name;
entry[1] = p_parser->psz_longname;
gtk_clist_append( GTK_CLIST(module_clist), entry );
}
}
......@@ -515,7 +516,7 @@ static void GtkCreateConfigDialog( char *psz_module_name,
}
while( p_item->i_type != CONFIG_HINT_END && p_item++ );
vlc_list_release( p_list );
vlc_list_release( &list );
#ifndef MODULE_NAME_IS_gnome
/* Now let's add the action buttons at the bottom of the page */
......@@ -658,9 +659,10 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
{
intf_thread_t *p_intf;
GtkWidget *config_button;
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser;
vlc_list_t list;
char *psz_name;
int i_index;
p_intf = (intf_thread_t *)gtk_object_get_data( GTK_OBJECT(module_clist),
"p_intf" );
......@@ -671,19 +673,19 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
}
/* look for module 'psz_name' */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( !strcmp( (*pp_parser)->psz_object_name, psz_name ) )
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_object_name, psz_name ) )
{
gtk_object_set_data( GTK_OBJECT(module_clist),
"module_highlighted", (*pp_parser) );
"module_highlighted", p_parser );
config_button = gtk_object_get_data( GTK_OBJECT(module_clist),
"config_button" );
if( (*pp_parser)->i_config_items )
if( p_parser->i_config_items )
gtk_widget_set_sensitive( config_button, TRUE );
else
gtk_widget_set_sensitive( config_button, FALSE );
......@@ -692,7 +694,7 @@ static void GtkModuleHighlighted( GtkCList *module_clist, int row, int column,
}
}
vlc_list_release( p_list );
vlc_list_release( &list );
}
/****************************************************************************
......
......@@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.8 2002/10/16 23:34:27 sigmunau Exp $
* $Id: preferences.cpp,v 1.9 2002/12/13 01:56:29 gbazin Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*
......@@ -52,37 +52,37 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
KDialogBase ( Tabbed, caption, Ok| Apply|Cancel|User1, Ok, parent,
"vlc preferences", true, false, "Save")
{
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser;
vlc_list_t list;
module_config_t *p_item;
int i_index;
QVBox *category_table = NULL;
QString *category_label;
this->p_intf = p_intf;
/* List all modules */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
/* Look for the selected module */
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
if( !(*pp_parser) )
if( !p_parser || i_index == list.i_count )
{
vlc_list_release( p_list );
vlc_list_release( list );
return;
}
p_item = (*pp_parser)->p_config;
p_item = p_parser->p_config;
if( p_item ) do
{
switch( p_item->i_type )
......@@ -129,18 +129,18 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
connect(item_frame, SIGNAL(selectionChanged(const QString &)),
ci, SLOT(setValue(const QString &)));
/* build a list of available plugins */
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( !strcmp( (*pp_parser)->psz_capability,
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_capability,
p_item->psz_type ) )
{
new QListViewItem(item_frame->getListView(),
(*pp_parser)->psz_object_name,
(*pp_parser)->psz_longname);
p_parser->psz_object_name,
p_parser->psz_longname);
}
}
......@@ -256,7 +256,7 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
}
while( p_item->i_type != CONFIG_HINT_END );
vlc_list_release( p_list );
vlc_list_release( &list );
exec();
}
......@@ -273,24 +273,25 @@ KPreferences::~KPreferences()
*/
bool KPreferences::isConfigureable(QString module)
{
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser;
vlc_list_t list;
int i_index;
p_list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( this->p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( !module.compare( (*pp_parser)->psz_object_name ) )
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( !module.compare( p_parser->psz_object_name ) )
{
bool ret = (*pp_parser)->i_config_items != 0;
vlc_list_release( p_list );
bool ret = p_parser->i_config_items != 0;
vlc_list_release( &list );
return ret;
}
}
vlc_list_release( p_list );
vlc_list_release( &list );
return false;
}
......
......@@ -2,7 +2,7 @@
* prefs.m: MacOS X plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: prefs.m,v 1.1 2002/11/05 03:57:16 jlj Exp $
* $Id: prefs.m,v 1.2 2002/12/13 01:56:30 gbazin Exp $
*
* Authors: Jon Lech Johansen <jon-vl@nanocrew.net>
*
......@@ -100,28 +100,29 @@
- (BOOL)hasPrefs:(NSString *)o_module_name
{
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser;
vlc_list_t list;
char *psz_module_name;
int i_index;
psz_module_name = (char *)[o_module_name lossyCString];
/* look for module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
if( !strcmp( (*pp_parser)->psz_object_name, psz_module_name ) )
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( !strcmp( p_parser->psz_object_name, psz_module_name ) )
{
BOOL b_has_prefs = (*pp_parser)->i_config_items != 0;
vlc_list_release( p_list );
BOOL b_has_prefs = p_parser->i_config_items != 0;
vlc_list_release( &list );
return( b_has_prefs );
}
}
vlc_list_release( p_list );
vlc_list_release( &list );
return( NO );
}
......@@ -131,10 +132,11 @@
int i_pos;
int i_module_tag;
module_t **pp_parser;
vlc_list_t *p_list;
module_t *p_parser;
vlc_list_t list;
module_config_t *p_item;
char *psz_module_name;
int i_index;
NSPanel *o_panel; /* panel */
NSRect s_panel_rc; /* panel rect */
......@@ -163,22 +165,22 @@
psz_module_name = (char *)[o_module_name lossyCString];
/* Look for the selected module */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
for( pp_parser = (module_t **)p_list->pp_objects ;
*pp_parser ;
pp_parser++ )
for( i_index = 0; i_index < list.i_count; i_index++ )
{
p_parser = (module_t *)list.p_values[i_index].p_object ;
if( psz_module_name
&& !strcmp( psz_module_name, (*pp_parser)->psz_object_name ) )
&& !strcmp( psz_module_name, p_parser->psz_object_name ) )
{
break;
}
}
if( !(*pp_parser) )
if( !p_parser || i_index == list.i_count )
{
vlc_list_release( p_list );
vlc_list_release( &list );
return;
}
......@@ -211,7 +213,7 @@
forKey: o_module_name];
/* Enumerate config options and add corresponding config boxes */
p_item = (*pp_parser)->p_config;
p_item = p_parser->p_config;
i_pos = 0;
o_view = nil;
......@@ -381,15 +383,15 @@
/* build a list of available modules */