*****************************************************************************/
static void SetLanguage ( char const * );
static int GetFilenames ( vlc_t *, int, char *[] );
+static void Help ( vlc_t *, char const *psz_help_name );
static void Usage ( vlc_t *, char const *psz_module_name );
static void ListModules ( vlc_t * );
static void Version ( void );
/* Check for short help option */
if( config_GetInt( p_vlc, "help" ) )
{
- fprintf( stdout, _("Usage: %s [options] [items]...\n"),
- p_vlc->psz_object_name );
- Usage( p_vlc, "main" );
- Usage( p_vlc, "help" );
+ Help( p_vlc, "help" );
b_exit = VLC_TRUE;
}
/* Check for version option */
/* Check for help on modules */
if( (p_tmp = config_GetPsz( p_vlc, "module" )) )
{
- Usage( p_vlc, p_tmp );
+ Help( p_vlc, p_tmp );
free( p_tmp );
b_exit = VLC_TRUE;
}
/* Check for long help option */
else if( config_GetInt( p_vlc, "longhelp" ) )
{
- Usage( p_vlc, NULL );
+ Help( p_vlc, "longhelp" );
b_exit = VLC_TRUE;
}
/* Check for module list option */
/* p_vlc initialization. FIXME ? */
-#if defined( __i386__ )
+ if( !config_GetInt( p_vlc, "fpu" ) )
+ libvlc.i_cpu &= ~CPU_CAPABILITY_FPU;
+
+#if defined( __i386__ ) || defined( __x86_64__ )
if( !config_GetInt( p_vlc, "mmx" ) )
libvlc.i_cpu &= ~CPU_CAPABILITY_MMX;
if( !config_GetInt( p_vlc, "3dn" ) )
return VLC_EGENERIC;
}
- /* Add service discovery modules */
- playlist_AddSDModules( p_playlist,
- config_GetPsz( p_playlist, "services-discovery" ) );
+ psz_modules = config_GetPsz( p_playlist, "services-discovery" );
+ if( psz_modules && *psz_modules )
+ {
+ /* Add service discovery modules */
+ playlist_AddSDModules( p_playlist, psz_modules );
+ }
+ if( psz_modules ) free( psz_modules );
/*
* Load background interfaces
{
psz_modules = (char *)realloc( psz_modules, strlen( psz_modules ) +
strlen( psz_control ) + 1 );
- sprintf( psz_modules, "%s,%s", psz_modules, psz_control );
+ sprintf( psz_modules, "%s:%s", psz_modules, psz_control );
}
else if( psz_control && *psz_control )
{
}
psz_parser = psz_modules;
+ if( psz_parser && *psz_parser &&
+ strstr( psz_parser, ",") && !strstr(psz_parser, ":" ) )
+ {
+ msg_Info( p_vlc, "Warning: you are using a deprecated syntax for "
+ "extraintf / control." );
+ msg_Info( p_vlc, "You must now use ':' as separator instead of ','." );
+ }
while ( psz_parser && *psz_parser )
{
char *psz_module, *psz_temp;
psz_module = psz_parser;
- psz_parser = strchr( psz_module, ',' );
+ psz_parser = strchr( psz_module, ':' );
+ if( !psz_parser ) psz_parser = strchr( psz_module, ',' );
if ( psz_parser )
{
*psz_parser = '\0';
return i_ret;
}
+/*****************************************************************************
+ * VLC_VariableType: get a vlc variable type
+ *****************************************************************************/
+int VLC_VariableType( int i_object, char const *psz_var, int *pi_type )
+{
+ int i_type;
+ vlc_t *p_vlc = vlc_current_object( i_object );
+
+ if( !p_vlc )
+ {
+ return VLC_ENOOBJ;
+ }
+
+ /* FIXME: Temporary hack for Mozilla, if variable starts with conf:: then
+ * we handle it as a configuration variable. Don't tell Gildas :) -- sam */
+ if( !strncmp( psz_var, "conf::", 6 ) )
+ {
+ module_config_t *p_item;
+ char const *psz_newvar = psz_var + 6;
+
+ p_item = config_FindConfig( VLC_OBJECT(p_vlc), psz_newvar );
+
+ if( p_item )
+ {
+ switch( p_item->i_type )
+ {
+ case CONFIG_ITEM_BOOL:
+ i_type = VLC_VAR_BOOL;
+ break;
+ case CONFIG_ITEM_INTEGER:
+ i_type = VLC_VAR_INTEGER;
+ break;
+ case CONFIG_ITEM_FLOAT:
+ i_type = VLC_VAR_FLOAT;
+ break;
+ default:
+ i_type = VLC_VAR_STRING;
+ break;
+ }
+ }
+ else
+ i_type = 0;
+ }
+ else
+ i_type = VLC_VAR_TYPE & var_Type( p_vlc , psz_var );
+
+ if( i_object ) vlc_object_release( p_vlc );
+
+ if( i_type > 0 )
+ {
+ *pi_type = i_type;
+ return VLC_SUCCESS;
+ }
+ return VLC_ENOVAR;
+}
+
/*****************************************************************************
* VLC_AddTarget: adds a target for playing.
*****************************************************************************
if( b_relative )
{
- val.i_time = i_seconds * 1000000;
+ val.i_time = i_seconds;
+ val.i_time = val.i_time * 1000000L;
var_Set( p_input, "time-offset", val );
}
else
{
- val.i_time = i_seconds * 1000000;
+ val.i_time = i_seconds;
+ val.i_time = val.i_time * 1000000L;
var_Set( p_input, "time", val );
}
vlc_object_release( p_input );
vlc_object_release( p_input );
if( i_object ) vlc_object_release( p_vlc );
- return val.i_time / 1000000;
+ return val.i_time / 1000000L;
}
/**
}
/*****************************************************************************
- * Usage: print program usage
+ * Help: print program help
+ *****************************************************************************
+ * Print a short inline help. Message interface is initialized at this stage.
+ *****************************************************************************/
+static void Help( vlc_t *p_this, char const *psz_help_name )
+{
+#ifdef WIN32
+ ShowConsole();
+#endif
+
+ if( psz_help_name && !strcmp( psz_help_name, "help" ) )
+ {
+ fprintf( stdout, VLC_USAGE, p_this->psz_object_name );
+ Usage( p_this, "help" );
+ Usage( p_this, "main" );
+ }
+ else if( psz_help_name && !strcmp( psz_help_name, "longhelp" ) )
+ {
+ fprintf( stdout, VLC_USAGE, p_this->psz_object_name );
+ Usage( p_this, NULL );
+ }
+ else if( psz_help_name )
+ {
+ Usage( p_this, psz_help_name );
+ }
+
+#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
+ PauseConsole();
+#endif
+}
+
+/*****************************************************************************
+ * Usage: print module usage
*****************************************************************************
* Print a short inline help. Message interface is initialized at this stage.
*****************************************************************************/
vlc_list_t *p_list;
module_t *p_parser;
module_config_t *p_item;
- char psz_spaces[PADDING_SPACES+LINE_START+1];
+ char psz_spaces_text[PADDING_SPACES+LINE_START+1];
+ char psz_spaces_longtext[LINE_START+3];
char psz_format[sizeof(FORMAT_STRING)];
- char psz_buffer[1000];
+ char psz_buffer[10000];
char psz_short[4];
int i_index;
int i_width = ConsoleWidth() - (PADDING_SPACES+LINE_START+1);
vlc_bool_t b_advanced = config_GetInt( p_this, "advanced" );
+ vlc_bool_t b_description;
- memset( psz_spaces, ' ', PADDING_SPACES+LINE_START );
- psz_spaces[PADDING_SPACES+LINE_START] = '\0';
+ memset( psz_spaces_text, ' ', PADDING_SPACES+LINE_START );
+ psz_spaces_text[PADDING_SPACES+LINE_START] = '\0';
+ memset( psz_spaces_longtext, ' ', LINE_START+2 );
+ psz_spaces_longtext[LINE_START+2] = '\0';
strcpy( psz_format, FORMAT_STRING );
-#ifdef WIN32
- ShowConsole();
-#endif
-
/* List all modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
p_item->i_type != CONFIG_HINT_END;
p_item++ )
{
- char *psz_text;
+ char *psz_text, *psz_spaces = psz_spaces_text;
char *psz_bra = NULL, *psz_type = NULL, *psz_ket = NULL;
char *psz_suf = "", *psz_prefix = NULL;
int i;
/* We wrap the rest of the output */
sprintf( psz_buffer, "%s%s", p_item->psz_text, psz_suf );
+ b_description = config_GetInt( p_this, "help-verbose" );
+
+ description:
psz_text = psz_buffer;
while( *psz_text )
{
psz_text = psz_word;
}
}
+
+ if( b_description && p_item->psz_longtext )
+ {
+ sprintf( psz_buffer, "%s%s", p_item->psz_longtext, psz_suf );
+ b_description = VLC_FALSE;
+ psz_spaces = psz_spaces_longtext;
+ fprintf( stdout, "%s", psz_spaces );
+ goto description;
+ }
}
}
/* Release the module list */
vlc_list_release( p_list );
-
-#ifdef WIN32 /* Pause the console because it's destroyed when we exit */
- PauseConsole();
-#endif
}
/*****************************************************************************
ShowConsole();
#endif
- /* Usage */
- fprintf( stdout, _("Usage: %s [options] [items]...\n\n"),
- p_this->p_vlc->psz_object_name );
-
- fprintf( stdout, _("[module] [description]\n") );
-
/* List all modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
hal_free_string( block_dev );
}
+ hal_free_string_array( devices );
}
hal_shutdown( ctx );