]> git.sesse.net Git - vlc/commitdiff
This is the first part of the new configuration architecture for vlc.
authorGildas Bazin <gbazin@videolan.org>
Sun, 24 Feb 2002 20:51:10 +0000 (20:51 +0000)
committerGildas Bazin <gbazin@videolan.org>
Sun, 24 Feb 2002 20:51:10 +0000 (20:51 +0000)
Two other parts will follow soon:
- config file implementation
- gtk configuration interface.

This part won't change much for end-users as these changes are mostly
internal, you will however notice that the command line interface has
changed. It will maybe be less user-friendly as I almost removed the
short options but it shouldn't a big problem when the config file is
implemented.

What as changed is that it is really easy now to add configuration
options to vlc. Plugins can also implement configuration options. All
you have to do is to declare a MODULE_CONFIG section in your plugin.
If you want to know more about this look at configuration.h and for some
example: main.c, dsp.c or xvideo.c

It would be nice if every developper could now start using configuration
options in there plugins and also enhance old plugins.

That's it, now let's hope I didn't break too many things ;-)

74 files changed:
Makefile
include/audio_output.h
include/common.h
include/config.h
include/configuration.h [new file with mode: 0644]
include/main.h
include/modules.h
include/modules_inner.h
include/videolan/vlc.h
plugins/a52/a52.c
plugins/ac3_adec/ac3_adec.c
plugins/ac3_adec/ac3_decoder.h
plugins/ac3_spdif/ac3_spdif.c
plugins/alsa/alsa.c
plugins/arts/aout_arts.c
plugins/arts/arts.c
plugins/beos/aout_beos.cpp
plugins/beos/beos.cpp
plugins/beos/vout_beos.cpp
plugins/directx/aout_directx.c
plugins/directx/directx.c
plugins/directx/vout_directx.c
plugins/dsp/aout_dsp.c
plugins/dsp/dsp.c
plugins/dummy/dummy.c
plugins/dummy/null.c
plugins/dvd/input_dvd.c
plugins/dvdread/input_dvdread.c
plugins/esd/aout_esd.c
plugins/esd/esd.c
plugins/fb/fb.c
plugins/filter/deinterlace.c
plugins/filter/distort.c
plugins/filter/invert.c
plugins/filter/transform.c
plugins/filter/wall.c
plugins/ggi/ggi.c
plugins/gtk/gtk_display.c
plugins/gtk/gtk_open.c
plugins/gtk/gtk_preferences.c
plugins/idct/idctclassic.c
plugins/kde/kde.cpp
plugins/kde/kde_interface.cpp
plugins/lirc/lirc.c
plugins/mga/xmga.c
plugins/mpeg_adec/mpeg_adec.c
plugins/mpeg_system/input_ps.c
plugins/mpeg_vdec/video_parser.c
plugins/mpeg_vdec/vpar_synchro.c
plugins/qnx/qnx.c
plugins/qnx/vout_qnx.c
plugins/qt/qt.cpp
plugins/sdl/aout_sdl.c
plugins/text/logger.c
plugins/text/ncurses.c
plugins/vcd/input_vcd.c
plugins/win32/waveout.c
plugins/x11/x11.c
plugins/x11/xcommon.c
plugins/x11/xcommon.h
plugins/x11/xvideo.c
src/audio_output/audio_output.c
src/input/input.c
src/input/input_dec.c
src/input/mpeg_system.c
src/interface/interface.c
src/interface/main.c
src/misc/configuration.c [new file with mode: 0644]
src/misc/modules.c
src/misc/modules_builtin.h.in
src/misc/modules_plugin.h
src/misc/netutils.c
src/video_output/video_output.c
src/video_output/vout_subpictures.c

index 1997460481bc30b022d39bdba545e2693af69548..553928685a16b2ae4a6b6f1af683541af59f8400 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -137,7 +137,7 @@ INTERFACE := main interface intf_msg intf_playlist intf_eject
 INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
 VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
 AUDIO_OUTPUT := audio_output aout_common aout_ext-dec aout_spdif
-MISC := mtime modules netutils iso_lang
+MISC := mtime modules configuration netutils iso_lang
 
 C_OBJ :=       $(INTERFACE:%=src/interface/%.o) \
                $(INPUT:%=src/input/%.o) \
index be1f5bf2f3f207775a6276a673647056dd1d8276..d61c51ea32f6b5afd80dcb09b2789445ce22d92a 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.h : audio output thread interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: audio_output.h,v 1.41 2002/01/14 12:15:10 asmax Exp $
+ * $Id: audio_output.h,v 1.42 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -158,10 +158,6 @@ typedef struct aout_thread_s
      * will be played */
     mtime_t             date;
 
-    /* Path to the audio output device (default is set to "/dev/dsp") */
-    char *              psz_device;
-    int                 i_fd;
-
     /* The current volume */
     int                 i_volume;
     int                 i_savedvolume;
index 9fc60221d819d2408272df0b4eb094574bf01a20..368cb635456935239248e2b9d577d4d313c72615 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.75 2002/02/20 23:23:53 sam Exp $
+ * $Id: common.h,v 1.76 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -98,9 +98,12 @@ typedef struct plugin_info_s *          p_plugin_info_t;
 struct playlist_s;
 struct playlist_item_s;
 struct module_s;
+struct module_config_s;
 
 typedef struct playlist_s *             p_playlist_t;
 typedef struct playlist_item_s *        p_playlist_item_t;
+typedef struct module_s *               p_module_t;
+typedef struct module_config_s *        p_module_config_t;
 
 /* Interface */
 struct intf_thread_s;
@@ -441,10 +444,13 @@ typedef struct module_symbols_s
     struct aout_bank_s*  p_aout_bank;
     struct vout_bank_s*  p_vout_bank;
 
-    int    ( * main_GetIntVariable ) ( char *, int );
-    char * ( * main_GetPszVariable ) ( char *, char * );
-    void   ( * main_PutIntVariable ) ( char *, int );
-    void   ( * main_PutPszVariable ) ( char *, char * );
+    int    ( * config_GetIntVariable ) ( const char * );
+    char * ( * config_GetPszVariable ) ( const char * );
+    void   ( * config_PutIntVariable ) ( const char *, int );
+    void   ( * config_PutPszVariable ) ( const char *, char * );
+    struct module_config_s * ( * config_FindConfig ) ( const char * );
+    struct module_config_s * ( * config_Duplicate ) ( struct module_config_s *,
+                                                      int );
 
     struct intf_subscription_s * ( * intf_MsgSub ) ( void );
     void ( * intf_MsgUnsub )   ( struct intf_subscription_s * );
@@ -463,9 +469,9 @@ typedef struct module_symbols_s
     void ( * intf_UrlDecode )       ( char * );
     int  ( * intf_Eject )           ( const char * );
 
-    void    ( * msleep )         ( mtime_t );
-    mtime_t ( * mdate )          ( void );
-    char  * ( * mstrtime )        ( char *, mtime_t );
+    void    ( * msleep )            ( mtime_t );
+    mtime_t ( * mdate )             ( void );
+    char  * ( * mstrtime )          ( char *, mtime_t );
 
     int  ( * network_ChannelCreate )( void );
     int  ( * network_ChannelJoin )  ( int );
@@ -574,8 +580,8 @@ typedef struct module_symbols_s
 
     char * ( * DecodeLanguage ) ( u16 );
 
-    struct module_s * ( * module_Need ) ( int, char *, void * );
-    void ( * module_Unneed )            ( struct module_s * );
+    struct module_s * ( * module_Need )   ( int, char *, void * );
+    void              ( * module_Unneed ) ( struct module_s * );
 
 } module_symbols_t;
 
index 56d107fedca726e713e835f49ea122e8335e20b0..f115d792727c9265e18158c173262f6ae85266a1 100644 (file)
  *
  * - Symbols should begin with a prefix indicating in which module they are
  *   used, such as INTF_, VOUT_ or ADEC_.
- *
- * - Regarding environment variables, which are used as initialization
- *  parameters for threads :
- *   + variable names should end with '_VAR'
- *   + environment variable default value should end with '_DEFAULT'
- *   + values having a special meaning with '_VAL'
- *
  */
 
 /*****************************************************************************
  * outputting an error message (in second) */
 #define THREAD_COND_TIMEOUT             5
 
-/* Environment variable containing the memcpy method */
-#define MEMCPY_METHOD_VAR               "vlc_memcpy"
-
-/*
- * Paths
- */
-
-#define MAX_PLUGIN_COUNT                32
-
 /*****************************************************************************
  * Interface configuration
  *****************************************************************************/
 
-/* Environment variable containing the display method */
-#define INTF_METHOD_VAR                 "vlc_intf"
-#define INTF_METHOD_DEFAULT             "gtk"
-
-/* Environment variable used to store startup script name and default value */
-#define INTF_INIT_SCRIPT_VAR            "vlcrc"
-#define INTF_INIT_SCRIPT_DEFAULT        ".vlcrc"
-
-/* Environment variable used to store channels file and default value */
-#define INTF_CHANNELS_VAR               "vlc_channels"
-#define INTF_CHANNELS_DEFAULT           "vlc.channels"
-
 /* Base delay in micro second for interface sleeps */
 #define INTF_IDLE_SLEEP                 ((int)(0.050*CLOCK_FREQ))
 
 #define INTF_GAMMA_STEP                 .1
 #define INTF_GAMMA_LIMIT                3
 
-/* Maximum number of channels */
-#define INTF_MAX_CHANNELS               10
-
-/* Default search path for interface file browser */
-#define INTF_PATH_VAR                   "vlc_search_path"
-#define INTF_PATH_DEFAULT               ""
-
 /*****************************************************************************
  * Input thread configuration
  *****************************************************************************/
 
-/* Environment variable containing the input method */
-#define INPUT_METHOD_VAR                "vlc_input"
-#define INPUT_METHOD_DEFAULT            "ps"
-
 /* XXX?? */
 #define INPUT_IDLE_SLEEP                ((int)(0.100*CLOCK_FREQ))
 
 /* Maximum memory the input is allowed to use (20 MB) */
 #define INPUT_MAX_ALLOCATION            20971520
 
-/* Default network protocol */
-#define INPUT_NETWORK_PROTOCOL_VAR      "vlc_network_protocol"
-#define INPUT_NETWORK_PROTOCOL_DEFAULT  "ts"
-
-/* Default input port */
-#define INPUT_PORT_VAR                  "vlc_server_port"
-#define INPUT_PORT_DEFAULT              1234
-
-/* FIXME : Delete those ! */
-/* Default remote server */
-#define INPUT_SERVER_VAR                "vlc_server"
-#define INPUT_SERVER_DEFAULT            "138.195.143.220"
-
-/* Broadcast mode */
-#define INPUT_BROADCAST_VAR             "vlc_broadcast"
-#define INPUT_BROADCAST_DEFAULT         0
-
-/* Default broadcast address */
-#define INPUT_BCAST_ADDR_VAR            "vlc_broadcast_addr"
-#define INPUT_BCAST_ADDR_DEFAULT        "138.195.143.255"
-
-/* Channels mode */
-#define INPUT_NETWORK_CHANNEL_VAR       "vlc_channel"
-#define INPUT_NETWORK_CHANNEL_DEFAULT   0
-
 /*
  * Channel method
  */
 
-/* Default network interface and environment variable */
-#define INPUT_IFACE_VAR                 "vlc_iface"
-#define INPUT_IFACE_DEFAULT             "eth0"
-
-/* Default server and port */
-#define INPUT_CHANNEL_SERVER_VAR           "vlc_channel_server"
-#define INPUT_CHANNEL_SERVER_DEFAULT       "138.195.143.120"
-#define INPUT_CHANNEL_PORT_VAR             "vlc_channel_port"
-#define INPUT_CHANNEL_PORT_DEFAULT         6010
-
 /* Delay between channel changes - this is required to avoid flooding the 
  * channel server */
 #define INPUT_CHANNEL_CHANGE_DELAY         (mtime_t)(5*CLOCK_FREQ)
  * mark it to be presented */
 #define DEFAULT_PTS_DELAY               (mtime_t)(.2*CLOCK_FREQ)
 
-/* DVD defaults */
-#define INPUT_DVD_DEVICE_VAR            "vlc_dvd_device"
-
-#define INPUT_TITLE_VAR                 "vlc_input_title"
-#define INPUT_CHAPTER_VAR               "vlc_input_chapter"
-#define INPUT_ANGLE_VAR                 "vlc_input_angle"
-#define INPUT_AUDIO_VAR                 "vlc_input_audio"
-#define INPUT_CHANNEL_VAR               "vlc_input_channel"
-#define INPUT_SUBTITLE_VAR              "vlc_input_subtitle"
-
-/* VCD defaults */
-#define INPUT_VCD_DEVICE_VAR            "vlc_vcd_device"
-
 /*****************************************************************************
  * Audio configuration
  *****************************************************************************/
 /* Maximum number of audio output threads */
 #define AOUT_MAX_THREADS                10
 
-/* Environment variable containing the audio output method */
-#define AOUT_METHOD_VAR                 "vlc_aout"
-#define AOUT_METHOD_DEFAULT             "dsp"
-
-/* Environment variable used to store dsp device name, and default value */
-#define AOUT_DSP_VAR                    "vlc_dsp"
-#define AOUT_DSP_DEFAULT                "/dev/dsp"
-
 /* Default audio output format (AOUT_FMT_S16_NE = Native Endianess) */
 #define AOUT_FORMAT_DEFAULT             AOUT_FMT_S16_NE
 /* #define AOUT_FORMAT_DEFAULT          AOUT_FMT_S8 */
 /* #define AOUT_FORMAT_DEFAULT          AOUT_FMT_U16_BE */
 /* #define AOUT_FORMAT_DEFAULT          AOUT_FMT_U16_LE */
 
-/* Environment variable for stereo, and default value */
-#define AOUT_STEREO_VAR                 "vlc_stereo"
-#define AOUT_STEREO_DEFAULT             1
-
-/* Environment variable for spdif mode */
-#define AOUT_SPDIF_VAR                  "vlc_spdif"
-#define AOUT_SPDIF_DEFAULT              0
-
-/* Environment variable containing the AC3 downmix method */
-#define DOWNMIX_METHOD_VAR              "vlc_downmix"
-
-/* Environment variable containing the AC3 IMDCT method */
-#define IMDCT_METHOD_VAR                "vlc_imdct"
-
 /* Volume */
 #define VOLUME_DEFAULT                  512
 #define VOLUME_STEP                     128
 #define VOLUME_MAX                      1024
 
-/* Environment variable for volume */
-#define AOUT_VOLUME_VAR                 "vlc_volume"
-
-/* Environment variable for output rate, and default value */
-#define AOUT_RATE_VAR                   "vlc_audio_rate"
-#define AOUT_RATE_DEFAULT               44100
-
 /* Number of audio output frames contained in an audio output fifo.
  * (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
  * %(AOUT_FIFO_SIZE + 1) operation with an &AOUT_FIFO_SIZE.
  * - long, in order to perform the buffer calculations as few as possible */
 #define AOUT_BUFFER_DURATION            100000
 
-/* Environment variable for audio decoders */
-#define ADEC_MPEG_VAR                   "vlc_mpeg_adec"
-#define ADEC_AC3_VAR                   "vlc_ac3_adec"
-
 /*****************************************************************************
  * Video configuration
  *****************************************************************************/
  * Default settings for video output threads
  */
 
-/* Environment variable containing the display method */
-#define VOUT_METHOD_VAR                 "vlc_vout"
-#define VOUT_METHOD_DEFAULT             "x11"
-
-/* Environment variable containing the display method */
-#define VOUT_FILTER_VAR                 "vlc_filter"
-#define VOUT_FILTER_DEFAULT             "x11"
-
-/* Environment variable containing the motion compensation method */
-#define MOTION_METHOD_VAR               "vlc_motion"
-
-/* Environment variable containing the IDCT method */
-#define IDCT_METHOD_VAR                 "vlc_idct"
-
-/* Environment variable containing the YUV method */
-#define YUV_METHOD_VAR                  "vlc_yuv"
-
-/* Environment variable used in place of DISPLAY if available */
-#define VOUT_DISPLAY_VAR                "vlc_display"
-
-/* Default dimensions for display window - these dimensions are enough for the
- * standard width and height broadcasted MPEG-2 streams or DVDs */
-#define VOUT_WIDTH_VAR                  "vlc_width"
-#define VOUT_WIDTH_DEFAULT              720
-#define VOUT_HEIGHT_VAR                 "vlc_height"
-#define VOUT_HEIGHT_DEFAULT             576
-#define VOUT_DEPTH_VAR                  "vlc_depth"
-#define VOUT_DEPTH_DEFAULT              15
-
-/* Default SPU margin is -1, which means we don't force their position */
-#define VOUT_SPUMARGIN_VAR              "vlc_spumargin"
-#define VOUT_SPUMARGIN_DEFAULT          -1
-
 /* Multiplier value for aspect ratio calculation (2^7 * 3^3 * 5^3) */
 #define VOUT_ASPECT_FACTOR              432000
 
  * joined. */
 #define VOUT_MAX_AREAS                  5
 
-/* Environment variable for grayscale output mode, and default value */
-#define VOUT_GRAYSCALE_VAR              "vlc_grayscale"
-#define VOUT_GRAYSCALE_DEFAULT          0
-
-/* Environment variable for fullscreen mode, and default value */
-#define VOUT_FULLSCREEN_VAR             "vlc_fullscreen"
-#define VOUT_FULLSCREEN_DEFAULT         0
-
-/* Environment variable for overlay mode, and default value */
-#define VOUT_NOOVERLAY_VAR              "vlc_nooverlay"
-#define VOUT_NOOVERLAY_DEFAULT          0
-
-/* Default gamma */
-#define VOUT_GAMMA_VAR                  "vlc_gamma"
-#define VOUT_GAMMA_DEFAULT              0.
-
 /* Default fonts */
 #define VOUT_DEFAULT_FONT               "default8x9.psf"
 #define VOUT_LARGE_FONT                 "default8x16.psf"
 /* The default video output window title */
 #define VOUT_TITLE                      "VideoLAN Client " VERSION
 
-/* Environment variable for framebuffer device, and default value */
-#define VOUT_FB_DEV_VAR                 "vlc_fb_dev"
-#define VOUT_FB_DEV_DEFAULT             "/dev/fb0"
-
-/* Environment variable for XVideo adaptor, and default value */
-#define VOUT_XVADAPTOR_VAR              "vlc_xv_adaptor"
-
 /*****************************************************************************
  * Video parser configuration
  *****************************************************************************/
 /* Maximum number of macroblocks in a picture. */
 #define MAX_MB                          2048
 
-/* The synchro variable name */
-#define VPAR_SYNCHRO_VAR                "vlc_synchro"
-
 /*****************************************************************************
  * Video decoder configuration
  *****************************************************************************/
 /* Maximum range of values out of the IDCT + motion compensation. */
 #define VDEC_CROPRANGE                  2048
 
-/* Environment variable containing the SMP value. */
-#define VDEC_SMP_VAR                   "vlc_smp"
-
 /* No SMP by default, since it slows down things on non-smp machines. */
 #define VDEC_SMP_DEFAULT                0
 
  * queue are printed, but not sent to the threads */
 #define INTF_MSG_QSIZE                  256
 
-/* Interface warnig message level */
-#define INTF_WARNING_VAR                "vlc_warning_level"
-#define INTF_WARNING_DEFAULT            0
 
 /****************************************************************************
- * Playlist defaults
+ * Macros for the names of the main options
+ * Instead of directly manipulating the option names, we define macros for
+ * them. This makes sense only for the main options (ie. only the ones defined
+ * in main.c) because they are widely used.
+ * We won't bother doing this for plugins as plugin specific options should
+ * by definition be restricted in useage to the plugin that defines them.
+ *
  ****************************************************************************/
 
-/* Launch on start-up */
-#define PLAYLIST_STARTUP_VAR            "vlc_playlist_on_start_up"
-#define PLAYLIST_STARTUP_DEFAULT        0
+/*
+ * Interface option names
+ */
 
-/* Enqueue drag'n dropped item */
-#define PLAYLIST_ENQUEUE_VAR            "vlc_playlist_enqueue"
-#define PLAYLIST_ENQUEUE_DEFAULT        0
+/* Variable containing the display method */
+#define INTF_METHOD_VAR                 "intf"
+/* Variable used to store startup script */
+#define INTF_INIT_SCRIPT_VAR            "vlcrc"
+/* Default search path for interface file browser */
+#define INTF_PATH_VAR                   "search_path"
+/* Interface warnig message level */
+#define INTF_WARNING_VAR                "warning"
+/* Variable to enable stats mode */
+#define INTF_STATS_VAR                  "stats"
+
+/*
+ * Audio output option names
+ */
+
+/* Variable to disable the audio output */
+#define AOUT_NOAUDIO_VAR                "noaudio"
+/* Variable containing the audio output method */
+#define AOUT_METHOD_VAR                 "aout"
+/* Variable for spdif mode */
+#define AOUT_SPDIF_VAR                  "spdif"
+/* Variable for volume */
+#define AOUT_VOLUME_VAR                 "volume"
+/* Variable for mono */
+#define AOUT_MONO_VAR                   "audio_mono"
+/* Variable for output rate */
+#define AOUT_RATE_VAR                   "audio_rate"
+/* Variable for output rate */
+#define AOUT_DESYNC_VAR                 "audio_desync"
+
+/*
+ * Video output option names
+ */
+
+/* Variable to disable the video output */
+#define VOUT_NOVIDEO_VAR                "novideo"
+/* Variable containing the display method */
+#define VOUT_METHOD_VAR                 "vout"
+/* Variable used in place of DISPLAY if available */
+#define VOUT_DISPLAY_VAR                "display"
+/* Dimensions for display window */
+#define VOUT_WIDTH_VAR                  "width"
+#define VOUT_HEIGHT_VAR                 "height"
+/* Variable for grayscale output mode */
+#define VOUT_GRAYSCALE_VAR              "grayscale"
+/* Variable for fullscreen mode */
+#define VOUT_FULLSCREEN_VAR             "fullscreen"
+/* Variable for overlay mode */
+#define VOUT_NOOVERLAY_VAR              "nooverlay"
+/* Variable containing the filter method */
+#define VOUT_FILTER_VAR                 "filter"
+/* Variable containing the SPU margin */
+#define VOUT_SPUMARGIN_VAR              "spumargin"
 
+/*
+ * Input option names
+ */
+
+/* Variable containing the input method */
+#define INPUT_METHOD_VAR                "input"
+/* Input port */
+#define INPUT_PORT_VAR                  "server_port"
+/* Channels mode */
+#define INPUT_NETWORK_CHANNEL_VAR       "network_channel"
+/* Variable containing channel server and port */
+#define INPUT_CHANNEL_SERVER_VAR        "channel_server"
+#define INPUT_CHANNEL_PORT_VAR          "channel_port"
+/* Variable containing network interface */
+#define INPUT_IFACE_VAR                 "iface"
+
+#define INPUT_TITLE_VAR                 "input_title"
+#define INPUT_CHAPTER_VAR               "input_chapter"
+#define INPUT_ANGLE_VAR                 "input_angle"
+#define INPUT_AUDIO_VAR                 "input_audio"
+#define INPUT_CHANNEL_VAR               "input_channel"
+#define INPUT_SUBTITLE_VAR              "input_subtitle"
+/* DVD defaults */
+#define INPUT_DVD_DEVICE_VAR            "dvd_device"
+/* VCD defaults */
+#define INPUT_VCD_DEVICE_VAR            "vcd_device"
+
+/*
+ * Decoders option names
+ */
+
+/* Variables for audio decoders */
+#define ADEC_MPEG_VAR                   "mpeg_adec"
+#define ADEC_AC3_VAR                    "ac3_adec"
+/* The synchro variable name */
+#define VPAR_SYNCHRO_VAR                "vpar_synchro"
+/* Variable containing the SMP value */
+#define VDEC_SMP_VAR                    "vdec_smp"
+
+/*
+ * Playlist option names
+ */
+
+/* Launch on start-up */
+#define PLAYLIST_STARTUP_VAR            "playlist_on_startup"
+/* Enqueue drag'n dropped item */
+#define PLAYLIST_ENQUEUE_VAR            "playlist_enqueue"
 /* Loop on playlist end */
-#define PLAYLIST_LOOP_VAR               "vlc_playlist_loop"
-#define PLAYLIST_LOOP_DEFAULT           0
+#define PLAYLIST_LOOP_VAR               "playlist_loop"
+
+/*
+ * CPU options
+ */
+#define NOMMX_VAR                       "nommx"
+#define NO3DN_VAR                       "no3dn"
+#define NOMMXEXT_VAR                    "nommxext"
+#define NOSSE_VAR                       "nosse"
+#define NOALTIVEC_VAR                   "noaltivec"
+
+/*
+ * Misc option names
+ */
 
