]> git.sesse.net Git - vlc/commitdiff
* include/configuration.h: some small re-work of the config declaration macros.
authorGildas Bazin <gbazin@videolan.org>
Wed, 5 Nov 2003 00:39:17 +0000 (00:39 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 5 Nov 2003 00:39:17 +0000 (00:39 +0000)
   String choices lists can now also have a list of text descriptions associated with them.
   Added integer choices lists.
* modules/gui/wxwindows/: modified config widgets to use the new config options.
* ALL: updated for the new config options.

18 files changed:
include/configuration.h
include/modules_inner.h
modules/access/dvd/dvd.c
modules/audio_output/file.c
modules/codec/subsdec.c
modules/control/gestures.c
modules/demux/mkv.cpp
modules/demux/util/sub.c
modules/gui/beos/BeOS.cpp
modules/gui/wxwindows/preferences_widgets.cpp
modules/gui/wxwindows/preferences_widgets.h
modules/misc/freetype.c
modules/misc/logger/logger.c
modules/video_filter/deinterlace/deinterlace.c
modules/video_filter/distort.c
modules/video_filter/transform.c
src/libvlc.h
src/misc/configuration.c

index dacb6c48f61c0148f256f75771c4258abc8a0aa2..08a90537ce4f88c287a9217f84afd863c03204e6 100644 (file)
@@ -4,7 +4,7 @@
  * It includes functions allowing to declare, get or set configuration options.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: configuration.h,v 1.31 2003/08/14 19:25:55 sigmunau Exp $
+ * $Id: configuration.h,v 1.32 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -69,6 +69,10 @@ struct module_config_t
     void          *p_callback_data;
 
     char       **ppsz_list;        /* List of possible values for the option */
+    int         *pi_list;          /* Idem for integers */
+    char       **ppsz_list_text;   /* Friendly names for list values */
+    int          i_list;           /* Options list size */
+    vlc_callback_t pf_list_update; /* Callback that updates the list */
 
     vlc_mutex_t *p_lock;            /* Lock to use when modifying the config */
     vlc_bool_t   b_dirty;          /* Dirty flag to indicate a config change */
@@ -98,7 +102,8 @@ VLC_EXPORT( int,    __config_LoadConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( int,    __config_SaveConfigFile, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( void,   __config_ResetAll, ( vlc_object_t * ) );
 
-VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char *psz_name ) );
+VLC_EXPORT( module_config_t *, config_FindConfig,( vlc_object_t *, const char * ) );
+VLC_EXPORT( module_t *, config_FindModule,( vlc_object_t *, const char * ) );
 
 VLC_EXPORT( void, config_Duplicate, ( module_t *, module_config_t * ) );
             void  config_Free       ( module_t * );
@@ -133,50 +138,61 @@ VLC_EXPORT( void, config_UnsetCallbacks, ( module_config_t * ) );
  *****************************************************************************/
 
 #define add_category_hint( text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_HINT_CATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; p_config[i_config].b_advanced = advc; }
 #define add_subcategory_hint( text, longtext ) \
-    { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY, NULL, NULL, '\0', text, longtext }; p_config[ i_config ] = tmp; }
 #define end_subcategory_hint \
-    { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, '\0' }; p_config[ i_config ] = tmp; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_HINT_SUBCATEGORY_END, NULL, NULL, '\0' }; p_config[ i_config ] = tmp; }
 #define add_usage_hint( text ) \
-    { static module_config_t tmp = { CONFIG_HINT_USAGE, NULL, NULL, '\0', text }; p_config[ i_config ] = tmp; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_HINT_USAGE, NULL, NULL, '\0', text }; p_config[ i_config ] = tmp; }
 
 #define add_string( name, psz_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value }; tmp.b_advanced = advc; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; } i_config++
-#define add_string_from_list( name, psz_value, ppsz_list, p_callback, text, \
-      longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value, 0, 0, 0, 0, 0, 0, NULL, NULL, ppsz_list }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, '\0', text, longtext, psz_value }; tmp.b_advanced = advc; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; }
 #define add_file( name, psz_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_directory( name, psz_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_DIRECTORY, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_DIRECTORY, NULL, name, '\0', text, longtext, psz_value, 0, 0 }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_module( name, psz_caps, psz_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, '\0', text, longtext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_integer( name, i_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_key( name, i_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_KEY, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_KEY, NULL, name, '\0', text, longtext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_integer_with_range( name, i_value, i_min, i_max, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value, 0, i_min, i_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, '\0', text, longtext, NULL, i_value, 0, i_min, i_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_float( name, f_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_float_with_range( name, f_value, f_min, f_max, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value, 0, 0, f_min, f_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, '\0', text, longtext, NULL, 0, f_value, 0, 0, f_min, f_max }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
 #define add_bool( name, b_value, p_callback, text, longtext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_BOOL, NULL, name, '\0', text, longtext, NULL, b_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
