]> git.sesse.net Git - vlc/blobdiff - src/interface/main.c
* ./plugins/macosx/intf_vlc_wrapper.m: fix for non-ASCII filenames in the
[vlc] / src / interface / main.c
index 2d80d7ff038ea9e3d1a7759ecae87f40c10e4048..3c8571cfcd140d9ad2aa97860cf9cf676e4357d8 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: main.c,v 1.177 2002/04/08 14:53:05 jobi Exp $
+ * $Id: main.c,v 1.195 2002/05/30 08:17:04 gbazin Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -14,7 +14,7 @@
  * 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
@@ -60,7 +60,7 @@
 #endif
 
 #ifdef HAVE_LOCALE_H
-#    include <locale.h>
+#   include <locale.h>
 #endif
 
 #include <errno.h>                                                 /* ENOMEM */
 #include "video.h"
 #include "video_output.h"
 
-#include "debug.h"
-
 /*****************************************************************************
- * Configuration options for the main program. Each plugin will also separatly
+ * Configuration options for the main program. Each module 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 __BUILTIN__
 #define MODULE_NAME main
 #include "modules_inner.h"                        /* for configuration stuff */
 
 
-#define INTF_TEXT "interface method"
-#define INTF_LONGTEXT "This option allows you to select the interface used by"\
-                      " vlc.\nNote that the default behaviour is to" \
-                      " automatically select the best method available"
-
-#define WARNING_TEXT "warning level (or use -v, -vv, etc...)"
-#define WARNING_LONGTEXT "Increasing the warning level will allow you to see" \
-                         " more debug messages and can sometimes help you to" \
-                         " troubleshoot a problem"
-
-#define STATS_TEXT "output statistics"
-#define STATS_LONGTEXT "Enabling the stats mode will flood your log console" \
-                       " with various statistics messages"
-
-#define INTF_PATH_TEXT "interface default search path"
-#define INTF_PATH_LONGTEXT "This option allows you to set the default path" \
-                           " that the interface will open when looking for a" \
-                           " file"
-
-#define AOUT_TEXT "audio output method"
-#define AOUT_LONGTEXT "This option allows you to select the audio" \
-                      " audio output method used by vlc.\nNote that the" \
-                      " default behaviour is to automatically select the best"\
-                      " method available"
-
-#define NOAUDIO_TEXT "disable audio"
-#define NOAUDIO_LONGTEXT "This will completely disable the audio output. The" \
-                         " audio decoding stage shouldn't even be done, so it"\
-                         " can allow you to save some processing power"
-
-#define MONO_TEXT "mono audio"
-#define MONO_LONGTEXT "This will force a mono audio output"
-
-#define VOLUME_TEXT "audio output volume"
-#define VOLUME_LONGTEXT "You can set the default audio output volume here," \
-                        " in a range from 0 to 1024"
-
-#define FORMAT_TEXT "audio output format"
-#define FORMAT_LONGTEXT "You can force the audio output format here.\n" \
-                        "0 -> 16 bits signed native endian (default)\n" \
-                        "1 ->  8 bits unsigned\n"                       \
-                        "2 -> 16 bits signed little endian\n"           \
-                        "3 -> 16 bits signed big endian\n"              \
-                        "4 ->  8 bits signed\n"                         \
-                        "5 -> 16 bits unsigned little endian\n"         \
-                        "6 -> 16 bits unsigned big endian\n"            \
-                        "7 -> mpeg2 audio (unsupported)\n"              \
-                        "8 -> ac3 pass-through"
-
-#define RATE_TEXT "audio output frequency (Hz)"
-#define RATE_LONGTEXT "You can force the audio output frequency here.\n"    \
-                      "Common values are 48000, 44100, 32000, 22050,"       \
-                      " 16000, 11025, 8000"
-
-#define DESYNC_TEXT "Compensate desynchronization of audio (in ms)"
-#define DESYNC_LONGTEXT "This option allows you to delay the audio output."  \
-                        " This can be handy if you notice a lag between the" \
-                        " video and the audio"
-
-#define VOUT_TEXT "video output method"
-#define VOUT_LONGTEXT "This option allows you to select the video output"     \
-                      " method used by vlc.\nNote that the default behaviour" \
-                      " is to automatically select the best method available"
-
-#define NOVIDEO_TEXT "disable video"
-#define NOVIDEO_LONGTEXT "This will completely disable the video output. The" \
-                         " video decoding stage shouldn't even be done, so"   \
-                         " it can allow you to save some processing power"
-
-#define DISPLAY_TEXT "display identifier"
-#define DISPLAY_LONGTEXT NULL
-
-#define WIDTH_TEXT "video width"
-#define WIDTH_LONGTEXT "You can enforce the video width here.\nNote"  \
-                       " that by default vlc will adapt to the video" \
-                       " characteristics"
-
-#define HEIGHT_TEXT "video height"
-#define HEIGHT_LONGTEXT "You can enforce the video height here.\nNote"  \
-                        " that by default vlc will adapt to the video " \
-                        " characteristics"
-
-#define GRAYSCALE_TEXT "grayscale video output"
-#define GRAYSCALE_LONGTEXT "Using this option, vlc will not decode the color "\
-                           "information from the video (this can also allow " \
-                           "you to save some processing power)"
-
-#define FULLSCREEN_TEXT "fullscreen video output"
-#define FULLSCREEN_LONGTEXT "If this option is enabled, vlc will always " \
-                            "start a video in fullscreen mode"
-
-#define NOOVERLAY_TEXT "disable hardware acceleration for the video output"
-#define NOOVERLAY_LONGTEXT "By default vlc will try to take advantage of the "\
-                           "overlay capabilities of you graphics card.\n"
-
-#define SPUMARGIN_TEXT "force SPU position"
-#define SPUMARGIN_LONGTEXT NULL
-
-#define FILTER_TEXT "video filter module"
-#define FILTER_LONGTEXT NULL
-
-#define SERVER_PORT_TEXT "server port"
-#define SERVER_PORT_LONGTEXT NULL
-
-#define NETCHANNEL_TEXT "enable network channel mode"
-#define NETCHANNEL_LONGTEXT NULL
-
-#define CHAN_SERV_TEXT "channel server address"
-#define CHAN_SERV_LONGTEXT NULL
-
-#define CHAN_PORT_TEXT "channel server port"
-#define CHAN_PORT_LONGTEXT NULL
-
-#define IFACE_TEXT "network interface"
-#define IFACE_LONGTEXT NULL
-
-#define INPUT_PROGRAM_TEXT "choose program (SID)"
-#define INPUT_PROGRAM_LONGTEXT "choose the program to select by giving its"\
-                                "Service ID"
-
-#define INPUT_AUDIO_TEXT "choose audio"
-#define INPUT_AUDIO_LONGTEXT NULL
-
-#define INPUT_CHAN_TEXT "choose channel"
-#define INPUT_CHAN_LONGTEXT NULL
-
-#define INPUT_SUBT_TEXT "choose subtitles"
-#define INPUT_SUBT_LONGTEXT NULL
-
-#define DVD_DEV_TEXT "DVD device"
-#define DVD_DEV_LONGTEXT NULL
-
-#define VCD_DEV_TEXT "VCD device"
-#define VCD_DEV_LONGTEXT NULL
-
-#define SAT_FREQ_TEXT "Satellite transponder frequency"
-#define SAT_FREQ_LONGTEXT NULL
-
-#define SAT_POL_TEXT "Satellite transponder polarization"
-#define SAT_POL_LONGTEXT NULL
-
-#define SAT_SRATE_TEXT "Satellite transponder symbol rate"
-#define SAT_SRATE_LONGTEXT NULL
-
-#define IPV6_TEXT "force IPv6"
-#define IPV6_LONGTEXT NULL
-
-#define IPV4_TEXT "force IPv4"
-#define IPV4_LONGTEXT NULL
-
-#define ADEC_MPEG_TEXT "choose MPEG audio decoder"
-#define ADEC_MPEG_LONGTEXT NULL
-
-#define ADEC_AC3_TEXT "choose AC3 audio decoder"
-#define ADEC_AC3_LONGTEXT NULL
-
-#define VDEC_SMP_TEXT "use additional processors"
-#define VDEC_SMP_LONGTEXT NULL
-
-#define VPAR_SYNCHRO_TEXT "force synchro algorithm {I|I+|IP|IP+|IPB}"
-#define VPAR_SYNCHRO_LONGTEXT NULL
-
-#define NOMMX_TEXT "disable CPU's MMX support"
-#define NOMMX_LONGTEXT NULL
-
-#define NO3DN_TEXT "disable CPU's 3D Now! support"
-#define NO3DN_LONGTEXT NULL
-
-#define NOMMXEXT_TEXT "disable CPU's MMX EXT support"
-#define NOMMXEXT_LONGTEXT NULL
-
-#define NOSSE_TEXT "disable CPU's SSE support"
-#define NOSSE_LONGTEXT NULL
-
-#define NOALTIVEC_TEXT "disable CPU's AltiVec support"
-#define NOALTIVEC_LONGTEXT NULL
-
-#define PLAYLIST_LAUNCH_TEXT "launch playlist on startup"
-#define PLAYLIST_LAUNCH_LONGTEXT NULL
-
-#define PLAYLIST_ENQUEUE_TEXT "enqueue playlist as default"
-#define PLAYLIST_ENQUEUE_LONGTEXT NULL
-
-#define PLAYLIST_LOOP_TEXT "loop playlist on end"
-#define PLAYLIST_LOOP_LONGTEXT NULL
-
-#define MEMCPY_TEXT "memory copy method"
-#define MEMCPY_LONGTEXT NULL
-
-#define FAST_PTHREAD_TEXT "fast pthread on NT/2K/XP (developpers only)"
-#define FAST_PTHREAD_LONGTEXT "On Windows NT/2K/XP we use a slow but correct "\
-                              "pthread implementation, you can also use this "\
-                              "faster implementation but you might "\
-                              "experience problems with it"
-
-/* 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 )
-*/
+#define INTF_TEXT N_("interface module")
+#define INTF_LONGTEXT N_( \
+    "This option allows you to select the interface used by vlc.\nNote that " \
+    "the default behavior is to automatically select the best module " \
+    "available.")
+
+#define WARNING_TEXT N_("warning level (or use -v, -vv, etc...)")
+#define WARNING_LONGTEXT N_( \
+    "Increasing the warning level will allow you to see more debug messages " \
+    "and can sometimes help you to troubleshoot a problem.")
+
+#define STATS_TEXT N_("output statistics")
+#define STATS_LONGTEXT N_( \
+    "Enabling the stats mode will flood your log console with various " \
+    "statistics messages.")
+
+#define INTF_PATH_TEXT N_("interface default search path")
+#define INTF_PATH_LONGTEXT N_( \
+    "This option allows you to set the default path that the interface will " \
+    "open when looking for a file.")
+
+#define AOUT_TEXT N_("audio output module")
+#define AOUT_LONGTEXT N_( \
+    "This option allows you to select the audio audio output method used by " \
+    "vlc.\nNote that the default behavior is to automatically select the " \
+    "best method available.")
+
+#define AUDIO_TEXT N_("enable audio")
+#define AUDIO_LONGTEXT N_( \
+    "You can completely disable the audio output. In this case the audio " \
+    "decoding stage won't be done, and it will also save some " \
+    "processing power.")
+
+#define MONO_TEXT N_("force mono audio")
+#define MONO_LONGTEXT N_("This will force a mono audio output")
+
+#define VOLUME_TEXT N_("audio output volume")
+#define VOLUME_LONGTEXT N_( \
+    "You can set the default audio output volume here, in a range from 0 to " \
+    "1024.")
+
+#define FORMAT_TEXT N_("audio output format")
+#define FORMAT_LONGTEXT N_( \
+    "You can force the audio output format here.\n" \
+    "0 -> 16 bits signed native endian (default)\n" \
+    "1 ->  8 bits unsigned\n"                       \
+    "2 -> 16 bits signed little endian\n"           \
+    "3 -> 16 bits signed big endian\n"              \
+    "4 ->  8 bits signed\n"                         \
+    "5 -> 16 bits unsigned little endian\n"         \
+    "6 -> 16 bits unsigned big endian\n"            \
+    "7 -> mpeg2 audio (unsupported)\n"              \
+    "8 -> ac3 pass-through")
+
+#define RATE_TEXT N_("audio output frequency (Hz)")
+#define RATE_LONGTEXT N_( \
+    "You can force the audio output frequency here.\nCommon values are " \
+    "48000, 44100, 32000, 22050, 16000, 11025, 8000.")
+
+#define DESYNC_TEXT N_("compensate desynchronization of audio (in ms)")
+#define DESYNC_LONGTEXT N_( \
+    "This option allows you to delay the audio output. This can be handy if " \
+    "you notice a lag between the video and the audio.")
+
+#define VOUT_TEXT N_("video output module")
+#define VOUT_LONGTEXT N_( \
+    "This option allows you to select the video output method used by vlc.\n" \
+    "Note that the default behavior is to automatically select the best " \
+    "method available.")
+
+#define VIDEO_TEXT N_("enable video")
+#define VIDEO_LONGTEXT N_( \
+    "You can completely disable the video output. In this case the video " \
+    "decoding stage won't be done, and it will also save some " \
+    "processing power.")
+
+#define DISPLAY_TEXT N_("display identifier")
+#define DISPLAY_LONGTEXT N_( \
+    "This is the local display port that will be used for X11 drawing. " \
+    "For instance :0.1.")
+
+#define WIDTH_TEXT N_("video width")
+#define WIDTH_LONGTEXT N_( \
+    "You can enforce the video width here.\nNote that by default vlc will " \
+    "adapt to the video characteristics.")
+
+#define HEIGHT_TEXT N_("video height")
+#define HEIGHT_LONGTEXT N_( \
+    "You can enforce the video height here.\nNote that by default vlc will " \
+    "adapt to the video characteristics.")
+
+#define ZOOM_TEXT N_("zoom video")
+#define ZOOM_LONGTEXT N_( \
+    "You can zoom the video by the specified factor.")
+
+#define GRAYSCALE_TEXT N_("grayscale video output")
+#define GRAYSCALE_LONGTEXT N_( \
+    "When enabled, the color information from the video won't be decoded " \
+    "(this can also allow you to save some processing power).")
+
+#define FULLSCREEN_TEXT N_("fullscreen video output")
+#define FULLSCREEN_LONGTEXT N_( \
+    "If this option is enabled, vlc will always start a video in fullscreen " \
+    "mode.")
+
+#define OVERLAY_TEXT N_("overlay video output")
+#define OVERLAY_LONGTEXT N_( \
+    "If enabled, vlc will try to take advantage of the overlay capabilities " \
+    "of you graphics card.")
+
+#define SPUMARGIN_TEXT N_("force SPU position")
+#define SPUMARGIN_LONGTEXT N_( \
+    "You can use this option to place the sub-titles under the movie, " \
+    "instead of over the movie. Try several positions.")
+
+#define FILTER_TEXT N_("video filter module")
+#define FILTER_LONGTEXT N_( \
+    "This will allow you to add a post-processing filter to enhance the " \
+    "picture quality, for instance deinterlacing, or to clone or distort " \
+    "the video window.")
+
+#define SERVER_PORT_TEXT N_("server port")
+#define SERVER_PORT_LONGTEXT N_( \
+    "This is the port used for UDP streams. By default, we chose 1234.")
+
+#define NETCHANNEL_TEXT N_("enable network channel mode")
+#define NETCHANNEL_LONGTEXT N_( \
+    "Activate this option if you want to use the VideoLAN Channel Server.")
+
+#define CHAN_SERV_TEXT N_("channel server address")
+#define CHAN_SERV_LONGTEXT N_( \
+    "Indicate here the address of the VideoLAN Channel Server.")
+
+#define CHAN_PORT_TEXT N_("channel server port")
+#define CHAN_PORT_LONGTEXT N_( \
+    "Indicate here the port on which the VideoLAN Channel Server runs.")
+
+#define IFACE_TEXT N_("network interface")
+#define IFACE_LONGTEXT N_( \
+    "If you have several interfaces on your Linux machine and use the " \
+    "VLAN solution, you may indicate here which interface to use.")
+
+#define INPUT_PROGRAM_TEXT N_("choose program (SID)")
+#define INPUT_PROGRAM_LONGTEXT N_( \
+    "Choose the program to select by giving its Service ID.")
+
+#define INPUT_AUDIO_TEXT N_("choose audio")
+#define INPUT_AUDIO_LONGTEXT N_( \
+    "Give the default type of audio you want to use in a DVD.")
+
+#define INPUT_CHAN_TEXT N_("choose channel")
+#define INPUT_CHAN_LONGTEXT N_( \
+    "Give the stream number of the audio channel you want to use in a DVD " \
+    "(from 1 to n).")
+
+#define INPUT_SUBT_TEXT N_("choose subtitles")
+#define INPUT_SUBT_LONGTEXT N_( \
+    "Give the stream number of the subtitle channel you want to use in a DVD "\
+    "(from 1 to n).")
+
+#define DVD_DEV_TEXT N_("DVD device")
+#define DVD_DEV_LONGTEXT N_( \
+    "This is the default DVD device to use.")
+
+#define VCD_DEV_TEXT N_("VCD device")
+#define VCD_DEV_LONGTEXT N_( \
+    "This is the default VCD device to use.")
+
+#define IPV6_TEXT N_("force IPv6")
+#define IPV6_LONGTEXT N_( \
+    "If you check this box, IPv6 will be used by default for all UDP and " \
+    "HTTP connections.")
+
+#define IPV4_TEXT N_("force IPv4")
+#define IPV4_LONGTEXT N_( \
+    "If you check this box, IPv4 will be used by default for all UDP and " \
+    "HTTP connections.")
+
+#define ADEC_MPEG_TEXT N_("choose MPEG audio decoder")
+#define ADEC_MPEG_LONGTEXT N_( \
+    "This allows you to select the MPEG audio decoder you want to use. " \
+    "Common choices are builtin and mad.")
+
+#define ADEC_AC3_TEXT N_("choose AC3 audio decoder")
+#define ADEC_AC3_LONGTEXT N_( \
+    "This allows you to select the AC3/A52 audio decoder you want to use. " \
+    "Common choices are builtin and a52.")
+
+#define MMX_TEXT N_("enable CPU MMX support")
+#define MMX_LONGTEXT N_( \
+    "If your processor supports the MMX instructions set, vlc can take " \
+    "advantage of them.")
+
+#define THREE_DN_TEXT N_("enable CPU 3D Now! support")
+#define THREE_DN_LONGTEXT N_( \
+    "If your processor supports the 3D Now! instructions set, vlc can take "\
+    "advantage of them.")
+
+#define MMXEXT_TEXT N_("enable CPU MMX EXT support")
+#define MMXEXT_LONGTEXT N_( \
+    "If your processor supports the MMX EXT instructions set, vlc can take "\
+    "advantage of them.")
+
+#define SSE_TEXT N_("enable CPU SSE support")
+#define SSE_LONGTEXT N_( \
+    "If your processor supports the SSE instructions set, vlc can take " \
+    "can take advantage of them.")
+
+#define ALTIVEC_TEXT N_("enable CPU AltiVec support")
+#define ALTIVEC_LONGTEXT N_( \
+    "If your processor supports the AltiVec instructions set, vlc can take "\
+    "advantage of them.")
+
+#define PL_LAUNCH_TEXT N_("launch playlist on startup")
+#define PL_LAUNCH_LONGTEXT N_( \
+    "If you want vlc to start playing on startup, then enable this option.")
+
+#define PL_ENQUEUE_TEXT N_("enqueue items in playlist")
+#define PL_ENQUEUE_LONGTEXT N_( \
+    "If you want vlc to add items to the playlist as you open them, then " \
+    "enable this option.")
+
+#define PL_LOOP_TEXT N_("loop playlist on end")
+#define PL_LOOP_LONGTEXT N_( \
+    "If you want vlc to keep playing the playlist indefinitely then enable " \
+    "this option.")
+
+#define MEMCPY_TEXT N_("memory copy module")
+#define MEMCPY_LONGTEXT N_( \
+    "You can select wich memory copy module you want to use. By default vlc " \
+    "will select the fastest one supported by your hardware.")
+
+#define ACCESS_TEXT N_("access module")
+#define ACCESS_LONGTEXT N_( \
+    "This is a legacy entry to let you configure access modules")
+
+#define DEMUX_TEXT N_("demux module")
+#define DEMUX_LONGTEXT N_( \
+    "This is a legacy entry to let you configure demux modules")
+
+#define FAST_PTHREAD_TEXT N_("fast pthread on NT/2K/XP (developpers only)")
+#define FAST_PTHREAD_LONGTEXT N_( \
+    "On Windows NT/2K/XP we use a slow but correct pthread implementation, " \
+    "you can also use this faster implementation but you might experience " \
+    "problems with it.")
+
+/*
+ * Quick usage guide for the configuration options:
+ *
+ * MODULE_CONFIG_START
+ * MODULE_CONFIG_STOP
+ * ADD_CATEGORY_HINT( N_(text), longtext )
+ * ADD_SUBCATEGORY_HINT( N_(text), longtext )
+ * ADD_STRING( option_name, value, p_callback, N_(text), N_(longtext) )
+ * ADD_FILE( option_name, psz_value, p_callback, N_(text), N_(longtext) )
+ * ADD_MODULE( option_name, psz_value, i_capability, p_callback,
+ *             N_(text), N_(longtext) )
+ * ADD_INTEGER( option_name, i_value, p_callback, N_(text), N_(longtext) )
+ * ADD_BOOL( option_name, b_value, p_callback, N_(text), N_(longtext) )
+ */
 
 MODULE_CONFIG_START
 
 /* Interface options */