+/* Variable containing the memcpy method */
+#define MEMCPY_METHOD_VAR               "memcpy"
diff --git a/include/configuration.h b/include/configuration.h
new file mode 100644 (file)
index 0000000..3729a32
--- /dev/null
@@ -0,0 +1,116 @@
+/*****************************************************************************
+ * configuration.h : configuration management module
+ * This file describes the programming interface for the configuration module.
+ * It includes functions allowing to declare, get or set configuration options.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: configuration.h,v 1.1 2002/02/24 20:51:09 gbazin Exp $
+ *
+ * Authors: Gildas Bazin <gbazin@netcourrier.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Macros used to build the configuration structure.
+ *****************************************************************************/
+
+/* Mandatory last part of the structure */
+#define MODULE_CONFIG_ITEM_END              0x000   /* End of config */
+
+/* Configuration widgets */
+#define MODULE_CONFIG_ITEM_CATEGORY         0x0001  /* Start of new category */
+#define MODULE_CONFIG_ITEM_SUBCATEGORY      0x0002  /* Start of sub-category */
+#define MODULE_CONFIG_ITEM_SUBCATEGORY_END  0x0003  /* End of sub-category */
+#define MODULE_CONFIG_ITEM_STRING           0x0004  /* String option */
+#define MODULE_CONFIG_ITEM_FILE             0x0005  /* File option */
+#define MODULE_CONFIG_ITEM_PLUGIN           0x0006  /* Plugin option */
+#define MODULE_CONFIG_ITEM_INTEGER          0x0007  /* Integer option */
+#define MODULE_CONFIG_ITEM_BOOL             0x0008  /* Bool option */
+#define MODULE_CONFIG_ITEM_ALIAS            0x0009  /* Alias option */
+
+typedef struct module_config_s
+{
+    int         i_type;                                /* Configuration type */
+    char *      psz_name;                                     /* Option name */
+    char *      psz_text;       /* Short comment on the configuration option */
+    char *      psz_longtext;    /* Long comment on the configuration option */
+    char *      psz_value;                                   /* Option value */
+    int         i_value;                                     /* Option value */
+    void *      p_callback;      /* Function to call when commiting a change */
+    boolean_t   b_dirty;           /* Dirty flag to indicate a config change */
+
+} module_config_t;
+
+/*****************************************************************************
+ * Prototypes - these methods are used to get, set or manipulate configuration
+ * data.
+ *****************************************************************************/
+#ifndef PLUGIN
+int    config_GetIntVariable( const char *psz_name );
+char * config_GetPszVariable( const char *psz_name );
+void   config_PutIntVariable( const char *psz_name, int i_value );
+void   config_PutPszVariable( const char *psz_name, char *psz_value );
+
+module_config_t *config_FindConfig( const char *psz_name );
+module_config_t *config_Duplicate ( module_config_t *p_config_orig,
+                                    int i_config_options );
+#else
+#   define config_GetIntVariable p_symbols->config_GetIntVariable
+#   define config_PutIntVariable p_symbols->config_PutIntVariable
+#   define config_GetPszVariable p_symbols->config_GetPszVariable
+#   define config_PutPszVariable p_symbols->config_PutPszVariable
+#   define config_Duplicate    p_symbols->config_Duplicate
+#   define config_FindConfig   p_symbols->config_FindConfig
+#endif
+
+/*****************************************************************************
+ * Macros used to build the configuration structure.
+ *
+ * Note that internally we support only 2 types of config data: int and string.
+ *   The other types declared here just map to one of these 2 basic types but
+ *   have the advantage of also providing very good hints to a configuration
+ *   interface so as to make it more user friendly.
+ * The configuration structure also includes category hints. These hints can
+ *   provide a configuration inteface with some very useful data and also allow
+ *   for a more user friendly interface.
+ *****************************************************************************/
+
+#define MODULE_CONFIG_START \
+    static module_config_t p_config[] = {
+
+#define MODULE_CONFIG_STOP \
+    { MODULE_CONFIG_ITEM_END, NULL, NULL, NULL, NULL, 0, NULL, 0 } };
+
+#define ADD_CATEGORY_HINT( text, longtext ) \
+    { MODULE_CONFIG_ITEM_CATEGORY, NULL, text, longtext, NULL, 0, NULL, 0 },
+#define ADD_SUBCATEGORY_HINT( text, longtext ) \
+    { MODULE_CONFIG_ITEM_SUBCATEGORY, NULL, text, longtext, NULL, 0, NULL, 0 },
+#define END_SUBCATEGORY_HINT \
+    { MODULE_CONFIG_ITEM_SUBCATEGORY_END, NULL, NULL, NULL, NULL, 0, NULL, 0 },
+#define ADD_STRING( name, value, p_callback, text, longtext ) \
+    { MODULE_CONFIG_ITEM_STRING, name, text, longtext, value, 0, \
+      p_callback, 0 },
+#define ADD_FILE( name, psz_value, p_callback, text, longtext ) \
+    { MODULE_CONFIG_ITEM_FILE, name, text, longtext, psz_value, 0, \
+      p_callback, 0 },
+#define ADD_PLUGIN( name, i_capability, psz_value, p_callback, text, longtext)\
+    { MODULE_CONFIG_ITEM_PLUGIN, name, text, longtext, psz_value, \
+      i_capability, p_callback, 0 },
+#define ADD_INTEGER( name, i_value, p_callback, text, longtext ) \
+    { MODULE_CONFIG_ITEM_INTEGER, name, text, longtext, NULL, i_value, \
+      p_callback, 0 },
+#define ADD_BOOL( name, p_callback, text, longtext ) \
+    { MODULE_CONFIG_ITEM_BOOL, name, text, longtext, NULL, 0, p_callback, 0 },
index 66c312a61ef13267838b818e3cadd04efa5c59ca..f8cc06379259d4a49390cb687b3dd7247f06b01f 100644 (file)
@@ -3,7 +3,7 @@
  * Declaration and extern access to global program object.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: main.h,v 1.29 2002/02/15 13:32:52 sam Exp $
+ * $Id: main.h,v 1.30 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -38,7 +38,6 @@ typedef struct main_s
     /* Global properties */
     int                    i_argc;           /* command line arguments count */
     char **                ppsz_argv;              /* command line arguments */
-    char **                ppsz_env;                /* environment variables */
     char *                 psz_arg0;         /* program name (whithout path) */
 
     u32                    i_cpu_capabilities;             /* CPU extensions */
@@ -49,6 +48,7 @@ typedef struct main_s
     boolean_t              b_audio;             /* is audio output allowed ? */
     boolean_t              b_video;             /* is video output allowed ? */
     boolean_t              b_ac3;
+    boolean_t              b_stereo;
     mtime_t                i_desync;   /* relative desync of the audio ouput */
 
     /* Fast memcpy plugin used */
@@ -77,20 +77,3 @@ extern main_t *p_main;
  *****************************************************************************/
 #define FAST_MEMCPY p_main->pf_memcpy
 #define FAST_MEMSET p_main->pf_memset
-
-/*****************************************************************************
- * Prototypes - these methods are used to get default values for some threads
- * and modules.
- *****************************************************************************/
-#ifndef PLUGIN
-int    main_GetIntVariable( char *psz_name, int i_default );
-char * main_GetPszVariable( char *psz_name, char *psz_default );
-void   main_PutIntVariable( char *psz_name, int i_value );
-void   main_PutPszVariable( char *psz_name, char *psz_value );
-#else
-#   define main_GetIntVariable p_symbols->main_GetIntVariable
-#   define main_PutIntVariable p_symbols->main_PutIntVariable
-#   define main_GetPszVariable p_symbols->main_GetPszVariable
-#   define main_PutPszVariable p_symbols->main_PutPszVariable
-#endif
-
index f2377292f473f5d004a07540991e5167eee85f31..230c400990568612489d62970394a88e0a252023 100644 (file)
@@ -2,7 +2,7 @@
  * modules.h : Module management functions.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.h,v 1.41 2002/02/15 13:32:52 sam Exp $