-
-/* These should be seldom used. They were added just to provide easy shortcuts
- * for the command line interface */
-#define add_string_with_short( name, ch, psz_value, p_callback, text, ltext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_STRING, NULL, name, ch, text, ltext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
-#define add_file_with_short( name, ch, psz_value, p_callback, text, ltext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_FILE, NULL, name, ch, text, ltext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
-#define add_module_with_short( name, ch, psz_caps, psz_value, p_callback, \
-    text, ltext, advc) \
-    { static module_config_t tmp = { CONFIG_ITEM_MODULE, psz_caps, name, ch, text, ltext, psz_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
-#define add_integer_with_short( name, ch, i_value, p_callback, text, ltext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_INTEGER, NULL, name, ch, text, ltext, NULL, i_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; } i_config++
-#define add_float_with_short( name, ch, f_value, p_callback, text, ltext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_FLOAT, NULL, name, ch, text, ltext, NULL, 0, f_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc;} i_config++
-#define add_bool_with_short( name, ch, b_value, p_callback, text, ltext, advc ) \
-    { static module_config_t tmp = { CONFIG_ITEM_BOOL, NULL, name, ch, text, ltext, NULL, b_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc;} i_config++
+    i_config++; \
+    { static module_config_t tmp = { CONFIG_ITEM_BOOL, NULL, name, '\0', text, longtext, NULL, b_value }; p_config[ i_config ] = tmp; p_config[ i_config ].pf_callback = p_callback; p_config[i_config].b_advanced = advc; }
+
+/* Modifier macros for the config options (used for fine tuning) */
+#define change_short( ch ) \
+    p_config[i_config].i_short = ch;
+
+#define change_string_list( list, list_text, list_update_func ) \
+    p_config[i_config].i_list = sizeof(list)/sizeof(char *); \
+    p_config[i_config].ppsz_list = list; \
+    p_config[i_config].ppsz_list_text = list_text; \
+    p_config[i_config].pf_list_update = list_update_func;
+
+#define change_integer_list( list, list_text, list_update_func ) \
+    p_config[i_config].i_list = sizeof(list)/sizeof(int); \
+    p_config[i_config].pi_list = list; \
+    p_config[i_config].ppsz_list_text = list_text; \
+    p_config[i_config].pf_list_update = list_update_func;
index 0cb4623fa27a7554e3b8035777993a5ce5eae49b..de60221bacb3830f6eaaa8ef74b2e7970561abc4 100644 (file)
@@ -2,7 +2,7 @@
  * modules_inner.h : Macros used from within a module.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules_inner.h,v 1.39 2003/10/30 21:44:48 gbazin Exp $
+ * $Id: modules_inner.h,v 1.40 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -91,7 +91,7 @@
     EXTERN_SYMBOL DLL_SYMBOL int CDECL_SYMBOL                                 \
     __VLC_SYMBOL(vlc_entry) ( module_t *p_module )                            \
     {                                                                         \
-        int i_shortcut = 1, i_config = 0;                                     \
+        int i_shortcut = 1, i_config = -1;                                    \
         module_config_t p_config[ 130 ];                                      \
         STORE_SYMBOLS;                                                        \
         p_module->b_submodule = VLC_FALSE;                                    \
         }                                                                     \
         {                                                                     \
             static module_config_t tmp = { CONFIG_HINT_END };                 \
-            p_config[ i_config ] = tmp;                                       \
+            p_config[ ++i_config ] = tmp;                                     \
         }                                                                     \
         config_Duplicate( p_module, p_config );                               \
         if( p_module->p_config == NULL )                                      \
index 94dbfb9205eb1e543924fc925a57090bc98c8f11..4ebb0eab6a140bef3e72fb7076874257ef6eb8f3 100644 (file)
@@ -2,7 +2,7 @@
  * dvd.c : DVD input module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dvd.c,v 1.8 2003/06/17 16:09:16 gbazin Exp $
+ * $Id: dvd.c,v 1.9 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -79,14 +79,18 @@ static void UnprobeLibDVDCSS( void );
            "libcss.\n" \
     "The default method is: key.")
 
-static char *cssmethod_list[] = { "title", "disc", "key", NULL };
+static char *psz_css_list[] = { "title", "disc", "key" };
+static char *psz_css_list_text[] = { N_("title"), N_("Disc"), N_("Key") };
 
 vlc_module_begin();
     int i;
     add_usage_hint( N_("[dvd:][device][@raw_device][@[title][,[chapter][,angle]]]") );
     add_category_hint( N_("dvd"), NULL, VLC_TRUE );
-    add_string_from_list( "dvdcss-method", NULL, cssmethod_list, NULL,
-                          CSSMETHOD_TEXT, CSSMETHOD_LONGTEXT, VLC_TRUE );
+
+    add_string( "dvdcss-method", NULL, NULL, CSSMETHOD_TEXT,
+                CSSMETHOD_LONGTEXT, VLC_TRUE );
+        change_string_list( psz_css_list, psz_css_list_text, 0 );
+
 #ifdef GOD_DAMN_DMCA
     set_description( _("DVD input (uses libdvdcss if installed)") );
     i = 90;
index 268fad03b0545413e5c51350a670aa42d97862a8..f52c3362ba60808023c7e33ec448759b70704d3c 100644 (file)
@@ -2,7 +2,7 @@
  * file.c : audio output which writes the samples to a file
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: file.c,v 1.23 2003/10/25 00:49:13 sam Exp $
+ * $Id: file.c,v 1.24 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -89,7 +89,7 @@ static void    Play        ( aout_instance_t * );
 
 static char *format_list[] = { "u8", "s8", "u16", "s16", "u16_le", "s16_le",
                                "u16_be", "s16_be", "fixed32", "float32",
-                               "spdif", NULL };
+                               "spdif" };
 static int format_int[] = { VLC_FOURCC('u','8',' ',' '),
                             VLC_FOURCC('s','8',' ',' '),
                             AOUT_FMT_U16_NE, AOUT_FMT_S16_NE,
@@ -106,8 +106,9 @@ static int format_int[] = { VLC_FOURCC('u','8',' ',' '),
 
 vlc_module_begin();
     add_category_hint( N_("Audio"), NULL, VLC_FALSE );
-    add_string_from_list( "audiofile-format", "s16", format_list, NULL,
-                          FORMAT_TEXT, FORMAT_LONGTEXT, VLC_TRUE );
+    add_string( "audiofile-format", "s16", NULL,
+                FORMAT_TEXT, FORMAT_LONGTEXT, VLC_TRUE );
+        change_string_list( format_list, 0, 0 );
     add_file( "audiofile", "audiofile.wav", NULL, FILE_TEXT,
               FILE_LONGTEXT, VLC_FALSE );
     add_bool( "audiofile-wav", 1, NULL, WAV_TEXT, WAV_LONGTEXT, VLC_TRUE );
index dd9115e7a02c9702186a602abd1451eb894bc1ad..7691afe8a804a03ac23d2f38106791e2c13ee057 100644 (file)
@@ -2,7 +2,7 @@
  * subsdec.c : text subtitles decoder
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: subsdec.c,v 1.4 2003/11/05 00:17:50 hartman Exp $
+ * $Id: subsdec.c,v 1.5 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Samuel Hocevar <sam@zoy.org>
@@ -89,13 +89,16 @@ static char *ppsz_encodings[] = { DEFAULT_NAME, "ASCII", "UTF-8", "",
     "C99", "JAVA", "UCS-2", "UCS-2BE", "UCS-2LE", "UCS-4", "UCS-4BE", "UCS-4LE", "",
     "HZ", "GBK", "GB18030", "JOHAB", "ARMSCII-8",
     "Georgian-Academy", "Georgian-PS", "TIS-620", "MuleLao-1", "VISCII", "TCVN",
-    "HPROMAN8", "NEXTSTEP", NULL };
+    "HPROMAN8", "NEXTSTEP" };
 #endif
 
+static int  pi_justification[] = { 0, 1, 2 };
+static char *ppsz_justification_text[] = {N_("Center"),N_("Left"),N_("Right")};
+
 #define ENCODING_TEXT N_("Subtitles text encoding")
 #define ENCODING_LONGTEXT N_("Change the encoding used in text subtitles")
 #define ALIGN_TEXT N_("Subtitles justification")
-#define ALIGN_LONGTEXT N_("Change the justification of substitles (0=center, 1=left, 2=right)")
+#define ALIGN_LONGTEXT N_("Change the justification of substitles")
 
 vlc_module_begin();
     set_description( _("text subtitles decoder") );
@@ -103,9 +106,13 @@ vlc_module_begin();
     set_callbacks( OpenDecoder, NULL );
 
     add_category_hint( N_("Subtitles"), NULL, VLC_FALSE );
-    add_integer( "subsdec-align", 0, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE );
+    add_integer( "subsdec-align", 0, NULL, ALIGN_TEXT, ALIGN_LONGTEXT,
+                 VLC_TRUE );
+        change_integer_list( pi_justification, ppsz_justification_text, 0 );
 #if defined(HAVE_ICONV)
-    add_string_from_list( "subsdec-encoding", DEFAULT_NAME, ppsz_encodings, NULL, ENCODING_TEXT, ENCODING_LONGTEXT, VLC_FALSE );
+    add_string( "subsdec-encoding", DEFAULT_NAME, NULL,
+                ENCODING_TEXT, ENCODING_LONGTEXT, VLC_FALSE );
+        change_string_list( ppsz_encodings, 0, 0 );
 #endif
 vlc_module_end();
 
index 8ba41ada322217a7c3e27522cb2f62f39a0c4976..9db5b98ac91b9b0f033d8ab40b323b62c238080f 100644 (file)
@@ -2,7 +2,7 @@
  * geatures.c: control vlc with mouse gestures
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: gestures.c,v 1.5 2003/06/22 13:27:41 sigmunau Exp $
+ * $Id: gestures.c,v 1.6 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -83,13 +83,15 @@ static void RunIntf        ( intf_thread_t *p_intf );
 #define BUTTON_LONGTEXT N_( \
     "the mouse button to be held down during mouse gestures" )
 
-static char *button_list[] = { "left", "middle", "right", NULL };
+static char *button_list[] = { "left", "middle", "right" };
+static char *button_list_text[] = { N_("Left"), N_("Middle"), N_("Right") };
 
 vlc_module_begin();
     add_category_hint( N_( "Gestures" ), NULL, VLC_FALSE );
     add_integer( "gestures-threshold", 30, NULL, THRESHOLD_TEXT, THRESHOLD_LONGTEXT, VLC_TRUE );
-    add_string_from_list( "gestures-button", "right", button_list, NULL,
-                          BUTTON_TEXT, BUTTON_LONGTEXT, VLC_FALSE );
+    add_string( "gestures-button", "right", NULL,
+                BUTTON_TEXT, BUTTON_LONGTEXT, VLC_FALSE );
+        change_string_list( button_list, button_list_text, 0 );
     set_description( _("mouse gestures control interface") );
 
     set_capability( "interface", 0 );
index 0d3e48893237d68c2bfc1d64d2a12f4a9d702396..72ea0cc7634f6a3f68467ad0e8868a3e84672bf0 100644 (file)
@@ -2,7 +2,7 @@
  * mkv.cpp : matroska demuxer
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: mkv.cpp,v 1.36 2003/11/05 00:17:50 hartman Exp $
+ * $Id: mkv.cpp,v 1.37 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -1249,7 +1249,7 @@ static int Open( vlc_object_t * p_this )
                  !strcmp( tk.psz_codec, "S_ASS" ))
         {
             tk.i_codec = VLC_FOURCC( 's', 's', 'a', ' ' );
-            tk.p_es->p_demux_data = malloc( sizeof( subtitle_data_t ) );
+            tk.p_es->p_demux_data = (es_sys_t *)malloc( sizeof( subtitle_data_t ) );
             tk.p_es->p_demux_data->psz_header = strdup( (char *)tk.p_extra_data );
         }
         else if( !strcmp( tk.psz_codec, "S_VOBSUB" ) )
