Commit 6eb6044c authored by Sam Hocevar's avatar Sam Hocevar

 . src/misc/modules.c is in a workable state now.

  To test it, run ./configure with the --enable-null flag, which will
  compile the Null Module as a plugin. Watch the memory usage at the
  launch and when the plugin is released.
parent 2a8ef11d
...@@ -245,6 +245,7 @@ VIDEO_DECODER = src/video_decoder/video_decoder.o \ ...@@ -245,6 +245,7 @@ VIDEO_DECODER = src/video_decoder/video_decoder.o \
MISC = src/misc/mtime.o \ MISC = src/misc/mtime.o \
src/misc/tests.o \ src/misc/tests.o \
src/misc/rsc_files.o \ src/misc/rsc_files.o \
src/misc/modules.o \
src/misc/netutils.o \ src/misc/netutils.o \
src/misc/playlist.o \ src/misc/playlist.o \
src/misc/plugins.o src/misc/plugins.o
......
...@@ -51,8 +51,9 @@ typedef struct ...@@ -51,8 +51,9 @@ typedef struct
/* Shared data - these structures are accessed directly from p_main by /* Shared data - these structures are accessed directly from p_main by
* several modules */ * several modules */
struct module_bank_s * p_module_bank; /* module bank */
p_plugin_bank_t p_bank; /* plugin bank */ p_plugin_bank_t p_bank; /* plugin bank */
p_playlist_t p_playlist; /* plugin bank */ p_playlist_t p_playlist; /* playlist */
p_intf_msg_t p_msg; /* messages interface data */ p_intf_msg_t p_msg; /* messages interface data */
p_input_vlan_t p_vlan; /* vlan library data */ p_input_vlan_t p_vlan; /* vlan library data */
} main_t; } main_t;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*****************************************************************************/ *****************************************************************************/
/* Number of tries before we unload an unused module */ /* Number of tries before we unload an unused module */
#define MODULE_HIDE_DELAY 10 #define MODULE_HIDE_DELAY 50
/* The module handle type. */ /* The module handle type. */
#ifdef SYS_BEOS #ifdef SYS_BEOS
...@@ -82,9 +82,10 @@ typedef struct module_bank_s ...@@ -82,9 +82,10 @@ typedef struct module_bank_s
/***************************************************************************** /*****************************************************************************
* Exported functions. * Exported functions.
*****************************************************************************/ *****************************************************************************/
module_bank_t * module_InitBank ( void ); module_bank_t * module_CreateBank ( void );
int module_DestroyBank ( module_bank_t * p_bank ); void module_InitBank ( module_bank_t * p_bank );
int module_ResetBank ( module_bank_t * p_bank ); void module_DestroyBank ( module_bank_t * p_bank );
void module_ResetBank ( module_bank_t * p_bank );
void module_ManageBank ( module_bank_t * p_bank ); void module_ManageBank ( module_bank_t * p_bank );
int module_Need ( module_t * p_module ); int module_Need ( module_t * p_module );
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "threads.h" #include "threads.h"
#include "mtime.h" #include "mtime.h"
#include "plugins.h" #include "plugins.h"
#include "modules.h"
#include "playlist.h" #include "playlist.h"
#include "stream_control.h" #include "stream_control.h"
...@@ -235,6 +236,9 @@ void intf_Run( intf_thread_t *p_intf ) ...@@ -235,6 +236,9 @@ void intf_Run( intf_thread_t *p_intf )
/* Manage specific interface */ /* Manage specific interface */
p_intf->p_sys_manage( p_intf ); p_intf->p_sys_manage( p_intf );
/* Manage module bank */
module_ManageBank( p_main->p_module_bank );
/* Check attached threads status */ /* Check attached threads status */
if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error ) if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error )
{ {
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "mtime.h" #include "mtime.h"
#include "tests.h" /* TestMMX() */ #include "tests.h" /* TestMMX() */
#include "plugins.h" #include "plugins.h"
#include "modules.h"
#include "playlist.h" #include "playlist.h"
#include "stream_control.h" #include "stream_control.h"
#include "input_ext-intf.h" #include "input_ext-intf.h"
...@@ -251,6 +252,20 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -251,6 +252,20 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
} }
bank_Init( p_main->p_bank ); bank_Init( p_main->p_bank );
/*
* Initialize module bank
*/
p_main->p_module_bank = module_CreateBank( );
if( !p_main->p_module_bank )
{
intf_Msg( "Module bank initialization failed" );
bank_Destroy( p_main->p_bank );
playlist_Destroy( p_main->p_playlist );
intf_MsgDestroy();
return( errno );
}
module_InitBank( p_main->p_module_bank );
/* /*
* Initialize shared resources and libraries * Initialize shared resources and libraries
*/ */
...@@ -312,6 +327,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -312,6 +327,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
} }
#endif #endif
/*
* Free module bank
*/
module_DestroyBank( p_main->p_module_bank );
/* /*
* Free plugin bank * Free plugin bank
*/ */
......
This diff is collapsed.
...@@ -115,7 +115,6 @@ void bank_Init( plugin_bank_t * p_bank ) ...@@ -115,7 +115,6 @@ void bank_Init( plugin_bank_t * p_bank )
/* Dummy plugin */ /* Dummy plugin */
SEEK_PLUGIN( "dummy" ); SEEK_PLUGIN( "dummy" );
SEEK_PLUGIN( "null" );
#undef SEEK_PLUGIN #undef SEEK_PLUGIN
} }
......
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