+ * $Id: modules.h,v 1.42 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -46,34 +46,36 @@ static __inline__ char *GetCapabilityName( unsigned int i_capa )
      * new capability. */
     static char *pp_capa[] =
     {
+        "main",
+#define MODULE_CAPABILITY_MAIN      0  /* Main */
         "interface",
-#define MODULE_CAPABILITY_INTF      0  /* Interface */
+#define MODULE_CAPABILITY_INTF      1  /* Interface */
         "access",
-#define MODULE_CAPABILITY_ACCESS    1  /* Input */
+#define MODULE_CAPABILITY_ACCESS    2  /* Input */
         "input",
-#define MODULE_CAPABILITY_INPUT     2  /* Input */
+#define MODULE_CAPABILITY_INPUT     3  /* Input */
         "decaps",
-#define MODULE_CAPABILITY_DECAPS    3  /* Decaps */
+#define MODULE_CAPABILITY_DECAPS    4  /* Decaps */
         "decoder",
-#define MODULE_CAPABILITY_DECODER   4  /* Audio or video decoder */
+#define MODULE_CAPABILITY_DECODER   5  /* Audio or video decoder */
         "motion",
-#define MODULE_CAPABILITY_MOTION    5  /* Motion compensation */
+#define MODULE_CAPABILITY_MOTION    6  /* Motion compensation */
         "iDCT",
-#define MODULE_CAPABILITY_IDCT      6  /* IDCT transformation */
+#define MODULE_CAPABILITY_IDCT      7  /* IDCT transformation */
         "audio output",
-#define MODULE_CAPABILITY_AOUT      7  /* Audio output */
+#define MODULE_CAPABILITY_AOUT      8  /* Audio output */
         "video output",
-#define MODULE_CAPABILITY_VOUT      8  /* Video output */
+#define MODULE_CAPABILITY_VOUT      9  /* Video output */
         "chroma transformation",
-#define MODULE_CAPABILITY_CHROMA    9  /* colorspace conversion */
+#define MODULE_CAPABILITY_CHROMA   10  /* colorspace conversion */
         "iMDCT",
-#define MODULE_CAPABILITY_IMDCT    10  /* IMDCT transformation */
+#define MODULE_CAPABILITY_IMDCT    11  /* IMDCT transformation */
         "downmix",
-#define MODULE_CAPABILITY_DOWNMIX  11  /* AC3 downmix */
+#define MODULE_CAPABILITY_DOWNMIX  12  /* AC3 downmix */
         "memcpy",
-#define MODULE_CAPABILITY_MEMCPY   12  /* memcpy */
+#define MODULE_CAPABILITY_MEMCPY   13  /* memcpy */
         "unknown"
-#define MODULE_CAPABILITY_MAX      13  /* Total number of capabilities */
+#define MODULE_CAPABILITY_MAX      14  /* Total number of capabilities */
     };
 
     return pp_capa[ (i_capa) > MODULE_CAPABILITY_MAX ? MODULE_CAPABILITY_MAX :
@@ -120,6 +122,7 @@ typedef struct module_s
 
     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 used internally by the module manager
@@ -325,41 +328,14 @@ typedef struct module_functions_s
 
 typedef struct module_functions_s * p_module_functions_t;
 
-/*****************************************************************************
- * Macros used to build the configuration structure.
- *****************************************************************************/
-
-/* Mandatory first and last parts of the structure */
-#define MODULE_CONFIG_ITEM_START       0xdead  /* The main window */
-#define MODULE_CONFIG_ITEM_END         0xbeef  /* End of the window */
-
-/* Configuration widgets */
-#define MODULE_CONFIG_ITEM_WINDOW      0x0001  /* The main window */
-#define MODULE_CONFIG_ITEM_PANE        0x0002  /* A notebook pane */
-#define MODULE_CONFIG_ITEM_FRAME       0x0003  /* A frame */
-#define MODULE_CONFIG_ITEM_COMMENT     0x0004  /* A comment text */
-#define MODULE_CONFIG_ITEM_STRING      0x0005  /* A string */
-#define MODULE_CONFIG_ITEM_FILE        0x0006  /* A file selector */
-#define MODULE_CONFIG_ITEM_CHECK       0x0007  /* A checkbox */
-#define MODULE_CONFIG_ITEM_CHOOSE      0x0008  /* A choose box */
-#define MODULE_CONFIG_ITEM_RADIO       0x0009  /* A radio box */
-#define MODULE_CONFIG_ITEM_SCALE       0x000a  /* A horizontal ruler */
-#define MODULE_CONFIG_ITEM_SPIN        0x000b  /* A numerical selector */
-
-typedef struct module_config_s
-{
-    int         i_type;                         /* Configuration widget type */
-    char *      psz_text;        /* Text commenting or describing the widget */
-    char *      psz_name;                                   /* Variable name */
-    void *      p_getlist;          /* Function to call to get a choice list */
-    void *      p_change;        /* Function to call when commiting a change */
-} module_config_t;
-
 /*****************************************************************************
  * Exported functions.
  *****************************************************************************/
 #ifndef PLUGIN
 void            module_InitBank     ( void );
+void            module_LoadMain     ( void );
+void            module_LoadBuiltins ( void );
+void            module_LoadPlugins  ( void );
 void            module_EndBank      ( void );
 void            module_ResetBank    ( void );
 void            module_ManageBank   ( void );
@@ -370,4 +346,3 @@ void            module_Unneed       ( module_t * p_module );
 #   define module_Need p_symbols->module_Need
 #   define module_Unneed p_symbols->module_Unneed
 #endif
-
index 4a9376f8487e49ba04b9ebad9ad9782bdc4979bf..f371a4aa32adcee03b09af2b31b6ed5d27daaf92 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.11 2002/01/09 02:01:14 sam Exp $
+ * $Id: modules_inner.h,v 1.12 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
 /*
  * InitModule: this function is called once and only once, when the module
  * is looked at for the first time. We get the useful data from it, for
- * instance the module name, its shortcuts, its capabilities...
+ * instance the module name, its shortcuts, its capabilities... we also create
+ * a copy of its config because the module can be unloaded at any time.
  */
 #define MODULE_INIT_START                                                     \
+    DECLARE_SYMBOLS;                                                          \
+                                                                              \
     int __VLC_SYMBOL( InitModule ) ( module_t *p_module )                     \
     {                                                                         \
         int i_shortcut = 0;                                                   \
         p_module->i_cpu_capabilities = 0;
 
 #define MODULE_INIT_STOP                                                      \
+        STORE_SYMBOLS;                                                        \
         p_module->pp_shortcuts[ i_shortcut ] = NULL;                          \
+        p_module->i_config_options = sizeof(p_config)/sizeof(module_config_t);\
+        p_module->p_config = config_Duplicate( p_config,                      \
+                                              p_module->i_config_options );  \
+        if( p_module->p_config == NULL )                                      \
+        {                                                                     \
+            intf_ErrMsg( MODULE_STRING                                        \
+                         " InitModule error: can't duplicate p_config" );     \
+            return( -1 );                                                     \
+        }                                                                     \
         return( 0 );                                                          \
     }
 
  * module will be used.
  */
 #define MODULE_ACTIVATE_START                                                 \
-    DECLARE_SYMBOLS;                                                          \
-                                                                              \
     int __VLC_SYMBOL( ActivateModule ) ( module_t *p_module )                 \
     {                                                                         \
         p_module->p_functions =                                               \
         {                                                                     \
             return( -1 );                                                     \
         }                                                                     \
-        p_module->p_config = p_config;                                        \
         STORE_SYMBOLS;
 
 #define MODULE_ACTIVATE_STOP                                                  \
 #define MODULE_DEACTIVATE_STOP                                                \
         return( 0 );                                                          \
     }
-
-/*****************************************************************************
- * Macros used to build the configuration structure.
- *****************************************************************************/
-
-#define MODULE_CONFIG_START \
-    static module_config_t p_config[] = { \
-    { MODULE_CONFIG_ITEM_START, NULL, NULL, NULL, NULL },
-
-#define MODULE_CONFIG_STOP \
-    { MODULE_CONFIG_ITEM_END, NULL, NULL, NULL, NULL } };
-
-#define ADD_WINDOW( text ) \
-    { MODULE_CONFIG_ITEM_WINDOW, text, NULL, NULL, NULL },
-#define ADD_FRAME( text ) \
-    { MODULE_CONFIG_ITEM_FRAME, text, NULL, NULL, NULL },
-#define ADD_PANE( text ) \
-    { MODULE_CONFIG_ITEM_PANE, text, NULL, NULL, NULL },
-#define ADD_COMMENT( text ) \
-    { MODULE_CONFIG_ITEM_COMMENT, text, NULL, NULL, NULL },
-#define ADD_STRING( text, name, p_update ) \
-    { MODULE_CONFIG_ITEM_STRING, text, name, NULL, p_update },
-#define ADD_FILE( text, name, p_update ) \
-    { MODULE_CONFIG_ITEM_FILE, text, name, NULL, p_update },
-#define ADD_CHECK( text, name, p_update ) \
-    { MODULE_CONFIG_ITEM_CHECK, text, name, NULL, p_update },
-#define ADD_CHOOSE( text, name, p_getlist, p_update ) \
-    { MODULE_CONFIG_ITEM_CHOOSE, text, name, p_getlist, p_update },
-#define ADD_RADIO( text, name, p_getlist, p_update ) \
-    { MODULE_CONFIG_ITEM_RADIO, text, name, p_getlist, p_update },
-#define ADD_SCALE( text, name, p_getlist, p_update ) \
-    { MODULE_CONFIG_ITEM_SCALE, text, name, p_getlist, p_update },
-#define ADD_SPIN( text, name, p_getlist, p_update ) \
-    { MODULE_CONFIG_ITEM_SPIN, text, name, p_getlist, p_update },
-
index 97c2a6f6d139fe6aaf991f2c9a85ac622da58d80..92cb66f282db05b3298961a820c12fa9619ff700 100644 (file)
@@ -2,7 +2,7 @@
  * vlc.h: global header for vlc
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: vlc.h,v 1.3 2002/01/04 14:01:34 sam Exp $
+ * $Id: vlc.h,v 1.4 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -52,4 +52,4 @@
 #include "modules.h"
 
 #include "main.h"
-
+#include "configuration.h"
index e044c10fc01acf57966419e0aa53cad66534bbdb..2b918da568b90217c37a4e6391a29f0b8fcdb51d 100644 (file)
@@ -4,7 +4,7 @@
  *   (http://liba52.sf.net/).
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: a52.c,v 1.3 2002/02/15 13:32:52 sam Exp $
+ * $Id: a52.c,v 1.4 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *      
@@ -28,7 +28,7 @@
  *****************************************************************************/
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>                                              /* strdup() */
-#include <stdint.h>
+#include <stdint.h>                                            /* int16_t .. */
 
 #include <videolan/vlc.h>
 
@@ -67,7 +67,7 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
 }
 
 /*****************************************************************************
- * Build configuration tree.
+ * Build configuration structure.
  *****************************************************************************/
 MODULE_CONFIG_START
 MODULE_CONFIG_STOP
index caf44b2474a7b23a3c9ce269745d61a14540b4be..feeca004b20c868941f933ee1c8ed55b64b7c8f5 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_adec.c: ac3 decoder module main file
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_adec.c,v 1.20 2002/02/19 00:50:19 sam Exp $
+ * $Id: ac3_adec.c,v 1.21 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *
@@ -68,7 +68,17 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
 /*****************************************************************************
  * Build configuration tree.
  *****************************************************************************/
+/* Variable containing the AC3 downmix method */
+#define DOWNMIX_METHOD_VAR              "ac3_downmix"
+/* Variable containing the AC3 IMDCT method */
+#define IMDCT_METHOD_VAR                "ac3_imdct"
+
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL)
+ADD_PLUGIN  ( DOWNMIX_METHOD_VAR, MODULE_CAPABILITY_DOWNMIX, NULL, NULL,
+              "AC3 downmix method", NULL )
+ADD_PLUGIN  ( IMDCT_METHOD_VAR, MODULE_CAPABILITY_IMDCT, NULL, NULL,
+              "AC3 IMDCT method", NULL )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -101,6 +111,8 @@ static int decoder_Probe( u8 *pi_type )
  *****************************************************************************/
 static int InitThread( ac3dec_thread_t * p_ac3thread )
 {
+    char *psz_name;
+
     /*
      * Thread properties 
      */
@@ -111,9 +123,10 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
      * Choose the best downmix module
      */
 #define DOWNMIX p_ac3thread->ac3_decoder->downmix
-    DOWNMIX.p_module = module_Need( MODULE_CAPABILITY_DOWNMIX,
-                               main_GetPszVariable( DOWNMIX_METHOD_VAR, NULL ),
-                               NULL );
+    psz_name = config_GetPszVariable( DOWNMIX_METHOD_VAR );
+    DOWNMIX.p_module = module_Need( MODULE_CAPABILITY_DOWNMIX, psz_name,
+                                    NULL );
+    if( psz_name ) free( psz_name );
 
     if( DOWNMIX.p_module == NULL )
     {
@@ -139,9 +152,10 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
     p_ac3thread->ac3_decoder->imdct = memalign(16, sizeof(imdct_t));
     
 #define IMDCT p_ac3thread->ac3_decoder->imdct
-    IMDCT->p_module = module_Need( MODULE_CAPABILITY_IMDCT,
-                               main_GetPszVariable( IMDCT_METHOD_VAR, NULL ),
-                               NULL );
+    psz_name = config_GetPszVariable( IMDCT_METHOD_VAR );
+    IMDCT->p_module = module_Need( MODULE_CAPABILITY_IMDCT, psz_name,
+                                   NULL );
+    if( psz_name ) free( psz_name );
 
     if( IMDCT->p_module == NULL )
     {
@@ -161,15 +175,7 @@ static int InitThread( ac3dec_thread_t * p_ac3thread )
 #undef F
 
     /* Initialize the ac3 decoder structures */
-#define p_dec p_ac3thread->ac3_decoder
-#if defined( __MINGW32__ )
-    p_dec->samples_back = memalign( 16, 6 * 256 * sizeof(float) + 15 );
-    p_dec->samples = (float *)
-                     (((unsigned long) p_dec->samples_back + 15 ) & ~0xFUL);
-#else
-    p_dec->samples = memalign( 16, 6 * 256 * sizeof(float) );
-#endif
-#undef p_dec
+    p_ac3thread->ac3_decoder->samples = memalign( 16, 6 * 256 * sizeof(float) );
 
     IMDCT->buf    = memalign( 16, N/4 * sizeof(complex_t) );
     IMDCT->delay  = memalign( 16, 6 * 256 * sizeof(float) );
@@ -222,7 +228,7 @@ static int decoder_Run ( decoder_config_t * p_config )
         DecoderError( p_config->p_decoder_fifo );
         return( -1 );
     }
-   
+
     /*
      * Initialize the thread properties
      */
@@ -264,7 +270,7 @@ static int decoder_Run ( decoder_config_t * p_config )
              AlignWord( p_bit_stream );
              b_sync = 1;
 #undef p_bit_stream
-         }
+        }
 
         if (ac3_sync_frame (p_ac3thread->ac3_decoder, &sync_info))
         {
@@ -275,16 +281,15 @@ static int decoder_Run ( decoder_config_t * p_config )
         if( ( p_ac3thread->p_aout_fifo != NULL ) &&
             ( p_ac3thread->p_aout_fifo->l_rate != sync_info.sample_rate ) )
         {
-            aout_DestroyFifo (p_ac3thread->p_aout_fifo);
-
             /* Make sure the output thread leaves the NextFrame() function */
             vlc_mutex_lock (&(p_ac3thread->p_aout_fifo->data_lock));
+            aout_DestroyFifo (p_ac3thread->p_aout_fifo);
             vlc_cond_signal (&(p_ac3thread->p_aout_fifo->data_wait));
             vlc_mutex_unlock (&(p_ac3thread->p_aout_fifo->data_lock));
 
             p_ac3thread->p_aout_fifo = NULL;
         }
-        
+
         /* Creating the audio output fifo if not created yet */
         if (p_ac3thread->p_aout_fifo == NULL ) {
             p_ac3thread->p_aout_fifo = aout_CreateFifo( AOUT_ADEC_STEREO_FIFO, 
@@ -307,12 +312,8 @@ static int decoder_Run ( decoder_config_t * p_config )
                 free( IMDCT->delay );
                 free( IMDCT->buf );
         #undef IMDCT
-        
-        #if defined( __MINGW32__ )
-                free( p_ac3thread->ac3_decoder->samples_back );
-        #else
+
                 free( p_ac3thread->ac3_decoder->samples );
-        #endif
         
                 module_Unneed( p_ac3thread->ac3_decoder->imdct->p_module );
                 module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
@@ -402,11 +403,7 @@ static void EndThread (ac3dec_thread_t * p_ac3thread)
     free( IMDCT->buf );
 #undef IMDCT
 
-#if defined( __MINGW32__ )
-    free( p_ac3thread->ac3_decoder->samples_back );
-#else
     free( p_ac3thread->ac3_decoder->samples );
-#endif
 
     /* Unlock the modules */
     module_Unneed( p_ac3thread->ac3_decoder->downmix.p_module );
index d68b943fc0eb6346b1898785935714c8f026c150..259a5e0b42f4bcb471006fe434f0449aa7c8d705 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_decoder.h : ac3 decoder interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder.h,v 1.1 2001/11/13 12:09:17 henri Exp $
+ * $Id: ac3_decoder.h,v 1.2 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Renaud Dartus <reno@videolan.org>
@@ -355,9 +355,6 @@ typedef struct mantissa_s
 struct ac3dec_s
 {
     float *             samples;
-#if defined( __MINGW32__ )
-    float *             samples_back;
-#endif
     imdct_t *           imdct;
 
     /*
index 32d459c47fe1e47252ff8ac966b59d5215b7c256..01b8c913bd86dcc7caf44a687e42cf78d06d7954 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: ac3_spdif.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
@@ -91,7 +91,7 @@ MODULE_DEACTIVATE_STOP
  *****************************************************************************/
 static int decoder_Probe( u8 *pi_type )
 {
-    return( ( main_GetIntVariable( AOUT_SPDIF_VAR, 0 )
+    return( ( config_GetIntVariable( AOUT_SPDIF_VAR )
                && *pi_type == AC3_AUDIO_ES ) ? 0 : -1 );
 }
 
index e7adf02834f4b86286541cf818acf6783516c711..130d3babfd8b2a3d8f2e7242c2ed9ac78e31ec6a 100644 (file)
@@ -2,7 +2,7 @@
  * alsa.c : alsa plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: alsa.c,v 1.13 2001/12/30 07:09:54 sam Exp $
+ * $Id: alsa.c,v 1.14 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
@@ -38,7 +38,7 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_COMMENT( "Yeah, alsa rocks !" )
+
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 902c2a85e28f48671d74ecbfde4203d40cd1a427..308e2d2446a508476c0e705b19368786c2471e35 100644 (file)
@@ -77,9 +77,6 @@ void _M( aout_getfunctions )( function_list_t * p_function_list )
 static int aout_Open( aout_thread_t *p_aout )
 {
     int i_err = 0;
-    p_aout->i_format = AOUT_FORMAT_DEFAULT;
-    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
-    p_aout->l_rate = AOUT_RATE_DEFAULT;
 
     /* Allocate structure */
     p_aout->p_sys = malloc( sizeof( aout_sys_t ) );
index 5cf7769aba8bbc47b5a9d1f533299204719d6606..2f324e756999f0ec88ecb20545f5defa8bc087be 100644 (file)
@@ -37,9 +37,6 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for arts module" )
-        ADD_FRAME( "aRts" )
-            ADD_COMMENT( "This module does not need configuration" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 195aec99d603a934636fc38cd4f01279d91d3339..35ab10523e00d5894c55808ee5bbffdecf207a22 100644 (file)
@@ -2,7 +2,7 @@
  * aout_beos.cpp: BeOS audio output
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: aout_beos.cpp,v 1.21 2002/02/15 13:32:52 sam Exp $
+ * $Id: aout_beos.cpp,v 1.22 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -109,11 +109,6 @@ static int aout_Open( aout_thread_t *p_aout )
     }
 
     /* Initialize some variables */
-    p_aout->i_format = AOUT_FORMAT_DEFAULT;
-    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
-                                                  AOUT_STEREO_DEFAULT );
-    p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );
-
     p_aout->p_sys->p_format->frame_rate = 44100.0;
     p_aout->p_sys->p_format->channel_count = p_aout->i_channels;
     p_aout->p_sys->p_format->format = gs_audio_format::B_GS_S16;
index 48be56280024e4d589cee9e3e6a8e02826e9b344..160dc8bca734b413ac399e36f09c31caf9b20a51 100644 (file)
@@ -2,7 +2,7 @@
  * beos.cpp : BeOS plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: beos.cpp,v 1.16 2002/01/05 18:25:48 sam Exp $
+ * $Id: beos.cpp,v 1.17 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -43,8 +43,6 @@ void _M( intf_getfunctions )( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for BeOS module" )
-    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 152dbf1ee356eb2e87e8f525cd2cc5b81efa31a1..30aed8eda74e27411e9696ad0ebc76cb4db8d62e 100644 (file)
@@ -2,7 +2,7 @@
  * vout_beos.cpp: beos video output display method
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_beos.cpp,v 1.41 2002/02/15 13:32:52 sam Exp $
+ * $Id: vout_beos.cpp,v 1.42 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -576,8 +576,8 @@ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
 static int BeosOpenDisplay( vout_thread_t *p_vout )
 { 
     p_vout->p_sys->p_window = new VideoWindow(
-            main_GetIntVariable( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT ) - 1,
-            main_GetIntVariable( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT ) - 1,
+            config_GetIntVariable( VOUT_WIDTH_VAR ) - 1,
+            config_GetIntVariable( VOUT_HEIGHT_VAR ) - 1,
             p_vout );
 
     if( p_vout->p_sys->p_window == NULL )
index e4b5b91ea268dc7a66643c93aa3e8ec5bf0b027f..98e84ea0226ef2da91fbd82cbbed27960f29947e 100644 (file)
@@ -2,7 +2,7 @@
  * aout_directx.c: Windows DirectX audio output method
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: aout_directx.c,v 1.18 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: aout_directx.c,v 1.19 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -146,8 +146,6 @@ static int aout_Open( aout_thread_t *p_aout )
     vlc_mutex_init( &p_aout->p_sys->buffer_lock );
 
 
-    p_aout->psz_device = 0;
-
     /* Initialise DirectSound */
     if( DirectxInitDSound( p_aout ) )
     {
index c2cce42edfde1d3dde25da168038702b2a2f1a04..242836ada54b6cbc962d30059af0a8c0fb4926fa 100644 (file)
@@ -2,7 +2,7 @@
  * directx.c : Windows DirectX plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: directx.c,v 1.5 2002/01/17 23:02:45 gbazin Exp $
+ * $Id: directx.c,v 1.6 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *      
@@ -44,8 +44,6 @@ void _M( vout_getfunctions )( function_list_t * p_function_list );
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for Windows DirectX module" )
-    ADD_COMMENT( "For now, the Windows DirectX module cannot be configured" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 64f694c2f1ab4ef7e8301c5b843d6a147b139c67..8f12e21814fe60518653b86d7c9ba4761cccbacb 100644 (file)
@@ -2,7 +2,7 @@
  * vout_directx.c: Windows DirectX video output display method
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: vout_directx.c,v 1.22 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: vout_directx.c,v 1.23 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -134,7 +134,7 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys->b_caps_overlay_clipping = 0;
     SetRectEmpty( &p_vout->p_sys->rect_display );
     p_vout->p_sys->b_using_overlay =
-        !main_GetIntVariable( VOUT_NOOVERLAY_VAR, VOUT_NOOVERLAY_DEFAULT );
+        !config_GetIntVariable( VOUT_NOOVERLAY_VAR );
 
     p_vout->p_sys->b_cursor = 1;
 
@@ -157,10 +157,8 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
 #if 0
-    p_vout->p_sys->i_window_width = main_GetIntVariable( VOUT_WIDTH_VAR,
-                                                         VOUT_WIDTH_DEFAULT );
-    p_vout->p_sys->i_window_height = main_GetIntVariable( VOUT_HEIGHT_VAR,
-                                                         VOUT_HEIGHT_DEFAULT );
+    p_vout->p_sys->i_window_width = config_GetIntVariable( VOUT_WIDTH_VAR );
+    p_vout->p_sys->i_window_height = config_GetIntVariable( VOUT_HEIGHT_VAR );
 #endif
 
     /* Set locks and condition variables */
index 4512301036a158090376fcdbbe01ded43e6461c8..ec9e2e7b64936faa2670fe1c0e2149fbc9d4a276 100644 (file)
@@ -2,7 +2,7 @@
  * aout_dsp.c : dsp functions library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_dsp.c,v 1.21 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_dsp.c,v 1.22 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -53,6 +53,7 @@
 
 #include "audio_output.h"                                   /* aout_thread_t */
 
+#define DSP_DEV_VAR "dsp_dev"
 /*****************************************************************************
  * aout_sys_t: dsp audio output method descriptor
  *****************************************************************************
@@ -63,6 +64,10 @@ typedef struct aout_sys_s
 {
     audio_buf_info        audio_buf;
 
+    /* Path to the audio output device */
+    char *                psz_device;
+    int                   i_fd;
+
 } aout_sys_t;
 
 /*****************************************************************************
@@ -92,7 +97,7 @@ void _M( aout_getfunctions )( function_list_t * p_function_list )
  * aout_Open: opens the audio device (the digital sound processor)
  *****************************************************************************
  * This function opens the dsp as a usual non-blocking write-only file, and
- * modifies the p_aout->i_fd with the file's descriptor.
+ * modifies the p_aout->p_sys->i_fd with the file's descriptor.
  *****************************************************************************/
 static int aout_Open( aout_thread_t *p_aout )
 {
@@ -105,13 +110,21 @@ static int aout_Open( aout_thread_t *p_aout )
     }
 
     /* Initialize some variables */
-    p_aout->psz_device = main_GetPszVariable( AOUT_DSP_VAR, AOUT_DSP_DEFAULT );
+    if( !(p_aout->p_sys->psz_device = config_GetPszVariable( DSP_DEV_VAR )) )
+    {
+        intf_ErrMsg( "aout error: don't know which audio device to open" );
+        free( p_aout->p_sys );
+        return( -1 );
+    }
 
     /* Open the sound device */
-    if( (p_aout->i_fd = open( p_aout->psz_device, O_WRONLY )) < 0 )
+    if( (p_aout->p_sys->i_fd = open( p_aout->p_sys->psz_device, O_WRONLY ))
+        < 0 )
     {
         intf_ErrMsg( "aout error: can't open audio device (%s)",
-                     p_aout->psz_device );
+                     p_aout->p_sys->psz_device );
+        free( p_aout->p_sys->psz_device );
+        free( p_aout->p_sys );
         return( -1 );
     }
 
@@ -133,16 +146,16 @@ static int aout_SetFormat( aout_thread_t *p_aout )
     boolean_t b_stereo = p_aout->b_stereo;
 
     /* Reset the DSP device */
-    if( ioctl( p_aout->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
+    if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_RESET, NULL ) < 0 )
     {
         intf_ErrMsg( "aout error: can't reset audio device (%s)",
-                     p_aout->psz_device );
+                     p_aout->p_sys->psz_device );
         return( -1 );
     }
 
     /* Set the output format */
     i_format = p_aout->i_format;
-    if( ioctl( p_aout->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
+    if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_SETFMT, &i_format ) < 0 )
     {
         intf_ErrMsg( "aout error: can't set audio output format (%i)",
                      p_aout->i_format );
@@ -151,13 +164,13 @@ static int aout_SetFormat( aout_thread_t *p_aout )
 
     if( i_format != p_aout->i_format )
     {
-        intf_WarnMsg( 2, "aout warning: audio output format not supported (%i)",
-                      p_aout->i_format );
+        intf_WarnMsg( 2, "aout warning: audio output format not supported (%i)"
+                      ,p_aout->i_format );
         p_aout->i_format = i_format;
     }
 
     /* Set the number of channels */
-    if( ioctl( p_aout->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
+    if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_STEREO, &b_stereo ) < 0 )
     {
         intf_ErrMsg( "aout error: can't set number of audio channels (%i)",
                      p_aout->i_channels );
@@ -166,15 +179,15 @@ static int aout_SetFormat( aout_thread_t *p_aout )
 
     if( b_stereo != p_aout->b_stereo )
     {
-        intf_WarnMsg( 2, "aout warning: number of audio channels not supported (%i)",
-                      p_aout->i_channels );
+        intf_WarnMsg( 2, "aout warning: number of audio channels not supported"
+                      " (%i)", p_aout->i_channels );
         p_aout->b_stereo = b_stereo;
         p_aout->i_channels = 1 + b_stereo;
     }
 
     /* Set the output rate */
     l_rate = p_aout->l_rate;
-    if( ioctl( p_aout->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
+    if( ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_SPEED, &l_rate ) < 0 )
     {
         intf_ErrMsg( "aout error: can't set audio output rate (%li)",
                      p_aout->l_rate );
@@ -204,7 +217,8 @@ static int aout_SetFormat( aout_thread_t *p_aout )
  *****************************************************************************/
 static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
 {
-    ioctl( p_aout->i_fd, SNDCTL_DSP_GETOSPACE, &p_aout->p_sys->audio_buf );
+    ioctl( p_aout->p_sys->i_fd, SNDCTL_DSP_GETOSPACE,
+           &p_aout->p_sys->audio_buf );
 
     /* returns the allocated space in bytes */
     return ( (p_aout->p_sys->audio_buf.fragstotal
@@ -221,7 +235,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
 {
     if( p_aout->b_active )
     {
-        write( p_aout->i_fd, buffer, i_size );
+        write( p_aout->p_sys->i_fd, buffer, i_size );
     }
 }
 
@@ -230,6 +244,6 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
  *****************************************************************************/
 static void aout_Close( aout_thread_t *p_aout )
 {
-    close( p_aout->i_fd );
+    close( p_aout->p_sys->i_fd );
+    free( p_aout->p_sys->psz_device );
 }
-
index b76353d62599ed211310453a83bf8020360ddbac..a64877226e513df774a7270b4800b99a5be5187a 100644 (file)
@@ -2,7 +2,7 @@
  * dsp.c : OSS /dev/dsp module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: dsp.c,v 1.12 2001/12/30 07:09:54 sam Exp $
+ * $Id: dsp.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -38,10 +38,11 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
 /*****************************************************************************
  * Build configuration tree.
  *****************************************************************************/
+#define DSP_DEV_VAR                    "dsp_dev"
+
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for dsp module" )
-    ADD_FRAME( "OSS Device" )
-        ADD_FILE( "Device name: ", MODULE_VAR(device), NULL )
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_FILE  ( DSP_DEV_VAR, "/dev/dsp", NULL,"OSS dsp device",NULL )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index c68a96de307ea79078f5e8ea40118966fc22f17f..1eebbc0e71a21769953c92b29a22c6e680a27dd7 100644 (file)
@@ -2,7 +2,7 @@
  * dummy.c : dummy plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: dummy.c,v 1.14 2002/01/09 02:01:14 sam Exp $
+ * $Id: dummy.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -41,8 +41,6 @@ void _M( intf_getfunctions )  ( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for dummy module" )
-        ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
 MODULE_CONFIG_STOP
 
 
index 008f0395fa95b14b5a65a8911a922b22f0a7dd26..e7e837aa8999c454e1b9c0a8114d790468a00152 100644 (file)
@@ -2,7 +2,7 @@
  * null.c : NULL module for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: null.c,v 1.4 2001/12/30 07:09:55 sam Exp $
+ * $Id: null.c,v 1.5 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for null module" )
-        ADD_PANE( "First pane" )
-            ADD_FRAME( "First frame" )
-                ADD_COMMENT( "You can put whatever you want here." )
+     /*        ADD_PANE( "First pane" )
+            ADD_SUBCATEGORY_HINT( "First frame" )
+
                 ADD_STRING( "Random text: ", MODULE_VAR(text), NULL )
-            ADD_FRAME( "Second frame" )
-                ADD_COMMENT( "The file below is not used." )
+            ADD_SUBCATEGORY_HINT( "Second frame" )
+
                 ADD_FILE( "Select file: ", MODULE_VAR(file), NULL )
-            ADD_FRAME( "Third frame" )
-                ADD_COMMENT( "This space intentionally left blank." )
+            ADD_SUBCATEGORY_HINT( "Third frame" )
+
         ADD_PANE( "Second pane" )
-            ADD_FRAME( "Frame" )
-                ADD_COMMENT( "There is nothing in this frame." )
+            ADD_SUBCATEGORY_HINT( "Frame" )
+     */
 MODULE_CONFIG_STOP
 
 
index 8d2cc98f191ff3f4eb559b741c223a5695528929..8bd3061c2d0be4b20f650483867d284deb2fb174 100644 (file)
@@ -9,7 +9,7 @@
  *  -dvd_udf to find files
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_dvd.c,v 1.120 2002/02/19 00:50:19 sam Exp $
+ * $Id: input_dvd.c,v 1.121 2002/02/24 20:51:09 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -263,7 +263,7 @@ static void DVDInit( input_thread_t * p_input )
 #undef area
 
     /* Get requested title - if none try the first title */
-    i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+    i_title = config_GetIntVariable( INPUT_TITLE_VAR );
     if( i_title <= 0 || i_title > title_inf.i_title_nb )
     {
         i_title = 1;
@@ -272,7 +272,7 @@ static void DVDInit( input_thread_t * p_input )
 #undef title_inf
 
     /* Get requested chapter - if none defaults to first one */
-    i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+    i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
     if( i_chapter <= 0 )
     {
         i_chapter = 1;
@@ -334,7 +334,7 @@ static void DVDOpen( struct input_thread_s *p_input )
         *psz_parser = '\0';
         psz_parser++;
 
-        main_PutPszVariable( "DVDCSS_RAW_DEVICE", psz_parser );
+        config_PutPszVariable( "DVDCSS_RAW_DEVICE", psz_parser );
     }
 
     intf_WarnMsg( 2, "input: dvd=%s raw=%s", psz_device, psz_parser );
@@ -452,7 +452,7 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
          * Angle management
          */
         p_dvd->i_angle_nb = vmg.title_inf.p_attr[p_dvd->i_title-1].i_angle_nb;
-        p_dvd->i_angle = main_GetIntVariable( INPUT_ANGLE_VAR, 1 );
+        p_dvd->i_angle = config_GetIntVariable( INPUT_ANGLE_VAR );
         if( ( p_dvd->i_angle <= 0 ) || p_dvd->i_angle > p_dvd->i_angle_nb )
         {
             p_dvd->i_angle = 1;
@@ -688,16 +688,15 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
         if( p_main->b_audio )
         {
             /* For audio: first one if none or a not existing one specified */
-            i_audio = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+            i_audio = config_GetIntVariable( INPUT_CHANNEL_VAR );
             if( i_audio < 0 || i_audio > i_audio_nb )
             {
-                main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
                 i_audio = 1;
             }
             if( i_audio > 0 && i_audio_nb > 0 )
             {
-                if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) ||
-                    ( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) ==
+                if( config_GetIntVariable( AOUT_SPDIF_VAR ) ||
+                    ( config_GetIntVariable( INPUT_AUDIO_VAR ) ==
                       REQUESTED_AC3 ) )
                 {
                     int     i_ac3 = i_audio;
@@ -724,10 +723,9 @@ static int DVDSetArea( input_thread_t * p_input, input_area_t * p_area )
         if( p_main->b_video )
         {
             /* for spu, default is none */
-            i_spu = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+            i_spu = config_GetIntVariable( INPUT_SUBTITLE_VAR );
             if( i_spu < 0 || i_spu > i_spu_nb )
             {
-                main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
                 i_spu = 0;
             }
             if( i_spu > 0 && i_spu_nb > 0 )
index e20d3f5fb24d85bea1acabd324ca0b0a09ebdf37..6b33fc321975c05907c8e00662ee5510b24b0aaf 100644 (file)
@@ -6,7 +6,7 @@
  * It depends on: libdvdread for ifo files and block reading.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: input_dvdread.c,v 1.20 2002/02/15 13:32:53 sam Exp $
+ * $Id: input_dvdread.c,v 1.21 2002/02/24 20:51:09 gbazin Exp $
  *
  * Author: Stéphane Borel <stef@via.ecp.fr>
  *
@@ -243,7 +243,7 @@ static void DvdReadInit( input_thread_t * p_input )
 #undef area
 
     /* Get requested title - if none try the first title */
-    i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+    i_title = config_GetIntVariable( INPUT_TITLE_VAR );
     if( i_title <= 0 || i_title > tt_srpt->nr_of_srpts )
     {
         i_title = 1;
@@ -252,7 +252,7 @@ static void DvdReadInit( input_thread_t * p_input )
 #undef tt_srpt
 
     /* Get requested chapter - if none defaults to first one */
-    i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+    i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
     if( i_chapter <= 0 )
     {
         i_chapter = 1;
@@ -473,7 +473,7 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
          * Angle management
          */
         p_area->i_angle_nb = p_vmg->tt_srpt->title[p_area->i_id-1].nr_of_angles;
-        p_area->i_angle = main_GetIntVariable( INPUT_ANGLE_VAR, 1 );
+        p_area->i_angle = config_GetIntVariable( INPUT_ANGLE_VAR );
 
         if( ( p_area->i_angle <= 0 ) || p_area->i_angle > p_area->i_angle_nb )
         {
@@ -667,16 +667,15 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
         if( p_main->b_audio )
         {
             /* For audio: first one if none or a not existing one specified */
-            int i_audio = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+            int i_audio = config_GetIntVariable( INPUT_CHANNEL_VAR );
             if( i_audio < 0 || i_audio > i_audio_nb )
             {
-                main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
                 i_audio = 1;
             }
             if( i_audio > 0 && i_audio_nb > 0 )
             {
-                if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) ||
-                    ( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) ==
+                if( config_GetIntVariable( AOUT_SPDIF_VAR ) ||
+                    ( config_GetIntVariable( INPUT_AUDIO_VAR ) ==
                       REQUESTED_AC3 ) )
                 {
                     int     i_ac3 = i_audio;
@@ -703,10 +702,9 @@ static int DvdReadSetArea( input_thread_t * p_input, input_area_t * p_area )
         if( p_main->b_video )
         {
             /* for spu, default is none */
-            int i_spu = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+            int i_spu = config_GetIntVariable( INPUT_SUBTITLE_VAR );
             if( i_spu < 0 || i_spu > i_spu_nb )
             {
-                main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
                 i_spu = 0;
             }
             if( i_spu > 0 && i_spu_nb > 0 )
index 52fc5b86859b4a20930b10d71cac1be2e17aac0a..adc21206b43f194f439aea64698b66fc93d4b8d8 100644 (file)
@@ -2,7 +2,7 @@
  * aout_esd.c : Esound functions library
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: aout_esd.c,v 1.19 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_esd.c,v 1.20 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -52,6 +52,7 @@
 typedef struct aout_sys_s
 {
     esd_format_t esd_format;
+    int          i_fd;
 
 } aout_sys_t;
 
@@ -97,7 +98,8 @@ static int aout_Open( aout_thread_t *p_aout )
     }
 
     /* Initialize some variables */
-    p_aout->l_rate = esd_audio_rate; /* We use actual esd rate value, not AOUT_RATE_DEFAULT */
+    p_aout->l_rate = esd_audio_rate; /* We use actual esd rate value, not
+                                     * initial value */
 
     i_bits = ESD_BITS16;
     i_mode = ESD_STREAM;
@@ -115,7 +117,7 @@ static int aout_Open( aout_thread_t *p_aout )
 
     /* open a socket for playing a stream
      * and try to open /dev/dsp if there's no EsounD */
-    if ( (p_aout->i_fd
+    if ( (p_aout->p_sys->i_fd
             = esd_play_stream_fallback(p_aout->p_sys->esd_format,
                 p_aout->l_rate, NULL, "vlc")) < 0 )
     {
@@ -184,7 +186,7 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
         }
     }
 
-    write( p_aout->i_fd, buffer, i_size );
+    write( p_aout->p_sys->i_fd, buffer, i_size );
 }
 
 /*****************************************************************************
@@ -192,6 +194,6 @@ static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
  *****************************************************************************/
 static void aout_Close( aout_thread_t *p_aout )
 {
-    close( p_aout->i_fd );
+    close( p_aout->p_sys->i_fd );
 }
 
index 6b13adfe026312c2d596126b8761f30fc3922594..f811e09d9c38fd4123236e400091ea960e12a0d4 100644 (file)
@@ -2,7 +2,7 @@
  * esd.c : EsounD module
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: esd.c,v 1.12 2001/12/31 04:53:33 sam Exp $
+ * $Id: esd.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -38,9 +38,6 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for esd module" )
-        ADD_FRAME( "EsounD" )
-            ADD_COMMENT( "This module does not need configuration" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 1a3e1fe266a66aa87a4bb9d9eefb4dbd8b470bf3..14bb58817dfae99ee148950ef7eb32969e1836cb 100644 (file)
@@ -2,7 +2,7 @@
  * fb.c : framebuffer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: fb.c,v 1.13 2002/02/15 13:32:53 sam Exp $
+ * $Id: fb.c,v 1.14 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -66,7 +66,11 @@ static void GfxMode        ( int i_tty );
 /*****************************************************************************
  * Building configuration tree
  *****************************************************************************/
+#define FB_DEV_VAR "fb_dev"
+
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_STRING  ( FB_DEV_VAR, "/dev/fb0", NULL,"framebuffer device",NULL )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -485,13 +489,22 @@ static int OpenDisplay( vout_thread_t *p_vout )
     struct fb_fix_screeninfo    fix_info;     /* framebuffer fix information */
 
     /* Open framebuffer device */
-    psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT );
+    if( !(psz_device = config_GetPszVariable( FB_DEV_VAR )) )
+    {
+        intf_ErrMsg( "vout error: don't know which fb device to open" );
+        return( 1 );
+    }
+
     p_vout->p_sys->i_fd = open( psz_device, O_RDWR);
+
     if( p_vout->p_sys->i_fd == -1 )
     {
-        intf_ErrMsg("vout error: can't open %s (%s)", psz_device, strerror(errno) );
+        intf_ErrMsg("vout error: can't open %s (%s)",
+                    psz_device, strerror(errno) );
+        free( psz_device );
         return( 1 );
     }
+    free( psz_device );
 
     /* Get framebuffer device informations */
     if( ioctl( p_vout->p_sys->i_fd,
index 35ea719986fc3b87416b8869874c2c441e3718fb..74afc85dc704cd4770143c6dcca1e2f73890d762 100644 (file)
@@ -2,7 +2,7 @@
  * deinterlace.c : deinterlacer plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: deinterlace.c,v 1.5 2002/02/15 13:32:53 sam Exp $
+ * $Id: deinterlace.c,v 1.6 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -113,7 +113,7 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method;
+    char *psz_method, *psz_method_tmp;
 
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
@@ -124,7 +124,13 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    if( !(psz_method = psz_method_tmp
+          = config_GetPszVariable( VOUT_FILTER_VAR )) )
+    {
+        intf_ErrMsg( "vout error: configuration variable %s empty",
+                     VOUT_FILTER_VAR );
+        return( 1 );
+    }
 
     while( *psz_method && *psz_method != ':' )
     {
@@ -146,6 +152,8 @@ static int vout_Create( vout_thread_t *p_vout )
         p_vout->p_sys->i_mode = DEINTERLACE_MODE_BOB;
     }
 
+    free( psz_method_tmp );
+
     return( 0 );
 }
 
@@ -180,8 +188,8 @@ static int vout_Init( vout_thread_t *p_vout )
     }
 
     /* Try to open the real video output, with half the height our images */
-    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+    psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+    config_PutPszVariable( VOUT_FILTER_VAR, NULL );
 
     intf_WarnMsg( 1, "filter: spawning the real video output" );
 
@@ -219,6 +227,9 @@ static int vout_Init( vout_thread_t *p_vout )
         break;
     }
 
+    config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    if( psz_filter ) free( psz_filter );
+
     /* Everything failed */
     if( p_vout->p_sys->p_vout == NULL )
     {
@@ -229,8 +240,6 @@ static int vout_Init( vout_thread_t *p_vout )
  
     p_vout->p_sys->last_date = 0;
 
-    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
     return( 0 );
index c2259d9aaec9717cdc88db13fd21603e951a46ea..7c5bc5ee24d97549e7e02c2e10edc22aad67e469 100644 (file)
@@ -2,7 +2,7 @@
  * distort.c : Misc video effects plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: distort.c,v 1.7 2002/02/15 13:32:53 sam Exp $
+ * $Id: distort.c,v 1.8 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -121,7 +121,7 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method;
+    char *psz_method, *psz_method_tmp;
 
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
@@ -132,7 +132,13 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    if( !(psz_method = psz_method_tmp
+          = config_GetPszVariable( VOUT_FILTER_VAR )) )
+    {
+        intf_ErrMsg( "vout error: configuration variable %s empty",
+                     VOUT_FILTER_VAR );
+        return( 1 );
+    }
 
     while( *psz_method && *psz_method != ':' )
     {
@@ -154,6 +160,8 @@ static int vout_Create( vout_thread_t *p_vout )
         p_vout->p_sys->i_mode = DISTORT_MODE_WAVE;
     }
 
+    free( psz_method_tmp );
+
     return( 0 );
 }
 
@@ -175,8 +183,8 @@ static int vout_Init( vout_thread_t *p_vout )
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 
     /* Try to open the real video output */
-    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+    psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+    config_PutPszVariable( VOUT_FILTER_VAR, NULL );
 
     intf_WarnMsg( 1, "filter: spawning the real video output" );
 
@@ -185,6 +193,9 @@ static int vout_Init( vout_thread_t *p_vout )
                            p_vout->render.i_width, p_vout->render.i_height,
                            p_vout->render.i_chroma, p_vout->render.i_aspect );
 
+    config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    if( psz_filter ) free( psz_filter );
+
     /* Everything failed */
     if( p_vout->p_sys->p_vout == NULL )
     {
@@ -193,8 +204,6 @@ static int vout_Init( vout_thread_t *p_vout )
         return( 0 );
     }
  
-    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
     p_vout->p_sys->f_angle = 0.0;
index ace5419e81f044a1de21b9787d0259ac83310d09..0f1f63e78ee478e448b402cf3deef363ddebad09 100644 (file)
@@ -2,7 +2,7 @@
  * invert.c : Invert video plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: invert.c,v 1.7 2002/02/15 13:32:53 sam Exp $
+ * $Id: invert.c,v 1.8 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -125,7 +125,7 @@ static int vout_Init( vout_thread_t *p_vout )
     int i_index;
     char *psz_filter;
     picture_t *p_pic;
-    
+
     I_OUTPUTPICTURES = 0;
 
     /* Initialize the output structure */
@@ -135,16 +135,19 @@ static int vout_Init( vout_thread_t *p_vout )
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 
     /* Try to open the real video output */
-    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+    psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+    config_PutPszVariable( VOUT_FILTER_VAR, NULL );
 
     intf_WarnMsg( 1, "filter: spawning the real video output" );
-        
+
     p_vout->p_sys->p_vout =
         vout_CreateThread( NULL,
                            p_vout->render.i_width, p_vout->render.i_height,
                            p_vout->render.i_chroma, p_vout->render.i_aspect );
 
+    config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    if( psz_filter ) free( psz_filter );
+
     /* Everything failed */
     if( p_vout->p_sys->p_vout == NULL )
     {
@@ -153,8 +156,6 @@ static int vout_Init( vout_thread_t *p_vout )
         return( 0 );
     }
  
-    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
     return( 0 );
index 86ef46f33e14b1a2c60cd98ae80b681f6d894d97..67afa00238c8acbbb08dd87da8ad23cae2a59d26 100644 (file)
@@ -2,7 +2,7 @@
  * transform.c : transform image plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: transform.c,v 1.6 2002/02/15 13:32:53 sam Exp $
+ * $Id: transform.c,v 1.7 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -114,7 +114,7 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method;
+    char *psz_method, *psz_method_tmp;
 
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
@@ -125,7 +125,13 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    if( !(psz_method = psz_method_tmp
+          = config_GetPszVariable( VOUT_FILTER_VAR )) )
+    {
+        intf_ErrMsg( "vout error: configuration variable %s empty",
+                     VOUT_FILTER_VAR );
+        return( 1 );
+    }
 
     while( *psz_method && *psz_method != ':' )
     {
@@ -165,6 +171,8 @@ static int vout_Create( vout_thread_t *p_vout )
         p_vout->p_sys->b_rotation = 1;
     }
 
+    free( psz_method_tmp );
+
     return( 0 );
 }
 
@@ -186,8 +194,8 @@ static int vout_Init( vout_thread_t *p_vout )
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 
     /* Try to open the real video output */
-    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+    psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+    config_PutPszVariable( VOUT_FILTER_VAR, NULL );
 
     intf_WarnMsg( 1, "filter: spawning the real video output" );
 
@@ -208,6 +216,9 @@ static int vout_Init( vout_thread_t *p_vout )
                            p_vout->render.i_chroma, p_vout->render.i_aspect );
     }
 
+    config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    if( psz_filter ) free( psz_filter );
+
     /* Everything failed */
     if( p_vout->p_sys->p_vout == NULL )
     {
@@ -215,8 +226,6 @@ static int vout_Init( vout_thread_t *p_vout )
         return( 0 );
     }
  
-    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
-
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
     return( 0 );
index 76c9c153340edd61f4f8dc39cc3dbe3f6c2844b3..7d2d2883b6076ece221f56b15c234c5193370255 100644 (file)
@@ -2,7 +2,7 @@
  * wall.c : Wall video plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: wall.c,v 1.12 2002/02/15 13:32:53 sam Exp $
+ * $Id: wall.c,v 1.13 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -117,7 +117,7 @@ static void vout_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
-    char *psz_method, *psz_tmp;
+    char *psz_method, *psz_tmp, *psz_method_tmp;
     int i_vout;
 
     /* Allocate structure */
@@ -129,7 +129,13 @@ static int vout_Create( vout_thread_t *p_vout )
     }
 
     /* Look what method was requested */
-    psz_method = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    if( !(psz_method = psz_method_tmp
+          = config_GetPszVariable( VOUT_FILTER_VAR )) )
+    {
+        intf_ErrMsg( "vout error: configuration variable %s empty",
+                     VOUT_FILTER_VAR );
+        return( 1 );
+    }
 
     while( *psz_method && *psz_method != ':' )
     {
@@ -203,6 +209,7 @@ static int vout_Create( vout_thread_t *p_vout )
     if( p_vout->p_sys->pp_vout == NULL )
     {
         intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        free( psz_method_tmp );
         free( p_vout->p_sys );
         return( 1 );
     }
@@ -253,6 +260,8 @@ static int vout_Create( vout_thread_t *p_vout )
         }
     }
 
+    free( psz_method_tmp );
+
     return( 0 );
 }
 
@@ -274,8 +283,8 @@ static int vout_Init( vout_thread_t *p_vout )
     p_vout->output.i_aspect = p_vout->render.i_aspect;
 
     /* Try to open the real video output */
-    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, NULL );
-    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+    psz_filter = config_GetPszVariable( VOUT_FILTER_VAR );
+    config_PutPszVariable( VOUT_FILTER_VAR, NULL );
 
     intf_WarnMsg( 1, "filter: spawning the real video outputs" );
 
@@ -330,6 +339,8 @@ static int vout_Init( vout_thread_t *p_vout )
                 intf_ErrMsg( "vout error: failed to get %ix%i vout threads",
                              p_vout->p_sys->i_col, p_vout->p_sys->i_row );
                 RemoveAllVout( p_vout );
+                config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+                if( psz_filter ) free( psz_filter );
                 return 0;
             }
 
@@ -337,7 +348,8 @@ static int vout_Init( vout_thread_t *p_vout )
         }
     }
 
-    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    config_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+    if( psz_filter ) free( psz_filter );
 
     ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
 
index 15eecf412839b6ade5438bc3c652308d9c6a664e..7847162dfbc2cc00f3e7db080dd46e5decfb7598 100644 (file)
@@ -2,7 +2,7 @@
  * ggi.c : GGI plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: ggi.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: ggi.c,v 1.15 2002/02/24 20:51:09 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -396,9 +396,10 @@ static int OpenDisplay( vout_thread_t *p_vout )
     }
 
     /* Open display */
-    psz_display = main_GetPszVariable( VOUT_DISPLAY_VAR, NULL );
+    psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
 
     p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
+    if( psz_display ) free( psz_display );
 
     if( p_vout->p_sys->p_display == NULL )
     {
@@ -409,10 +410,8 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
     /* Find most appropriate mode */
     p_vout->p_sys->mode.frames =    2;                          /* 2 buffers */
-    p_vout->p_sys->mode.visible.x = main_GetIntVariable( VOUT_WIDTH_VAR,
-                                                         VOUT_WIDTH_DEFAULT );
-    p_vout->p_sys->mode.visible.y = main_GetIntVariable( VOUT_HEIGHT_VAR,
-                                                         VOUT_HEIGHT_DEFAULT );
+    p_vout->p_sys->mode.visible.x = config_GetIntVariable( VOUT_WIDTH_VAR );
+    p_vout->p_sys->mode.visible.y = config_GetIntVariable( VOUT_HEIGHT_VAR );
     p_vout->p_sys->mode.virt.x =    GGI_AUTO;
     p_vout->p_sys->mode.virt.y =    GGI_AUTO;
     p_vout->p_sys->mode.size.x =    GGI_AUTO;
@@ -515,4 +514,3 @@ static void CloseDisplay( vout_thread_t *p_vout )
     /* Exit library */
     ggiExit();
 }
-
index 56d34ddf1ee4addf5427c90d9eea304286a32d8e..813d5b73d2bcd862b47a04fa441159226f3d2aaa 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_display.c: Gtk+ tools for main interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: gtk_display.c,v 1.13 2002/01/10 04:11:25 sam Exp $
+ * $Id: gtk_display.c,v 1.14 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -147,8 +147,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
                                     p_input_bank->pp_input[0]->p_source );
                 p_channel = GTK_WIDGET( gtk_object_get_data( GTK_OBJECT(
                            p_intf->p_sys->p_window ), "network_channel_box" ) );
-                if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                                         INPUT_NETWORK_CHANNEL_DEFAULT  ) )
+                if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
                 {
                     gtk_widget_show( GTK_WIDGET( p_channel ) );
                 }
@@ -194,8 +193,7 @@ gint GtkModeManage( intf_thread_t * p_intf )
     }
     else
     {
-        if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                                 INPUT_NETWORK_CHANNEL_DEFAULT  ) )
+        if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
         {
             gtk_widget_show( GTK_WIDGET( p_network_box ) );
 
index d657e4952df972ce4b22449afc01ba1f90599d96..1392b1716f60a75fdfc241d266a6a4c777fda145 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_open.c : functions to handle file/disc/network open widgets.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_open.c,v 1.15 2002/01/31 23:18:27 massiot Exp $
+ * $Id: gtk_open.c,v 1.16 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -66,13 +66,16 @@ gboolean GtkFileOpenShow( GtkWidget       *widget,
     /* If we have never used the file selector, open it */
     if( !GTK_IS_WIDGET( p_intf->p_sys->p_fileopen ) )
     {
+        char *psz_path;
+
         p_intf->p_sys->p_fileopen = create_intf_fileopen();
         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_fileopen ),
                              "p_intf", p_intf );
 
-        gtk_file_selection_set_filename( GTK_FILE_SELECTION(
-            p_intf->p_sys->p_fileopen ),
-            main_GetPszVariable( INTF_PATH_VAR, INTF_PATH_DEFAULT ) );
+        if( (psz_path = config_GetPszVariable( INTF_PATH_VAR )) )
+            gtk_file_selection_set_filename( GTK_FILE_SELECTION(
+                p_intf->p_sys->p_fileopen ), psz_path );
+        if( psz_path ) free( psz_path );
     }
 
     gtk_widget_show( p_intf->p_sys->p_fileopen );
@@ -148,10 +151,13 @@ void GtkDiscOpenDvd( GtkToggleButton * togglebutton, gpointer user_data )
 {
     if( togglebutton->active )
     {
-        gtk_entry_set_text(
-          GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
-          main_GetPszVariable( INPUT_DVD_DEVICE_VAR, DVD_DEVICE )
-        );
+        char *psz_dvd_device;
+
+        if( (psz_dvd_device = config_GetPszVariable( INPUT_DVD_DEVICE_VAR )) )
+            gtk_entry_set_text(
+                GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton),
+                                          "disc_name" ) ), psz_dvd_device );
+        if( psz_dvd_device ) free( psz_dvd_device );
     }
 }
 
@@ -159,10 +165,13 @@ void GtkDiscOpenVcd( GtkToggleButton * togglebutton, gpointer user_data )
 {
     if( togglebutton->active )
     {
-        gtk_entry_set_text(
-          GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton), "disc_name" ) ),
-          main_GetPszVariable( INPUT_VCD_DEVICE_VAR, VCD_DEVICE )
-        );
+        char *psz_vcd_device;
+
+        if( (psz_vcd_device = config_GetPszVariable( INPUT_VCD_DEVICE_VAR )) )
+            gtk_entry_set_text(
+                GTK_ENTRY( lookup_widget( GTK_WIDGET(togglebutton),
+                                          "disc_name" ) ), psz_vcd_device );
+        if( psz_vcd_device ) free( psz_vcd_device );
     }
 }
 
@@ -204,11 +213,11 @@ void GtkDiscOpenOk( GtkButton * button, gpointer user_data )
     }
     
     /* Select title and chapter */
-    main_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
+    config_PutIntVariable( INPUT_TITLE_VAR, gtk_spin_button_get_value_as_int(
                               GTK_SPIN_BUTTON( lookup_widget(
                                   GTK_WIDGET(button), "disc_title" ) ) ) );
 
-    main_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
+    config_PutIntVariable( INPUT_CHAPTER_VAR, gtk_spin_button_get_value_as_int(
                               GTK_SPIN_BUTTON( lookup_widget(
                                   GTK_WIDGET(button), "disc_chapter" ) ) ) );
 
@@ -253,44 +262,30 @@ gboolean GtkNetworkOpenShow( GtkWidget       *widget,
 
     if( !GTK_IS_WIDGET( p_intf->p_sys->p_network ) )
     {
+        char *psz_channel_server;
+
         p_intf->p_sys->p_network = create_intf_network();
         gtk_object_set_data( GTK_OBJECT( p_intf->p_sys->p_network ),
                              "p_intf", p_intf );
 
-        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
-            GTK_OBJECT( p_intf->p_sys->p_network ), "network_server" ) ),
-            main_GetPszVariable( INPUT_SERVER_VAR,
-                                 INPUT_SERVER_DEFAULT ) );
-
         gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
             GTK_OBJECT( p_intf->p_sys->p_network ), "network_port" ) ),
-            main_GetIntVariable( INPUT_PORT_VAR,
-                                 INPUT_PORT_DEFAULT ) );
-
-        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
-            GTK_OBJECT( p_intf->p_sys->p_network ), "network_broadcast" ) ),
-            main_GetPszVariable( INPUT_BCAST_ADDR_VAR,
-                                 INPUT_BCAST_ADDR_DEFAULT ) );
+            config_GetIntVariable( INPUT_PORT_VAR ) );
 
-        gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
-            GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel" ) ),
-            main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR,
-                                 INPUT_CHANNEL_SERVER_DEFAULT ) );
+        psz_channel_server = config_GetPszVariable( INPUT_CHANNEL_SERVER_VAR );
+        if( psz_channel_server )
+            gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data(
+                GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel" ) ),
+                psz_channel_server );
+        if( psz_channel_server ) free( psz_channel_server );
 
         gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(
             GTK_OBJECT( p_intf->p_sys->p_network ), "network_channel_port" ) ),
-            main_GetIntVariable( INPUT_CHANNEL_PORT_VAR,
-                                 INPUT_CHANNEL_PORT_DEFAULT ) );
+            config_GetIntVariable( INPUT_CHANNEL_PORT_VAR ) );
 
         gtk_toggle_button_set_active( gtk_object_get_data( GTK_OBJECT(
             p_intf->p_sys->p_network ), "network_channel_check" ),
-            main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                                 INPUT_NETWORK_CHANNEL_DEFAULT ) );
-            
-        gtk_toggle_button_set_active( gtk_object_get_data( GTK_OBJECT(
-            p_intf->p_sys->p_network ), "network_broadcast_check" ),
-            main_GetIntVariable( INPUT_BROADCAST_VAR,
-                                 INPUT_BROADCAST_DEFAULT ) );
+            config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) );
     }
 
     gtk_widget_show( p_intf->p_sys->p_network );
@@ -340,7 +335,7 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data )
     /* Manage channel server */
     b_channel = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(
         lookup_widget( GTK_WIDGET(button), "network_channel_check" ) ) );
-    main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, b_channel );
+    config_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, b_channel );
     if( b_channel )
     {
         char *          psz_channel;
@@ -356,10 +351,10 @@ void GtkNetworkOpenOk( GtkButton *button, gpointer user_data )
         i_channel_port = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(
             lookup_widget( GTK_WIDGET(button), "network_channel_port" ) ) );
 
-        main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, psz_channel );
+        config_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, psz_channel );
         if( i_channel_port < 65536 )
         {
-            main_PutIntVariable( INPUT_CHANNEL_PORT_VAR, i_channel_port );
+            config_PutIntVariable( INPUT_CHANNEL_PORT_VAR, i_channel_port );
         }
 
         p_intf->p_sys->b_playing = 1;
index f7cd18e36a3b61c5441d9cf3e457efbd4fa82c31..bf333bb6dc1920e0a12fcb1ebdf0e1715f1db020 100644 (file)
@@ -2,7 +2,7 @@
  * gtk_control.c : functions to handle stream control buttons.
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: gtk_preferences.c,v 1.10 2002/01/02 14:37:42 sam Exp $
+ * $Id: gtk_preferences.c,v 1.11 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
  ****************************************************************************/
 
 /* macros to create preference box */
-#define ASSIGN_PSZ_ENTRY( var, default, name )                               \
+#define ASSIGN_PSZ_ENTRY( var, name )                                        \
     gtk_entry_set_text( GTK_ENTRY( gtk_object_get_data( GTK_OBJECT(          \
         p_intf->p_sys->p_preferences ), name ) ),                            \
-                        main_GetPszVariable( var, default ) )
+                        config_GetPszVariable( var ) )
 
-#define ASSIGN_INT_VALUE( var, default, name )                                        \
+#define ASSIGN_INT_VALUE( var, name )                                        \
     gtk_spin_button_set_value( GTK_SPIN_BUTTON( gtk_object_get_data(         \
         GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ),                \
-                               main_GetIntVariable( var, default ) )
+                               config_GetIntVariable( var ) )
 
-#define ASSIGN_INT_TOGGLE( var, default, name )                                       \
+#define ASSIGN_INT_TOGGLE( var, name )                                       \
     gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( gtk_object_get_data(    \
         GTK_OBJECT( p_intf->p_sys->p_preferences ), name ) ),                \
-                               main_GetIntVariable( var, default ) )
+                               config_GetIntVariable( var ) )
 
 gboolean GtkPreferencesShow( GtkWidget       *widget,
                              GdkEventButton  *event,
@@ -85,49 +85,37 @@ gboolean GtkPreferencesShow( GtkWidget       *widget,
                              "p_intf", p_intf );
 
         /* Default path */
-        ASSIGN_PSZ_ENTRY( INTF_PATH_VAR, INTF_PATH_DEFAULT,
+        ASSIGN_PSZ_ENTRY( INTF_PATH_VAR,
                           "preferences_file_path_entry" );
     
         /* Default DVD */
-        ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR,DVD_DEVICE,
+        ASSIGN_PSZ_ENTRY( INPUT_DVD_DEVICE_VAR,
                           "preferences_disc_dvd_entry" );
     
         /* Default VCD */
-        ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, VCD_DEVICE,
+        ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR,
                           "preferences_disc_vcd_entry" );
     
-        /* Default server */
-        ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, INPUT_SERVER_DEFAULT,
-                          "preferences_network_server_entry" );
-    
         /* Default port */
-        ASSIGN_INT_VALUE( INPUT_PORT_VAR, INPUT_PORT_DEFAULT,
+        ASSIGN_INT_VALUE( INPUT_PORT_VAR,
                           "preferences_network_port_spinbutton" );
     
-        /* Broadcast address */
-        ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADDR_VAR, INPUT_BCAST_ADDR_DEFAULT,
-                          "preferences_network_broadcast_entry" );
-    
-        /* Broadcast stream by default ? */
-        ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR, INPUT_BROADCAST_DEFAULT,
-                           "preferences_network_broadcast_checkbutton" );
-    
         /* XXX Protocol */
     
         /* Default interface */
-        ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR, INTF_METHOD_DEFAULT,
+        ASSIGN_PSZ_ENTRY( INTF_METHOD_VAR,
                           "preferences_interface_entry" );
     
         /* Default video output */
-        ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR, VOUT_METHOD_DEFAULT,
+        ASSIGN_PSZ_ENTRY( VOUT_METHOD_VAR,
                           "preferences_video_output_entry" );
     
         /* Default output width */
-        ASSIGN_INT_VALUE( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT,
+        ASSIGN_INT_VALUE( VOUT_WIDTH_VAR,
                           "preferences_video_width_spinbutton" );
     
         /* Default output height */
-        ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT,
+        ASSIGN_INT_VALUE( VOUT_HEIGHT_VAR,
                           "preferences_video_height_spinbutton" );
     
         /* XXX Default screen depth */
@@ -137,20 +125,17 @@ gboolean GtkPreferencesShow( GtkWidget       *widget,
         /* XXX Default gamma */
         
         /* Fullscreen on play */
-        ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT,
+        ASSIGN_INT_TOGGLE( VOUT_FULLSCREEN_VAR,
                            "preferences_video_fullscreen_checkbutton" );
     
         /* Grayscale display */
-        ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT,
+        ASSIGN_INT_TOGGLE( VOUT_GRAYSCALE_VAR,
                            "preferences_video_grayscale_checkbutton" );
     
         /* Default audio output */
-        ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, AOUT_METHOD_DEFAULT,
+        ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR,
                           "preferences_audio_output_entry" );
-    
-        /* Default audio device */
-        ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, AOUT_DSP_DEFAULT,
-                          "preferences_audio_device_entry" );
+
     
         /* XXX Default frequency */
     
@@ -159,23 +144,23 @@ gboolean GtkPreferencesShow( GtkWidget       *widget,
         /* XXX Default number of channels */
     
         /* Use spdif output ? */
-        ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR, AOUT_SPDIF_DEFAULT,
+        ASSIGN_INT_TOGGLE( AOUT_SPDIF_VAR,
                            "preferences_audio_spdif_checkbutton" );
     
         /* Launch playlist on startup */
-        ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR, PLAYLIST_STARTUP_DEFAULT,
+        ASSIGN_INT_TOGGLE( PLAYLIST_STARTUP_VAR,
                         "preferences_playlist_startup_checkbutton" );
     
         /* Enqueue drag'n dropped item as default */
-        ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR, PLAYLIST_ENQUEUE_DEFAULT,
+        ASSIGN_INT_TOGGLE( PLAYLIST_ENQUEUE_VAR,
                            "preferences_playlist_enqueue_checkbutton" );
     
         /* Loop on playlist end */
-        ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR, PLAYLIST_LOOP_DEFAULT,
+        ASSIGN_INT_TOGGLE( PLAYLIST_LOOP_VAR,
                            "preferences_playlist_loop_checkbutton" );
     
         /* Verbosity of warning messages */
-        ASSIGN_INT_VALUE( INTF_WARNING_VAR, INTF_WARNING_DEFAULT,
+        ASSIGN_INT_VALUE( INTF_WARNING_VAR,
                           "preferences_misc_messages_spinbutton" );
 #undef ASSIGN_PSZ_ENTRY
 #undef ASSIGN_INT_VALUE
@@ -193,18 +178,18 @@ gboolean GtkPreferencesShow( GtkWidget       *widget,
  ****************************************************************************/
 
 /* macros to read value frfom preference box */
-#define ASSIGN_PSZ_ENTRY( var, name )                                        \
-    main_PutPszVariable( var, gtk_entry_get_text(                            \
+#define ASSIGN_PSZ_ENTRY( var, name )                                         \
+    config_PutPszVariable( var, gtk_entry_get_text(                           \
     GTK_ENTRY( gtk_object_get_data( GTK_OBJECT( p_preferences ), name ) ) ) )
 
-#define ASSIGN_INT_VALUE( var, name )                                        \
-    main_PutIntVariable( var, gtk_spin_button_get_value_as_int(              \
-        GTK_SPIN_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ),   \
+#define ASSIGN_INT_VALUE( var, name )                                         \
+    config_PutIntVariable( var, gtk_spin_button_get_value_as_int(             \
+        GTK_SPIN_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ),    \
         name ) ) ) )
 
-#define ASSIGN_INT_TOGGLE( var, name )                                       \
-    main_PutIntVariable( var, gtk_toggle_button_get_active(                  \
-        GTK_TOGGLE_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ), \
+#define ASSIGN_INT_TOGGLE( var, name )                                        \
+    config_PutIntVariable( var, gtk_toggle_button_get_active(                 \
+        GTK_TOGGLE_BUTTON( gtk_object_get_data( GTK_OBJECT( p_preferences ),  \
         name ) ) ) )
 
 void GtkPreferencesApply( GtkButton * button, gpointer user_data )
@@ -223,20 +208,9 @@ void GtkPreferencesApply( GtkButton * button, gpointer user_data )
     /* Default VCD */
     ASSIGN_PSZ_ENTRY( INPUT_VCD_DEVICE_VAR, "preferences_disc_vcd_entry" );
 
-    /* Default server */
-    ASSIGN_PSZ_ENTRY( INPUT_SERVER_VAR, "preferences_network_server_entry" );
-
     /* Default port */
     ASSIGN_INT_VALUE( INPUT_PORT_VAR, "preferences_network_port_spinbutton" );
 
-    /* Broadcast address */
-    ASSIGN_PSZ_ENTRY( INPUT_BCAST_ADDR_VAR,
-                      "preferences_network_broadcast_entry" );
-
-    /* Broadcast stream by default ? */
-    ASSIGN_INT_TOGGLE( INPUT_BROADCAST_VAR,
-                       "preferences_network_broadcast_checkbutton" );
-
     /* XXX Protocol */
 
     /* Default interface */
@@ -268,9 +242,6 @@ void GtkPreferencesApply( GtkButton * button, gpointer user_data )
     /* Default audio output */
     ASSIGN_PSZ_ENTRY( AOUT_METHOD_VAR, "preferences_audio_output_entry" );
 
-    /* Default audio device */
-    ASSIGN_PSZ_ENTRY( AOUT_DSP_VAR, "preferences_audio_device_entry" );
-
     /* XXX Default frequency */
 
     /* XXX Default quality */
index d243599a3ef7839b5b1db5469ff08bae8f438730..1ea0bcfe961984a204980c98407f8a85cbfe7e18 100644 (file)
@@ -2,7 +2,7 @@
  * idctclassic.c : Classic IDCT module
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: idctclassic.c,v 1.20 2002/02/15 13:32:53 sam Exp $
+ * $Id: idctclassic.c,v 1.21 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -41,8 +41,6 @@ static void idct_getfunctions( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for classic IDCT module" )
-        ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 3f885a536c9582904b81239fdf8f20daa9b1ab8f..9daf9dd0b703e82f0d4d7acdc7e9e8cef6d4a71f 100644 (file)
@@ -2,7 +2,7 @@
  * kde.cpp : KDE plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: kde.cpp,v 1.6 2002/01/02 14:37:42 sam Exp $
+ * $Id: kde.cpp,v 1.7 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Andres Krapf <dae@chez.com> Sun Mar 25 2001
  *
@@ -48,8 +48,6 @@ extern "C"
 {
 
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for KDE module" )
-        ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index e0627b49e09da825cd23a75db2e2d1ce71124b1f..8c6db28d93e1aa45241aad0123dfdbd5cd855c5c 100644 (file)
@@ -287,8 +287,8 @@ void KInterface::slotOpenDisk()
         source += fDiskDialog->device();
 
         // Select title and chapter
-        main_PutIntVariable( INPUT_TITLE_VAR, fDiskDialog->title() );
-        main_PutIntVariable( INPUT_CHAPTER_VAR, fDiskDialog->chapter() );
+        config_PutIntVariable( INPUT_TITLE_VAR, fDiskDialog->title() );
+        config_PutIntVariable( INPUT_CHAPTER_VAR, fDiskDialog->chapter() );
 
         // add it to playlist
         intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, source.latin1() );
index 6b0898f10bc89963594027e0e45e3c150d3e4eed..d3ea352edbb8bc9488fac2489b8e862d2404a2c2 100644 (file)
@@ -2,7 +2,7 @@
  * lirc.c : lirc plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: lirc.c,v 1.7 2002/02/21 21:55:40 sam Exp $
+ * $Id: lirc.c,v 1.8 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Sigmund Augdal <sigmunau@idi.ntnu.no>
  *
@@ -64,8 +64,7 @@ static void intf_Run       ( intf_thread_t *p_intf );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for lirc module" )
-    ADD_COMMENT( "use ~/.lircrc" )
+
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -148,7 +147,14 @@ static void intf_Run( intf_thread_t *p_intf )
     char *code;
     char *c;
 
+    /* Manage core vlc functions through the callback */
+    p_intf->pf_manage( p_intf );
+
+<<<<<<< lirc.c
+    while( !p_intf->b_die && lirc_nextcode(&code) == 0 )
+=======
     while( !p_intf->b_die )
+>>>>>>> 1.7
     {
         /* Manage core vlc functions through the callback */
         p_intf->pf_manage( p_intf );
index 462c0b74adb461004f67d7672b61129943bd8e55..9805e27d58aa2a27229c7dbf5f39061c6236be06 100644 (file)
@@ -2,7 +2,7 @@
  * xmga.c : X11 MGA plugin for vlc
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xmga.c,v 1.5 2002/02/19 00:50:19 sam Exp $
+ * $Id: xmga.c,v 1.6 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -267,16 +267,21 @@ static int vout_Create( vout_thread_t *p_vout )
         return( 1 );
     }
 
-    /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
-    psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
+    /* Open display, unsing the VOUT_DISPLAY_VAR config variable or the DISPLAY
+     * environment variable */
+    psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
     p_vout->p_sys->p_display = XOpenDisplay( psz_display );
 
     if( p_vout->p_sys->p_display == NULL )                          /* error */
     {
-        intf_ErrMsg( "vout error: cannot open display %s", psz_display );
+        intf_ErrMsg( "vout error: cannot open display %s",
+                     XDisplayName( psz_display ) );
         free( p_vout->p_sys );
+        if( psz_display ) free( psz_display );
         return( 1 );
     }
+    if( psz_display ) free( psz_display );
+
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
     /* Create blank cursor (for mouse cursor autohiding) */
index 08a34ba8807c0477d3ec793575c7a4e03e38a15c..6d3e2041eae963facdf92c6b092aaee1da5c6c84 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_adec.c: MPEG audio decoder thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: mpeg_adec.c,v 1.19 2002/02/19 00:50:19 sam Exp $
+ * $Id: mpeg_adec.c,v 1.20 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -171,7 +171,7 @@ static void DecodeThread( adec_thread_t * p_adec )
             int fifo_type;
             int channels;
             
-            if( main_GetIntVariable( AOUT_STEREO_VAR, 0 ) )
+            if( p_main->b_stereo )
             {
                 intf_WarnMsg( 4, "adec info: setting stereo output" );
                 fifo_type = AOUT_ADEC_STEREO_FIFO;
index bbded57610fb8c57b4d4cc6fa6f9300218c905d6..85af71487d8fc2cf4e4220b0c2767a59e1896591 100644 (file)
@@ -2,7 +2,7 @@
  * input_ps.c: PS demux and packet management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ps.c,v 1.12 2002/02/15 13:32:53 sam Exp $
+ * $Id: input_ps.c,v 1.13 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -258,33 +258,33 @@ static void PSInit( input_thread_t * p_input )
 
                     case MPEG1_AUDIO_ES:
                     case MPEG2_AUDIO_ES:
-                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                == (p_es->i_id & 0x1F) )
-                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+                                == (p_es->i_id & 0x1F) ||
+                            ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+                              && !(p_es->i_id & 0x1F) ) )
+                        switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
                         {
-                        case 0:
-                            main_PutIntVariable( INPUT_AUDIO_VAR,
-                                                 REQUESTED_MPEG );
+                        case -1:
                         case REQUESTED_MPEG:
                             input_SelectES( p_input, p_es );
                         }
                         break;
 
                     case AC3_AUDIO_ES:
-                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                == ((p_es->i_id & 0xF00) >> 8) )
-                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+                                == ((p_es->i_id & 0xF00) >> 8) ||
+                            ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+                              && !((p_es->i_id & 0xF00) >> 8) ) )
+                        switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
                         {
-                        case 0:
-                            main_PutIntVariable( INPUT_AUDIO_VAR,
-                                                 REQUESTED_AC3 );
+                        case -1:
                         case REQUESTED_AC3:
                             input_SelectES( p_input, p_es );
                         }
                         break;
 
                     case DVD_SPU_ES:
-                        if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+                        if( config_GetIntVariable( INPUT_SUBTITLE_VAR )
                                 == ((p_es->i_id & 0x1F00) >> 8) )
                         {
                             input_SelectES( p_input, p_es );
@@ -292,13 +292,13 @@ static void PSInit( input_thread_t * p_input )
                         break;
 
                     case LPCM_AUDIO_ES:
-                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                == ((p_es->i_id & 0x1F00) >> 8) )
-                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+                                == ((p_es->i_id & 0x1F00) >> 8) ||
+                            ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+                              && !((p_es->i_id & 0x1F00) >> 8) ) )
+                        switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
                         {
-                        case 0:
-                            main_PutIntVariable( INPUT_AUDIO_VAR,
-                                                 REQUESTED_LPCM );
+                        case -1:
                         case REQUESTED_LPCM:
                             input_SelectES( p_input, p_es );
                         }
index da4e36afdec3a5371a62ba0ce50d6537b41980d4..58898139d40091deb51c67ad453c64e9193d3120 100644 (file)
@@ -2,7 +2,7 @@
  * video_parser.c : video parser thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: video_parser.c,v 1.14 2002/02/19 00:50:19 sam Exp $
+ * $Id: video_parser.c,v 1.15 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -71,7 +71,17 @@ void _M( vdec_getfunctions )( function_list_t * p_function_list )
 /*****************************************************************************
  * Build configuration tree.
  *****************************************************************************/
+/* Variable containing the motion compensation method */
+#define MOTION_METHOD_VAR               "mpeg_vdec_motion"
+/* Variable containing the IDCT method */
+#define IDCT_METHOD_VAR                 "mpeg_vdec_idct"
+
 MODULE_CONFIG_START
+ADD_CATEGORY_HINT( "Misc Options", NULL)
+ADD_PLUGIN( IDCT_METHOD_VAR, MODULE_CAPABILITY_IDCT, NULL, NULL,
+           "IDCT method", NULL )
+ADD_PLUGIN( MOTION_METHOD_VAR, MODULE_CAPABILITY_MOTION, NULL, NULL,
+           "motion compensation method", NULL )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -179,12 +189,15 @@ static int decoder_Run ( decoder_config_t * p_config )
  *****************************************************************************/
 static int InitThread( vpar_thread_t *p_vpar )
 {
+    char *psz_name;
+
     /*
      * Choose the best motion compensation module
      */
-    p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION,
-                                main_GetPszVariable( MOTION_METHOD_VAR, NULL ),
-                                NULL );
+    psz_name = config_GetPszVariable( MOTION_METHOD_VAR );
+    p_vpar->p_motion_module = module_Need( MODULE_CAPABILITY_MOTION, psz_name,
+                                           NULL );
+    if( psz_name ) free( psz_name );
 
     if( p_vpar->p_motion_module == NULL )
     {
@@ -200,9 +213,10 @@ static int InitThread( vpar_thread_t *p_vpar )
     /*
      * Choose the best IDCT module
      */
-    p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT,
-                                  main_GetPszVariable( IDCT_METHOD_VAR, NULL ),
-                                  NULL );
+    psz_name = config_GetPszVariable( IDCT_METHOD_VAR );
+    p_vpar->p_idct_module = module_Need( MODULE_CAPABILITY_IDCT, psz_name,
+                                         NULL );
+    if( psz_name ) free( psz_name );
 
     if( p_vpar->p_idct_module == NULL )
     {
index 38e1cda39200fd4ebf2dfde135f1a4810ef9ddea..e57e2eb940eb88e64f3e9f434c00ed3ece8874cf 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_synchro.c : frame dropping routines
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_synchro.c,v 1.6 2002/02/19 00:50:19 sam Exp $
+ * $Id: vpar_synchro.c,v 1.7 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
@@ -94,6 +94,7 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#include <stdlib.h>                                                /* free() */
 #include <string.h>                                    /* memcpy(), memset() */
 
 #include <videolan/vlc.h>
@@ -532,13 +533,18 @@ void vpar_SynchroNewPicture( vpar_thread_t * p_vpar, int i_coding_type,
  *****************************************************************************/
 static int SynchroType( void )
 {
-    char * psz_synchro = main_GetPszVariable( VPAR_SYNCHRO_VAR, NULL );
+    char psz_synchro_tmp[5];
+    char * psz_synchro = config_GetPszVariable( VPAR_SYNCHRO_VAR );
 
     if( psz_synchro == NULL )
     {
         return VPAR_SYNCHRO_DEFAULT;
     }
 
+    strncpy( psz_synchro_tmp, psz_synchro, 5);
+    free( psz_synchro );
+    psz_synchro = psz_synchro_tmp;
+
     switch( *psz_synchro++ )
     {
       case 'i':
index 1ce7418159aa2ebbca71729cdae2b58553bf40b4..a629f10f1dfadbd2c2e285e737b5ef7df0f9b693 100644 (file)
@@ -41,8 +41,6 @@ void _M( vout_getfunctions )( function_list_t * p_function_list );
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for QNX RTOS module" )
-    ADD_COMMENT( "For now, the QNX RTOS module cannot be configured" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index e32d8b9dbcc377be7372e1c00e26fbdfdb0ef08a..20bc5322ceaf059d7927b89317058fc7ae282859 100644 (file)
@@ -142,14 +142,14 @@ static int vout_Create( vout_thread_t *p_vout )
     memset( p_vout->p_sys, 0, sizeof( vout_sys_t ) );
 
     p_vout->b_fullscreen = 
-        main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT );
+        config_GetIntVariable( VOUT_FULLSCREEN_VAR );
     p_vout->p_sys->i_mode = 
-        main_GetIntVariable( VOUT_NOOVERLAY_VAR, VOUT_NOOVERLAY_DEFAULT ) ?
+        config_GetIntVariable( VOUT_NOOVERLAY_VAR ) ?
         MODE_NORMAL_MEM : MODE_VIDEO_OVERLAY;
     p_vout->p_sys->dim.w =
-        main_GetIntVariable( VOUT_WIDTH_VAR, VOUT_WIDTH_DEFAULT );
+        config_GetIntVariable( VOUT_WIDTH_VAR );
     p_vout->p_sys->dim.h =
-        main_GetIntVariable( VOUT_HEIGHT_VAR, VOUT_HEIGHT_DEFAULT );
+        config_GetIntVariable( VOUT_HEIGHT_VAR );
 
     /* init display and create window */
     if( QNXInitDisplay( p_vout ) || QNXCreateWnd( p_vout ) )
index d21bd0666a6a1bca4916fb36082f4893373e1f6d..fba7d5be3c41a415371c2250b3f9d136f57de18b 100644 (file)
@@ -2,7 +2,7 @@
  * qt.cpp : Qt plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: qt.cpp,v 1.6 2001/12/30 07:09:56 sam Exp $
+ * $Id: qt.cpp,v 1.7 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -40,8 +40,6 @@ void _M( intf_getfunctions )( function_list_t * p_function_list );
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for Qt module" )
-        ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 6bdbf95972b17897131f38de971f58d6850791c8..28743655bbd4d1b30a404dd833c45a328b44540d 100644 (file)
@@ -2,7 +2,7 @@
  * aout_sdl.c : audio sdl functions library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: aout_sdl.c,v 1.25 2002/02/15 13:32:53 sam Exp $
+ * $Id: aout_sdl.c,v 1.26 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -130,7 +130,6 @@ static int aout_Open( aout_thread_t *p_aout )
     p_aout->p_sys->audio_buf = malloc( OVERFLOWLIMIT );
 
     /* Initialize some variables */
-    p_aout->psz_device = 0;
     desired.freq =     p_aout->l_rate;
 
     /* TODO: write conversion beetween AOUT_FORMAT_DEFAULT
index ab04952f285b91b86af863e80a9130e17c4be072..04bf16e5d2676742742c1560305e55e9e96622fd 100644 (file)
@@ -2,7 +2,7 @@
  * logger.c : file logging plugin for vlc
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: logger.c,v 1.3 2002/02/20 05:56:18 sam Exp $
+ * $Id: logger.c,v 1.4 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -92,7 +92,7 @@ static void intf_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int intf_Open( intf_thread_t *p_intf )
 {
-    char *psz_filename;
+    char *psz_filename_tmp, *psz_filename;
 
     /* Allocate instance and initialize some members */
     p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) );
@@ -102,7 +102,13 @@ static int intf_Open( intf_thread_t *p_intf )
         return -1;
     }
 
-    psz_filename = main_GetPszVariable( INTF_METHOD_VAR, NULL );
+    if( !(psz_filename = psz_filename_tmp
+          = config_GetPszVariable( INTF_METHOD_VAR )) )
+    {
+        intf_ErrMsg( "intf error: configuration variable %s empty",
+                     INTF_METHOD_VAR );
+        return -1;
+    }
 
     while( *psz_filename && *psz_filename != ':' )
     {
@@ -131,9 +137,12 @@ static int intf_Open( intf_thread_t *p_intf )
         intf_ErrMsg( "intf error: error opening logfile `%s'", psz_filename );
         free( p_intf->p_sys );
         intf_MsgUnsub( p_intf->p_sys->p_sub );
+        free( psz_filename_tmp );
         return -1;
     }
 
+    free( psz_filename_tmp );
+
     LOG_STRING( "-- log plugin started --\n", p_intf->p_sys->p_file );
 
     return 0;
index 28b1a9f23d7b6f26a9e930f236a9bc91fc3131c6..992d63f91cd15d5297a7b4875b97ef5bd9a9340d 100644 (file)
@@ -2,7 +2,7 @@
  * ncurses.c : NCurses plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ncurses.c,v 1.11 2002/02/15 13:32:53 sam Exp $
+ * $Id: ncurses.c,v 1.12 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *      
@@ -50,8 +50,6 @@ static void intf_Run          ( intf_thread_t *p_intf );
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for NCurses module" )
-    ADD_COMMENT( "For now, the NCurses module cannot be configured" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 0e924a207d2a27f28bc8407c27aa8fdccd734a4d..6b2d1b4d6b305849b84b651d8ed901a88e401b37 100644 (file)
@@ -280,7 +280,7 @@ static void VCDInit( input_thread_t * p_input )
 #undef area
 
     /* Get requested title - if none try the first title */
-    i_title = main_GetIntVariable( INPUT_TITLE_VAR, 1 );
+    i_title = config_GetIntVariable( INPUT_TITLE_VAR );
     if( i_title <= 0 )
     {
         i_title = 1;
@@ -289,7 +289,7 @@ static void VCDInit( input_thread_t * p_input )
     // p_vcd->i_track = i_title-1;
 
     /* Get requested chapter - if none defaults to first one */
-    i_chapter = main_GetIntVariable( INPUT_CHAPTER_VAR, 1 );
+    i_chapter = config_GetIntVariable( INPUT_CHAPTER_VAR );
     if( i_chapter <= 0 )
     {
         i_chapter = 1;
index 8601bb426881891456c9da2e5173764366cf9658..65dfb2953ab0b52537e62b924f95aa38c69ac0eb 100644 (file)
@@ -2,7 +2,7 @@
  * waveout.c : Windows waveOut plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: waveout.c,v 1.2 2002/02/15 20:02:21 gbazin Exp $
+ * $Id: waveout.c,v 1.3 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *      
@@ -45,8 +45,6 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for Windows waveOut module" )
-    ADD_COMMENT( "For now, the Windows WaveOut module cannot be configured" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
@@ -137,8 +135,6 @@ static int aout_Open( aout_thread_t *p_aout )
     for( i=0; i<NUMBUF; i++)
         p_aout->p_sys->waveheader[i].lpData = malloc( 1 );
 
-    p_aout->psz_device = 0;
-
     return OpenWaveOutDevice( p_aout );
 
 }
index 114e745fdfcf00fe889e972ae03282745865f727..5fc4acd0e9f2fcadbdd16f4b1dba7e9ff01cc585 100644 (file)
@@ -2,7 +2,7 @@
  * x11.c : X11 plugin for vlc
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: x11.c,v 1.11 2002/02/19 00:50:19 sam Exp $
+ * $Id: x11.c,v 1.12 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -37,8 +37,6 @@
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for X11 module" )
-        ADD_COMMENT( "For now, the X11 module cannot be configured" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index 70f72582b3b6c9770f09135a8abe8cec2fe4177a..107d0dc7bee5addb02ac9a2799734473e8a055d7 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.18 2002/02/20 23:23:53 sam Exp $
+ * $Id: xcommon.c,v 1.19 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -295,16 +295,21 @@ static int vout_Create( vout_thread_t *p_vout )
         return( 1 );
     }
 
-    /* Open display, unsing 'vlc_display' or DISPLAY environment variable */
-    psz_display = XDisplayName( main_GetPszVariable( VOUT_DISPLAY_VAR, NULL ) );
+    /* Open display, unsing the VOUT_DISPLAY_VAR config variable or the DISPLAY
+     * environment variable */
+    psz_display = config_GetPszVariable( VOUT_DISPLAY_VAR );
     p_vout->p_sys->p_display = XOpenDisplay( psz_display );
 
     if( p_vout->p_sys->p_display == NULL )                          /* error */
     {
-        intf_ErrMsg( "vout error: cannot open display %s", psz_display );
+        intf_ErrMsg( "vout error: cannot open display %s",
+                     XDisplayName( psz_display ) );
         free( p_vout->p_sys );
+        if( psz_display ) free( psz_display );
         return( 1 );
     }
+    if( psz_display ) free( psz_display );
+
     p_vout->p_sys->i_screen = DefaultScreen( p_vout->p_sys->p_display );
 
 #ifdef MODULE_NAME_IS_xvideo
@@ -1829,7 +1834,7 @@ static int XVideoGetPort( Display *dpy, u32 i_chroma, u32 *pi_newchroma )
     }
 
     i_selected_port = -1;
-    i_requested_adaptor = main_GetIntVariable( VOUT_XVADAPTOR_VAR, -1 );
+    i_requested_adaptor = config_GetIntVariable( XVADAPTOR_VAR );
 
     for( i_adaptor = 0; i_adaptor < i_num_adaptors; ++i_adaptor )
     {
index 02d64792c713bafa09ebf4376ff1f6117ab0b463..c6e4685cb8e350ba1d5785f6f50979a8a0c7ae47 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.h: Common X11 and Xvideo video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.h,v 1.1 2001/12/30 07:09:56 sam Exp $
+ * $Id: xcommon.h,v 1.2 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *          Vincent Seguin <seguin@via.ecp.fr>
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+/*****************************************************************************
+ * Common macros
+ *****************************************************************************/
+#define XVADAPTOR_VAR              "xvideo_adaptor"
+
 /*****************************************************************************
  * Common prototypes
  *****************************************************************************/
index 40b07f821f916a0783c3a6366dac8589b6dcca2c..f2df13210733f14242f3c86f7da2b736b7d8a8cc 100644 (file)
@@ -2,7 +2,7 @@
  * xvideo.c : Xvideo plugin for vlc
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xvideo.c,v 1.6 2001/12/30 07:09:56 sam Exp $
+ * $Id: xvideo.c,v 1.7 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -38,8 +38,8 @@
  * Building configuration tree
  *****************************************************************************/
 MODULE_CONFIG_START
-    ADD_WINDOW( "Configuration for xvideo module" )
-        ADD_COMMENT( "For now, the xvideo module cannot be configured" )
+ADD_CATEGORY_HINT( "Misc Options", NULL )
+ADD_INTEGER ( XVADAPTOR_VAR, -1, NULL, "XVideo adaptor number", NULL )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
index ba20bc4e59f1cff175967a859e5b81dac822177b..a5917bb1879e7b0e886ee4d8aaf62724abea8ef9 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.c : audio output thread
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: audio_output.c,v 1.76 2002/02/15 13:32:54 sam Exp $
+ * $Id: audio_output.c,v 1.77 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Cyril Deguet <asmax@via.ecp.fr>
@@ -93,9 +93,8 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, long l_rate )
     }
 
     p_aout->i_latency = 0;
-    p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR, l_rate );
-    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
-                                                  i_channels - 1 );
+    p_aout->l_rate = config_GetIntVariable( AOUT_RATE_VAR );
+    p_aout->i_channels = config_GetIntVariable( AOUT_MONO_VAR ) ? 1 : 2;
 
     intf_WarnMsg( 3, "aout info: thread created, channels %d, rate %d",
                   p_aout->i_channels, p_aout->l_rate );
@@ -105,7 +104,7 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, long l_rate )
 
     /* special setting for ac3 pass-through mode */
     /* FIXME is it necessary ? (cf ac3_adec.c) */
-    if( main_GetIntVariable( AOUT_SPDIF_VAR, 0 ) && p_main->b_ac3 )
+    if( config_GetIntVariable( AOUT_SPDIF_VAR ) && p_main->b_ac3 )
     {
         intf_WarnMsg( 4, "aout info: setting ac3 spdif" );
         p_aout->i_format = AOUT_FMT_AC3;
@@ -123,7 +122,7 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, long l_rate )
 
     /* Choose the best module */
     p_aout->p_module = module_Need( MODULE_CAPABILITY_AOUT,
-                           main_GetPszVariable( AOUT_METHOD_VAR, NULL ), 
+                           config_GetPszVariable( AOUT_METHOD_VAR ), 
                            (void *)p_aout );
 
     if( p_aout->p_module == NULL )
@@ -153,7 +152,7 @@ aout_thread_t *aout_CreateThread( int *pi_status, int i_channels, long l_rate )
     }
 
     /* Initialize the volume level */
-    p_aout->i_volume = main_GetIntVariable( AOUT_VOLUME_VAR, VOLUME_DEFAULT );
+    p_aout->i_volume = config_GetIntVariable( AOUT_VOLUME_VAR );
     p_aout->i_savedvolume = 0;
     
     /* FIXME: maybe it would be cleaner to change SpawnThread prototype
index 8b9c8d71e22bae43a83d95b74fb55bc185e74909..23a87cba61a6048ab64a062fcffe23adb3ebcef1 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input.c,v 1.175 2002/02/19 00:50:19 sam Exp $
+ * $Id: input.c,v 1.176 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -199,10 +199,9 @@ input_thread_t *input_CreateThread ( playlist_item_t *p_item, int *pi_status )
     p_input->stream.control.i_status = PLAYING_S;
     p_input->stream.control.i_rate = DEFAULT_RATE;
     p_input->stream.control.b_mute = 0;
-    p_input->stream.control.b_grayscale = main_GetIntVariable(
-                            VOUT_GRAYSCALE_VAR, VOUT_GRAYSCALE_DEFAULT );
-    p_input->stream.control.i_smp = main_GetIntVariable(
-                            VDEC_SMP_VAR, VDEC_SMP_DEFAULT );
+    p_input->stream.control.b_grayscale = config_GetIntVariable(
+                                             VOUT_GRAYSCALE_VAR );
+    p_input->stream.control.i_smp = config_GetIntVariable( VDEC_SMP_VAR );
 
     intf_WarnMsg( 1, "input: playlist item `%s'", p_input->p_source );
 
@@ -448,11 +447,14 @@ static void RunThread( input_thread_t *p_input )
  *****************************************************************************/
 static int InitThread( input_thread_t * p_input )
 {
+    char *psz_name;
+
     /* Find appropriate module. */
-    p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT,
-                                 main_GetPszVariable( INPUT_METHOD_VAR, NULL ),
-                                 (void *)p_input );
+    psz_name = config_GetPszVariable( INPUT_METHOD_VAR );
+    p_input->p_input_module = module_Need( MODULE_CAPABILITY_INPUT, psz_name,
+                                           (void *)p_input );
 
+    if( psz_name ) free( psz_name );
     if( p_input->p_input_module == NULL )
     {
         intf_ErrMsg( "input error: no suitable input module for `%s'",
@@ -871,7 +873,7 @@ static void NetworkOpen( input_thread_t * p_input )
     /* Check that we got a valid port */
     if( i_bind_port == 0 )
     {
-        i_bind_port = main_GetIntVariable( INPUT_PORT_VAR, INPUT_PORT_DEFAULT );
+        i_bind_port = config_GetIntVariable( INPUT_PORT_VAR );
     }
 
     intf_WarnMsg( 2, "input: server=%s:%d local=%s:%d",
@@ -1138,7 +1140,7 @@ static void HTTPOpen( input_thread_t * p_input )
     }
 
     /* Check proxy */
-    if( (psz_proxy = main_GetPszVariable( "http_proxy", NULL )) != NULL )
+    if( (psz_proxy = getenv( "http_proxy" )) != NULL )
     {
         /* http://myproxy.mydomain:myport/ */
         int                 i_proxy_port = 0;
index 48e5dabae0e688e45ad386df5eaa7b02fb228c2f..787a3d88db665df69d399262be90e22eea1a99e0 100644 (file)
@@ -2,7 +2,7 @@
  * input_dec.c: Functions for the management of decoders
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: input_dec.c,v 1.27 2002/02/19 00:50:19 sam Exp $
+ * $Id: input_dec.c,v 1.28 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -50,16 +50,17 @@ vlc_thread_t input_RunDecoder( input_thread_t * p_input,
 
     if( p_es->i_type == MPEG1_AUDIO_ES || p_es->i_type == MPEG2_AUDIO_ES )
     {
-        psz_plugin = main_GetPszVariable( ADEC_MPEG_VAR, NULL );
+        psz_plugin = config_GetPszVariable( ADEC_MPEG_VAR );
     }
     if( p_es->i_type == AC3_AUDIO_ES )
     {
-        psz_plugin = main_GetPszVariable( ADEC_AC3_VAR, NULL );
+        psz_plugin = config_GetPszVariable( ADEC_AC3_VAR );
     }
 
     /* Get a suitable module */
     p_es->p_module = module_Need( MODULE_CAPABILITY_DECODER, psz_plugin,
                                   (void *)&p_es->i_type );
+    if( psz_plugin ) free( psz_plugin );
     if( p_es->p_module == NULL )
     {
         intf_ErrMsg( "input error: no suitable decoder module for type 0x%x",
index 5fea7a6f0ab5a27e4a9cbeeb04447675a860b89e..5e7580c13f59bc39da0a8791af3b058e46a5f670 100644 (file)
@@ -2,7 +2,7 @@
  * mpeg_system.c: TS, PS and PES management
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: mpeg_system.c,v 1.79 2002/02/19 00:50:19 sam Exp $
+ * $Id: mpeg_system.c,v 1.80 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Michel Lespinasse <walken@via.ecp.fr>
@@ -708,13 +708,13 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
                         if( !p_input->stream.b_seekable )
-                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                == (p_es->i_id & 0x1F) )
-                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+                                == (p_es->i_id & 0x1F) ||
+                            ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+                              && !(p_es->i_id & 0x1F) ) )
+                        switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
                         {
-                        case 0:
-                            main_PutIntVariable( INPUT_CHANNEL_VAR,
-                                                 REQUESTED_MPEG );
+                        case -1:
                         case REQUESTED_MPEG:
                             input_SelectES( p_input, p_es );
                         }
@@ -728,13 +728,13 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->i_cat = AUDIO_ES;
 #ifdef AUTO_SPAWN
                         if( !p_input->stream.b_seekable )
-                        if( main_GetIntVariable( INPUT_CHANNEL_VAR, 0 )
-                                == ((p_es->i_id & 0xF00) >> 8) )
-                        switch( main_GetIntVariable( INPUT_AUDIO_VAR, 0 ) )
+                        if( config_GetIntVariable( INPUT_CHANNEL_VAR )
+                                == ((p_es->i_id & 0xF00) >> 8) ||
+                            ( config_GetIntVariable( INPUT_CHANNEL_VAR ) < 0
+                              && !((p_es->i_id & 0xF00) >> 8)) )
+                        switch( config_GetIntVariable( INPUT_AUDIO_VAR ) )
                         {
-                        case 0:
-                            main_PutIntVariable( INPUT_CHANNEL_VAR,
-                                                 REQUESTED_AC3 );
+                        case -1:
                         case REQUESTED_AC3:
                             input_SelectES( p_input, p_es );
                         }
@@ -746,7 +746,7 @@ es_descriptor_t * input_ParsePS( input_thread_t * p_input,
                         p_es->i_type = DVD_SPU_ES;
                         p_es->i_cat = SPU_ES;
 #ifdef AUTO_SPAWN
-                        if( main_GetIntVariable( INPUT_SUBTITLE_VAR, -1 )
+                        if( config_GetIntVariable( INPUT_SUBTITLE_VAR )
                                 == ((p_es->i_id & 0x1F00) >> 8) )
                         {
                             if( !p_input->stream.b_seekable )
@@ -1476,10 +1476,9 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
         if( p_main->b_audio )
         {
             /* Default is the first one */
-            i_required_audio_es = main_GetIntVariable( INPUT_CHANNEL_VAR, 1 );
+            i_required_audio_es = config_GetIntVariable( INPUT_CHANNEL_VAR );
             if( i_required_audio_es < 0 )
             {
-                main_PutIntVariable( INPUT_CHANNEL_VAR, 1 );
                 i_required_audio_es = 1;
             }
         }
@@ -1492,10 +1491,9 @@ static void input_DecodePMT( input_thread_t * p_input, es_descriptor_t * p_es )
         if( p_main->b_video )
         {
             /* for spu, default is none */
-            i_required_spu_es = main_GetIntVariable( INPUT_SUBTITLE_VAR, 0 );
+            i_required_spu_es = config_GetIntVariable( INPUT_SUBTITLE_VAR );
             if( i_required_spu_es < 0 )
             {
-                main_PutIntVariable( INPUT_SUBTITLE_VAR, 0 );
                 i_required_spu_es = 0;
             }
         }
index 28323add9b40bbda1fa31bd78c1fea1fd459afa8..22d9d1fb8fd1fdc07dfb42284f7aa75e31998ccd 100644 (file)
@@ -4,7 +4,7 @@
  * interface, such as command line.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: interface.c,v 1.89 2002/02/19 00:50:19 sam Exp $
+ * $Id: interface.c,v 1.90 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -59,6 +59,7 @@ static void intf_Manage( intf_thread_t *p_intf );
 intf_thread_t* intf_Create( void )
 {
     intf_thread_t * p_intf;
+    char *psz_name;
 
     /* Allocate structure */
     p_intf = malloc( sizeof( intf_thread_t ) );
@@ -70,10 +71,11 @@ intf_thread_t* intf_Create( void )
     }
 
     /* Choose the best module */
-    p_intf->p_module = module_Need( MODULE_CAPABILITY_INTF,
-                           main_GetPszVariable( INTF_METHOD_VAR, NULL ),
-                           (void *)p_intf );
+    psz_name = config_GetPszVariable( INTF_METHOD_VAR );
+    p_intf->p_module = module_Need( MODULE_CAPABILITY_INTF, psz_name,
+                                    (void *)p_intf );
 
+    if( psz_name ) free( psz_name );
     if( p_intf->p_module == NULL )
     {
         intf_ErrMsg( "intf error: no suitable intf module" );
@@ -163,8 +165,7 @@ static void intf_Manage( intf_thread_t *p_intf )
 
                 p_main->p_playlist->b_stopped = 0;
                 p_main->p_playlist->i_mode = PLAYLIST_FORWARD + 
-                    main_GetIntVariable( PLAYLIST_LOOP_VAR,
-                                         PLAYLIST_LOOP_DEFAULT );
+                    config_GetIntVariable( PLAYLIST_LOOP_VAR );
                 intf_WarnMsg( 3, "intf: creating new input thread" );
                 p_input = input_CreateThread( &p_main->p_playlist->current,
                                               NULL );
index 8a87ece5d5d920cb0c72e00c2330f8a2e3a45c1e..d25d5ba12c0451c92b34135a9876586bcd721c62 100644 (file)
@@ -4,10 +4,11 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: main.c,v 1.152 2002/02/19 00:50:19 sam Exp $
+ * $Id: main.c,v 1.153 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
+ *          Gildas Bazin <gbazin@netcourrier.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
 #include "debug.h"
 
 /*****************************************************************************
- * Command line options constants. If something is changed here, be sure that
- * GetConfiguration and Usage are also changed.
+ * Configuration options for the main program. Each plugin will also separatly
+ * define its own configuration options.
+ * Look into configuration.h if you need to know more about the following
+ * macros.
+ * 
+ *****************************************************************************/
+#define BUILTIN
+#define MODULE_NAME main
+#include "modules_inner.h"                        /* for configuration stuff */
+
+/* Quick usage guide
+MODULE_CONFIG_START
+MODULE_CONFIG_STOP
+ADD_CATEGORY_HINT( text, longtext )
+ADD_SUBCATEGORY_HINT( text, longtext )
+ADD_STRING( option_name, value, p_callback, text, longtext )
+ADD_FILE( option_name, psz_value, p_callback, text, longtext )
+ADD_PLUGIN( option_name, psz_value, i_capability, p_callback, text, longtext )
+ADD_INTEGER( option_name, i_value, p_callback, text, longtext )
+ADD_BOOL( option_name, p_callback, text, longtext )
+*/
+
+MODULE_CONFIG_START
+
+/* Help options */
+ADD_CATEGORY_HINT( "Help Options", NULL )
+ADD_BOOL    ( "help", NULL,"print help and exit (or use -h)", NULL )
+ADD_BOOL    ( "longhelp", NULL, "print long help version and exit (or use -H)",
+              NULL )
+ADD_BOOL    ( "list", NULL, "list available plugins (or use -l)", NULL )
+ADD_STRING  ( "pluginhelp", NULL, NULL,"print help on a plugin and exit",NULL )
+ADD_BOOL    ( "version", NULL, "output version information and exit", NULL )
+
+/* Interface options */
+ADD_CATEGORY_HINT( "Interface Options", NULL)
+ADD_PLUGIN  ( INTF_METHOD_VAR, MODULE_CAPABILITY_INTF, NULL, NULL,
+              "interface method", NULL )
+ADD_INTEGER ( INTF_WARNING_VAR, 0, NULL, "warning level (or use -v)", NULL )
+ADD_BOOL    ( INTF_STATS_VAR, NULL, "output statistics", NULL )
+ADD_STRING  ( INTF_PATH_VAR, NULL, NULL, "interface default search path", NULL)
+
+/* Audio Options */
+ADD_CATEGORY_HINT( "Audio Options", NULL)
+ADD_BOOL    ( AOUT_NOAUDIO_VAR, NULL, "disable audio", NULL )
+ADD_PLUGIN  ( AOUT_METHOD_VAR, MODULE_CAPABILITY_AOUT, NULL, NULL,
+              "audio output method", NULL )
+ADD_BOOL    ( AOUT_MONO_VAR, NULL, "mono audio", NULL )
+ADD_BOOL    ( AOUT_SPDIF_VAR, NULL, "AC3 pass-through mode", NULL )
+ADD_INTEGER ( AOUT_VOLUME_VAR, VOLUME_DEFAULT, NULL, "VLC output volume", NULL)
+ADD_INTEGER ( AOUT_RATE_VAR, 44100, NULL, "VLC output frequency", NULL )
+ADD_INTEGER ( AOUT_DESYNC_VAR, 0, NULL, "Compensate desynchronization of the "
+                                        "audio (in ms)", NULL )
+
+/* Video options */
+ADD_CATEGORY_HINT( "Video Options", NULL )
+ADD_BOOL    ( VOUT_NOVIDEO_VAR, NULL, "disable video", NULL )
+ADD_PLUGIN  ( VOUT_METHOD_VAR, MODULE_CAPABILITY_VOUT, NULL, NULL,
+              "video output method", NULL )
+ADD_STRING  ( VOUT_DISPLAY_VAR, NULL, NULL, "display string", NULL )
+ADD_INTEGER ( VOUT_WIDTH_VAR, 720, NULL, "display width", NULL )
+ADD_INTEGER ( VOUT_HEIGHT_VAR, 576, NULL, "display height", NULL )
+ADD_BOOL    ( VOUT_GRAYSCALE_VAR, NULL, "grayscale output", NULL )
+ADD_BOOL    ( VOUT_FULLSCREEN_VAR, NULL, "fullscreen output", NULL )
+ADD_BOOL    ( VOUT_NOOVERLAY_VAR, NULL, "disable accelerated display", NULL )
+ADD_PLUGIN  ( VOUT_FILTER_VAR, MODULE_CAPABILITY_VOUT, NULL, NULL,
+              "video filter module", NULL )
+ADD_INTEGER ( VOUT_SPUMARGIN_VAR, -1, NULL, "force SPU position", NULL )
+
+/* Input options */
+ADD_CATEGORY_HINT( "Input Options", NULL )
+ADD_STRING  ( INPUT_METHOD_VAR, NULL, NULL, "input method", NULL )
+ADD_BOOL    ( INPUT_NETWORK_CHANNEL_VAR, NULL, "enable network channel mode",
+              NULL )
+ADD_STRING  ( INPUT_CHANNEL_SERVER_VAR, "localhost", NULL,
+              "channel server address", NULL )
+ADD_INTEGER ( INPUT_CHANNEL_PORT_VAR, 6010, NULL, "channel server port", NULL )
+ADD_STRING  ( INPUT_IFACE_VAR, "eth0", NULL, "network interface", NULL )
+
+ADD_INTEGER ( INPUT_TITLE_VAR, -1, NULL, "choose title", NULL )
+ADD_INTEGER ( INPUT_CHAPTER_VAR, -1, NULL, "choose chapter", NULL )
+ADD_INTEGER ( INPUT_ANGLE_VAR, -1, NULL, "chosse angle", NULL )
+ADD_INTEGER ( INPUT_AUDIO_VAR, -1, NULL, "choose audio", NULL )
+ADD_INTEGER ( INPUT_CHANNEL_VAR, -1, NULL, "choose channel", NULL )
+ADD_INTEGER ( INPUT_SUBTITLE_VAR, -1, NULL, "choose subtitles", NULL )
+
+ADD_STRING  ( INPUT_DVD_DEVICE_VAR, "/dev/dvd", NULL, "DVD device", NULL )
+ADD_STRING  ( INPUT_VCD_DEVICE_VAR, "/dev/cdrom", NULL, "VCD device", NULL )
+
+/* Decoder options */
+ADD_CATEGORY_HINT( "Decoders Options", NULL )
+ADD_PLUGIN  ( ADEC_MPEG_VAR, MODULE_CAPABILITY_DECODER, NULL, NULL,
+              "choose MPEG audio decoder", NULL )
+ADD_PLUGIN  ( ADEC_AC3_VAR, MODULE_CAPABILITY_DECODER, NULL, NULL,
+              "choose AC3 audio decoder", NULL )
+ADD_INTEGER ( VDEC_SMP_VAR, 0, NULL, "use additional processors", NULL )
+ADD_STRING  ( VPAR_SYNCHRO_VAR, NULL, NULL, "force synchro algorithm "
+                                            "{I|I+|IP|IP+|IPB}", NULL )
+
+/* CPU options */
+ADD_CATEGORY_HINT( "CPU Options Options", NULL )
+ADD_BOOL    ( NOMMX_VAR, NULL, "disable CPU's MMX support", NULL )
+ADD_BOOL    ( NO3DN_VAR, NULL, "disable CPU's 3D Now! support", NULL )
+ADD_BOOL    ( NOMMXEXT_VAR, NULL, "disable CPU's MMX EXT support", NULL )
+ADD_BOOL    ( NOSSE_VAR, NULL, "disable CPU's SSE support", NULL )
+ADD_BOOL    ( NOALTIVEC_VAR, NULL, "disable CPU's AltiVec support", NULL )
+
+/* Playlist options */
+ADD_BOOL    ( PLAYLIST_STARTUP_VAR, NULL, "launch playlist on startup", NULL )
+ADD_BOOL    ( PLAYLIST_ENQUEUE_VAR, NULL, "enqueue playlist as default", NULL )
+ADD_BOOL    ( PLAYLIST_LOOP_VAR, NULL, "loop on playlist end", NULL )
+
+/* Misc options */
+ADD_CATEGORY_HINT( "Miscellaneous Options", NULL )
+ADD_PLUGIN  ( MEMCPY_METHOD_VAR, MODULE_CAPABILITY_MEMCPY, NULL, NULL,
+              "memory copy method", NULL )
+
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+    SET_DESCRIPTION( "Main program" )
+    ADD_CAPABILITY( MAIN, 100/*whatever*/ )
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+/*****************************************************************************
+ * End configuration.
  *****************************************************************************/
-
-/* Long options return values - note that values corresponding to short options
- * chars, and in general any regular char, should be avoided */
-#define OPT_NOAUDIO             150
-#define OPT_STEREO              151
-#define OPT_MONO                152
-#define OPT_SPDIF               153
-#define OPT_VOLUME              154
-#define OPT_DESYNC              155
-
-#define OPT_NOVIDEO             160
-#define OPT_DISPLAY             161
-#define OPT_WIDTH               162
-#define OPT_HEIGHT              163
-#define OPT_COLOR               164
-#define OPT_FULLSCREEN          165
-#define OPT_NOOVERLAY           166
-#define OPT_XVADAPTOR           167
-#define OPT_SMP                 168
-#define OPT_SPUMARGIN           169
-
-#define OPT_CHANNELS            170
-#define OPT_SERVER              171
-#define OPT_PORT                172
-#define OPT_BROADCAST           173
-#define OPT_CHANNELSERVER       174
-
-#define OPT_INPUT               180
-#define OPT_MOTION              181
-#define OPT_IDCT                182
-#define OPT_YUV                 183
-#define OPT_DOWNMIX             184
-#define OPT_IMDCT               185
-#define OPT_MEMCPY              186
-#define OPT_FILTER              187
-#define OPT_DVDCSS_METHOD       188
-#define OPT_DVDCSS_VERBOSE      189
-
-#define OPT_SYNCHRO             190
-#define OPT_WARNING             191
-#define OPT_VERSION             192
-#define OPT_STATS               193
-
-#define OPT_MPEG_ADEC           200
-#define OPT_AC3_ADEC            201
-
-#define OPT_NOMMX               210
-#define OPT_NO3DNOW             211
-#define OPT_NOMMXEXT            212
-#define OPT_NOSSE               213
-#define OPT_NOALTIVEC           214
-
-/* Usage fashion */
-#define USAGE                     0
-#define SHORT_HELP                1
-#define LONG_HELP                 2
-
-/* Long options */
-static const struct option longopts[] =
-{
-    /*  name,               has_arg,    flag,   val */
-
-    /* General/common options */
-    {   "help",             0,          0,      'h' },
-    {   "longhelp",         0,          0,      'H' },
-    {   "version",          0,          0,      OPT_VERSION },
-
-    /* Interface options */
-    {   "intf",             1,          0,      'I' },
-    {   "warning",          1,          0,      OPT_WARNING },
-    {   "stats",            0,          0,      OPT_STATS },
-
-    /* Audio options */
-    {   "noaudio",          0,          0,      OPT_NOAUDIO },
-    {   "aout",             1,          0,      'A' },
-    {   "stereo",           0,          0,      OPT_STEREO },
-    {   "mono",             0,          0,      OPT_MONO },
-    {   "spdif",            0,          0,      OPT_SPDIF },
-    {   "downmix",          1,          0,      OPT_DOWNMIX },
-    {   "imdct",            1,          0,      OPT_IMDCT },
-    {   "volume",           1,          0,      OPT_VOLUME },
-    {   "desync",           1,          0,      OPT_DESYNC },
-
-    /* Video options */
-    {   "novideo",          0,          0,      OPT_NOVIDEO },
-    {   "vout",             1,          0,      'V' },
-    {   "display",          1,          0,      OPT_DISPLAY },
-    {   "width",            1,          0,      OPT_WIDTH },
-    {   "height",           1,          0,      OPT_HEIGHT },
-    {   "grayscale",        0,          0,      'g' },
-    {   "color",            0,          0,      OPT_COLOR },
-    {   "motion",           1,          0,      OPT_MOTION },
-    {   "idct",             1,          0,      OPT_IDCT },
-    {   "yuv",              1,          0,      OPT_YUV },
-    {   "fullscreen",       0,          0,      OPT_FULLSCREEN },
-    {   "nooverlay",        0,          0,      OPT_NOOVERLAY },
-    {   "xvadaptor",        1,          0,      OPT_XVADAPTOR },
-    {   "smp",              1,          0,      OPT_SMP },
-    {   "spumargin",        1,          0,      OPT_SPUMARGIN },
-
-    /* DVD options */
-    {   "dvdtitle",         1,          0,      't' },
-    {   "dvdchapter",       1,          0,      'T' },
-    {   "dvdangle",         1,          0,      'u' },
-    {   "dvdaudio",         1,          0,      'a' },
-    {   "dvdchannel",       1,          0,      'c' },
-    {   "dvdsubtitle",      1,          0,      's' },
-    {   "dvdcss-method",    1,          0,      OPT_DVDCSS_METHOD },
-    {   "dvdcss-verbose",   1,          0,      OPT_DVDCSS_VERBOSE },
-
-    /* Input options */
-    {   "input",            1,          0,      OPT_INPUT },
-    {   "channels",         0,          0,      OPT_CHANNELS },
-    {   "channelserver",    1,          0,      OPT_CHANNELSERVER },
-
-    /* Misc options */
-    {   "synchro",          1,          0,      OPT_SYNCHRO },
-    {   "memcpy",           1,          0,      OPT_MEMCPY },
-    {   "filter",           1,          0,      OPT_FILTER },
-
-    /* Decoder options */
-    {   "mpeg_adec",        1,          0,      OPT_MPEG_ADEC },
-    {   "ac3_adec",         1,          0,      OPT_AC3_ADEC },
-
-    /* CPU options */
-    {   "nommx",            0,          0,      OPT_NOMMX },
-    {   "no3dnow",          0,          0,      OPT_NO3DNOW },
-    {   "nommxext",         0,          0,      OPT_NOMMXEXT },
-    {   "nosse",            0,          0,      OPT_NOSSE },
-    {   "noaltivec",        0,          0,      OPT_NOALTIVEC },
-
-    {   0,                  0,          0,      0 }
-};
-
-/* Short options */
-static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:";
 
 /*****************************************************************************
  * Global variables - these are the only ones, see main.h and modules.h
@@ -236,19 +229,23 @@ vout_bank_t   *p_vout_bank;
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  GetConfiguration        ( int *pi_argc, char *ppsz_argv[],
-                                      char *ppsz_env[] );
-static int  GetFilenames            ( int i_argc, char *ppsz_argv[] );
-static void Usage                   ( int i_fashion );
-static void Version                 ( void );
-
-static void InitSignalHandler       ( void );
-static void SimpleSignalHandler     ( int i_signal );
-static void FatalSignalHandler      ( int i_signal );
-static void IllegalSignalHandler    ( int i_signal );
-static u32  CPUCapabilities         ( void );
-
-static void ShowConsole             ( void );
+static int  GetConfigurationFromFile    ( void ){return 0;};
+static int  GetConfigurationFromCmdLine ( int *pi_argc, char *ppsz_argv[],
+                                          boolean_t b_ignore_errors );
+static int  GetFilenames                ( int i_argc, char *ppsz_argv[] );
+static void Usage                       ( const char *psz_module_name );
+static void ListModules                 ( void );
+static void Version                     ( void );
+
+static void InitSignalHandler           ( void );
+static void SimpleSignalHandler         ( int i_signal );
+static void FatalSignalHandler          ( int i_signal );
+static void IllegalSignalHandler        ( int i_signal );
+static u32  CPUCapabilities             ( void );
+
+#ifdef WIN32
+static void ShowConsole                 ( void );
+#endif
 
 static jmp_buf env;
 static int     i_illegal;
@@ -271,6 +268,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     input_bank_t  input_bank;
     aout_bank_t   aout_bank;
     vout_bank_t   vout_bank;
+    char *p_tmp;
 
     p_main        = &main_data;               /* set up the global variables */
     p_module_bank = &module_bank;
@@ -278,6 +276,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     p_aout_bank   = &aout_bank;
     p_vout_bank   = &vout_bank;
 
+    p_main->i_warning_level = 0;
+
+
 #if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
     /*
      * Support for getext
@@ -317,7 +318,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 #elif defined( SYS_LINUX )
 #   ifdef DEBUG
     /* Activate malloc checking routines to detect heap corruptions. */
-    main_PutIntVariable( "MALLOC_CHECK_", 2 );
+    putenv( "MALLOC_CHECK_=2" );
 #   endif
 #endif
 
@@ -328,19 +329,114 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 
     intf_Msg( COPYRIGHT_MESSAGE "\n" );
 
+
+    /* Get the executable name (similar to the basename command) */
+    p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
+    while( *p_tmp )
+    {
+        if( *p_tmp == '/' ) p_main->psz_arg0 = ++p_tmp;
+        else ++p_tmp;
+    }
+
     /*
-     * Read configuration
+     * Initialize the module bank and and load the configuration of the main
+     * module. We need to do this at this stage to be able to display a short
+     * help if required by the user. (short help == main module options)
      */
-    if( GetConfiguration( &i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */
+    module_InitBank();
+    module_LoadMain();
+
+    if( GetConfigurationFromCmdLine( &i_argc, ppsz_argv, 1 ) )
     {
         intf_MsgDestroy();
         return( errno );
     }
 
+    /* Check for short help option */
+    if( config_GetIntVariable( "help" ) )
+    {
+        Usage( "main" );
+        return( -1 );
+    }
+
+    /* Check for version option */
+    if( config_GetIntVariable( "version" ) )
+    {
+        Version();
+        return( -1 );
+    }
+
     /*
-     * Redirect the standard output if required by the user, and on Win32 we
-     * also open a console to display the debug messages.
+     * Load the builtins and plugins into the module_bank.
+     * We have to do it before GetConfiguration() because this also gets the
+     * list of configuration options exported by each plugin and loads their
+     * default values.
      */
+    module_LoadBuiltins();
+    module_LoadPlugins();
+    intf_WarnMsg( 2, "module: module bank initialized, found %i modules",
+                  p_module_bank->i_count );
+
+
+    /* Check for help on plugins */
+    if( (p_tmp = config_GetPszVariable( "pluginhelp" )) )
+    {
+        Usage( p_tmp );
+        free( p_tmp );
+        return( -1 );
+    }
+
+    /* Check for long help option */
+    if( config_GetIntVariable( "longhelp" ) )
+    {
+        Usage( NULL );
+        return( -1 );
+    }
+
+    /* Check for plugin list option */
+    if( config_GetIntVariable( "list" ) )
+    {
+        ListModules();
+        return( -1 );
+    }
+
+    /*
+     * Override default configuration with config file settings
+     */
+    if( GetConfigurationFromFile() )
+    {
+        intf_MsgDestroy();
+        return( errno );
+    }
+
+    /*
+     * Override configuration with command line settings
+     */
+    if( GetConfigurationFromCmdLine( &i_argc, ppsz_argv, 0 ) )
+    {
+        intf_MsgDestroy();
+        return( errno );
+    }
+
+    /* p_main inititalization. FIXME ? */
+    p_main->i_desync = (mtime_t)config_GetIntVariable( AOUT_DESYNC_VAR )
+      * (mtime_t)1000;
+    p_main->b_stats = config_GetIntVariable( INTF_STATS_VAR );
+    p_main->b_audio = !config_GetIntVariable( AOUT_NOAUDIO_VAR );
+    p_main->b_stereo= !config_GetIntVariable( AOUT_MONO_VAR );
+    p_main->b_video = !config_GetIntVariable( VOUT_NOVIDEO_VAR );
+    if( config_GetIntVariable( NOMMX_VAR ) )
+        p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
+    if( config_GetIntVariable( NO3DN_VAR ) )
+        p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
+    if( config_GetIntVariable( NOMMXEXT_VAR ) )
+        p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
+    if( config_GetIntVariable( NOSSE_VAR ) )
+        p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
+    if( config_GetIntVariable( NOALTIVEC_VAR ) )
+        p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
+
+
     if( p_main->b_stats )
     {
         char          p_capabilities[200];
@@ -384,9 +480,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     GetFilenames( i_argc, ppsz_argv );
 
     /*
-     * Initialize module, input, aout and vout banks
+     * Initialize input, aout and vout banks
      */
-    module_InitBank();
     input_InitBank();
     aout_InitBank();
     vout_InitBank();
@@ -411,14 +506,13 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * Initialize shared resources and libraries
      */
-    if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                             INPUT_NETWORK_CHANNEL_DEFAULT ) &&
+    if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) &&
         network_ChannelCreate() )
     {
         /* On error during Channels initialization, switch off channels */
         intf_ErrMsg( "intf error: channels initialization failed, " 
                                  "deactivating channels" );
-        main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 0 );
+        config_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 0 );
     }
 
     /*
@@ -449,8 +543,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         /*
          * Go back into channel 0 which is the network
          */
-        if( main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                                 INPUT_NETWORK_CHANNEL_DEFAULT ) )
+        if( config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
         {
             network_ChannelJoin( COMMON_CHANNEL );
         }
@@ -503,132 +596,37 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     return 0;
 }
 
-/*****************************************************************************
- * main_GetIntVariable: get the int value of an environment variable
- *****************************************************************************
- * This function is used to read some default parameters in modules.
- *****************************************************************************/
-int main_GetIntVariable( char *psz_name, int i_default )
-{
-    char *      psz_env;                                /* environment value */
-    char *      psz_end;                             /* end of parsing index */
-    long int    i_value;                                            /* value */
-
-    psz_env = getenv( psz_name );
-    if( psz_env )
-    {
-        i_value = strtol( psz_env, &psz_end, 0 );
-        if( (*psz_env != '\0') && (*psz_end == '\0') )
-        {
-            return( i_value );
-        }
-    }
-    return( i_default );
-}
-
-/*****************************************************************************
- * main_GetPszVariable: get the string value of an environment variable
- *****************************************************************************
- * This function is used to read some default parameters in modules.
- *****************************************************************************/
-char * main_GetPszVariable( char *psz_name, char *psz_default )
-{
-    char *psz_env;
-
-    psz_env = getenv( psz_name );
-    if( psz_env )
-    {
-        return( psz_env );
-    }
-    return( psz_default );
-}
 
-/*****************************************************************************
- * main_PutPszVariable: set the string value of an environment variable
- *****************************************************************************
- * This function is used to set some default parameters in modules. The use of
- * this function will cause some memory leak: since some systems use the pointer
- * passed to putenv to store the environment string, it can't be freed.
- *****************************************************************************/
-void main_PutPszVariable( char *psz_name, char *psz_value )
-{
-    char *psz_env;
-
-    psz_env = malloc( strlen(psz_name) + strlen(psz_value) + 2 );
-    if( psz_env == NULL )
-    {
-        intf_ErrMsg( "intf error: cannot create psz_env (%s)",
-                     strerror(ENOMEM) );
-    }
-    else
-    {
-        sprintf( psz_env, "%s=%s", psz_name, psz_value );
-        if( putenv( psz_env ) )
-        {
-            intf_ErrMsg( "intf error: cannot putenv (%s)", strerror(errno) );
-        }
-    }
-}
+/* following functions are local */
 
 /*****************************************************************************
- * main_PutIntVariable: set the integer value of an environment variable
+ * GetConfigurationFromCmdLine: parse command line
  *****************************************************************************
- * This function is used to set some default parameters in modules. The use of
- * this function will cause some memory leak: since some systems use the pointer
- * passed to putenv to store the environment string, it can't be freed.
+ * Parse command line for configuration. If the inline help is requested, the
+ * function Usage() is called and the function returns -1 (causing main() to
+ * exit).
+ * Now that the module_bank has been initialized, we can dynamically
+ * generate the longopts structure used by getops. We have to do it this way
+ * because we don't know (and don't want to know) in advance the configuration
+ * options used (ie. exported) by each module.
  *****************************************************************************/
-void main_PutIntVariable( char *psz_name, int i_value )
+static int GetConfigurationFromCmdLine( int *pi_argc, char *ppsz_argv[],
+                                        boolean_t b_ignore_errors )
 {
-    char psz_value[ 256 ];                               /* buffer for value */
+    int i_cmd, i, i_index, i_longopts_size;
+    module_t *p_module;
+    struct option *p_longopts;
 
-    sprintf( psz_value, "%d", i_value );
-    main_PutPszVariable( psz_name, psz_value );
-}
+    /* Short options */
+    const char *psz_shortopts = "hHvl";
 
-/* following functions are local */
-
-/*****************************************************************************
- * GetConfiguration: parse command line
- *****************************************************************************
- * Parse command line and configuration file for configuration. If the inline
- * help is requested, the function Usage() is called and the function returns
- * -1 (causing main() to exit). The messages interface is initialized at this
- * stage, but most structures are not allocated, so only environment should
- * be used.
- *****************************************************************************/
-static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
-{
-    int   i_cmd;
-    char *p_tmp;
 
     /* Set default configuration and copy arguments */
     p_main->i_argc    = *pi_argc;
     p_main->ppsz_argv = ppsz_argv;
-    p_main->ppsz_env  = ppsz_env;
-
-    p_main->b_audio     = 1;
-    p_main->b_video     = 1;
-
-    p_main->i_warning_level = 0;
-    p_main->b_stats = 0;
-    p_main->i_desync = 0; /* No desynchronization by default */
 
     p_main->p_channel = NULL;
 
-    /* Get the executable name (similar to the basename command) */
-    p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
-    while( *p_tmp )
-    {
-        if( *p_tmp == '/' )
-        {
-            p_main->psz_arg0 = ++p_tmp;
-        }
-        else
-        {
-            ++p_tmp;
-        }
-    }
-
 #ifdef SYS_DARWIN
     /* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
      * is the PSN - process serial number (a unique PID-ish thingie)
@@ -649,233 +647,132 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
     }
 #endif
 
-    /* Parse command line options */
+
+    /*
+     * Generate the longopts structure used by getopt_long
+     */
+    i_longopts_size = 0;
+    for( p_module = p_module_bank->first ;
+         p_module != NULL ;
+         p_module = p_module->next )
+    {
+        /* count the number of exported configuration options (to allocate
+         * longopts). The i_config_options we use is an approximation of the
+         * real number of options (it also includes markers like: category ...)
+         * but it is enough for our purpose */
+        i_longopts_size += p_module->i_config_options -1;
+    }
+
+    p_longopts = (struct option *)malloc( sizeof(struct option)
+                                          * (i_longopts_size + 1) );
+    if( p_longopts == NULL )
+    {
+        intf_ErrMsg( "GetConfigurationFromCmdLine error: "
+                     "can't allocate p_longopts" );
+        return( -1 );
+    }
+
+    /* Fill the longopts structure */
+    i_index = 0;
+    for( p_module = p_module_bank->first ;
+         p_module != NULL ;
+         p_module = p_module->next )
+    {
+        for( i = 1; i < (p_module->i_config_options -1); i++ )
+        {
+            if( (p_module->p_config[i].i_type == MODULE_CONFIG_ITEM_CATEGORY)||
+                (p_module->p_config[i].i_type ==
+                     MODULE_CONFIG_ITEM_SUBCATEGORY)||
+                (p_module->p_config[i].i_type ==
+                     MODULE_CONFIG_ITEM_SUBCATEGORY_END) )
+                 continue;
+            p_longopts[i_index].name = p_module->p_config[i].psz_name;
+            p_longopts[i_index].has_arg =
+                (p_module->p_config[i].i_type == MODULE_CONFIG_ITEM_BOOL)?
+                                               no_argument : required_argument;
+            p_longopts[i_index].flag = 0;
+            p_longopts[i_index].val = 0;
+            i_index++;
+        }
+    }
+    /* Close the longopts structure */
+    memset( &p_longopts[i_index], 0, sizeof(struct option) );
+
+
+    /*
+     * Parse the command line options
+     */
     opterr = 0;
-    while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv,
-                                   psz_shortopts, longopts, 0 ) ) != EOF )
+    optind = 1;
+    while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv, psz_shortopts,
+                                  p_longopts, &i_index ) ) != EOF )
     {
+
+        if( i_cmd == 0 )
+        {
+            /* A long option has been recognized */
+
+            module_config_t *p_config;
+
+            /* Store the configuration option */
+            p_config = config_FindConfig( p_longopts[i_index].name );
+
+            switch( p_config->i_type )
+            {
+            case MODULE_CONFIG_ITEM_STRING:
+            case MODULE_CONFIG_ITEM_FILE:
+            case MODULE_CONFIG_ITEM_PLUGIN:
+                config_PutPszVariable( p_longopts[i_index].name, optarg );
+                break;
+            case MODULE_CONFIG_ITEM_INTEGER:
+                config_PutIntVariable( p_longopts[i_index].name, atoi(optarg));
+                break;
+            case MODULE_CONFIG_ITEM_BOOL:
+                config_PutIntVariable( p_longopts[i_index].name, 1 );
+                break;
+            }
+
+            continue;
+        }
+
+        /* short options handled here for now */
         switch( i_cmd )
         {
+
         /* General/common options */
         case 'h':                                              /* -h, --help */
-            ShowConsole();
-            Usage( SHORT_HELP );
-#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-            intf_Msg( "\nPress the RETURN key to continue..." );
-            getchar();
-#endif
-            return( -1 );
+            config_PutIntVariable( "help", 1 );
             break;
         case 'H':                                          /* -H, --longhelp */
-            ShowConsole();
-            Usage( LONG_HELP );
-#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-            intf_Msg( "\nPress the RETURN key to continue..." );
-            getchar();
-#endif
-            return( -1 );
+            config_PutIntVariable( "longhelp", 1 );
             break;
-        case OPT_VERSION:                                       /* --version */
-            ShowConsole();
-            Version();
-#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-            intf_Msg( "\nPress the RETURN key to continue..." );
-            getchar();
-#endif
-            return( -1 );
+        case 'l':                                              /* -l, --list */
+            config_PutIntVariable( "list", 1 );
             break;
         case 'v':                                           /* -v, --verbose */
             p_main->i_warning_level++;
             break;
 
-        /* Interface warning messages level */
-        case 'I':                                              /* -I, --intf */
-            main_PutPszVariable( INTF_METHOD_VAR, optarg );
-            break;
-        case OPT_WARNING:                                       /* --warning */
-            intf_ErrMsg( "intf error: `--warning' is deprecated, use `-v'" );
-            p_main->i_warning_level = atoi(optarg);
-            break;
-
-        case OPT_STATS:
-            p_main->b_stats = 1;
-            break;
-
-        /* Audio options */
-        case OPT_NOAUDIO:                                       /* --noaudio */
-            p_main->b_audio = 0;
-            break;
-        case 'A':                                              /* -A, --aout */
-            main_PutPszVariable( AOUT_METHOD_VAR, optarg );
-            break;
-        case OPT_STEREO:                                         /* --stereo */
-            main_PutIntVariable( AOUT_STEREO_VAR, 1 );
-            break;
-        case OPT_MONO:                                             /* --mono */
-            main_PutIntVariable( AOUT_STEREO_VAR, 0 );
-            break;
-        case OPT_SPDIF:                                           /* --spdif */
-            main_PutIntVariable( AOUT_SPDIF_VAR, 1 );
-            break;
-        case OPT_DOWNMIX:                                       /* --downmix */
-            main_PutPszVariable( DOWNMIX_METHOD_VAR, optarg );
-            break;
-        case OPT_IMDCT:                                           /* --imdct */
-            main_PutPszVariable( IMDCT_METHOD_VAR, optarg );
-            break;
-        case OPT_VOLUME:                                         /* --volume */
-            main_PutIntVariable( AOUT_VOLUME_VAR, atoi(optarg) );
-            break;
-        case OPT_DESYNC:                                         /* --desync */
-            p_main->i_desync = (mtime_t)atoi(optarg) * (mtime_t)1000;
-            break;
-
-        /* Video options */
-        case OPT_NOVIDEO:                                       /* --novideo */
-            p_main->b_video = 0;
-            break;
-        case 'V':                                              /* -V, --vout */
-            main_PutPszVariable( VOUT_METHOD_VAR, optarg );
-            break;
-        case OPT_DISPLAY:                                       /* --display */
-            main_PutPszVariable( VOUT_DISPLAY_VAR, optarg );
-            break;
-        case OPT_WIDTH:                                           /* --width */
-            main_PutPszVariable( VOUT_WIDTH_VAR, optarg );
-            break;
-        case OPT_HEIGHT:                                         /* --height */
-            main_PutPszVariable( VOUT_HEIGHT_VAR, optarg );
-            break;
-        case 'g':                                         /* -g, --grayscale */
-            main_PutIntVariable( VOUT_GRAYSCALE_VAR, 1 );
-            break;
-        case OPT_COLOR:                                           /* --color */
-            main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 );
-            break;
-        case OPT_FULLSCREEN:                                 /* --fullscreen */
-            main_PutIntVariable( VOUT_FULLSCREEN_VAR, 1 );
-            break;
-        case OPT_NOOVERLAY:                                   /* --nooverlay */
-            main_PutIntVariable( VOUT_NOOVERLAY_VAR, 1 );
-            break;
-        case OPT_XVADAPTOR:                                   /* --xvadaptor */
-            main_PutIntVariable( VOUT_XVADAPTOR_VAR, atoi(optarg) );
-            break;
-        case OPT_MOTION:                                         /* --motion */
-            main_PutPszVariable( MOTION_METHOD_VAR, optarg );
-            break;
-        case OPT_IDCT:                                             /* --idct */
-            main_PutPszVariable( IDCT_METHOD_VAR, optarg );
-            break;
-        case OPT_YUV:                                               /* --yuv */
-            main_PutPszVariable( YUV_METHOD_VAR, optarg );
-            break;
-        case OPT_SMP:                                               /* --smp */
-            main_PutIntVariable( VDEC_SMP_VAR, atoi(optarg) );
-            break;
-        case OPT_SPUMARGIN:                                   /* --spumargin */
-            main_PutIntVariable( VOUT_SPUMARGIN_VAR, atoi(optarg) );
-            break;
-
-        /* DVD options */
-        case 't':                                              /* --dvdtitle */
-            main_PutIntVariable( INPUT_TITLE_VAR, atoi(optarg) );
-            break;
-        case 'T':                                            /* --dvdchapter */
-            main_PutIntVariable( INPUT_CHAPTER_VAR, atoi(optarg) );
-            break;
-        case 'u':                                              /* --dvdangle */
-            main_PutIntVariable( INPUT_ANGLE_VAR, atoi(optarg) );
-            break;
-        case 'a':                                              /* --dvdaudio */
-            if ( ! strcmp(optarg, "ac3") )
-                main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_AC3 );
-            else if ( ! strcmp(optarg, "lpcm") )
-                main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_LPCM );
-            else if ( ! strcmp(optarg, "mpeg") )
-                main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_MPEG );
-            else
-                main_PutIntVariable( INPUT_AUDIO_VAR, REQUESTED_NOAUDIO );
-            break;
-        case 'c':                                            /* --dvdchannel */
-            main_PutIntVariable( INPUT_CHANNEL_VAR, atoi(optarg) );
-            break;
-        case 's':                                           /* --dvdsubtitle */
-            main_PutIntVariable( INPUT_SUBTITLE_VAR, atoi(optarg) );
-            break;
-        case OPT_DVDCSS_METHOD:                           /* --dvdcss-method */
-            main_PutPszVariable( "DVDCSS_METHOD", optarg );
-            break;
-        case OPT_DVDCSS_VERBOSE:                         /* --dvdcss-verbose */
-            main_PutPszVariable( "DVDCSS_VERBOSE", optarg );
-            break;
-
-        /* Input options */
-        case OPT_INPUT:                                           /* --input */
-            main_PutPszVariable( INPUT_METHOD_VAR, optarg );
-            break;
-        case OPT_CHANNELS:                                     /* --channels */
-            main_PutIntVariable( INPUT_NETWORK_CHANNEL_VAR, 1 );
-            break;
-        case OPT_CHANNELSERVER:                           /* --channelserver */
-            main_PutPszVariable( INPUT_CHANNEL_SERVER_VAR, optarg );
-            break;
-
-        /* Misc options */
-        case OPT_SYNCHRO:
-            main_PutPszVariable( VPAR_SYNCHRO_VAR, optarg );
-            break;
-        case OPT_MEMCPY:
-            main_PutPszVariable( MEMCPY_METHOD_VAR, optarg );
-            break;
-        case OPT_FILTER:                                         /* --filter */
-            main_PutPszVariable( VOUT_FILTER_VAR, optarg );
-            break;
-
-        /* Decoder options */
-        case OPT_MPEG_ADEC:
-            main_PutPszVariable( ADEC_MPEG_VAR, optarg );
-            break;
-
-        case OPT_AC3_ADEC:
-            main_PutPszVariable( ADEC_AC3_VAR, optarg );
-            break;
-
-        /* CPU options */
-        case OPT_NOMMX:
-            p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
-            break;
-
-        case OPT_NO3DNOW:
-            p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
-            break;
-
-        case OPT_NOMMXEXT:
-            p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
-            break;
-
-        case OPT_NOSSE:
-            p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
-            break;
-
-        case OPT_NOALTIVEC:
-            p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
-            break;
-
         /* Internal error: unknown option */
         case '?':
         default:
-            ShowConsole();
-            intf_ErrMsg( "intf error: unknown option `%s'",
-                         ppsz_argv[optind] );
-            Usage( USAGE );
+            if( !b_ignore_errors )
+            {
+                intf_ErrMsg( "intf error: unknown option `%s'",
+                             ppsz_argv[optind] );
+                intf_Msg( "Try `%s --help' for more information.\n",
+                          p_main->psz_arg0 );
+
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-            intf_Msg( "\nPress the RETURN key to continue..." );
-            getchar();
+                intf_Msg( "\nPress the RETURN key to continue..." );
+                getchar();
 #endif
-            return( EINVAL );
-            break;
+                free( p_longopts );
+                return( EINVAL );
+                break;
+            }
         }
+
     }
 
     if( p_main->i_warning_level < 0 )
@@ -883,6 +780,7 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
         p_main->i_warning_level = 0;
     }
 
+    free( p_longopts );
     return( 0 );
 }
 
@@ -910,146 +808,158 @@ static int GetFilenames( int i_argc, char *ppsz_argv[] )
  *****************************************************************************
  * Print a short inline help. Message interface is initialized at this stage.
  *****************************************************************************/
-static void Usage( int i_fashion )
+static void Usage( const char *psz_module_name )
 {
+    int i;
+    module_t *p_module;
+    char psz_spaces[30];
+
+    memset( psz_spaces, 32, 30 );
+
+#ifdef WIN32
+    ShowConsole();
+#endif
+
     /* Usage */
-    intf_Msg( "Usage: %s [options] [parameters] [file]...",
-                 p_main->psz_arg0 );
+    intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
+              p_main->psz_arg0 );
 
-    if( i_fashion == USAGE )
+    /* Enumerate the config of each module */
+    for( p_module = p_module_bank->first ;
+         p_module != NULL ;
+         p_module = p_module->next )
     {
-        intf_Msg( "Try `%s --help' for more information.",
-                     p_main->psz_arg0 );
-        return;
+
+        if( psz_module_name && strcmp( psz_module_name, p_module->psz_name ) )
+            continue;
+
+        /* print module name */
+        intf_Msg( "%s configuration:\n", p_module->psz_name );
+
+        for( i = 0; i < (p_module->i_config_options -1); i++ )
+        {
+            int j;
+
+            switch( p_module->p_config[i].i_type )
+            {
+            case MODULE_CONFIG_ITEM_CATEGORY:
+                intf_Msg( " %s", p_module->p_config[i].psz_text );
+                break;
+
+            case MODULE_CONFIG_ITEM_STRING:
+            case MODULE_CONFIG_ITEM_FILE:
+            case MODULE_CONFIG_ITEM_PLUGIN:
+                /* Nasty hack, but right now I'm too tired to think about
+                 * a nice solution */
+                j = 25 - strlen( p_module->p_config[i].psz_name )
+                    - strlen(" <string>") - 1;
+                if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+                intf_Msg( "  --%s <string>%s %s",
+                          p_module->p_config[i].psz_name, psz_spaces,
+                          p_module->p_config[i].psz_text );
+                psz_spaces[j] = 32;
+                break;
+            case MODULE_CONFIG_ITEM_INTEGER:
+                /* Nasty hack, but right now I'm too tired to think about
+                 * a nice solution */
+                j = 25 - strlen( p_module->p_config[i].psz_name )
+                    - strlen(" <integer>") - 1;
+                if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+                intf_Msg( "  --%s <integer>%s %s",
+                          p_module->p_config[i].psz_name, psz_spaces,
+                          p_module->p_config[i].psz_text );
+                psz_spaces[j] = 32;
+                break;
+            default:
+                /* Nasty hack, but right now I'm too tired to think about
+                 * a nice solution */
+                j = 25 - strlen( p_module->p_config[i].psz_name ) - 1;
+                if( j < 0 ) j = 0; psz_spaces[j] = 0;
+
+                intf_Msg( "  --%s%s %s",
+                          p_module->p_config[i].psz_name, psz_spaces,
+                          p_module->p_config[i].psz_text );
+                psz_spaces[j] = 32;
+                break;
+            }
+        }
+
+        /* Yet another nasty hack.
+         * Maybe we could use MODULE_CONFIG_ITEM_END to display tail messages
+         * for each module?? */
+        if( !strcmp( "main", p_module->psz_name ) )
+            intf_Msg( "\nPlaylist items:"
+                "\n  *.mpg, *.vob                   \tPlain MPEG-1/2 files"
+                "\n  dvd:<device>[@<raw device>]    \tDVD device"
+                "\n  vcd:<device>                   \tVCD device"
+                "\n  udpstream:[<server>[:<server port>]][@[<bind address>]"
+                      "[:<bind port>]]"
+                "\n                                 \tUDP stream sent by VLS"
+                "\n  vlc:loop                       \tLoop execution of the "
+                      "playlist"
+                "\n  vlc:pause                      \tPause execution of "
+                      "playlist items"
+                "\n  vlc:quit                       \tQuit VLC" );
+
+        intf_Msg( "" );
+
     }
 