index a044e90df314de11dfcde67b595215aa249c3c1b..624bfd0f867608574301dcc37e6c119537de1730 100644 (file)
@@ -2,7 +2,7 @@
  * sub.c
  *****************************************************************************
  * Copyright (C) 1999-2003 VideoLAN
- * $Id: sub.c,v 1.34 2003/11/05 00:17:50 hartman Exp $
+ * $Id: sub.c,v 1.35 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
@@ -53,9 +53,8 @@ static void sub_close( subtitle_demux_t *p_sub );
 
 static void sub_fix( subtitle_demux_t *p_sub );
 
-static char *ppsz_sub_type[] = { "auto", "microdvd", "subrip", "ssa1", "ssa2-4",
-                                 "vplayer", "sami", "vobsub", NULL };
-
+static char *ppsz_sub_type[] = { "auto", "microdvd", "subrip", "ssa1",
+  "ssa2-4", "vplayer", "sami", "vobsub" };
 
 /*****************************************************************************
  * Module descriptor
@@ -79,9 +78,9 @@ vlc_module_begin();
         add_integer( "sub-delay", 0, NULL,
                      "Delay subtitles (in 1/10s)",
                      SUB_DELAY_LONGTEXT, VLC_TRUE );
-        add_string_from_list( "sub-type", "auto", ppsz_sub_type, NULL,
-                              "subtitles type",
-                              SUB_TYPE_LONGTEXT, VLC_TRUE );
+        add_string( "sub-type", "auto", NULL, "subtitles type",
+                    SUB_TYPE_LONGTEXT, VLC_TRUE );
+            change_string_list( ppsz_sub_type, 0, 0 );
     set_callbacks( Open, NULL );
 vlc_module_end();
 
index a8e29860f100baab17391b9c15e69d1fa8cb7e27..8199736bb425dbb260708bce7d4b53dfb0fc5745 100644 (file)
@@ -2,11 +2,11 @@
  * beos.cpp : BeOS plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: BeOS.cpp,v 1.12 2003/06/17 16:09:16 gbazin Exp $
+ * $Id: BeOS.cpp,v 1.13 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
- *          Stephan Aßmus <stippi@yellowbites.com>
+ *          Stephan AÃ\83Â\9fmus <stippi@yellowbites.com>
  *
  * 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
@@ -46,12 +46,14 @@ void E_(CloseVideo)   ( vlc_object_t * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static char * ppsz_screenshotformat[] = { "TGA", "PPM", "PNG", "JPEG", "BMP", NULL };
+static char * ppsz_screenshotformat[] = { "TGA", "PPM", "PNG", "JPEG", "BMP" };
 
 vlc_module_begin();
     add_bool( "beos-dvdmenus", 0, NULL, "Use DVD Menus", "", VLC_TRUE );
     add_string( "beos-screenshotpath", "/boot/home/", NULL, "Screenshot Path", "", VLC_TRUE );
-    add_string_from_list( "beos-screenshotformat", "PNG", ppsz_screenshotformat, NULL, "Screenshot Format", "", VLC_TRUE );
+    add_string( "beos-screenshotformat", "PNG",  NULL, "Screenshot Format",
+                "", VLC_TRUE );
+        change_string_list( ppsz_screenshotformat, 0, 0 );
     set_description( _("BeOS standard API interface") );
     set_capability( "interface", 100 );
     set_callbacks( E_(OpenIntf), E_(CloseIntf) );
index c572e063967f4654d6d0ab0b20bba101b5ece3f5..a4b388561ce14628be2c468a2e28330b09265a58 100644 (file)
@@ -2,7 +2,7 @@
  * preferences_widgets.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: preferences_widgets.cpp,v 1.9 2003/11/02 22:16:32 gbazin Exp $
+ * $Id: preferences_widgets.cpp,v 1.10 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Sigmund Augdal <sigmunau@idi.ntnu.no>
@@ -53,7 +53,7 @@ ConfigControl *CreateConfigControl( vlc_object_t *p_this,
         break;
 
     case CONFIG_ITEM_STRING:
-        if( !p_item->ppsz_list )
+        if( !p_item->i_list )
         {
             p_control = new StringConfigControl( p_item, parent );
         }
@@ -69,7 +69,11 @@ ConfigControl *CreateConfigControl( vlc_object_t *p_this,
         break;
 
     case CONFIG_ITEM_INTEGER:
-        if( p_item->i_min != 0 || p_item->i_max != 0 )
+        if( p_item->i_list )
+        {
+            p_control = new IntegerListConfigControl( p_item, parent );
+        }
+        else if( p_item->i_min != 0 || p_item->i_max != 0 )
         {
             p_control = new RangedIntConfigControl( p_item, parent );
         }
@@ -359,22 +363,29 @@ StringListConfigControl::StringListConfigControl( module_config_t *p_item,
 {
     label = new wxStaticText(this, -1, wxU(p_item->psz_text));
     sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
-    combo = new wxComboBox( this, -1, wxU(p_item->psz_value),
+    combo = new wxComboBox( this, -1, wxT(""),
                             wxDefaultPosition, wxDefaultSize,
                             0, NULL, wxCB_READONLY );
 
     /* build a list of available options */