-ADD_CATEGORY_HINT( "Interface", NULL)
-ADD_PLUGIN  ( "intf", MODULE_CAPABILITY_INTF, NULL, NULL, INTF_TEXT, INTF_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Interface"), NULL)
+ADD_MODULE_WITH_SHORT  ( "intf", 'I', MODULE_CAPABILITY_INTF, NULL, NULL, INTF_TEXT, INTF_LONGTEXT )
 ADD_INTEGER ( "warning", 0, NULL, WARNING_TEXT, WARNING_LONGTEXT )
-ADD_BOOL    ( "stats", NULL, STATS_TEXT, STATS_LONGTEXT )
-ADD_STRING  ( "search_path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT )
+ADD_BOOL    ( "stats", 0, NULL, STATS_TEXT, STATS_LONGTEXT )
+ADD_STRING  ( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT )
 
 /* Audio options */
-ADD_CATEGORY_HINT( "Audio", NULL)
-ADD_PLUGIN  ( "aout", MODULE_CAPABILITY_AOUT, NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT )
-ADD_BOOL    ( "noaudio", NULL, NOAUDIO_TEXT, NOAUDIO_LONGTEXT )
-ADD_BOOL    ( "mono", NULL, MONO_TEXT, MONO_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Audio"), NULL)
+ADD_MODULE_WITH_SHORT  ( "aout", 'A', MODULE_CAPABILITY_AOUT, NULL, NULL, AOUT_TEXT, AOUT_LONGTEXT )
+ADD_BOOL    ( "audio", 1, NULL, AUDIO_TEXT, AUDIO_LONGTEXT )
+ADD_BOOL    ( "mono", 0, NULL, MONO_TEXT, MONO_LONGTEXT )
 ADD_INTEGER ( "volume", VOLUME_DEFAULT, NULL, VOLUME_TEXT, VOLUME_LONGTEXT )
 ADD_INTEGER ( "rate", 44100, NULL, RATE_TEXT, RATE_LONGTEXT )
 ADD_INTEGER ( "desync", 0, NULL, DESYNC_TEXT, DESYNC_LONGTEXT )
-ADD_INTEGER ( "aout_format", 0, NULL, FORMAT_TEXT,
-              FORMAT_LONGTEXT )
+ADD_INTEGER ( "audio-format", 0, NULL, FORMAT_TEXT, FORMAT_LONGTEXT )
 
 /* Video options */
-ADD_CATEGORY_HINT( "Video", NULL )
-ADD_PLUGIN  ( "vout", MODULE_CAPABILITY_VOUT, NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT )
-ADD_BOOL    ( "novideo", NULL, NOVIDEO_TEXT, NOVIDEO_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Video"), NULL )
+ADD_MODULE_WITH_SHORT  ( "vout", 'V', MODULE_CAPABILITY_VOUT, NULL, NULL, VOUT_TEXT, VOUT_LONGTEXT )
+ADD_BOOL    ( "video", 1, NULL, VIDEO_TEXT, VIDEO_LONGTEXT )
 ADD_INTEGER ( "width", -1, NULL, WIDTH_TEXT, WIDTH_LONGTEXT )
 ADD_INTEGER ( "height", -1, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT )
-ADD_BOOL    ( "grayscale", NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT )
-ADD_BOOL    ( "fullscreen", NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT )
-ADD_BOOL    ( "nooverlay", NULL, NOOVERLAY_TEXT, NOOVERLAY_LONGTEXT )
+ADD_FLOAT   ( "zoom", 1, NULL, ZOOM_TEXT, ZOOM_LONGTEXT )
+ADD_BOOL    ( "grayscale", 0, NULL, GRAYSCALE_TEXT, GRAYSCALE_LONGTEXT )
+ADD_BOOL    ( "fullscreen", 0, NULL, FULLSCREEN_TEXT, FULLSCREEN_LONGTEXT )
+ADD_BOOL    ( "overlay", 1, NULL, OVERLAY_TEXT, OVERLAY_LONGTEXT )
 ADD_INTEGER ( "spumargin", -1, NULL, SPUMARGIN_TEXT, SPUMARGIN_LONGTEXT )
-ADD_PLUGIN  ( "filter", MODULE_CAPABILITY_VOUT, NULL, NULL, FILTER_TEXT, FILTER_LONGTEXT )
+ADD_MODULE  ( "filter", MODULE_CAPABILITY_VOUT, NULL, NULL, FILTER_TEXT, FILTER_LONGTEXT )
 
 /* Input options */
-ADD_CATEGORY_HINT( "Input", NULL )
-ADD_INTEGER ( "server_port", 1234, NULL, SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT )
-ADD_BOOL    ( "network_channel", NULL, NETCHANNEL_TEXT, NETCHANNEL_LONGTEXT )
-ADD_STRING  ( "channel_server", "localhost", NULL, CHAN_SERV_TEXT, CHAN_SERV_LONGTEXT )
-ADD_INTEGER ( "channel_port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Input"), NULL )
+ADD_INTEGER ( "server-port", 1234, NULL, SERVER_PORT_TEXT, SERVER_PORT_LONGTEXT )
+ADD_BOOL    ( "network-channel", 0, NULL, NETCHANNEL_TEXT, NETCHANNEL_LONGTEXT )
+ADD_STRING  ( "channel-server", "localhost", NULL, CHAN_SERV_TEXT, CHAN_SERV_LONGTEXT )
+ADD_INTEGER ( "channel-port", 6010, NULL, CHAN_PORT_TEXT, CHAN_PORT_LONGTEXT )
 ADD_STRING  ( "iface", "eth0", NULL, IFACE_TEXT, IFACE_LONGTEXT )
 
-ADD_INTEGER ( "input_program", 0, NULL, INPUT_PROGRAM_TEXT,
-        INPUT_PROGRAM_LONGTEXT )
-ADD_INTEGER ( "input_audio", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT )
-ADD_INTEGER ( "input_channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
-ADD_INTEGER ( "input_subtitle", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT )
-
-ADD_STRING  ( "dvd_device", "/dev/dvd", NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT )
-ADD_STRING  ( "vcd_device", "/dev/cdrom", NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT )
-#ifdef HAVE_SATELLITE
-ADD_INTEGER ( "sat_frequency", 12553, NULL, SAT_FREQ_TEXT, SAT_FREQ_LONGTEXT )
-ADD_INTEGER ( "sat_polarization", 0, NULL, SAT_POL_TEXT, SAT_POL_LONGTEXT )
-ADD_INTEGER ( "sat_symbol_rate", 27500, NULL, SAT_SRATE_TEXT,
-            SAT_SRATE_LONGTEXT )
-#endif
+ADD_INTEGER ( "program", 0, NULL, INPUT_PROGRAM_TEXT, INPUT_PROGRAM_LONGTEXT )
+ADD_INTEGER ( "audio-type", -1, NULL, INPUT_AUDIO_TEXT, INPUT_AUDIO_LONGTEXT )
+ADD_INTEGER ( "audio-channel", -1, NULL, INPUT_CHAN_TEXT, INPUT_CHAN_LONGTEXT )
+ADD_INTEGER ( "spu-channel", -1, NULL, INPUT_SUBT_TEXT, INPUT_SUBT_LONGTEXT )
+
+ADD_STRING  ( "dvd", DVD_DEVICE, NULL, DVD_DEV_TEXT, DVD_DEV_LONGTEXT )
+ADD_STRING  ( "vcd", VCD_DEVICE, NULL, VCD_DEV_TEXT, VCD_DEV_LONGTEXT )
 
-ADD_BOOL    ( "ipv6", NULL, IPV6_TEXT, IPV6_LONGTEXT )
-ADD_BOOL    ( "ipv4", NULL, IPV4_TEXT, IPV4_LONGTEXT )
+ADD_BOOL_WITH_SHORT ( "ipv6", '6', 0, NULL, IPV6_TEXT, IPV6_LONGTEXT )
+ADD_BOOL_WITH_SHORT ( "ipv4", '4', 0, NULL, IPV4_TEXT, IPV4_LONGTEXT )
 
 /* Decoder options */
-ADD_CATEGORY_HINT( "Decoders", NULL )
-ADD_PLUGIN  ( "mpeg_adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_MPEG_TEXT, ADEC_MPEG_LONGTEXT )
-ADD_PLUGIN  ( "ac3_adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_AC3_TEXT, ADEC_AC3_LONGTEXT )
-ADD_INTEGER ( "vdec_smp", 0, NULL, VDEC_SMP_TEXT, VDEC_SMP_LONGTEXT )
-ADD_STRING  ( "vpar_synchro", NULL, NULL, VPAR_SYNCHRO_TEXT, VPAR_SYNCHRO_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Decoders"), NULL )
+ADD_MODULE  ( "mpeg-adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_MPEG_TEXT, ADEC_MPEG_LONGTEXT )
+ADD_MODULE  ( "ac3-adec", MODULE_CAPABILITY_DECODER, NULL, NULL, ADEC_AC3_TEXT, ADEC_AC3_LONGTEXT )
 
 /* CPU options */
-ADD_CATEGORY_HINT( "CPU", NULL )
-ADD_BOOL    ( "nommx", NULL, NOMMX_TEXT, NOMMX_LONGTEXT )
-ADD_BOOL    ( "no3dn", NULL, NO3DN_TEXT, NO3DN_LONGTEXT )
-ADD_BOOL    ( "nommxext", NULL, NOMMXEXT_TEXT, NOMMXEXT_LONGTEXT )
-ADD_BOOL    ( "nosse", NULL, NOSSE_TEXT, NOSSE_LONGTEXT )
-ADD_BOOL    ( "noaltivec", NULL, NOALTIVEC_TEXT, NOALTIVEC_LONGTEXT )
+ADD_CATEGORY_HINT( N_("CPU"), NULL )
+ADD_BOOL ( "mmx", 1, NULL, MMX_TEXT, MMX_LONGTEXT )
+ADD_BOOL ( "3dn", 1, NULL, THREE_DN_TEXT, THREE_DN_LONGTEXT )
+ADD_BOOL ( "mmxext", 1, NULL, MMXEXT_TEXT, MMXEXT_LONGTEXT )
+ADD_BOOL ( "sse", 1, NULL, SSE_TEXT, SSE_LONGTEXT )
+ADD_BOOL ( "altivec", 1, NULL, ALTIVEC_TEXT, ALTIVEC_LONGTEXT )
 
 /* Playlist options */
-ADD_CATEGORY_HINT( "Playlist", NULL )
-ADD_BOOL    ( "playlist_launch", NULL, PLAYLIST_LAUNCH_TEXT, PLAYLIST_LAUNCH_LONGTEXT )
-ADD_BOOL    ( "playlist_enqueue", NULL, PLAYLIST_ENQUEUE_TEXT, PLAYLIST_ENQUEUE_LONGTEXT )
-ADD_BOOL    ( "playlist_loop", NULL, PLAYLIST_LOOP_TEXT, PLAYLIST_LOOP_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Playlist"), NULL )
+ADD_BOOL ( "launch-playlist", 0, NULL, PL_LAUNCH_TEXT, PL_LAUNCH_LONGTEXT )
+ADD_BOOL ( "enqueue-playlist", 0, NULL, PL_ENQUEUE_TEXT, PL_ENQUEUE_LONGTEXT )
+ADD_BOOL ( "loop-playlist", 0, NULL, PL_LOOP_TEXT, PL_LOOP_LONGTEXT )
 
 /* Misc options */
-ADD_CATEGORY_HINT( "Miscellaneous", NULL )
-ADD_PLUGIN  ( "memcpy", MODULE_CAPABILITY_MEMCPY, NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT )
+ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
+ADD_MODULE  ( "memcpy", MODULE_CAPABILITY_MEMCPY, NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT )
+ADD_MODULE  ( "access", MODULE_CAPABILITY_ACCESS, NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT )
+ADD_MODULE  ( "demux", MODULE_CAPABILITY_DEMUX, NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT )
 
 #if defined(WIN32)
-ADD_BOOL    ( "fast_pthread", NULL, FAST_PTHREAD_TEXT, FAST_PTHREAD_LONGTEXT )
+ADD_BOOL ( "fast_pthread", 0, NULL, FAST_PTHREAD_TEXT, FAST_PTHREAD_LONGTEXT )
 #endif
 
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
-    SET_DESCRIPTION( "Main program" )
+    SET_DESCRIPTION( N_("main program") )
     ADD_CAPABILITY( MAIN, 100/*whatever*/ )
 MODULE_INIT_STOP
 
@@ -403,18 +448,26 @@ MODULE_DEACTIVATE_STOP
 
 /* Hack for help options */
 static module_t help_module;
-static module_config_t p_help_config[] = {
-    { MODULE_CONFIG_ITEM_BOOL, "help", "print help (or use -h)",
-      NULL, NULL, 0, NULL, NULL, 0 },
-    { MODULE_CONFIG_ITEM_BOOL, "longhelp", "print detailed help (or use -H)",
-      NULL, NULL, 0, NULL, NULL, 0 },
-    { MODULE_CONFIG_ITEM_BOOL, "list", "print a list of available plugins "
-      "(or use -l)", NULL, NULL, 0, NULL, NULL, 0 },
-    { MODULE_CONFIG_ITEM_STRING, "plugin", "print help on plugin (or use -p)",
-      NULL, NULL, 0, NULL, &help_module.config_lock, 0 },
-    { MODULE_CONFIG_ITEM_BOOL, "version", "print version information",
-      NULL, NULL, 0, NULL, NULL, 0 },
-    { MODULE_CONFIG_HINT_END, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0 } };
+static module_config_t p_help_config[] =
+{
+    { MODULE_CONFIG_ITEM_BOOL, "help", 'h', N_("print help"),
+      NULL, NULL, 0, 0, NULL, NULL, 0 },
+    { MODULE_CONFIG_ITEM_BOOL, "longhelp", 'H', N_("print detailed help"),
+      NULL, NULL, 0, 0, NULL, NULL, 0 },
+    { MODULE_CONFIG_ITEM_BOOL, "list", 'l', N_("print a list of available "
+      "modules"), NULL, NULL, 0, 0, NULL, NULL, 0 },
+    { MODULE_CONFIG_ITEM_STRING, "module", 'p', N_("print help on module"),
+      NULL, NULL, 0, 0, NULL, &help_module.config_lock, 0 },
+    { MODULE_CONFIG_ITEM_BOOL, "version", '\0',
+      N_("print version information"), NULL, NULL, 0, 0, NULL, NULL, 0 },
+    { MODULE_CONFIG_HINT_END, NULL, '\0', NULL, NULL, NULL, 0, 0,
+      NULL, NULL, 0 }
+};
+static module_t help_module = { "help", "help module", NULL, {NULL}, 0, {0}, 0,
+                                NULL, p_help_config, {0},
+                                sizeof(p_help_config)/sizeof(module_config_t),
+                                sizeof(p_help_config)/sizeof(module_config_t)
+};
 
 
 /*****************************************************************************
@@ -425,7 +478,6 @@ static module_config_t p_help_config[] = {
  * Global variables - these are the only ones, see main.h and modules.h
  *****************************************************************************/
 main_t        *p_main;
-p_main_sys_t  p_main_sys;
 module_bank_t *p_module_bank;
 input_bank_t  *p_input_bank;
 aout_bank_t   *p_aout_bank;
@@ -470,7 +522,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 *psz_plugin;
+    char *psz_module;
     char *p_tmp;
 
     p_main        = &main_data;               /* set up the global variables */
@@ -481,16 +533,18 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 
     p_main->i_warning_level = 0;
 
-#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
     /*
-     * Support for getext
+     * Support for gettext
      */
-#if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES )
+#if defined( ENABLE_NLS ) && defined ( HAVE_GETTEXT )
+#   if defined( HAVE_LOCALE_H ) && defined( HAVE_LC_MESSAGES )
     if( !setlocale( LC_MESSAGES, "" ) )
     {
-        fprintf( stderr, "warning: unsupported locale.\n" );
+        fprintf( stderr, "warning: unsupported locale settings\n" );
     }
-#endif
+
+    setlocale( LC_CTYPE, "" );
+#   endif
 
     if( !bindtextdomain( PACKAGE, LOCALEDIR ) )
     {
@@ -534,11 +588,18 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 
 
     /* Get the executable name (similar to the basename command) */
-    p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
-    while( *p_tmp )
+    if( i_argc > 0 )
     {
-        if( *p_tmp == '/' ) p_main->psz_arg0 = ++p_tmp;
-        else ++p_tmp;
+        p_main->psz_arg0 = p_tmp = ppsz_argv[ 0 ];
+        while( *p_tmp )
+        {
+            if( *p_tmp == '/' ) p_main->psz_arg0 = ++p_tmp;
+            else ++p_tmp;
+        }
+    }
+    else
+    {
+        p_main->psz_arg0 = "vlc";
     }
 
     /*
@@ -550,12 +611,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     module_LoadMain();
 
     /* Hack: insert the help module here */
-    help_module.psz_name = "help";
-    help_module.i_config_lines = sizeof(p_help_config) /
-                                     sizeof(module_config_t);
-    help_module.i_config_items = help_module.i_config_lines - 1;
     vlc_mutex_init( &help_module.config_lock );
-    help_module.p_config = p_help_config;
     help_module.next = p_module_bank->first;
     p_module_bank->first = &help_module;
     /* end hack */
@@ -569,8 +625,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /* Check for short help option */
     if( config_GetIntVariable( "help" ) )
     {
-        intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
-                  p_main->psz_arg0 );
+        intf_Msg( _("Usage: %s [options] [parameters] [file]...\n"),
+                    p_main->psz_arg0 );
 
         Usage( "help" );
         Usage( "main" );
@@ -591,7 +647,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * Load the builtins and plugins into the module_bank.
      * We have to do it before config_Load*() because this also gets the
-     * list of configuration options exported by each plugin and loads their
+     * list of configuration options exported by each module and loads their
      * default values.
      */
     module_LoadBuiltins();
@@ -604,8 +660,8 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     p_module_bank->first = &help_module;
     /* end hack */
 
-    /* Check for help on plugins */
-    if( (p_tmp = config_GetPszVariable( "plugin" )) )
+    /* Check for help on modules */
+    if( (p_tmp = config_GetPszVariable( "module" )) )
     {
         Usage( p_tmp );
         free( p_tmp );
@@ -619,7 +675,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         return( -1 );
     }
 
-    /* Check for plugin list option */
+    /* Check for module list option */
     if( config_GetIntVariable( "list" ) )
     {
         ListModules();
@@ -658,32 +714,30 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * System specific configuration
      */
-#if defined( WIN32 )
     system_Configure();
-#endif
 
     /* p_main inititalization. FIXME ? */
-    p_main->i_desync = (mtime_t)config_GetIntVariable( "desync" )
-      * (mtime_t)1000;
+    p_main->i_warning_level = config_GetIntVariable( "warning" );
+    p_main->i_desync = config_GetIntVariable( "desync" ) * (mtime_t)1000;
     p_main->b_stats = config_GetIntVariable( "stats" );
-    p_main->b_audio = !config_GetIntVariable( "noaudio" );
+    p_main->b_audio = config_GetIntVariable( "audio" );
     p_main->b_stereo= !config_GetIntVariable( "mono" );
-    p_main->b_video = !config_GetIntVariable( "novideo" );
-    if( config_GetIntVariable( "nommx" ) )
+    p_main->b_video = config_GetIntVariable( "video" );
+    if( !config_GetIntVariable( "mmx" ) )
         p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMX;
-    if( config_GetIntVariable( "no3dn" ) )
+    if( !config_GetIntVariable( "3dn" ) )
         p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_3DNOW;
-    if( config_GetIntVariable( "nommxext" ) )
+    if( !config_GetIntVariable( "mmxext" ) )
         p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_MMXEXT;
-    if( config_GetIntVariable( "nosse" ) )
+    if( !config_GetIntVariable( "sse" ) )
         p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_SSE;
-    if( config_GetIntVariable( "noaltivec" ) )
+    if( !config_GetIntVariable( "altivec" ) )
         p_main->i_cpu_capabilities &= ~CPU_CAPABILITY_ALTIVEC;
 
 
     if( p_main->b_stats )
     {
-        char          p_capabilities[200];
+        char p_capabilities[200];
         p_capabilities[0] = '\0';
 
 #define PRINT_CAPABILITY( capability, string )                              \
@@ -733,10 +787,10 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * Choose the best memcpy module
      */
-    psz_plugin = config_GetPszVariable( "memcpy" );
+    psz_module = config_GetPszVariable( "memcpy" );
     p_main->p_memcpy_module = module_Need( MODULE_CAPABILITY_MEMCPY,
-                                           psz_plugin, NULL );
-    if( psz_plugin ) free( psz_plugin );
+                                           psz_module, NULL );
+    if( psz_module ) free( psz_module );
     if( p_main->p_memcpy_module == NULL )
     {
         intf_ErrMsg( "intf error: no suitable memcpy module, "
@@ -752,13 +806,13 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * Initialize shared resources and libraries
      */
-    if( config_GetIntVariable( "network_channel" ) &&
+    if( config_GetIntVariable( "network-channel" ) &&
         network_ChannelCreate() )
     {
         /* On error during Channels initialization, switch off channels */
         intf_ErrMsg( "intf error: channels initialization failed, "
                                  "deactivating channels" );
-        config_PutIntVariable( "network_channel", 0 );
+        config_PutIntVariable( "network-channel", 0 );
     }
 
     /*
@@ -789,7 +843,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
         /*
          * Go back into channel 0 which is the network
          */
-        if( config_GetIntVariable( "network_channel" ) && p_main->p_channel )
+        if( config_GetIntVariable( "network-channel" ) && p_main->p_channel )
         {
             network_ChannelJoin( COMMON_CHANNEL );
         }
@@ -808,13 +862,15 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     intf_PlaylistDestroy( p_main->p_playlist );
 
     /*
-     * Free memcpy module if it was allocated
+     * Free allocated memory
      */
     if( p_main->p_memcpy_module != NULL )
     {
         module_Unneed( p_main->p_memcpy_module );
     }
 
+    free( p_main->psz_homedir );
+
     /*
      * Free module bank
      */
@@ -823,10 +879,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     /*
      * System specific cleaning code
      */
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN ) || defined( WIN32 )
     system_End();
-#endif
-
 
     /*
      * Terminate messages interface and program
@@ -871,105 +924,150 @@ static int GetFilenames( int i_argc, char *ppsz_argv[] )
  *****************************************************************************/
 static void Usage( const char *psz_module_name )
 {
-    int i;
+#define FORMAT_STRING "      --%s%s%s%s%s%s %s%s"
+    /* option name prefix ------' | | | | |  | |
+     * option name ---------------' | | | |  | |
+     * <bra ------------------------' | | |  | |
+     * option type or "" -------------' | |  | |
+     * ket> ----------------------------' |  | |
+     * padding spaces --------------------'  | |
+     * comment ------------------------------' |
+     * comment suffix -------------------------'
+     *
+     * The purpose of having bra and ket is that we might i18n them as well.
+     */
+#define LINE_START 8
+#define PADDING_SPACES 25
     module_t *p_module;
-    char psz_spaces[30];
+    module_config_t *p_item;
+    char psz_spaces[PADDING_SPACES+LINE_START+1];
+    char psz_format[sizeof(FORMAT_STRING)];
+
+    memset( psz_spaces, ' ', PADDING_SPACES+LINE_START );
+    psz_spaces[PADDING_SPACES+LINE_START] = '\0';
 
-    memset( psz_spaces, 32, 30 );
+    strcpy( psz_format, FORMAT_STRING );
 
 #ifdef WIN32
     ShowConsole();
 #endif
 
-    /* Enumerate the config of each module */
+    /* Enumerate the config for each module */
     for( p_module = p_module_bank->first ;
          p_module != NULL ;
          p_module = p_module->next )
     {
+        boolean_t b_help_module = !strcmp( "help", p_module->psz_name );
 
         if( psz_module_name && strcmp( psz_module_name, p_module->psz_name ) )
             continue;
 
-        /* ignore plugins without config options */
+        /* ignore modules without config options */
         if( !p_module->i_config_items ) continue;
 
         /* print module name */
-        intf_Msg( "%s options:\n", p_module->psz_name );
+        intf_Msg( _("%s module options:\n"), p_module->psz_name );
 
-        for( i = 0; i < p_module->i_config_lines; i++ )
+        for( p_item = p_module->p_config;
+             p_item->i_type != MODULE_CONFIG_HINT_END;
+             p_item++ )
         {
-            int j;
+            char *psz_bra = NULL, *psz_type = NULL, *psz_ket = NULL;
+            char *psz_suf = "";
+            int i;
 
-            switch( p_module->p_config[i].i_type )
+            switch( p_item->i_type )
             {
             case MODULE_CONFIG_HINT_CATEGORY:
-                intf_Msg( " %s", p_module->p_config[i].psz_text );
+                intf_Msg( " %s", p_item->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;
+            case MODULE_CONFIG_ITEM_MODULE: /* We could also have "=<" here */
+                psz_bra = " <"; psz_type = _("string"); psz_ket = ">";
                 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;
+                psz_bra = " <"; psz_type = _("integer"); psz_ket = ">";
+                break;
+            case MODULE_CONFIG_ITEM_FLOAT:
+                psz_bra = " <"; psz_type = _("float"); psz_ket = ">";
                 break;
             case MODULE_CONFIG_ITEM_BOOL:
-                /* 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;
+                psz_bra = ""; psz_type = ""; psz_ket = "";
+                if( !b_help_module )
+                    psz_suf = p_item->i_value ? _(" (default: enabled)") :
+                                                _(" (default: disabled)");
                 break;
             }
+
+            /* Add short option */
+            if( p_item->i_short )
+            {
+                psz_format[2] = '-';
+                psz_format[3] = p_item->i_short;
+                psz_format[4] = ',';
+            }
+            else
+            {
+                psz_format[2] = ' ';
+                psz_format[3] = ' ';
+                psz_format[4] = ' ';
+            }
+
+            if( psz_type )
+            {
+                i = PADDING_SPACES - strlen( p_item->psz_name )
+                     - strlen( psz_bra ) - strlen( psz_type )
+                     - strlen( psz_ket ) - 1;
+                if( p_item->i_type == MODULE_CONFIG_ITEM_BOOL &&
+                    !b_help_module ) i -= 5;
+
+                if( i < 0 )
+                {
+                    i = 0;
+                    psz_spaces[i] = '\n';
+                }
+                else
+                {
+                    psz_spaces[i] = '\0';
+                }
+
+                intf_Msg( psz_format,
+                          ( p_item->i_type == MODULE_CONFIG_ITEM_BOOL &&
+                            !b_help_module ) ? "(no-)" : "",
+                          p_item->psz_name, psz_bra, psz_type, psz_ket,
+                          psz_spaces, p_item->psz_text, psz_suf );
+                psz_spaces[i] = ' ';
+            }
         }
 
         /* 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"
+        {
+            intf_Msg( _("\nPlaylist items:"
+                "\n  *.mpg, *.vob                   plain MPEG-1/2 files"
                 "\n  [dvd:][device][@raw_device][@[title][,[chapter][,angle]]]"
-                "\n                                 \tDVD device"
+                "\n                                 DVD device"
                 "\n  [vcd:][device][@[title][,[chapter]]"
-                "\n                                 \tVCD device"
+                "\n                                 VCD device"
                 "\n  udpstream:[@[<bind address>][:<bind port>]]"
-                "\n                                 \tUDP stream sent by VLS"
-                "\n  vlc:loop                       \tLoop execution of the "
+                "\n                                 UDP stream sent by VLS"
+                "\n  vlc:loop                       loop execution of the "
                       "playlist"
-                "\n  vlc:pause                      \tPause execution of "
+                "\n  vlc:pause                      pause execution of "
                       "playlist items"
-                "\n  vlc:quit                       \tQuit VLC" );
+                "\n  vlc:quit                       quit VLC") );
+        }
 
         intf_Msg( "" );
 
     }
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-        intf_Msg( "\nPress the RETURN key to continue..." );
+        intf_Msg( _("\nPress the RETURN key to continue...") );
         getchar();
 #endif
 }
@@ -983,19 +1081,19 @@ static void Usage( const char *psz_module_name )
 static void ListModules( void )
 {
     module_t *p_module;
-    char psz_spaces[20];
+    char psz_spaces[22];
 
-    memset( psz_spaces, 32, 20 );
+    memset( psz_spaces, ' ', 22 );
 
 #ifdef WIN32
     ShowConsole();
 #endif
 
     /* Usage */
-    intf_Msg( "Usage: %s [options] [parameters] [file]...\n",
+    intf_Msg( _("Usage: %s [options] [parameters] [file]...\n"),
               p_main->psz_arg0 );
 
-    intf_Msg( "[plugin]              [description]" );
+    intf_Msg( _("[module]              [description]") );
 
     /* Enumerate each module */
     for( p_module = p_module_bank->first ;
@@ -1006,19 +1104,19 @@ static void ListModules( void )
 
         /* Nasty hack, but right now I'm too tired to think about a nice
          * solution */
-        i = 20 - strlen( p_module->psz_name ) - 1;
+        i = 22 - 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;
+        psz_spaces[i] = ' ';
 
     }
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-        intf_Msg( "\nPress the RETURN key to continue..." );
+        intf_Msg( _("\nPress the RETURN key to continue...") );
         getchar();
 #endif
 }
@@ -1034,14 +1132,15 @@ static void Version( void )
     ShowConsole();
 #endif
 
-    intf_Msg( VERSION_MESSAGE
-        "This program comes with NO WARRANTY, to the extent permitted by "
+    intf_Msg( VERSION_MESSAGE );
+    intf_Msg(
+      _("This program comes with NO WARRANTY, to the extent permitted by "
         "law.\nYou may redistribute it under the terms of the GNU General "
         "Public License;\nsee the file named COPYING for details.\n"
-        "Written by the VideoLAN team at Ecole Centrale, Paris." );
+        "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..." );
+        intf_Msg( _("\nPress the RETURN key to continue...") );
         getchar();
 #endif
 }
@@ -1086,21 +1185,40 @@ static void SimpleSignalHandler( int i_signal )
  *****************************************************************************/
 static void FatalSignalHandler( int i_signal )
 {
+    static mtime_t abort_time = 0;
+    static volatile boolean_t b_die = 0;
+
     /* Once a signal has been trapped, the termination sequence will be
      * armed and following signals will be ignored to avoid sending messages
      * to an interface having been destroyed */
+    if( !b_die )
+    {
+        b_die = 1;
+        abort_time = mdate();
+
+        /* Acknowledge the signal received */
+        intf_ErrMsg( "intf error: signal %d received, exiting - do it again "
+                     "if vlc gets stuck", i_signal );
+
+        /* Try to terminate everything - this is done by requesting the end
+         * of the interface thread */
+        p_main->p_intf->b_die = 1;
+
+        return;
+    }
+
+    /* If user asks again 1 second later, die badly */
+    if( mdate() > abort_time + 1000000 )
+    {
 #ifndef WIN32
-    signal( SIGINT,  SIG_IGN );
-    signal( SIGHUP,  SIG_IGN );
-    signal( SIGQUIT, SIG_IGN );
+        signal( SIGINT,  SIG_IGN );
+        signal( SIGHUP,  SIG_IGN );
+        signal( SIGQUIT, SIG_IGN );
 #endif
 
-    /* Acknowledge the signal received */
-    intf_ErrMsg( "intf error: signal %d received, exiting", i_signal );
-
-    /* Try to terminate everything - this is done by requesting the end of the
-     * interface thread */
-    p_main->p_intf->b_die = 1;
+        intf_ErrMsg( "intf error: user insisted too much, dying badly" );
+        exit( 1 );
+    }
 }
 
 /*****************************************************************************
@@ -1118,12 +1236,14 @@ static void IllegalSignalHandler( int i_signal )
     sigrelse( i_signal );
 #endif
 
+#if defined( __i386__ )
     fprintf( stderr, "warning: your CPU has %s instructions, but not your "
                      "operating system.\n", psz_capability );
     fprintf( stderr, "         some optimizations will be disabled unless "
                      "you upgrade your OS\n" );
-#ifdef SYS_LINUX
-    fprintf( stderr, "         (for instance Linux kernel 2.4.x or later)" );
+#   if defined( SYS_LINUX )
+    fprintf( stderr, "         (for instance Linux kernel 2.4.x or later)\n" );
+#   endif
 #endif
 
     longjmp( env, 1 );
@@ -1256,7 +1376,7 @@ static u32 CPUCapabilities( void )
         i_capabilities |= CPU_CAPABILITY_MMXEXT;
 
 #   ifdef CAN_COMPILE_SSE
-        /* We test if OS support the SSE instructions */
+        /* We test if OS supports the SSE instructions */
         psz_capability = "SSE";
         i_illegal = 0;
         if( setjmp( env ) == 0 )
@@ -1356,7 +1476,7 @@ static u32 CPUCapabilities( void )
 /*****************************************************************************
  * ShowConsole: On Win32, create an output console for debug messages
  *****************************************************************************
- * This function is usefull only on Win32.
+ * This function is useful only on Win32.
  *****************************************************************************/
 #ifdef WIN32 /*  */
 static void ShowConsole( void )