-    /* Options */
-    intf_Msg( "\nOptions:"
-          "\n  -I, --intf <module>            \tinterface method"
-          "\n  -v, --verbose                  \tverbose mode (cumulative)"
-          "\n      --memcpy <module>          \tmemcpy method"
-          "\n"
-          "\n      --noaudio                  \tdisable audio"
-          "\n  -A, --aout <module>            \taudio output method"
-          "\n      --stereo, --mono           \tstereo/mono audio"
-          "\n      --spdif                    \tAC3 pass-through mode"
-          "\n      --downmix <module>         \tAC3 downmix method"
-          "\n      --imdct <module>           \tAC3 IMDCT method"
-          "\n      --volume [0..1024]         \tVLC output volume"
-          "\n      --desync <time in ms>      \tCompensate desynchronization of the audio"
-          "\n"
-          "\n      --novideo                  \tdisable video"
-          "\n  -V, --vout <module>            \tvideo output method"
-          "\n      --display <display>        \tdisplay string"
-          "\n      --width <w>, --height <h>  \tdisplay dimensions"
-          "\n  -g, --grayscale                \tgrayscale output"
-          "\n      --fullscreen               \tfullscreen output"
-          "\n      --nooverlay                \tdisable accelerated display"
-          "\n      --xvadaptor <adaptor>      \tXVideo adaptor"
-          "\n      --color                    \tcolor output"
-          "\n      --motion <module>          \tmotion compensation method"
-          "\n      --idct <module>            \tIDCT method"
-          "\n      --yuv <module>             \tYUV method"
-          "\n      --synchro <type>           \tforce synchro algorithm"
-          "\n      --smp <number of threads>  \tuse several processors"
-          "\n      --spumargin <m>            \tforce SPU position"
-          "\n      --filter <module>          \tvideo filter module"
-          "\n"
-          "\n  -t, --dvdtitle <num>           \tchoose DVD title"
-          "\n  -T, --dvdchapter <num>         \tchoose DVD chapter"
-          "\n  -u, --dvdangle <num>           \tchoose DVD angle"
-          "\n  -a, --dvdaudio <type>          \tchoose DVD audio type"
-          "\n  -c, --dvdchannel <channel>     \tchoose DVD audio channel"
-          "\n  -s, --dvdsubtitle <channel>    \tchoose DVD subtitle channel"
-          "\n      --dvdcss-method <method>   \tselect dvdcss decryption method"
-          "\n      --dvdcss-verbose <level>   \tselect dvdcss verbose level"
-          "\n"
-          "\n      --input                    \tinput method"
-          "\n      --channels                 \tenable channels"
-          "\n      --channelserver <host>     \tchannel server address"
-          "\n"
-          "\n      --mpeg_adec <builtin|mad>  \tchoose MPEG audio decoder"
-          "\n      --ac3_adec <builtin|a52>   \tchoose AC3 audio decoder"
-          "\n"
-          "\n      --nommx                    \tdisable CPU's MMX support"
-          "\n      --no3dnow                  \tdisable CPU's 3D Now! support"
-          "\n      --nommxext                 \tdisable CPU's MMX EXT support"
-          "\n      --nosse                    \tdisable CPU's SSE support"
-          "\n      --noaltivec                \tdisable CPU's AltiVec support"
-          "\n"
-          "\n  -h, --help                     \tprint help and exit"
-          "\n  -H, --longhelp                 \tprint long help and exit"
-          "\n      --version                  \toutput version information and exit"
-          "\n\nPlaylist items:"
-          "\n  *.mpg, *.vob                   \tPlain MPEG-1/2 files"
-          "\n  dvd:<device>[@<raw device>]    \tDVD device"
-          "\n  vcd:<device>                   \tVCD device"
-          "\n  udpstream:[<server>[:<server port>]][@[<bind address>][:<bind port>]]"
-          "\n                                 \tUDP stream sent by VLS"
-          "\n  vlc:loop                       \tLoop execution of the playlist"
-          "\n  vlc:pause                      \tPause execution of playlist items"
-          "\n  vlc:quit                       \tQuit VLC");
-
-    if( i_fashion == SHORT_HELP )
-        return;
-
-    /* Interface parameters */
-    intf_Msg( "\nInterface parameters:"
-        "\n  " INTF_METHOD_VAR "=<method name>        \tinterface method"
-        "\n  " INTF_INIT_SCRIPT_VAR "=<filename>              \tinitialization script"
-        "\n  " INTF_CHANNELS_VAR "=<filename>         \tchannels list"
-        "\n  " MEMCPY_METHOD_VAR "=<method name>      \tmemcpy method" );
-
-    /* Audio parameters */
-    intf_Msg( "\nAudio parameters:"
-        "\n  " AOUT_METHOD_VAR "=<method name>        \taudio method"
-        "\n  " AOUT_DSP_VAR "=<filename>              \tdsp device path"
-        "\n  " AOUT_STEREO_VAR "={1|0}                \tstereo or mono output"
-        "\n  " AOUT_SPDIF_VAR "={1|0}                 \tAC3 pass-through mode"
-        "\n  " DOWNMIX_METHOD_VAR "=<method name>     \tAC3 downmix method"
-        "\n  " IMDCT_METHOD_VAR "=<method name>       \tAC3 IMDCT method"
-        "\n  " AOUT_VOLUME_VAR "=[0..1024]            \tVLC output volume"
-        "\n  " AOUT_RATE_VAR "=<rate>                 \toutput rate" );
-
-    /* Video parameters */
-    intf_Msg( "\nVideo parameters:"
-        "\n  " VOUT_METHOD_VAR "=<method name>        \tdisplay method"
-        "\n  " VOUT_DISPLAY_VAR "=<display name>      \tdisplay used"
-        "\n  " VOUT_WIDTH_VAR "=<width>               \tdisplay width"
-        "\n  " VOUT_HEIGHT_VAR "=<height>             \tdislay height"
-        "\n  " VOUT_FB_DEV_VAR "=<filename>           \tframebuffer device path"
-        "\n  " VOUT_GRAYSCALE_VAR "={1|0}             \tgrayscale or color output"
-        "\n  " VOUT_FULLSCREEN_VAR "={1|0}            \tfullscreen"
-        "\n  " VOUT_NOOVERLAY_VAR "={1|0}             \tnooverlay"
-        "\n  " VOUT_XVADAPTOR_VAR "=<adaptor>         \tXVideo adaptor"
-        "\n  " MOTION_METHOD_VAR "=<method name>      \tmotion compensation method"
-        "\n  " IDCT_METHOD_VAR "=<method name>        \tIDCT method"
-        "\n  " YUV_METHOD_VAR "=<method name>         \tYUV method"
-        "\n  " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB}   \tsynchro algorithm"
-        "\n  " VDEC_SMP_VAR "=<number of threads>     \tuse several processors"
-        "\n  " VOUT_FILTER_VAR "=<method name>        \tvideo filter method"
-        "\n  " VOUT_SPUMARGIN_VAR "=<margin>          \tforce SPU margin" );
-
-    /* DVD parameters */
-    intf_Msg( "\nDVD parameters:"
-        "\n  " INPUT_DVD_DEVICE_VAR "=<device>        \tDVD device"
-        "\n  " INPUT_TITLE_VAR "=<title>              \ttitle number"
-        "\n  " INPUT_CHAPTER_VAR "=<chapter>          \tchapter number"
-        "\n  " INPUT_ANGLE_VAR "=<angle>              \tangle number"
-        "\n  " INPUT_AUDIO_VAR "={ac3|lpcm|mpeg|off}  \taudio type"
-        "\n  " INPUT_CHANNEL_VAR "=[0-15]             \taudio channel"
-        "\n  " INPUT_SUBTITLE_VAR "=[0-31]            \tsubtitle channel" );
-
-    /* Input parameters */
-    intf_Msg( "\nInput parameters:"
-        "\n  " INPUT_IFACE_VAR "=<interface>          \tnetwork interface"
-        "\n  " INPUT_CHANNEL_SERVER_VAR "=<hostname>  \tchannel server"
-        "\n  " INPUT_CHANNEL_PORT_VAR "=<port>        \tchannel server port" );
-
-    /* Decoder parameters */
-    intf_Msg( "\nDecoder parameters:"
-        "\n  " ADEC_MPEG_VAR "=<builtin|mad>          \tMPEG audio decoder"
-        "\n  " ADEC_AC3_VAR "=<builtin|a52>           \tAC3 audio decoder" );
+#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
+        intf_Msg( "\nPress the RETURN key to continue..." );
+        getchar();
+#endif
+}
+
+/*****************************************************************************
+ * ListModules: list the available modules with their description
+ *****************************************************************************
+ * Print a list of all available modules (builtins and plugins) and a short
+ * description for each one.
+ *****************************************************************************/
+static void ListModules( void )
+{
+    module_t *p_module;
+    char psz_spaces[20];
+
+    memset( psz_spaces, 32, 20 );
+
+#ifdef WIN32
+    ShowConsole();
+#endif
+
+    /* Usage */
+    intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
+              p_main->psz_arg0 );
+
+    intf_Msg( "[plugin]              [description]" );
+
+    /* Enumerate each module */
+    for( p_module = p_module_bank->first ;
+         p_module != NULL ;
+         p_module = p_module->next )
+    {
+        int i;
+
+        /* Nasty hack, but right now I'm too tired to think about a nice
+         * solution */
+        i = 20 - strlen( p_module->psz_name ) - 1;
+        if( i < 0 ) i = 0;
+        psz_spaces[i] = 0;
+
+        intf_Msg( "  %s%s %s", p_module->psz_name, psz_spaces,
+                  p_module->psz_longname );
+
+        psz_spaces[i] = 32;
+
+    }
+
+#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
+        intf_Msg( "\nPress the RETURN key to continue..." );
+        getchar();
+#endif
 }
 
 /*****************************************************************************
@@ -1059,11 +969,18 @@ static void Usage( int i_fashion )
  *****************************************************************************/
 static void Version( void )
 {
+#ifdef WIN32
+    ShowConsole();
+#endif
     intf_Msg( VERSION_MESSAGE
         "This program comes with NO WARRANTY, to the extent permitted by law.\n"
         "You may redistribute it under the terms of the GNU General Public License;\n"
         "see the file named COPYING for details.\n"
         "Written by the VideoLAN team at Ecole Centrale, Paris." );
+#ifdef WIN32        /* Pause the console because it's destroyed when we exit */
+        intf_Msg( "\nPress the RETURN key to continue..." );
+        getchar();
+#endif
 }
 
 /*****************************************************************************
@@ -1126,7 +1043,7 @@ static void FatalSignalHandler( int i_signal )
 /*****************************************************************************
  * IllegalSignalHandler: system signal handler
  *****************************************************************************
- * This function is called when a illegal instruction signal is received by
+ * This function is called when an illegal instruction signal is received by
  * the program. We use this function to test OS and CPU capabilities
  *****************************************************************************/
 static void IllegalSignalHandler( int i_signal )
@@ -1373,13 +1290,13 @@ static u32 CPUCapabilities( void )
  *****************************************************************************
  * This function is usefull only on Win32.
  *****************************************************************************/
+#ifdef WIN32 /*  */
 static void ShowConsole( void )
 {
-#ifdef WIN32 /*  */
     AllocConsole();
     freopen( "CONOUT$", "w", stdout );
     freopen( "CONOUT$", "w", stderr );
     freopen( "CONIN$", "r", stdin );
-#endif
     return;
 }
+#endif
diff --git a/src/misc/configuration.c b/src/misc/configuration.c
new file mode 100644 (file)
index 0000000..ba729c7
--- /dev/null
@@ -0,0 +1,249 @@
+/*****************************************************************************
+ * configuration.c management of the modules configuration
+ *****************************************************************************
+ * Copyright (C) 2001 VideoLAN
+ * $Id: configuration.c,v 1.1 2002/02/24 20:51:10 gbazin Exp $
+ *
+ * Authors: Gildas Bazin <gbazin@netcourrier.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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#include <stdlib.h>                                      /* free(), strtol() */
+#include <stdio.h>                                              /* sprintf() */
+#include <string.h>                                              /* strdup() */
+
+#include <videolan/vlc.h>
+
+/* TODO: implement locking for config_PutPszVariable and config_GetPszVariable
+ * because they are not thread safe */
+
+/*****************************************************************************
+ * config_GetIntVariable: get the value of an int variable
+ *****************************************************************************
+ * This function is used to get the value of variables which are internally
+ * represented by an integer (MODULE_CONFIG_ITEM_INTEGER and
+ * MODULE_CONFIG_ITEM_BOOL).
+ *****************************************************************************/
+int config_GetIntVariable( const char *psz_name )
+{
+    module_config_t *p_config;
+
+    p_config = config_FindConfig( psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        intf_ErrMsg( "config_GetIntVariable: option %s doesn't exist",
+                     psz_name );
+        return -1;
+    }
+    if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
+    {
+        intf_ErrMsg( "config_GetIntVariable: option %s doesn't refer to an int"
+                     , psz_name );
+        return -1;
+    }
+
+    return p_config->i_value;
+}
+
+/*****************************************************************************
+ * config_GetPszVariable: get the string value of a string variable
+ *****************************************************************************
+ * This function is used to get the value of variables which are internally
+ * represented by a string (MODULE_CONFIG_ITEM_STRING, MODULE_CONFIG_ITEM_FILE,
+ * and MODULE_CONFIG_ITEM_PLUGIN).
+ *
+ * Important note: remember to free() the returned char* because it a duplicate
+ *   of the actual value. It isn't safe to return a pointer to the actual value
+ *   as it can be modified at any time.
+ *****************************************************************************/
+char * config_GetPszVariable( const char *psz_name )
+{
+    module_config_t *p_config;
+    char *psz_value = NULL;
+
+    p_config = config_FindConfig( psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        intf_ErrMsg( "config_GetPszVariable: option %s doesn't exist",
+                     psz_name );
+        return NULL;
+    }
+    if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
+    {
+        intf_ErrMsg( "config_GetPszVariable: option %s doesn't refer to a "
+                     "string", psz_name );
+        return NULL;
+    }
+
+    /* return a copy of the string */
+    if( p_config->psz_value ) psz_value = strdup( p_config->psz_value );
+
+    return psz_value;
+}
+
+/*****************************************************************************
+ * config_PutPszVariable: set the string value of a string variable
+ *****************************************************************************
+ * This function is used to set the value of variables which are internally
+ * represented by a string (MODULE_CONFIG_ITEM_STRING, MODULE_CONFIG_ITEM_FILE,
+ * and MODULE_CONFIG_ITEM_PLUGIN).
+ *****************************************************************************/
+void config_PutPszVariable( const char *psz_name, char *psz_value )
+{
+    module_config_t *p_config;
+    char *psz_tmp;
+
+    p_config = config_FindConfig( psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        intf_ErrMsg( "config_PutPszVariable: option %s doesn't exist",
+                     psz_name );
+        return;
+    }
+    if( (p_config->i_type!=MODULE_CONFIG_ITEM_STRING) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_FILE) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_PLUGIN) )
+    {
+        intf_ErrMsg( "config_PutPszVariable: option %s doesn't refer to a "
+                     "string", psz_name );
+        return;
+    }
+
+    psz_tmp = p_config->psz_value;
+    if( psz_value ) p_config->psz_value = strdup( psz_value );
+    else p_config->psz_value = NULL;
+
+    /* free old string */
+    if( psz_tmp ) free( psz_tmp );
+
+}
+
+/*****************************************************************************
+ * config_PutIntVariable: set the integer value of an int variable
+ *****************************************************************************
+ * This function is used to set the value of variables which are internally
+ * represented by an integer (MODULE_CONFIG_ITEM_INTEGER and
+ * MODULE_CONFIG_ITEM_BOOL).
+ *****************************************************************************/
+void config_PutIntVariable( const char *psz_name, int i_value )
+{
+    module_config_t *p_config;
+
+    p_config = config_FindConfig( psz_name );
+
+    /* sanity checks */
+    if( !p_config )
+    {
+        intf_ErrMsg( "config_PutIntVariable: option %s doesn't exist",
+                     psz_name );
+        return;
+    }
+    if( (p_config->i_type!=MODULE_CONFIG_ITEM_INTEGER) &&
+        (p_config->i_type!=MODULE_CONFIG_ITEM_BOOL) )
+    {
+        intf_ErrMsg( "config_PutIntVariable: option %s doesn't refer to an int"
+                     , psz_name );
+        return;
+    }
+
+    p_config->i_value = i_value;
+}
+
+/*****************************************************************************
+ * config_FindConfig: find the config structure associated with an option.
+ *****************************************************************************
+ * FIXME: This function really needs to be optimized.
+ *****************************************************************************/
+module_config_t *config_FindConfig( const char *psz_name )
+{
+    module_t *p_module;
+    int i;
+
+    if( !psz_name ) return NULL;
+
+    for( p_module = p_module_bank->first ;
+         p_module != NULL ;
+         p_module = p_module->next )
+    {
+        for( i = 0; i < (p_module->i_config_options -1); i++ )
+        {
+            if( (p_module->p_config[i].i_type ==
+                     MODULE_CONFIG_ITEM_CATEGORY)||
+                (p_module->p_config[i].i_type ==
+                     MODULE_CONFIG_ITEM_SUBCATEGORY)||
+                (p_module->p_config[i].i_type ==
+                     MODULE_CONFIG_ITEM_SUBCATEGORY_END) )
+                continue;
+            if( !strcmp( psz_name, p_module->p_config[i].psz_name ) )
+                return &p_module->p_config[i];
+        }
+    }
+
+    return NULL;
+}
+
+/*****************************************************************************
+ * config_Duplicate: creates a duplicate of a module's configuration data.
+ *****************************************************************************
+ * Unfortunatly we cannot work directly with the module's config data as
+ * this module might be unloaded from memory at any time (remember HideModule).
+ * This is why we need to create an exact copy of the config data.
+ *****************************************************************************/
+module_config_t *config_Duplicate( module_config_t *p_config_orig,
+                                   int i_config_options )
+{
+    int i;
+    module_config_t *p_config;
+
+    /* allocate memory */
+    p_config = (module_config_t *)malloc( sizeof(module_config_t)
+                                          * i_config_options );
+    if( p_config == NULL )
+    {
+        intf_ErrMsg( "config_Duplicate error: can't allocate p_config" );
+        return( NULL );
+    }
+
+    for( i = 0; i < i_config_options ; i++ )
+    {
+        p_config[i].i_type = p_config_orig[i].i_type;
+        p_config[i].i_value = p_config_orig[i].i_value;
+        p_config[i].b_dirty = p_config_orig[i].b_dirty;
+        if( p_config_orig[i].psz_name )
+            p_config[i].psz_name = strdup( p_config_orig[i].psz_name );
+        if( p_config_orig[i].psz_text )
+            p_config[i].psz_text = strdup( p_config_orig[i].psz_text );
+        if( p_config_orig[i].psz_longtext )
+            p_config[i].psz_longtext = strdup( p_config_orig[i].psz_longtext );
+        if( p_config_orig[i].psz_value )
+            p_config[i].psz_value = strdup( p_config_orig[i].psz_value );
+
+        /* the callback pointer is only valid when the module is loaded so this
+         * value is set in ActivateModule() and reset in DeactivateModule() */
+        p_config_orig[i].p_callback = NULL;
+    }
+
+    return p_config;
+}
index ef32e0cff69e64d609919b9cb509debb63e0fffc..063f9691544581c3e81d30a9b1d1df018858a447 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Built-in and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.53 2002/02/19 00:50:20 sam Exp $
+ * $Id: modules.c,v 1.54 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -51,6 +51,7 @@
 #   undef HAVE_DYNAMIC_PLUGINS
 #endif
 
+
 #include "netutils.h"
 
 #include "interface.h"
@@ -81,7 +82,6 @@
 static void AllocateAllPlugins   ( void );
 static int  AllocatePluginModule ( char * );
 #endif
-static void AllocateAllBuiltins  ( void );
 static int  AllocateBuiltinModule( int ( * ) ( module_t * ),
                                    int ( * ) ( module_t * ),
                                    int ( * ) ( module_t * ) );
@@ -100,8 +100,8 @@ static module_symbols_t symbols;
 /*****************************************************************************
  * module_InitBank: create the module bank.
  *****************************************************************************
- * This function creates a module bank structure and fills it with the
- * built-in modules, as well as all the plugin modules it can find.
+ * This function creates a module bank structure which will be filled later
+ * on with all the modules found.
  *****************************************************************************/
 void module_InitBank( void )
 {
@@ -116,24 +116,46 @@ void module_InitBank( void )
     STORE_SYMBOLS( &symbols );
 #endif
 
-    /*
-     * Check all the built-in modules
-     */
+    return;
+}
+
+/*****************************************************************************
+ * module_LoadMain: load the main program info into the module bank.
+ *****************************************************************************
+ * This function fills the module bank structure with the main module infos.
+ * This is very useful as it will allow us to consider the main program just
+ * as another module, and for instance the configuration options of main will
+ * be available in the module bank structure just as for every other module.
+ *****************************************************************************/
+void module_LoadMain( void )
+{
+    AllocateBuiltinModule( InitModule__MODULE_main,
+                           ActivateModule__MODULE_main,
+                           DeactivateModule__MODULE_main );
+}
+
+/*****************************************************************************
+ * module_LoadBuiltins: load all modules which we built with.
+ *****************************************************************************
+ * This function fills the module bank structure with the built-in modules.
+ *****************************************************************************/
+void module_LoadBuiltins( void )
+{
     intf_WarnMsg( 2, "module: checking built-in modules" );
-    AllocateAllBuiltins();
+    ALLOCATE_ALL_BUILTINS();
+}
 
-    /*
-     * Check all the plugin modules we can find
-     */
+/*****************************************************************************
+ * module_LoadPlugins: load all plugin modules we can find.
+ *****************************************************************************
+ * This function fills the module bank structure with the plugin modules.
+ *****************************************************************************/
+void module_LoadPlugins( void )
+{
 #ifdef HAVE_DYNAMIC_PLUGINS
     intf_WarnMsg( 2, "module: checking plugin modules" );
     AllocateAllPlugins();
 #endif
-
-    intf_WarnMsg( 2, "module: module bank initialized, found %i modules",
-                     p_module_bank->i_count );
-
-    return;
 }
 
 /*****************************************************************************
@@ -615,7 +637,7 @@ static int AllocatePluginModule( char * psz_filename )
     p_module->is.plugin.handle = handle;
     p_module->p_symbols = &symbols;
 
-    /* Initialize the module : fill p_module->psz_name, etc. */
+    /* Initialize the module : fill p_module->psz_name, default config, etc. */
     if( CallSymbol( p_module, "InitModule" MODULE_SUFFIX ) != 0 )
     {
         /* We couldn't call InitModule() */
@@ -706,14 +728,6 @@ static int AllocatePluginModule( char * psz_filename )
 }
 #endif /* HAVE_DYNAMIC_PLUGINS */
 
-/*****************************************************************************
- * AllocateAllBuiltins: load all modules we were built with.
- *****************************************************************************/
-static void AllocateAllBuiltins( void )
-{
-    ALLOCATE_ALL_BUILTINS();
-}
-
 /*****************************************************************************
  * AllocateBuiltinModule: initialize a built-in module.
  *****************************************************************************
index 90c399b76c8516b4237ab29926755b0c3ef1e369..2c0497261ea2b556a7c96a096a5f4dd54e1cb49c 100644 (file)
@@ -25,5 +25,9 @@
                            ActivateModule__MODULE_ ## NAME, \
                            DeactivateModule__MODULE_ ## NAME );
 
-/* Add stuff here */
+/* We also consider the main program as a module (useful for config stuff) */
+int InitModule__MODULE_main( module_t* );
+int ActivateModule__MODULE_main( module_t* );
+int DeactivateModule__MODULE_main( module_t* );
 
+/* Add stuff here */
index 9b3312d9a0154679490649cd18c259ba72b2e2aa..8f8156c9030ba01a31372d5de69e6104e693c9f3 100644 (file)
@@ -2,7 +2,7 @@
  * modules_plugin.h : Plugin management functions used by the core application.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules_plugin.h,v 1.10 2002/02/21 23:56:08 sam Exp $
+ * $Id: modules_plugin.h,v 1.11 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -157,10 +157,12 @@ module_error( void )
     (p_symbols)->p_input_bank = p_input_bank; \
     (p_symbols)->p_aout_bank = p_aout_bank; \
     (p_symbols)->p_vout_bank = p_vout_bank; \
-    (p_symbols)->main_GetIntVariable = main_GetIntVariable; \
-    (p_symbols)->main_GetPszVariable = main_GetPszVariable; \
-    (p_symbols)->main_PutIntVariable = main_PutIntVariable; \
-    (p_symbols)->main_PutPszVariable = main_PutPszVariable; \
+    (p_symbols)->config_GetIntVariable = config_GetIntVariable; \
+    (p_symbols)->config_GetPszVariable = config_GetPszVariable; \
+    (p_symbols)->config_PutIntVariable = config_PutIntVariable; \
+    (p_symbols)->config_PutPszVariable = config_PutPszVariable; \
+    (p_symbols)->config_Duplicate = config_Duplicate; \
+    (p_symbols)->config_FindConfig = config_FindConfig; \
     (p_symbols)->intf_MsgSub = intf_MsgSub; \
     (p_symbols)->intf_MsgUnsub = intf_MsgUnsub; \
     (p_symbols)->intf_Msg = intf_Msg; \
@@ -233,5 +235,3 @@ module_error( void )
     (p_symbols)->DecodeLanguage = DecodeLanguage; \
     (p_symbols)->module_Need = module_Need; \
     (p_symbols)->module_Unneed = module_Unneed;
-    
-
index c3db66c65f6d0ce3c7a7f35226590bcf9c033cab..ad6b1a21877c51c07b6d95706784ba2ae12a3379 100644 (file)
@@ -2,7 +2,7 @@
  * netutils.c: various network functions
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: netutils.c,v 1.56 2002/02/20 23:23:53 sam Exp $
+ * $Id: netutils.c,v 1.57 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Benoit Steiner <benny@via.ecp.fr>
@@ -211,8 +211,7 @@ int network_ChannelJoin( int i_channel )
     struct timeval delay;
     fd_set fds;
 
-    if( !main_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR,
-                              INPUT_NETWORK_CHANNEL_DEFAULT  ) )
+    if( !config_GetIntVariable( INPUT_NETWORK_CHANNEL_VAR ) )
     {
         intf_ErrMsg( "network: channels disabled, to enable them, use the"
                      "--channels option" );
@@ -247,10 +246,14 @@ int network_ChannelJoin( int i_channel )
     }
 
     /* Getting information about the channel server */
-    psz_vlcs = main_GetPszVariable( INPUT_CHANNEL_SERVER_VAR,
-                                    INPUT_CHANNEL_SERVER_DEFAULT );
-    i_port = main_GetIntVariable( INPUT_CHANNEL_PORT_VAR,
-                                  INPUT_CHANNEL_PORT_DEFAULT );
+    if( !(psz_vlcs = config_GetPszVariable( INPUT_CHANNEL_SERVER_VAR )) )
+    {
+        intf_ErrMsg( "network: configuration variable %s empty",
+                     INPUT_CHANNEL_SERVER_VAR );
+        return -1;
+    }
+
+    i_port = config_GetIntVariable( INPUT_CHANNEL_PORT_VAR );
 
     intf_WarnMsg( 5, "network: socket %i, vlcs '%s', port %d",
                      i_fd, psz_vlcs, i_port );
@@ -267,6 +270,7 @@ int network_ChannelJoin( int i_channel )
 #else
     sa_server.sin_addr.s_addr = inet_addr( psz_vlcs );
 #endif
+    free( psz_vlcs );
 
     /* Bind the socket */
     if( bind( i_fd, (struct sockaddr*)(&sa_client), sizeof(sa_client) ) )
@@ -380,13 +384,20 @@ static int GetMacAddress( int i_fd, char *psz_mac )
 #if defined( SYS_LINUX )
     struct ifreq interface;
     int i_ret;
+    char *psz_interface;
 
     /*
      * Looking for information about the eth0 interface
      */
     interface.ifr_addr.sa_family = AF_INET;
-    strcpy( interface.ifr_name, 
-            main_GetPszVariable( INPUT_IFACE_VAR, INPUT_IFACE_DEFAULT ) );
+    if( !(psz_interface = config_GetPszVariable( INPUT_IFACE_VAR )) )
+    {
+        intf_ErrMsg( "network error: configuration variable %s empty",
+                     INPUT_IFACE_VAR );
+        return -1;
+    }
+    strcpy( interface.ifr_name, psz_interface );
+    free( psz_interface );
 
     i_ret = ioctl( i_fd, SIOCGIFHWADDR, &interface );
 
index 2897e2c6d0ddf4086ced94be3315a59aa7646f45..9e1d3aa3f585a675754b8484917638fe1433cd8d 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.160 2002/02/19 00:50:20 sam Exp $
+ * $Id: video_output.c,v 1.161 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -106,10 +106,9 @@ vout_thread_t * vout_CreateThread   ( int *pi_status,
     }
 
     /* Choose the best module */
-    psz_plugin = main_GetPszVariable( VOUT_FILTER_VAR, "" );
-    if( psz_plugin[0] == '\0' )
+    if( !(psz_plugin = config_GetPszVariable( VOUT_FILTER_VAR )) )
     {
-        psz_plugin = main_GetPszVariable( VOUT_METHOD_VAR, "" );
+        psz_plugin = config_GetPszVariable( VOUT_METHOD_VAR );
     }
 
     /* Initialize thread properties - thread id and locks will be initialized
@@ -154,12 +153,13 @@ vout_thread_t * vout_CreateThread   ( int *pi_status,
     p_vout->render_time  = 10;
 
     /* user requested fullscreen? */
-    if( main_GetIntVariable( VOUT_FULLSCREEN_VAR, VOUT_FULLSCREEN_DEFAULT ) )
+    if( config_GetIntVariable( VOUT_FULLSCREEN_VAR ) )
         p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
 
     p_vout->p_module
         = module_Need( MODULE_CAPABILITY_VOUT, psz_plugin, (void *)p_vout );
 
+    if( psz_plugin ) free( psz_plugin );
     if( p_vout->p_module == NULL )
     {
         intf_ErrMsg( "vout error: no suitable vout module" );
index d72df7791f5af804fde393be47f2043213d78041..e1d41ee78d671f0431eba4d61d1553a23ea07b69 100644 (file)
@@ -2,7 +2,7 @@
  * vout_subpictures.c : subpicture management functions
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vout_subpictures.c,v 1.8 2002/02/19 00:50:20 sam Exp $
+ * $Id: vout_subpictures.c,v 1.9 2002/02/24 20:51:10 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -60,8 +60,7 @@ void  vout_DisplaySubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
 
     /* If the user requested an SPU margin, we force the position after
      * having checked that it was a valid value. */
-    i_margin = main_GetIntVariable( VOUT_SPUMARGIN_VAR,
-                                    VOUT_SPUMARGIN_DEFAULT );
+    i_margin = config_GetIntVariable( VOUT_SPUMARGIN_VAR );
 
     if( i_margin >= 0 )
     {