-    for( int i_index = 0; p_item->ppsz_list[i_index];
-         i_index++ )
+    for( int i_index = 0; i_index < p_item->i_list; i_index++ )
     {
-        combo->Append( wxU(p_item->ppsz_list[i_index]) );
+        combo->Append( ( p_item->ppsz_list_text &&
+                         p_item->ppsz_list_text[i_index] ) ?
+                       wxU(p_item->ppsz_list_text[i_index]) :
+                       wxU(p_item->ppsz_list[i_index]) );
+        combo->SetClientData( i_index, (void *)p_item->ppsz_list[i_index] );
         if( p_item->psz_value && !strcmp( p_item->psz_value,
                                           p_item->ppsz_list[i_index] ) )
+        {
             combo->SetSelection( i_index );
+            combo->SetValue( ( p_item->ppsz_list_text &&
+                               p_item->ppsz_list_text[i_index] ) ?
+                             wxU(p_item->ppsz_list_text[i_index]) :
+                             wxU(p_item->ppsz_list[i_index]) );
+        }
     }
 
-    if( p_item->psz_value )
-        combo->SetValue( wxU(p_item->psz_value) );
     combo->SetToolTip( wxU(p_item->psz_longtext) );
     sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
     sizer->Layout();
@@ -388,7 +399,12 @@ StringListConfigControl::~StringListConfigControl()
 
 wxString StringListConfigControl::GetPszValue()
 {
-    return combo->GetStringSelection();
+    int selected = combo->GetSelection();
+    if( selected != -1 )
+    {
+        return (char *)combo->GetClientData( selected );
+    }
+    return wxString();
 }
 
 /*****************************************************************************
@@ -484,6 +500,60 @@ int IntegerConfigControl::GetIntValue()
     return spin->GetValue();
 }
 
+/*****************************************************************************
+ * IntegerListConfigControl implementation
+ *****************************************************************************/
+IntegerListConfigControl::IntegerListConfigControl( module_config_t *p_item,
+                                                    wxWindow *parent )
+  : ConfigControl( p_item, parent )
+{
+    label = new wxStaticText(this, -1, wxU(p_item->psz_text));
+    sizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
+    combo = new wxComboBox( this, -1, wxT(""),
+                            wxDefaultPosition, wxDefaultSize,
+                            0, NULL, wxCB_READONLY );
+
+    /* build a list of available options */
+    for( int i_index = 0; i_index < p_item->i_list; i_index++ )
+    {
+        combo->Append( ( p_item->ppsz_list_text &&
+                         p_item->ppsz_list_text[i_index] ) ?
+                       wxU(p_item->ppsz_list_text[i_index]) :
+                       wxString::Format(wxT("%i"),
+                                        p_item->pi_list[i_index]) );
+        combo->SetClientData( i_index, (void *)p_item->pi_list[i_index] );
+        if( p_item->i_value == p_item->pi_list[i_index] )
+        {
+            combo->SetSelection( i_index );
+            combo->SetValue( ( p_item->ppsz_list_text &&
+                               p_item->ppsz_list_text[i_index] ) ?
+                             wxU(p_item->ppsz_list_text[i_index]) :
+                             wxString::Format(wxT("%i"),
+                                              p_item->pi_list[i_index]) );
+        }
+    }
+
+    combo->SetToolTip( wxU(p_item->psz_longtext) );
+    sizer->Add( combo, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );    
+    sizer->Layout();
+    this->SetSizerAndFit( sizer );
+}
+
+IntegerListConfigControl::~IntegerListConfigControl()
+{
+    ;
+}
+
+int IntegerListConfigControl::GetIntValue()
+{
+    int selected = combo->GetSelection();
+    if( selected != -1 )
+    {
+        return (int)combo->GetClientData( selected );
+    }
+    return -1;
+}
+
 /*****************************************************************************
  * RangedIntConfigControl implementation
  *****************************************************************************/
