Commit f501554a authored by Sam Hocevar's avatar Sam Hocevar

* ./configure.ac.in: duplicated arguments to AM_INIT_AUTOMAKE to fix

    locales breakage.
  * ./src/libvlc.c: libvlc understands the VLC_VERBOSE environment variable,
    to be set between 0 and 4. Default value is 0 for a program using libvlc,
    but vlc sets it to 1 by default.
  * ./src/misc/configuration.c: -v now works the old way (-v, -vv, -vvv) as
    well as the new way (-v0, -v1, -v4). -v1 is the same as -v, and -v0 is
    the same as -q (quiet). Hope it's all understandable.
parent 6dafa419
......@@ -11,7 +11,7 @@ AC_CANONICAL_SYSTEM
dnl XXX: we don't put any flags here, because automake 1.5 doesn't support
dnl them. And we need the comma otherwize automake will choke on it.
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AM_INIT_AUTOMAKE(vlc,0.5.0-cvs-am)
AM_CONFIG_HEADER(config.h)
dnl
......
......@@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: main.h,v 1.46 2002/10/03 13:21:54 sam Exp $
* $Id: main.h,v 1.47 2002/10/03 18:56:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -39,6 +39,10 @@ struct libvlc_t
/* CPU extensions */
u32 i_cpu;
/* Generic settings */
int i_verbose; /* info messages */
vlc_bool_t b_color; /* color messages? */
/* Object structure data */
int i_counter; /* object counter */
int i_objects; /* Attached objects count */
......@@ -85,14 +89,8 @@ struct vlc_t
char * psz_homedir; /* user's home directory */
/* Generic settings */
vlc_bool_t b_quiet; /* be quiet ? */
vlc_bool_t b_verbose; /* info messages ? */
vlc_bool_t b_color; /* color messages ? */
mtime_t i_desync; /* relative desync of the audio ouput */
/* CPU extensions (inherited from libvlc_t) */
u32 i_cpu;
/* Fast memcpy plugin used */
module_t * p_memcpy_module;
void* ( *pf_memcpy ) ( void *, const void *, size_t );
......
......@@ -2,7 +2,7 @@
* vlcshell.c: a VideoLAN Client plugin for Mozilla
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: vlcshell.cpp,v 1.2 2002/09/30 11:05:41 sam Exp $
* $Id: vlcshell.cpp,v 1.3 2002/10/03 18:56:09 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -165,8 +165,6 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
, "--aout", "dsp"
, "--intf", "dummy"
/*, "--noaudio"*/
/*, "-q"*/
, "-v"
};
if( instance == NULL )
......
......@@ -2,7 +2,7 @@
* output.c : internal management of output streams for the audio output
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: output.c,v 1.16 2002/09/30 21:32:33 massiot Exp $
* $Id: output.c,v 1.17 2002/10/03 18:56:09 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -56,7 +56,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
{
/* Non-S/PDIF mixer only deals with float32 or fixed32. */
p_aout->output.output.i_format
= (p_aout->p_vlc->i_cpu & CPU_CAPABILITY_FPU) ?
= (p_aout->p_libvlc->i_cpu & CPU_CAPABILITY_FPU) ?
VLC_FOURCC('f','l','3','2') :
VLC_FOURCC('f','i','3','2');
}
......@@ -93,7 +93,7 @@ int aout_OutputNew( aout_instance_t * p_aout,
{
/* Non-S/PDIF mixer only deals with float32 or fixed32. */
p_aout->mixer.mixer.i_format
= (p_aout->p_vlc->i_cpu & CPU_CAPABILITY_FPU) ?
= (p_aout->p_libvlc->i_cpu & CPU_CAPABILITY_FPU) ?
VLC_FOURCC('f','l','3','2') :
VLC_FOURCC('f','i','3','2');
aout_FormatPrepare( &p_aout->mixer.mixer );
......
......@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.34 2002/10/03 13:21:55 sam Exp $
* $Id: libvlc.c,v 1.35 2002/10/03 18:56:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -156,6 +156,8 @@ vlc_t * vlc_create_r( void )
vlc_mutex_lock( &libvlc.global_lock );
if( !libvlc.b_ready )
{
char *psz_env;
vlc_mutex_init( &libvlc, &libvlc.structure_lock );
libvlc.p_global_data = NULL;
libvlc.b_ready = VLC_TRUE;
......@@ -163,6 +165,16 @@ vlc_t * vlc_create_r( void )
/* Guess what CPU we have */
libvlc.i_cpu = CPUCapabilities();
/* Find verbosity from VLC_VERBOSE environment variable */
psz_env = getenv( "VLC_VERBOSE" );
libvlc.i_verbose = psz_env ? atoi( psz_env ) : 0;
#ifdef HAVE_ISATTY
libvlc.b_color = isatty( 2 ); /* 2 is for stderr */
#else
libvlc.b_color = VLC_FALSE;
#endif
/* Initialize message queue */
msg_Create( &libvlc );
......@@ -188,9 +200,6 @@ vlc_t * vlc_create_r( void )
p_vlc->psz_object_name = "root";
p_vlc->b_verbose = VLC_TRUE;
p_vlc->b_quiet = VLC_FALSE; /* FIXME: delay message queue output! */
/* Initialize mutexes */
vlc_mutex_init( p_vlc, &p_vlc->config_lock );
......@@ -397,36 +406,48 @@ vlc_error_t vlc_init_r( vlc_t *p_vlc, int i_argc, char *ppsz_argv[] )
*/
system_Configure( p_vlc );
/*
* Message queue options
*/
if( config_GetInt( p_vlc, "quiet" ) )
{
libvlc.i_verbose = 0;
}
else
{
int i_tmp = config_GetInt( p_vlc, "verbose" );
if( i_tmp >= 0 && i_tmp <= 4 )
{
libvlc.i_verbose = i_tmp;
}
}
libvlc.b_color = libvlc.b_color || config_GetInt( p_vlc, "color" );
/*
* Output messages that may still be in the queue
*/
p_vlc->b_verbose = config_GetInt( p_vlc, "verbose" );
p_vlc->b_quiet = config_GetInt( p_vlc, "quiet" );
p_vlc->b_color = config_GetInt( p_vlc, "color" );
msg_Flush( p_vlc );
/* p_vlc inititalization. FIXME ? */
p_vlc->i_desync = config_GetInt( p_vlc, "desync" ) * (mtime_t)1000;
p_vlc->i_cpu = libvlc.i_cpu;
#if defined( __i386__ )
if( !config_GetInt( p_vlc, "mmx" ) )
p_vlc->i_cpu &= ~CPU_CAPABILITY_MMX;
libvlc.i_cpu &= ~CPU_CAPABILITY_MMX;
if( !config_GetInt( p_vlc, "3dn" ) )
p_vlc->i_cpu &= ~CPU_CAPABILITY_3DNOW;
libvlc.i_cpu &= ~CPU_CAPABILITY_3DNOW;
if( !config_GetInt( p_vlc, "mmxext" ) )
p_vlc->i_cpu &= ~CPU_CAPABILITY_MMXEXT;
libvlc.i_cpu &= ~CPU_CAPABILITY_MMXEXT;
if( !config_GetInt( p_vlc, "sse" ) )
p_vlc->i_cpu &= ~CPU_CAPABILITY_SSE;
libvlc.i_cpu &= ~CPU_CAPABILITY_SSE;
#endif
#if defined( __powerpc__ ) || defined( SYS_DARWIN )
if( !config_GetInt( p_vlc, "altivec" ) )
p_vlc->i_cpu &= ~CPU_CAPABILITY_ALTIVEC;
libvlc.i_cpu &= ~CPU_CAPABILITY_ALTIVEC;
#endif
#define PRINT_CAPABILITY( capability, string ) \
if( p_vlc->i_cpu & capability ) \
if( libvlc.i_cpu & capability ) \
{ \
strncat( p_capabilities, string " ", \
sizeof(p_capabilities) - strlen(p_capabilities) ); \
......
......@@ -2,7 +2,7 @@
* libvlc.h: main libvlc header
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.h,v 1.16 2002/10/01 22:29:09 massiot Exp $
* $Id: libvlc.h,v 1.17 2002/10/03 18:56:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -37,9 +37,10 @@
"The default behavior is to automatically select the best module " \
"available.")
#define VERBOSE_TEXT N_("be verbose")
#define VERBOSE_TEXT N_("verbosity (0-4)")
#define VERBOSE_LONGTEXT N_( \
"This options activates the output of information messages.")
"This options sets the verbosity level (0=no messages, 1=only errors, " \
"4=max.")
#define QUIET_TEXT N_("be quiet")
#define QUIET_LONGTEXT N_( \
......@@ -351,8 +352,8 @@ vlc_module_begin();
add_category_hint( N_("Interface"), NULL);
add_module_with_short( "intf", 'I', "interface", NULL, NULL,
INTF_TEXT, INTF_LONGTEXT );
add_bool_with_short( "verbose", 'v', 0, NULL,
VERBOSE_TEXT, VERBOSE_LONGTEXT );
add_integer_with_short( "verbose", 'v', -1, NULL,
VERBOSE_TEXT, VERBOSE_LONGTEXT );
add_bool_with_short( "quiet", 'q', 0, NULL, QUIET_TEXT, QUIET_LONGTEXT );
add_bool( "color", 0, NULL, COLOR_TEXT, COLOR_LONGTEXT );
add_string( "search-path", NULL, NULL, INTF_PATH_TEXT, INTF_PATH_LONGTEXT );
......
......@@ -2,7 +2,7 @@
* configuration.c management of the modules configuration
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: configuration.c,v 1.39 2002/09/29 18:19:53 sam Exp $
* $Id: configuration.c,v 1.40 2002/10/03 18:56:09 sam Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -1043,6 +1043,12 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
{
psz_shortopts[i_shortopts] = ':';
i_shortopts++;
if( p_item->i_short == 'v' )
{
psz_shortopts[i_shortopts] = ':';
i_shortopts++;
}
}
}
}
......@@ -1107,8 +1113,38 @@ int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[],
config_PutPsz( p_this, pp_shortopts[i_cmd]->psz_name, optarg );
break;
case CONFIG_ITEM_INTEGER:
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
atoi(optarg));
if( i_cmd == 'v' )
{
int i_verbose = 0;
if( optarg )
{
if( *optarg == 'v' ) /* eg. -vvvvv */
{
i_verbose++;
while( *optarg == 'v' )
{
i_verbose++;
optarg++;
}
}
else
{
i_verbose += atoi( optarg ); /* eg. -v2 */
}
}
else
{
i_verbose = 1; /* -v */
}
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
i_verbose );
}
else
{
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name,
atoi(optarg) );
}
break;
case CONFIG_ITEM_BOOL:
config_PutInt( p_this, pp_shortopts[i_cmd]->psz_name, 1 );
......
......@@ -4,7 +4,7 @@
* modules, especially intf modules. See config.h for output configuration.
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: messages.c,v 1.11 2002/10/03 13:21:55 sam Exp $
* $Id: messages.c,v 1.12 2002/10/03 18:56:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -435,15 +435,20 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
char *psz_object = "private";
int i_type = p_item->i_type;
if( /*p_this->p_vlc->b_quiet ||*/ !p_this->p_libvlc->msg_bank.b_configured )
switch( i_type )
{
return;
}
if( /*!p_this->p_vlc->b_verbose && */
( (i_type == VLC_MSG_WARN) || (i_type == VLC_MSG_DBG) ) )
{
return;
case VLC_MSG_ERR:
if( p_this->p_libvlc->i_verbose < 1 ) return;
break;
case VLC_MSG_INFO:
if( p_this->p_libvlc->i_verbose < 2 ) return;
break;
case VLC_MSG_WARN:
if( p_this->p_libvlc->i_verbose < 3 ) return;
break;
case VLC_MSG_DBG:
if( p_this->p_libvlc->i_verbose < 4 ) return;
break;
}
switch( p_item->i_object_type )
......@@ -462,7 +467,7 @@ static void PrintMsg ( vlc_object_t * p_this, msg_item_t * p_item )
}
/* Send the message to stderr */
if( /*p_this->p_vlc->b_color*/1 )
if( p_this->p_libvlc->b_color )
{
fprintf( stderr, "[" GREEN "%.6x" GRAY "] %s %s%s: %s%s" GRAY "\n",
p_item->i_object_id, p_item->psz_module, psz_object,
......
......@@ -2,7 +2,7 @@
* modules.c : Builtin and plugin modules management functions
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: modules.c,v 1.94 2002/10/03 13:21:55 sam Exp $
* $Id: modules.c,v 1.95 2002/10/03 18:56:10 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Ethan C. Baldridge <BaldridgeE@cadmus.com>
......@@ -312,7 +312,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
}
/* Test if we have the required CPU */
if( (p_module->i_cpu & p_this->p_vlc->i_cpu) != p_module->i_cpu )
if( (p_module->i_cpu & p_this->p_libvlc->i_cpu) != p_module->i_cpu )
{
continue;
}
......
......@@ -2,7 +2,7 @@
* objects.c: vlc_object_t handling
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: objects.c,v 1.21 2002/10/03 13:21:55 sam Exp $
* $Id: objects.c,v 1.22 2002/10/03 18:56:10 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
*
......@@ -447,12 +447,9 @@ void __vlc_liststructure( vlc_object_t *p_this )
}
else
{
vlc_object_t *p_me = p_this->p_vlc
? (vlc_object_t *)p_this->p_vlc
: (vlc_object_t *)p_this->p_libvlc;
msg_Info( p_me, "o %.6x %s (not attached)",
(*pp_current)->i_object_id,
(*pp_current)->psz_object_type );
printf( " o %.6x %s (not attached)\n",
(*pp_current)->i_object_id,
(*pp_current)->psz_object_type );
}
}
......@@ -649,7 +646,6 @@ static void SetAttachment( vlc_object_t *p_this, vlc_bool_t b_attached )
static void PrintObject( vlc_object_t *p_this, const char *psz_prefix )
{
char psz_children[20], psz_refcount[20], psz_thread[20], psz_name[50];
vlc_object_t *p_me;
psz_name[0] = '\0';
if( p_this->psz_object_name )
......@@ -688,11 +684,9 @@ static void PrintObject( vlc_object_t *p_this, const char *psz_prefix )
psz_thread[19] = '\0';
}
p_me = p_this->p_vlc ? (vlc_object_t *)p_this->p_vlc
: (vlc_object_t *)p_this->p_libvlc;
msg_Info( p_me, "%so %.6x %s%s%s%s%s", psz_prefix,
p_this->i_object_id, p_this->psz_object_type,
psz_name, psz_thread, psz_refcount, psz_children );
printf( " %so %.6x %s%s%s%s%s\n", psz_prefix,
p_this->i_object_id, p_this->psz_object_type,
psz_name, psz_thread, psz_refcount, psz_children );
}
static void DumpStructure( vlc_object_t *p_this, int i_level, char *psz_foo )
......
......@@ -2,7 +2,7 @@
* vlc.c: the vlc player
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: vlc.c,v 1.11 2002/09/29 18:19:53 sam Exp $
* $Id: vlc.c,v 1.12 2002/10/03 18:56:09 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -50,7 +50,7 @@ int main( int i_argc, char *ppsz_argv[] )
fprintf( stderr, COPYRIGHT_MESSAGE "\n" );
#ifdef SYS_LINUX
#ifdef HAVE_PUTENV
# ifdef DEBUG
/* Activate malloc checking routines to detect heap corruptions. */
putenv( "MALLOC_CHECK_=2" );
......@@ -58,6 +58,12 @@ int main( int i_argc, char *ppsz_argv[] )
/* Disable the ugly Gnome crash dialog so that we properly segfault */
putenv( "GNOME_DISABLE_CRASH_DIALOG=1" );
# endif
/* If the user isn't using VLC_VERBOSE, set it to 1 by default */
if( getenv( "VLC_VERBOSE" ) == NULL )
{
putenv( "VLC_VERBOSE=1" );
}
#endif
/* Create a libvlc structure */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment