]> git.sesse.net Git - vlc/blobdiff - include/modules.h
* ./configure.in: fixed a breakage.
[vlc] / include / modules.h
index 230c400990568612489d62970394a88e0a252023..438099122853125fbbb9b4345b20dd0c4eb8fca0 100644 (file)
@@ -2,7 +2,7 @@
  * 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>
  *
@@ -26,7 +26,7 @@
  *****************************************************************************/
 
 /* 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. */
@@ -39,7 +39,7 @@ typedef void *  module_handle_t;
 /*****************************************************************************
  * 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
@@ -52,10 +52,10 @@ static __inline__ char *GetCapabilityName( unsigned int i_capa )
 #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",
@@ -87,7 +87,7 @@ static __inline__ char *GetCapabilityName( unsigned int i_capa )
  *****************************************************************************
  * 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 */
@@ -96,7 +96,11 @@ typedef struct
                                     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
@@ -121,8 +125,14 @@ typedef struct module_s
     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
@@ -174,45 +184,40 @@ typedef struct function_list_s
             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;
@@ -312,8 +317,8 @@ typedef struct module_functions_s
     /* 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;
@@ -331,7 +336,7 @@ typedef struct module_functions_s * p_module_functions_t;
 /*****************************************************************************
  * Exported functions.
  *****************************************************************************/
-#ifndef PLUGIN
+#ifndef __PLUGIN__
 void            module_InitBank     ( void );
 void            module_LoadMain     ( void );
 void            module_LoadBuiltins ( void );
@@ -340,7 +345,7 @@ void            module_EndBank      ( 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