index 11887943a5c2e27844c61fd2a9efd7c87bcfcd14..e6ad20dac235bd70b9ce0d45c74c9915b3745c22 100644 (file)
@@ -2,7 +2,7 @@
  * preferences_widgets.h : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2003 VideoLAN
- * $Id: preferences_widgets.h,v 1.3 2003/10/20 12:25:22 gbazin Exp $
+ * $Id: preferences_widgets.h,v 1.4 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -117,6 +117,16 @@ private:
     wxSpinCtrl *spin;
 };
 
+class IntegerListConfigControl: public ConfigControl
+{
+public:
+    IntegerListConfigControl( module_config_t *p_item, wxWindow *parent );
+    ~IntegerListConfigControl();
+    virtual int GetIntValue();
+private:
+    wxComboBox *combo;
+};
+
 class RangedIntConfigControl: public ConfigControl
 {
 public:
index ae243dbc22fb5c80ac4eef47a42d6bbd9ec3c135..8080ea70a6be07eccd30d03d94660818a3cfaaaf 100644 (file)
@@ -2,7 +2,7 @@
  * freetype.c : Put text on the video, using freetype2
  *****************************************************************************
  * Copyright (C) 2002, 2003 VideoLAN
- * $Id: freetype.c,v 1.30 2003/10/29 12:23:50 gbazin Exp $
+ * $Id: freetype.c,v 1.31 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -89,13 +89,17 @@ static line_desc_t *NewLine( byte_t * );
 #define FONTSIZE_TEXT N_("Font size")
 #define FONTSIZE_LONGTEXT N_("The size of the fonts used by the osd module" )
 
-static char *ppsz_sizes[] = { "smaller", "small", "normal", "large", "larger", NULL};
+static char *ppsz_sizes[] = { "smaller", "small", "normal", "large", "larger"};
+static char *ppsz_sizes_text[] = { N_("Smaller"), N_("Small"), N_("Normal"),
+                                   N_("Large"), N_("Larger") };
 
 vlc_module_begin();
     add_category_hint( N_("Fonts"), NULL, VLC_FALSE );
     add_file( "freetype-font", DEFAULT_FONT, NULL, FONT_TEXT, FONT_LONGTEXT, VLC_FALSE );
     add_integer( "freetype-fontsize", 16, NULL, FONTSIZE_TEXT, FONTSIZE_LONGTEXT, VLC_TRUE );
-    add_string_from_list( "freetype-rel-fontsize", "normal", ppsz_sizes, NULL, FONTSIZE_TEXT, FONTSIZE_LONGTEXT, VLC_FALSE );
+    add_string( "freetype-rel-fontsize", "normal", NULL, FONTSIZE_TEXT,
+                FONTSIZE_LONGTEXT, VLC_FALSE );
+        change_string_list( ppsz_sizes, ppsz_sizes_text, 0 );
     set_description( _("freetype2 font renderer") );
     set_capability( "text renderer", 100 );
     add_shortcut( "text" );
index 69ca66b56627c760716be20b40e4f00fb6a7fb4d..c9ae2677fbf9b295a4dfedc156a6d55ed801b318 100644 (file)
@@ -2,7 +2,7 @@
  * logger.c : file logging plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: logger.c,v 1.8 2003/05/15 22:27:37 massiot Exp $
+ * $Id: logger.c,v 1.9 2003/11/05 00:39:16 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -81,14 +81,18 @@ static void HtmlPrint         ( const msg_item_t *, FILE * );
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-static char *mode_list[] = { "text", "html", NULL };
+static char *mode_list[] = { "text", "html" };
+static char *mode_list_text[] = { N_("Text"), N_("Html") };
+
 #define LOGMODE_TEXT N_("Log format")
 #define LOGMODE_LONGTEXT N_("Specify the log format. Available choices are \"text\" (default) and \"html\"")
 
 vlc_module_begin();
     add_category_hint( N_("Miscellaneous"), NULL, VLC_FALSE );
     add_file( "logfile", NULL, NULL, N_("log filename"), N_("Specify the log filename."), VLC_FALSE );
-    add_string_from_list( "logmode", "text", mode_list, NULL, LOGMODE_TEXT, LOGMODE_LONGTEXT, VLC_FALSE );
+    add_string( "logmode", "text", NULL, LOGMODE_TEXT, LOGMODE_LONGTEXT,
+                VLC_FALSE );
+        change_string_list( mode_list, mode_list_text, 0 );
     set_description( _("file logging interface") );
     set_capability( "interface", 0 );
     set_callbacks( Open, Close );
index 57057aa254ec826278215271d7ce05b48a6edea3..d81725b2205e0d78ce4403a6843afabb5ddf9e83 100644 (file)
@@ -2,7 +2,7 @@
  * deinterlace.c : deinterlacer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: deinterlace.c,v 1.15 2003/10/15 22:49:48 gbazin Exp $
+ * $Id: deinterlace.c,v 1.16 2003/11/05 00:39:17 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -75,12 +75,15 @@ static int FilterCallback ( vlc_object_t *, char const *,
 #define MODE_TEXT N_("Deinterlace mode")
 #define MODE_LONGTEXT N_("You can choose the default deinterlace mode")
 
-static char *mode_list[] = { "discard", "blend", "mean", "bob", "linear", NULL };
+static char *mode_list[] = { "discard", "blend", "mean", "bob", "linear" };
+static char *mode_list_text[] = { N_("discard"), N_("Blend"), N_("Mean"),
+                                  N_("Bob"), N_("Linear") };
 
 vlc_module_begin();
     add_category_hint( N_("Deinterlace"), NULL, VLC_FALSE );
-    add_string_from_list( "deinterlace-mode", "discard", mode_list, NULL,
-                          MODE_TEXT, MODE_LONGTEXT, VLC_FALSE );
+    add_string( "deinterlace-mode", "discard", NULL, MODE_TEXT,
+                MODE_LONGTEXT, VLC_FALSE );
+        change_string_list( mode_list, mode_list_text, 0 );
     set_description( _("video deinterlacing filter") );
     set_capability( "video filter", 0 );
     add_shortcut( "deinterlace" );
index f4d8958e08a97c33fa0ba5e0356fb922f7f2565b..3e88c813e36df7cc8a5af49980ebe538864e8162 100644 (file)
@@ -2,7 +2,7 @@
  * distort.c : Misc video effects plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: distort.c,v 1.11 2003/10/15 22:49:48 gbazin Exp $
+ * $Id: distort.c,v 1.12 2003/11/05 00:39:17 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -59,12 +59,14 @@ static int  SendEvents   ( vlc_object_t *, char const *,
 #define MODE_TEXT N_("Distort mode")
 #define MODE_LONGTEXT N_("Distort mode, one of \"wave\" and \"ripple\"")
 
-static char *mode_list[] = { "wave", "ripple", NULL };
+static char *mode_list[] = { "wave", "ripple" };
+static char *mode_list_text[] = { N_("Wave"), N_("Ripple") };
 
 vlc_module_begin();
     add_category_hint( N_("Distort"), NULL, VLC_FALSE );
-    add_string_from_list( "distort-mode", "wave", mode_list, NULL,
-                          MODE_TEXT, MODE_LONGTEXT, VLC_FALSE );
+    add_string( "distort-mode", "wave", NULL, MODE_TEXT, MODE_LONGTEXT,
+                VLC_FALSE );
+        change_string_list( mode_list, mode_list_text, 0 );
     set_description( _("miscellaneous distort video effects filter") );
     set_capability( "video filter", 0 );
     add_shortcut( "distort" );
index a90fdff441f060874bb19424408cf911f851e83c..eee0367c8bbe8b90adbcd685e7fcdae596aa4a52 100644 (file)
@@ -2,7 +2,7 @@
  * transform.c : transform image plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001, 2002, 2003 VideoLAN
- * $Id: transform.c,v 1.14 2003/10/15 22:49:48 gbazin Exp $
+ * $Id: transform.c,v 1.15 2003/11/05 00:39:17 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -57,12 +57,15 @@ static int  SendEvents( vlc_object_t *, char const *,
 #define TYPE_TEXT N_("Transform type")
 #define TYPE_LONGTEXT N_("One of '90', '180', '270', 'hflip' and 'vflip'")
 
-static char *type_list[] = { "90", "180", "270", "hflip", "vflip", NULL };
+static char *type_list[] = { "90", "180", "270", "hflip", "vflip" };
+static char *type_list_text[] = { N_("Rotate by 90°"), N_("Rotate by 1800"),
+  N_("Rotate by 270°"), N_("Flip horizontally"), N_("Flip vertically") };
 
 vlc_module_begin();
     add_category_hint( N_("Miscellaneous"), NULL, VLC_FALSE );
-    add_string_from_list( "transform-type", "90", type_list, NULL,
+    add_string( "transform-type", "90", NULL,
                           TYPE_TEXT, TYPE_LONGTEXT, VLC_FALSE);
+        change_string_list( type_list, type_list_text, 0);
     set_description( _("video transformation filter") );
     set_capability( "video filter", 0 );
     add_shortcut( "transform" );
index fe5daf774aeed42c541bef483f385a250bd656e2..483140ea7c7089cc045802a14898194e4873f217 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.100 2003/10/30 22:34:48 hartman Exp $
+ * $Id: libvlc.h,v 1.101 2003/11/05 00:39:17 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #define Nothing here, this is just to prevent update-po from being stupid
 #include "vlc_keys.h"
 
-static char *ppsz_language[] = { "auto", "en", "en_GB", "es", "de", "fr", "it", "ja",
-                                "nl", "no", "pl", "pt_BR", "ru", "sv", NULL };
+static char *ppsz_language[] =
+{ "auto", "en", "en_GB", "es", "de", "fr", "it", "ja",
+  "nl", "no", "pl", "pt_BR", "ru", "sv" };
+static char *ppsz_language_text[] =
+{ N_("Auto"), N_("English US"), N_("English GB"), N_("Spanish"), N_("German"),
+  N_("French"), N_("Italian"), N_("Japanese"), N_("Dutch"), N_("Norwegian"),
+  N_("Polish"), N_("Portugese BR"), N_("Russian"), N_("Swedish") };
 
 /*****************************************************************************
  * Configuration options for the main program. Each module will also separatly
@@ -584,16 +589,19 @@ static char *ppsz_language[] = { "auto", "en", "en_GB", "es", "de", "fr", "it",
 vlc_module_begin();
     /* Interface options */
     add_category_hint( N_("Interface"), INTF_CAT_LONGTEXT , VLC_FALSE );
-    add_module_with_short( "intf", 'I', "interface", NULL, NULL,
-                           INTF_TEXT, INTF_LONGTEXT, VLC_TRUE );
+    add_module( "intf", "interface", NULL, NULL, INTF_TEXT,
+                INTF_LONGTEXT, VLC_TRUE );
+        change_short('I');
     add_string( "extraintf", NULL, NULL, EXTRAINTF_TEXT, 
                      EXTRAINTF_LONGTEXT, VLC_FALSE );
-    add_integer_with_short( "verbose", 'v', 0, NULL,
-                            VERBOSE_TEXT, VERBOSE_LONGTEXT, VLC_FALSE );
-    add_bool_with_short( "quiet", 'q', 0, NULL, QUIET_TEXT, 
-                            QUIET_LONGTEXT, VLC_TRUE );
-    add_string_from_list( "language", "auto", ppsz_language, NULL,
-                            LANGUAGE_TEXT, LANGUAGE_LONGTEXT, VLC_FALSE );
+    add_integer( "verbose", 0, NULL, VERBOSE_TEXT, VERBOSE_LONGTEXT,
+                 VLC_FALSE );
+        change_short('v');
+    add_bool( "quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, VLC_TRUE );
+        change_short('q');
+    add_string( "language", "auto", NULL, LANGUAGE_TEXT, LANGUAGE_LONGTEXT,
+                VLC_FALSE );
+        change_string_list( ppsz_language, ppsz_language_text, 0 );
     add_bool( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
     add_bool( "advanced", 0, NULL, ADVANCED_TEXT, 
                             ADVANCED_LONGTEXT, VLC_FALSE );
@@ -604,8 +612,9 @@ vlc_module_begin();
 
     /* Audio options */
     add_category_hint( N_("Audio"), AOUT_CAT_LONGTEXT , VLC_FALSE );
-    add_module_with_short( "aout", 'A', "audio output", NULL, NULL,
-                           AOUT_TEXT, AOUT_LONGTEXT, VLC_TRUE);
+    add_module( "aout", "audio output", NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT,
+                VLC_TRUE );
+        change_short('A');
     add_bool( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT, VLC_FALSE );
     add_integer_with_range( "volume", AOUT_VOLUME_DEFAULT, AOUT_VOLUME_MIN,
                             AOUT_VOLUME_MAX, NULL, VOLUME_TEXT,
@@ -628,8 +637,9 @@ vlc_module_begin();
     
     /* Video options */
     add_category_hint( N_("Video"), VOUT_CAT_LONGTEXT , VLC_FALSE );
-    add_module_with_short( "vout", 'V', "video output", NULL, NULL,
-                           VOUT_TEXT, VOUT_LONGTEXT, VLC_TRUE );
+    add_module( "vout", "video output", NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT,
+                VLC_TRUE );
+        change_short('V');
     add_bool( "video", 1, NULL, VIDEO_TEXT, VIDEO_LONGTEXT, VLC_TRUE );
     add_integer( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_TRUE );
     add_integer( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_TRUE );
@@ -678,8 +688,10 @@ vlc_module_begin();
     add_file( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT, VLC_FALSE );
     add_file( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT, VLC_FALSE );
 
-    add_bool_with_short( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE );
-    add_bool_with_short( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT, VLC_FALSE );
+    add_bool( "ipv6", 0, NULL, IPV6_TEXT, IPV6_LONGTEXT, VLC_FALSE );
+        change_short('6');
+    add_bool( "ipv4", 0, NULL, IPV4_TEXT, IPV4_LONGTEXT, VLC_FALSE );
+        change_short('4');
 
     /* Decoder options */
     add_category_hint( N_("Decoders"), CODEC_CAT_LONGTEXT , VLC_TRUE );
@@ -722,9 +734,12 @@ vlc_module_begin();
 
     /* Playlist options */
     add_category_hint( N_("Playlist"), PLAYLIST_CAT_LONGTEXT , VLC_FALSE );
-    add_bool_with_short( "random", 'Z', 0, NULL, RANDOM_TEXT, RANDOM_LONGTEXT, VLC_FALSE );
-    add_bool_with_short( "loop", 'L', 0, NULL, LOOP_TEXT, LOOP_LONGTEXT, VLC_FALSE );
-    add_bool_with_short( "repeat", 'R', 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE );
+    add_bool( "random", 0, NULL, RANDOM_TEXT, RANDOM_LONGTEXT, VLC_FALSE );
+        change_short('Z');
+    add_bool( "loop", 0, NULL, LOOP_TEXT, LOOP_LONGTEXT, VLC_FALSE );
+        change_short('L');
+    add_bool( "repeat", 0, NULL, REPEAT_TEXT, REPEAT_LONGTEXT, VLC_TRUE );
+        change_short('R');
 
     /* Misc options */
     add_category_hint( N_("Miscellaneous"), MISC_CAT_LONGTEXT, VLC_TRUE );
index 6be2cf5e89230fba0a47126fe53b8859f9e6ac06..441834f2635e241fb5531ecd64eff8649c207f73 100644 (file)
@@ -2,7 +2,7 @@
  * configuration.c management of the modules configuration
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: configuration.c,v 1.66 2003/10/29 01:33:27 gbazin Exp $
+ * $Id: configuration.c,v 1.67 2003/11/05 00:39:17 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -423,6 +423,34 @@ module_config_t *config_FindConfig( vlc_object_t *p_this, const char *psz_name )
     return NULL;
 }
 
+/*****************************************************************************
+ * config_FindModule: find a specific module structure.
+ *****************************************************************************/
+module_t *config_FindModule( vlc_object_t *p_this, const char *psz_name )
+{
+    vlc_list_t *p_list;
+    module_t *p_module, *p_result = NULL;
+    int i_index;
+
+    if( !psz_name ) return NULL;
+
+    p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+
+    for( i_index = 0; i_index < p_list->i_count; i_index++ )
+    {
+        p_module = (module_t *)p_list->p_values[i_index].p_object;
+        if( !strcmp( p_module->psz_object_name, psz_name ) )
+        {
+             p_result = p_module;
+             break;
+        }
+    }
+
+    vlc_list_release( p_list );
+
+    return p_result;
+}
+
 /*****************************************************************************
  * config_Duplicate: creates a duplicate of a module's configuration data.
  *****************************************************************************
@@ -466,18 +494,7 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig )
     /* Do the duplication job */
     for( i = 0; i < i_lines ; i++ )
     {
-        p_module->p_config[i].i_type = p_orig[i].i_type;
-        p_module->p_config[i].i_short = p_orig[i].i_short;
-        p_module->p_config[i].i_value = p_orig[i].i_value;
-        p_module->p_config[i].i_value_orig = p_orig[i].i_value;
-        p_module->p_config[i].i_min = p_orig[i].i_min;
-        p_module->p_config[i].i_max = p_orig[i].i_max;
-        p_module->p_config[i].f_value = p_orig[i].f_value;
-        p_module->p_config[i].f_value_orig = p_orig[i].f_value;
-        p_module->p_config[i].f_min = p_orig[i].f_min;
-        p_module->p_config[i].f_max = p_orig[i].f_max;
-        p_module->p_config[i].b_dirty = p_orig[i].b_dirty;
-        p_module->p_config[i].b_advanced = p_orig[i].b_advanced;
+        p_module->p_config[i] = p_orig[i];
 
         p_module->p_config[i].psz_type = p_orig[i].psz_type ?
                                    strdup( p_orig[i].psz_type ) : NULL;
@@ -495,18 +512,43 @@ void config_Duplicate( module_t *p_module, module_config_t *p_orig )
         p_module->p_config[i].p_lock = &p_module->object_lock;
 
         /* duplicate the string list */
-        p_module->p_config[i].ppsz_list = NULL;
-        if( p_orig[i].ppsz_list )
+        if( p_orig[i].i_list )
         {
-            for( j = 0; p_orig[i].ppsz_list[j]; j++ );
-            p_module->p_config[i].ppsz_list = malloc( (j+1) *sizeof(char *) );
-            if( p_module->p_config[i].ppsz_list )
+            if( p_orig[i].ppsz_list )
+            {
+                p_module->p_config[i].ppsz_list =
+                    malloc( (p_orig[i].i_list + 1) * sizeof(char *) );
+                if( p_module->p_config[i].ppsz_list )
+                {
+                    for( j = 0; j < p_orig[i].i_list; j++ )
+                        p_module->p_config[i].ppsz_list[j] =
+                            strdup( p_orig[i].ppsz_list[j] );
+                    p_module->p_config[i].ppsz_list[j] = NULL;
+                }
+            }
+            if( p_orig[i].ppsz_list_text )
             {
-                for( j = 0; p_orig[i].ppsz_list[j]; j++ )
-                    p_module->p_config[i].ppsz_list[j] =
-                        strdup( p_orig[i].ppsz_list[j] );
+                p_module->p_config[i].ppsz_list_text =
+                    malloc( (p_orig[i].i_list + 1) * sizeof(char *) );
+                if( p_module->p_config[i].ppsz_list_text )
+                {
+                    for( j = 0; j < p_orig[i].i_list; j++ )
+                        p_module->p_config[i].ppsz_list_text[j] =
+                            strdup( _(p_orig[i].ppsz_list_text[j]) );
+                    p_module->p_config[i].ppsz_list_text[j] = NULL;
+                }
+            }
+            if( p_orig[i].pi_list )
+            {
+                p_module->p_config[i].pi_list =
+                    malloc( (p_orig[i].i_list + 1) * sizeof(int) );
+                if( p_module->p_config[i].pi_list )
+                {
+                    for( j = 0; j < p_orig[i].i_list; j++ )
+                        p_module->p_config[i].pi_list[j] =
+                            p_orig[i].pi_list[j];
+                }
             }
-            p_module->p_config[i].ppsz_list[j] = NULL;
         }
 
         p_module->p_config[i].pf_callback = p_orig[i].pf_callback;
@@ -548,11 +590,18 @@ void config_Free( module_t *p_module )
         if( p_item->psz_value_orig )
             free( p_item->psz_value_orig );
 
-        if( p_item->ppsz_list )
+        if( p_item->i_list )
         {
-            for( i = 0; p_item->ppsz_list[i]; i++ )
-                free(p_item->ppsz_list[i]);
-            free( p_item->ppsz_list );
+            for( i = 0; i < p_item->i_list; i++ )
+            {
+                if( p_item->ppsz_list && p_item->ppsz_list[i] )
+                    free( p_item->ppsz_list[i] );
+                if( p_item->ppsz_list_text && p_item->ppsz_list_text[i] )
+                    free( p_item->ppsz_list_text[i] );
+            }
+            if( p_item->ppsz_list ) free( p_item->ppsz_list );
+            if( p_item->ppsz_list_text ) free( p_item->ppsz_list_text );
+            if( p_item->pi_list ) free( p_item->pi_list );
         }
     }