[vlc-devel] commit: libvlc: Add a --ignore-config options that allow not to use the config file. This is especially useful for libvlc based applications. (Pierre d' Herbemont )
git version control
git at videolan.org
Thu Apr 3 00:55:02 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Wed Apr 2 23:22:03 2008 +0200| [b61c8fdebdb1260da5b9baa47bd9f0245be11252]
libvlc: Add a --ignore-config options that allow not to use the config file. This is especially useful for libvlc based applications.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b61c8fdebdb1260da5b9baa47bd9f0245be11252
---
src/libvlc-common.c | 33 ++++++++++++++++++++-------------
src/libvlc-module.c | 5 +++++
2 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/libvlc-common.c b/src/libvlc-common.c
index 599e0e7..c951a38 100644
--- a/src/libvlc-common.c
+++ b/src/libvlc-common.c
@@ -394,7 +394,9 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
# if defined (WIN32) || defined (__APPLE__)
/* This ain't really nice to have to reload the config here but it seems
* the only way to do it. */
- config_LoadConfigFile( p_libvlc, "main" );
+
+ if( !config_GetInt( p_libvlc, "ignore-config" ) )
+ config_LoadConfigFile( p_libvlc, "main" );
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
/* Check if the user specified a custom language */
@@ -411,7 +413,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
module_EndBank( p_libvlc );
module_InitBank( p_libvlc );
- config_LoadConfigFile( p_libvlc, "main" );
+ if( !config_GetInt( p_libvlc, "ignore-config" ) )
+ config_LoadConfigFile( p_libvlc, "main" );
config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
p_libvlc_global->p_module_bank->b_cache_delete = b_cache_delete;
}
@@ -465,17 +468,20 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
}
/* Check for config file options */
- if( config_GetInt( p_libvlc, "reset-config" ) > 0 )
+ if( !config_GetInt( p_libvlc, "ignore-config" ) )
{
- config_ResetAll( p_libvlc );
- config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
- config_SaveConfigFile( p_libvlc, NULL );
- }
- if( config_GetInt( p_libvlc, "save-config" ) > 0 )
- {
- config_LoadConfigFile( p_libvlc, NULL );
- config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
- config_SaveConfigFile( p_libvlc, NULL );
+ if( config_GetInt( p_libvlc, "reset-config" ) > 0 )
+ {
+ config_ResetAll( p_libvlc );
+ config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
+ config_SaveConfigFile( p_libvlc, NULL );
+ }
+ if( config_GetInt( p_libvlc, "save-config" ) > 0 )
+ {
+ config_LoadConfigFile( p_libvlc, NULL );
+ config_LoadCmdLine( p_libvlc, &i_argc, ppsz_argv, VLC_TRUE );
+ config_SaveConfigFile( p_libvlc, NULL );
+ }
}
if( b_exit )
@@ -492,7 +498,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/*
* Override default configuration with config file settings
*/
- config_LoadConfigFile( p_libvlc, NULL );
+ if( !config_GetInt( p_libvlc, "ignore-config" ) )
+ config_LoadConfigFile( p_libvlc, NULL );
/*
* Override configuration with command line settings
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index 755b517..43ba2b8 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -2446,6 +2446,8 @@ vlc_module_begin();
#define MODULE_TEXT \
N_("print help on a specific module (can be combined with --advanced " \
"and --help-verbose)")
+#define IGNORE_CONFIG_TEXT \
+ N_("no configuration option will be loaded nor saved to config file")
#define SAVE_CONFIG_TEXT \
N_("save the current command line options in the config")
#define RESET_CONFIG_TEXT \
@@ -2482,6 +2484,9 @@ vlc_module_begin();
change_short( 'p' );
change_internal();
change_unsaveable();
+ add_bool( "ignore-config", VLC_FALSE, NULL, IGNORE_CONFIG_TEXT, "", VLC_FALSE );
+ change_internal();
+ change_unsaveable();
add_bool( "save-config", VLC_FALSE, NULL, SAVE_CONFIG_TEXT, "",
VLC_FALSE );
change_internal();
More information about the vlc-devel
mailing list