]> git.sesse.net Git - vlc/commitdiff
* ./configure.ac.in: duplicated arguments to AM_INIT_AUTOMAKE to fix
authorSam Hocevar <sam@videolan.org>
Thu, 3 Oct 2002 18:56:10 +0000 (18:56 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 3 Oct 2002 18:56:10 +0000 (18:56 +0000)
    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.

configure.ac.in
include/main.h
mozilla/vlcshell.cpp
src/audio_output/output.c
src/libvlc.c
src/libvlc.h
src/misc/configuration.c
src/misc/messages.c
src/misc/modules.c
src/misc/objects.c
src/vlc.c

index da470c4a3c34d148cc0ff6fbf34fe52fcecc64e4..fba00d7206fe30721f28d56a93ce001c524317d7 100644 (file)
@@ -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
index d5a248b8769a4e67b82c85e0c1f4499a1643fc6d..1f76970fae06e0cf731ec29d5a030fd7ca8a6bdc 100644 (file)
@@ -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 );
index d6910f230559eeac1a827b4c909a3a136cf17374..bb7bf5907470228636401ab5e49fbb9638a1fde2 100644 (file)
@@ -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 )
index 5ddbcfad1df81f093e9b65f43ab95780bcaa9a97..f7e6e03e69ddac92c915872e1d9abfd96456fdab 100644 (file)
@@ -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 );
index e1254db9d347ec16dd86e84360e99ef39056fcb5..3c8f3c9b299a8f496f0a86e66fdab4a0d99b6826 100644 (file)
@@ -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) );         \
index f2b34e05f7311f683d8ba2af384da57613ed7979..fa169da540c505bc22f59633b4dd6590e90dfc96 100644 (file)
@@ -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>
     "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 );
index 696ec872f09e3627f55463dd495a323394104cad..28b05564152f9d54b9a5587f7ac3b4e9810b8ec0 100644 (file)
@@ -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 );
index 3ae6ad868ca8a61a278cb2e42bd6371f58b6abc0..be1ac6afe1c2bf8d5e2adbb23bd18eccd481d17e 100644 (file)
@@ -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,
index ecd1d58a4d5cd143c5dec4918fed7c728e60aee7..ac7f88ef9f2256d417bbfca18d7643e39174bd1f 100644 (file)
@@ -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;
         }
index 4571105abfe38e36cd4fd58842b7a1e3661ed3df..857d43b4f8539ea245c87558ac9933cfdb0d7f91 100644 (file)
@@ -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 )
index add142d3e0cbb33563e8306d2e664a5feb98e3ae..db7f4c8707a9ef1d5e3d980ec80d8152eca993bd 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -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 */