]> git.sesse.net Git - vlc/blobdiff - src/libvlc-common.c
MacOSX/Framework/VLCMediaPlayer.m: -isSeekable.
[vlc] / src / libvlc-common.c
index 2d2abcbf5dea12157a12a3d5ad8e20058536119c..5b5675207d466444e9949dca46c01d5dfefca902 100644 (file)
@@ -37,7 +37,7 @@
 #include <vlc_input.h>
 
 #include "modules/modules.h"
-#include "modules/configuration.h"
+#include "config/config.h"
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
@@ -247,7 +247,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     char *       psz_control = NULL;
     vlc_bool_t   b_exit = VLC_FALSE;
     int          i_ret = VLC_EEXIT;
-    module_t    *p_help_module = NULL;
     playlist_t  *p_playlist = NULL;
     vlc_value_t  val;
 #if defined( ENABLE_NLS ) \
@@ -289,24 +288,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      * options) */
     module_InitBank( p_libvlc );
 
-    /* Hack: insert the help module here */
-    p_help_module = vlc_module_create( VLC_OBJECT(p_libvlc) );
-    if( p_help_module == NULL )
-    {
-        module_EndBank( p_libvlc );
-        return VLC_EGENERIC;
-    }
-    p_help_module->psz_object_name = "help";
-    p_help_module->psz_longname = N_("Help options");
-    config_Duplicate( p_help_module, libvlc_config, libvlc_config_count );
-    vlc_object_attach( p_help_module, libvlc_global.p_module_bank );
-    /* End hack */
-
     if( config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE ) )
     {
-        vlc_object_detach( p_help_module );
-        config_Free( p_help_module );
-        vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return VLC_EGENERIC;
     }
@@ -339,10 +322,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
         libvlc_global.p_module_bank->b_cache_delete = VLC_TRUE;
     }
 
-    /* Hack: remove the help module here */
-    vlc_object_detach( p_help_module );
-    /* End hack */
-
     /* Will be re-done properly later on */
     p_libvlc->i_verbose = config_GetInt( p_libvlc, "verbose" );
 
@@ -413,8 +392,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 
     if( b_exit )
     {
-        config_Free( p_help_module );
-        vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return i_ret;
     }
@@ -466,10 +443,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     msg_Dbg( p_libvlc, "module bank initialized, found %i modules",
                     libvlc_global.p_module_bank->i_children );
 
-    /* Hack: insert the help module here */
-    vlc_object_attach( p_help_module, libvlc_global.p_module_bank );
-    /* End hack */
-
     /* Check for help on modules */
     if( (p_tmp = config_GetPsz( p_libvlc, "module" )) )
     {
@@ -502,29 +475,19 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     /* Check for config file options */
     if( config_GetInt( p_libvlc, "reset-config" ) )
     {
-        vlc_object_detach( p_help_module );
         config_ResetAll( p_libvlc );
         config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
         config_SaveConfigFile( p_libvlc, NULL );
-        vlc_object_attach( p_help_module, libvlc_global.p_module_bank );
     }
     if( config_GetInt( p_libvlc, "save-config" ) )
     {
-        vlc_object_detach( p_help_module );
         config_LoadConfigFile( p_libvlc, NULL );
         config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
         config_SaveConfigFile( p_libvlc, NULL );
-        vlc_object_attach( p_help_module, libvlc_global.p_module_bank );
     }
 
-    /* Hack: remove the help module here */
-    vlc_object_detach( p_help_module );
-    /* End hack */
-
     if( b_exit )
     {
-        config_Free( p_help_module );
-        vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return i_ret;
     }
@@ -539,10 +502,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
      */
     config_LoadConfigFile( p_libvlc, NULL );
 
-    /* Hack: insert the help module here */
-    vlc_object_attach( p_help_module, libvlc_global.p_module_bank );
-    /* End hack */
-
     /*
      * Override configuration with command line settings
      */
@@ -555,19 +514,10 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
                  "that they are valid.\n" );
         PauseConsole();
 #endif
-        vlc_object_detach( p_help_module );
-        config_Free( p_help_module );
-        vlc_object_destroy( p_help_module );
         module_EndBank( p_libvlc );
         return VLC_EGENERIC;
     }
 
-    /* Hack: remove the help module here */
-    vlc_object_detach( p_help_module );
-    config_Free( p_help_module );
-    vlc_object_destroy( p_help_module );
-    /* End hack */
-
     /*
      * System specific configuration
      */
@@ -1329,7 +1279,7 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
 #   define BLUE    COL(34)
 #   define MAGENTA COL(35)
 #   define CYAN    COL(36)
-#   define WHITE   COL(37)
+#   define WHITE   COL(0)
 #   define GRAY    "\033[0m"
 #define COLOR_FORMAT_STRING (WHITE"  %s --%s"YELLOW"%s%s%s%s%s%s "GRAY)
 #define COLOR_FORMAT_STRING_BOOL (WHITE"  %s --%s%s%s%s%s%s%s "GRAY)
@@ -1355,6 +1305,7 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
     vlc_bool_t b_description = config_GetInt( p_this, "help-verbose" );
     vlc_bool_t b_description_hack;
     vlc_bool_t b_color       = config_GetInt( p_this, "color" );
+    vlc_bool_t b_has_advanced = VLC_FALSE;
 
     memset( psz_spaces_text, ' ', PADDING_SPACES+LINE_START );
     psz_spaces_text[PADDING_SPACES+LINE_START] = '\0';
@@ -1454,14 +1405,15 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
             signed int i;
             size_t i_cur_width;
 
-            /* Skip deprecated options */
-            if( p_item->psz_current )
+            /* Skip removed options */
+            if( p_item->b_removed )
             {
                 continue;
             }
             /* Skip advanced options if requested */
             if( p_item->b_advanced && !b_advanced )
             {
+                b_has_advanced = VLC_TRUE;
                 continue;
             }
 
@@ -1514,6 +1466,8 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
             case CONFIG_ITEM_MODULE_CAT:
             case CONFIG_ITEM_MODULE_LIST:
             case CONFIG_ITEM_MODULE_LIST_CAT:
+            case CONFIG_ITEM_FONT:
+            case CONFIG_ITEM_PASSWORD:
                 psz_bra = OPTION_VALUE_SEP "<";
                 psz_type = _("string");
                 psz_ket = ">";
@@ -1731,6 +1685,10 @@ static void Usage( libvlc_int_t *p_this, char const *psz_module_name )
         }
     }
 
+    if( b_has_advanced )
+        utf8_fprintf( stdout, "\n" WHITE "%s" GRAY " %s\n", _( "Note:" ),
+        _( "add --advanced to your command line to see advanced options." ) );
+
     /* Release the module list */
     vlc_list_release( p_list );
 }
@@ -1809,14 +1767,6 @@ static void ListModules( libvlc_int_t *p_this, vlc_bool_t b_verbose )
                                   p_parser->psz_capability,
                                   p_parser->i_score );
             }
-            if( p_parser->psz_program )
-            {
-                if( b_color )
-                    utf8_fprintf( stdout, YELLOW "   p %s\n"GRAY,
-                                  p_parser->psz_program );
-                else
-                    utf8_fprintf( stdout, "   p %s\n", p_parser->psz_program );
-            }
         }
 
         psz_spaces[i] = ' ';