Commit 005be138 authored by Sam Hocevar's avatar Sam Hocevar

* ./src/misc/objects.c: implemented vlc_list_find() which works like

    vlc_object_find() but returns a list of _all_ the matching objects. Only
    works with FIND_ANYWHERE at the moment.
  * ./modules/gui/gtk/preferences.c, ./modules/gui/kde/preferences.cpp,
    ./modules/gui/win32/preferences.cpp: the module lists in the preferences
    menus work again.
  * ./src/misc/objects.c: added a missing sizeof that caused crashes because
    the reindexing of the global object array was incomplete.
  * ./include/modules_inner.h: propagated the module long description to its
    submodules.
parent 211b2031
......@@ -2,7 +2,7 @@
* modules_inner.h : Macros used from within a module.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules_inner.h,v 1.29 2002/08/08 22:28:22 sam Exp $
* $Id: modules_inner.h,v 1.30 2002/08/14 17:06:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -129,6 +129,7 @@
p_module->pp_shortcuts[ i_shortcut ]; \
} \
p_submodule->psz_object_name = p_module->psz_object_name; \
p_submodule->psz_longname = p_module->psz_longname; \
p_submodule->psz_program = p_module->psz_program; \
p_submodule->psz_capability = p_module->psz_capability; \
p_submodule->i_score = p_module->i_score; \
......
......@@ -2,7 +2,7 @@
* vlc.h: global header for vlc
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc.h,v 1.7 2002/08/08 00:35:10 sam Exp $
* $Id: vlc.h,v 1.8 2002/08/14 17:06:53 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
......@@ -29,10 +29,8 @@ extern "C" {
/*****************************************************************************
* Our custom types
*****************************************************************************/
struct vlc_t;
struct vlc_object_t;
typedef struct vlc_t vlc_t;
typedef struct vlc_list_t vlc_list_t;
typedef struct vlc_object_t vlc_object_t;
typedef signed int vlc_error_t;
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.19 2002/08/12 22:12:50 massiot Exp $
* $Id: vlc_common.h,v 1.20 2002/08/14 17:06:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -270,6 +270,17 @@ struct vlc_object_t
VLC_COMMON_MEMBERS
};
/* The object list */
struct vlc_list_t
{
int i_count;
vlc_object_t ** pp_objects;
/* Private */
int _i_extra;
vlc_object_t * _p_first;
};
/* VLC_OBJECT: attempt at doing a clever cast */
#define VLC_OBJECT( x ) \
((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct
......
......@@ -2,7 +2,7 @@
* vlc_objects.h: vlc_object_t definition.
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlc_objects.h,v 1.8 2002/08/14 08:17:24 sam Exp $
* $Id: vlc_objects.h,v 1.9 2002/08/14 17:06:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -31,7 +31,7 @@
#define VLC_OBJECT_DECODER (-7)
#define VLC_OBJECT_VOUT (-8)
#define VLC_OBJECT_AOUT (-9)
#define VLC_OBJECT_SOUT (-10)
#define VLC_OBJECT_SOUT (-10)
#define VLC_OBJECT_GENERIC (-666)
/* Object search mode */
......@@ -41,22 +41,18 @@
#define FIND_STRICT 0x0010
/* Object cast */
/*****************************************************************************
* Prototypes
*****************************************************************************/
VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
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( void, __vlc_object_detach, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
#if 0
//VLC_EXPORT( void, __vlc_object_setchild, ( vlc_object_t *, vlc_object_t * ) );
#endif
VLC_EXPORT( vlc_list_t *, __vlc_list_find, ( vlc_object_t *, int, int ) );
VLC_EXPORT( void, __vlc_list_release, ( vlc_object_t *, vlc_list_t * ) );
VLC_EXPORT( void, __vlc_liststructure, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
......@@ -68,6 +64,12 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
__vlc_object_destroy( VLC_OBJECT(a) ); \
(a) = NULL; } while(0)
#define vlc_object_detach(a) \
__vlc_object_detach( VLC_OBJECT(a) )
#define vlc_object_attach(a,b) \
__vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) )
#define vlc_object_find(a,b,c) \
__vlc_object_find( VLC_OBJECT(a),b,c)
......@@ -77,16 +79,11 @@ VLC_EXPORT( void, __vlc_dumpstructure, ( vlc_object_t * ) );
#define vlc_object_release(a) \
__vlc_object_release( VLC_OBJECT(a) )
#define vlc_object_detach(a) \
__vlc_object_detach( VLC_OBJECT(a) )
#define vlc_object_attach(a,b) \
__vlc_object_attach( VLC_OBJECT(a), VLC_OBJECT(b) )
#define vlc_list_find(a,b,c) \
__vlc_list_find( VLC_OBJECT(a),b,c)
#if 0
#define vlc_object_setchild(a,b) \
__vlc_object_setchild( VLC_OBJECT(a), VLC_OBJECT(b) )
#endif
#define vlc_list_release(a,b) \
__vlc_list_release( VLC_OBJECT(a),b )
#define vlc_liststructure(a) \
__vlc_liststructure( VLC_OBJECT(a) )
......
......@@ -71,6 +71,7 @@ struct module_symbols_t
u32 (* UnalignedShowBits_inner) ( bit_stream_t *, unsigned int ) ;
vlc_bool_t (* NextDataPacket_inner) ( decoder_fifo_t *, data_packet_t ** ) ;
vlc_error_t (* intf_RunThread_inner) ( intf_thread_t * ) ;
vlc_list_t * (* __vlc_list_find_inner) ( vlc_object_t *, int, int ) ;
void (* BitstreamNextDataPacket_inner) ( bit_stream_t * ) ;
void (* CurrentPTS_inner) ( bit_stream_t *, mtime_t *, mtime_t * ) ;
void (* DecoderError_inner) ( decoder_fifo_t * p_fifo ) ;
......@@ -92,6 +93,7 @@ struct module_symbols_t
void (* __msg_Unsubscribe_inner) ( vlc_object_t *, msg_subscription_t * ) ;
void (* __msg_Warn_inner) ( void *, const char *, ... ) ;
void (* __vlc_dumpstructure_inner) ( vlc_object_t * ) ;
void (* __vlc_list_release_inner) ( vlc_object_t *, vlc_list_t * ) ;
void (* __vlc_liststructure_inner) ( vlc_object_t * ) ;
void (* __vlc_object_attach_inner) ( vlc_object_t *, vlc_object_t * ) ;
void (* __vlc_object_destroy_inner) ( vlc_object_t * ) ;
......@@ -188,6 +190,8 @@ struct module_symbols_t
# define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner
# define __vlc_cond_init p_symbols->__vlc_cond_init_inner
# define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner
# define __vlc_list_find p_symbols->__vlc_list_find_inner
# define __vlc_list_release p_symbols->__vlc_list_release_inner
# define __vlc_liststructure p_symbols->__vlc_liststructure_inner
# define __vlc_mutex_destroy p_symbols->__vlc_mutex_destroy_inner
# define __vlc_mutex_init p_symbols->__vlc_mutex_init_inner
......
......@@ -2,7 +2,7 @@
* gtk_preferences.c: functions to handle the preferences dialog box.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: preferences.c,v 1.2 2002/08/08 22:28:22 sam Exp $
* $Id: preferences.c,v 1.3 2002/08/14 17:06:53 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
* Loc Minier <lool@via.ecp.fr>
......@@ -118,7 +118,7 @@ void GtkPreferencesShow( GtkMenuItem * menuitem, gpointer user_data )
static void GtkCreateConfigDialog( char *psz_module_name,
intf_thread_t *p_intf )
{
module_t *p_module, *p_module_bis;
module_t *p_module;
module_config_t *p_item;
guint rows = 0;
......@@ -318,27 +318,22 @@ static void GtkCreateConfigDialog( char *psz_module_name,
/* build a list of available modules */
{
gchar * entry[2];
char * psz_capability;
vlc_list_t *p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
module_t **pp_parser = (module_t **)p_list->pp_objects;
for( p_module_bis = p_intf->p_vlc->p_module_bank->first ;
p_module_bis != NULL ;
p_module_bis = p_module_bis->next )
for( ; *pp_parser ; pp_parser++ )
{
#if 0 /* FIXME */
for( psz_capability = p_module_bis->pp_capabilities[0] ;
*psz_capability ;
psz_capability++ )
if( !strcmp( (*pp_parser)->psz_capability,
p_item->psz_type ) )
{
if( !strcmp( psz_capability, p_item->psz_type ) )
{
entry[0] = p_module_bis->psz_object_name;
entry[1] = p_module_bis->psz_longname;
gtk_clist_append( GTK_CLIST(module_clist), entry );
break;
}
entry[0] = (*pp_parser)->psz_object_name;
entry[1] = (*pp_parser)->psz_longname;
gtk_clist_append( GTK_CLIST(module_clist), entry );
}
#endif
}
vlc_list_release( p_intf, p_list );
}
gtk_clist_set_column_auto_resize( GTK_CLIST(module_clist),
......
......@@ -2,7 +2,7 @@
* preferences.cpp: preferences window for the kde gui
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: preferences.cpp,v 1.2 2002/08/12 17:38:10 sigmunau Exp $
* $Id: preferences.cpp,v 1.3 2002/08/14 17:06:53 sam Exp $
*
* Authors: Sigmund Augdal <sigmunau@idi.ntnu.no> Mon Aug 12 2002
*
......@@ -51,7 +51,9 @@ 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 *p_module, *p_module_bis;
module_t *p_module;
module_t **pp_parser;
vlc_list_t *p_list;
module_config_t *p_item;
QVBox *category_table = NULL;
QString *category_label;
......@@ -116,18 +118,22 @@ KPreferences::KPreferences(intf_thread_t *p_intf, const char *psz_module_name,
/* build a list of available plugins */
#if 0 /* FIXME */
for( p_module_bis = p_intf->p_vlc->p_module_bank->first ;
p_module_bis != NULL ;
p_module_bis = p_module_bis->next ) {
if( p_module_bis->i_capabilities & (1 << p_item->i_value)){
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE,
FIND_ANYWHERE );
pp_parser = (module_t **)p_list->pp_objects;
for( ; *pp_parser ; pp_parser++ )
{
if( !strcmp( (*pp_parser)->psz_capability,
p_item->psz_type ) )
{
new QListViewItem(item_frame->getListView(),
p_module_bis->psz_object_name,
p_module_bis->psz_longname);
(*pp_parser)->psz_object_name,
(*pp_parser)->psz_longname);
}
}
#endif
vlc_list_release( p_intf, p_list );
vlc_mutex_unlock( p_item->p_lock );
}
break;
......
......@@ -360,7 +360,10 @@ void __fastcall TPreferencesDlg::FormHide( TObject *Sender )
void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
{
module_t *p_module, *p_module_plugins;
module_t *p_module;
module_t **pp_parser;
vlc_list_t *p_list;
module_config_t *p_item;
int i_pages, i_ctrl;
......@@ -422,20 +425,20 @@ void __fastcall TPreferencesDlg::CreateConfigDialog( char *psz_module_name )
/* add panel as separator */
ADD_PANEL;
#if 0 /* FIXME */
/* build a list of available plugins */
for( p_module_plugins = p_intfGlobal->p_vlc->p_module_bank->first ;
p_module_plugins != NULL ;
p_module_plugins = p_module_plugins->next )
/* Look for valid modules */
p_list = vlc_list_find( p_intf, VLC_OBJECT_MODULE, FIND_ANYWHERE );
pp_parser = (module_t **)p_list->pp_objects;
for( ; *pp_parser ; pp_parser++ )
{
if( p_module_plugins->i_capabilities &
( 1 << p_item->i_value ) )
if( !strcmp( (*pp_parser)->psz_capability, p_item->psz_type ) )
{
ListItem = GroupBoxPlugin->ListView->Items->Add();
ListItem->Caption = p_module_plugins->psz_object_name;
ListItem->Caption = (*pp_parser)->psz_object_name;
}
}
#endif
vlc_list_release( p_intf, p_list );
break;
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.85 2002/08/14 08:17:24 sam Exp $
* $Id: modules.c,v 1.86 2002/08/14 17:06:53 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -170,7 +170,8 @@ void __module_EndBank( vlc_object_t *p_this )
/* We just free the module by hand. Niahahahahaha. */
p_next = p_this->p_vlc->p_module_bank->first->next;
free( p_this->p_vlc->p_module_bank->first );
vlc_object_detach( p_this->p_vlc->p_module_bank->first );
vlc_object_destroy( p_this->p_vlc->p_module_bank->first );
p_this->p_vlc->p_module_bank->first = p_next;
}
}
......@@ -748,6 +749,7 @@ static int AllocatePluginFile( vlc_object_t * p_this, char * psz_file )
if( CallEntry( p_module ) != 0 )
{
/* We couldn't call module_init() */
msg_Err( p_this, "failed calling entry point in `%s'", psz_file );
vlc_object_destroy( p_module );
module_unload( handle );
return -1;
......
......@@ -298,11 +298,13 @@ static const char * module_error( char *psz_buffer )
(p_symbols)->__msg_Unsubscribe_inner = __msg_Unsubscribe; \
(p_symbols)->__vlc_object_create_inner = __vlc_object_create; \
(p_symbols)->__vlc_object_destroy_inner = __vlc_object_destroy; \
(p_symbols)->__vlc_object_attach_inner = __vlc_object_attach; \
(p_symbols)->__vlc_object_detach_inner = __vlc_object_detach; \
(p_symbols)->__vlc_object_find_inner = __vlc_object_find; \
(p_symbols)->__vlc_object_yield_inner = __vlc_object_yield; \
(p_symbols)->__vlc_object_release_inner = __vlc_object_release; \
(p_symbols)->__vlc_object_detach_inner = __vlc_object_detach; \
(p_symbols)->__vlc_object_attach_inner = __vlc_object_attach; \
(p_symbols)->__vlc_list_find_inner = __vlc_list_find; \
(p_symbols)->__vlc_list_release_inner = __vlc_list_release; \
(p_symbols)->__vlc_liststructure_inner = __vlc_liststructure; \
(p_symbols)->__vlc_dumpstructure_inner = __vlc_dumpstructure; \
(p_symbols)->playlist_Command_inner = playlist_Command; \
......
This diff is collapsed.
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