* modules.h : Module management functions.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: modules.h,v 1.42 2002/02/24 20:51:09 gbazin Exp $
+ * $Id: modules.h,v 1.51 2002/05/30 08:17:04 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
*****************************************************************************/
/* Number of tries before we unload an unused module */
-#define MODULE_HIDE_DELAY 10000
+#define MODULE_HIDE_DELAY 50
#define MODULE_SHORTCUT_MAX 10
/* The module handle type. */
/*****************************************************************************
* Module capabilities.
*****************************************************************************/
-static __inline__ char *GetCapabilityName( unsigned int i_capa )
+static inline char *GetCapabilityName( unsigned int i_capa )
{
/* The sole purpose of this inline function and the ugly #defines
* around it is to avoid having two places to modify when adding a
#define MODULE_CAPABILITY_INTF 1 /* Interface */
"access",
#define MODULE_CAPABILITY_ACCESS 2 /* Input */
- "input",
-#define MODULE_CAPABILITY_INPUT 3 /* Input */
- "decaps",
-#define MODULE_CAPABILITY_DECAPS 4 /* Decaps */
+ "demux",
+#define MODULE_CAPABILITY_DEMUX 3 /* Input */
+ "network",
+#define MODULE_CAPABILITY_NETWORK 4 /* Network */
"decoder",
#define MODULE_CAPABILITY_DECODER 5 /* Audio or video decoder */
"motion",
*****************************************************************************
* This global variable is accessed by any function using modules.
*****************************************************************************/
-typedef struct
+typedef struct module_bank_s
{
struct module_s * first; /* First module in the bank */
int i_count; /* Number of allocated modules */
it is to design thread-safe linked lists */
} module_bank_t;
+#ifndef __PLUGIN__
extern module_bank_t *p_module_bank;
+#else
+# define p_module_bank (p_symbols->p_module_bank)
+#endif
/*****************************************************************************
* Module description structure
u32 i_cpu_capabilities; /* Required CPU capabilities */
struct module_functions_s *p_functions; /* Capability functions */
- struct module_config_s *p_config; /* Module configuration structure */
- int i_config_options; /* number of configuration options */
+
+ /*
+ * Variables set by the module to store its config options
+ */
+ struct module_config_s *p_config; /* Module configuration structure */
+ vlc_mutex_t config_lock; /* lock used to modify the config */
+ unsigned int i_config_items; /* number of configuration items */
+ unsigned int i_bool_items; /* number of bool config items */
/*
* Variables used internally by the module manager
void ( * pf_run ) ( struct intf_thread_s * );
} intf;
- /* Input plugin */
+ /* Access plugin */
struct
{
- int ( * pf_probe )( struct input_thread_s * );
- void ( * pf_init ) ( struct input_thread_s * );
- void ( * pf_open ) ( struct input_thread_s * );
+ int ( * pf_open ) ( struct input_thread_s * );
void ( * pf_close )( struct input_thread_s * );
- void ( * pf_end ) ( struct input_thread_s * );
- void ( * pf_init_bit_stream ) ( struct bit_stream_s *,
- struct decoder_fifo_s *,
- void (* pf_bitstream_callback)( struct bit_stream_s *,
- boolean_t ),
- void * );
-
- int ( * pf_read ) ( struct input_thread_s *,
- struct data_packet_s ** );
- void ( * pf_demux )( struct input_thread_s *,
- struct data_packet_s * );
-
- struct data_packet_s * ( * pf_new_packet ) ( void *, size_t );
- struct pes_packet_s * ( * pf_new_pes ) ( void * );
- void ( * pf_delete_packet ) ( void *, struct data_packet_s * );
- void ( * pf_delete_pes ) ( void *, struct pes_packet_s * );
-
+ ssize_t ( * pf_read ) ( struct input_thread_s *, byte_t *, size_t );
+ void ( * pf_seek ) ( struct input_thread_s *, off_t );
int ( * pf_set_program ) ( struct input_thread_s *,
- struct pgrm_descriptor_s * );
-
+ struct pgrm_descriptor_s * );
int ( * pf_set_area ) ( struct input_thread_s *,
struct input_area_s * );
+ } access;
+
+ /* Demux plugin */
+ struct
+ {
+ int ( * pf_init ) ( struct input_thread_s * );
+ void ( * pf_end ) ( struct input_thread_s * );
+ int ( * pf_demux )( struct input_thread_s * );
int ( * pf_rewind ) ( struct input_thread_s * );
- void ( * pf_seek ) ( struct input_thread_s *, off_t );
- } input;
+ } demux;
+
+ /* Network plugin */
+ struct
+ {
+ int ( * pf_open )( struct network_socket_s * );
+ } network;
/* Audio output plugin */
struct
{
int ( * pf_open ) ( struct aout_thread_s * );
int ( * pf_setformat ) ( struct aout_thread_s * );
- long ( * pf_getbufinfo ) ( struct aout_thread_s *, long );
+ int ( * pf_getbufinfo ) ( struct aout_thread_s *, int );
void ( * pf_play ) ( struct aout_thread_s *, byte_t *, int );
void ( * pf_close ) ( struct aout_thread_s * );
} aout;
/* XXX: The order here has to be the same as above for the #defines */
function_list_t intf;
function_list_t access;
- function_list_t input;
- function_list_t decaps;
+ function_list_t demux;
+ function_list_t network;
function_list_t dec;
function_list_t motion;
function_list_t idct;
/*****************************************************************************
* Exported functions.
*****************************************************************************/
-#ifndef PLUGIN
+#ifndef __PLUGIN__
void module_InitBank ( void );
void module_LoadMain ( void );
void module_LoadBuiltins ( void );
void module_ResetBank ( void );
void module_ManageBank ( void );
module_t * module_Need ( int, char *, void * );
-void module_Unneed ( module_t * p_module );
+void module_Unneed ( module_t * );
#else
# define module_Need p_symbols->module_Need