]> git.sesse.net Git - vlc/commitdiff
* ./src/misc/modules.c: added the --plugin-path option to give vlc an
authorSam Hocevar <sam@videolan.org>
Thu, 27 Jun 2002 19:05:17 +0000 (19:05 +0000)
committerSam Hocevar <sam@videolan.org>
Thu, 27 Jun 2002 19:05:17 +0000 (19:05 +0000)
    extra plugin location.
  * ./plugins/text/rc.c: if stdin/stdout are not connected to a TTY, we
    don't launch the rc interface.
  * ./plugins/access/http.c: fixed a compilation warning.
  * ./src/misc/messages.c: cosmetic enhancements in the message output.

13 files changed:
include/main.h
plugins/access/http.c
plugins/avi/avi.c
plugins/avi/libLE.c [deleted file]
plugins/avi/libioRIFF.c
plugins/text/rc.c
src/input/input.c
src/input/input_ext-plugins.c
src/libvlc.c
src/libvlc.h
src/misc/messages.c
src/misc/modules.c
src/vlc.c

index 59fd83bab45ec29759baec10badcafb8011a67fa..c31d5b2556bc473308123bd63f9d822d52304ecb 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.38 2002/06/01 17:09:25 sam Exp $
+ * $Id: main.h,v 1.39 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -71,13 +71,14 @@ struct vlc_s
     /* Locks */
     vlc_mutex_t            config_lock;          /* lock for the config file */
     vlc_mutex_t            structure_lock;        /* lock for the p_vlc tree */
+    int                    i_unique;                    /* p_vlc occurence # */
     int                    i_counter;                      /* object counter */
 
     /* Pointer to the big, evil global lock */
     vlc_mutex_t *          p_global_lock;
     void **                pp_global_data;
 
-    /* Private data */
+    /* System-specific variables */
 #if defined( SYS_BEOS )
     vlc_object_t *         p_appthread;
 #elif defined( WIN32 )
index fa9db32405d3cf0adf66f8d1e0c5db7977c8b589..0a739db7eebb36372c7f8b22eb475841132738b2 100644 (file)
@@ -2,7 +2,7 @@
  * http.c: HTTP access plug-in
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: http.c,v 1.12 2002/06/18 23:18:40 massiot Exp $
+ * $Id: http.c,v 1.13 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -150,7 +150,7 @@ static int HTTPConnect( input_thread_t * p_input, off_t i_tell )
          snprintf( psz_buffer, sizeof(psz_buffer),
                    "%s"
                    HTTP_USERAGENT HTTP_END,
-                   p_access_data->psz_buffer, i_tell );
+                   p_access_data->psz_buffer );
     }
     psz_buffer[sizeof(psz_buffer) - 1] = '\0';
 
index 7fa0b16abd1b99c558df6ac8b66b5d183900d88f..9fed773f3cc17d5e34b879665ced2d49fe47d1ab 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.23 2002/06/26 23:11:12 fenrir Exp $
+ * $Id: avi.c,v 1.24 2002/06/27 19:05:17 sam Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -33,9 +33,8 @@
 
 #include "video.h"
 
-/*****************************************************************************
- * Constants
- *****************************************************************************/
+#include "libioRIFF.h"
+#include "avi.h"
 
 /*****************************************************************************
  * Local prototypes
@@ -63,12 +62,6 @@ MODULE_ACTIVATE_STOP
 MODULE_DEACTIVATE_START
 MODULE_DEACTIVATE_STOP
 
-/*****************************************************************************
- * Definition of structures and libraries for this plugins 
- *****************************************************************************/
-#include "libioRIFF.h"
-#include "avi.h"
-
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
diff --git a/plugins/avi/libLE.c b/plugins/avi/libLE.c
deleted file mode 100644 (file)
index 4eccfdf..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*****************************************************************************
- * avi_file.c : AVI file Stream input module for vlc
- *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: libLE.c,v 1.1 2002/04/23 23:44:36 fenrir Exp $
- * Authors: Laurent Aimar <fenrir@via.ecp.fr>
- * 
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
- *****************************************************************************/
-
-/*
- * Data reading functions
- */
-
-static u16 __GetWordLittleEndianFromBuff( byte_t *p_buff )
-{
-    u16 i;
-    i = (*p_buff) + ( *(p_buff + 1) <<8 );
-    return ( i );
-}
-
-static u32 __GetDoubleWordLittleEndianFromBuff( byte_t *p_buff )
-{
-    u32 i;
-    i = (*p_buff) + ( *(p_buff + 1) <<8 ) + ( *(p_buff + 2) <<16 ) + ( *(p_buff + 3) <<24 );
-    return ( i );
-}
-
-static void __SetWordLittleEndianToBuff( byte_t *p_buff, u16 i)
-{
-    *(p_buff)     = (i & 0xFF);
-    *(p_buff + 1) = ( ( i >>8 ) & 0xFF);
-    return;
-}
-
-static void __SetDoubleWordLittleEndianToBuff( byte_t *p_buff, u32 i)
-{
-    *(p_buff)     = ( i & 0xFF );
-    *(p_buff + 1) = (( i >>8 ) & 0xFF);
-    *(p_buff + 2) = (( i >>16 ) & 0xFF);
-    *(p_buff + 3) = (( i >>24 ) & 0xFF);
-    return;
-}
-
-
index 9fa3808757c7f9fee4319fad4fe89fe9ca9adf28..decd9574d731a0b4d9d6ad08128b9e45bc8ff85e 100644 (file)
@@ -2,7 +2,7 @@
  * libioRIFF.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libioRIFF.c,v 1.8 2002/06/27 18:10:16 fenrir Exp $
+ * $Id: libioRIFF.c,v 1.9 2002/06/27 19:05:17 sam Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#include <stdlib.h>
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include <stdlib.h>                                      /* malloc(), free() */
+
 #include <vlc/vlc.h>
 #include <vlc/input.h>
-#include <video.h>
+
+#include "video.h"
 
 #include "libioRIFF.h"
 
index 852099caacb8f92f05f2851e9aa3c57ef66a7ecd..51d806de75e5ecd3f25eb490d2d2d97ecd11ac75 100644 (file)
@@ -2,7 +2,7 @@
  * rc.c : remote control stdin/stdout plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: rc.c,v 1.19 2002/06/07 23:05:03 sam Exp $
+ * $Id: rc.c,v 1.20 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Peter Surda <shurdeek@panorama.sth.ac.at>
  *
@@ -100,6 +100,15 @@ static void intf_getfunctions( function_list_t * p_function_list )
  *****************************************************************************/
 static int intf_Open( intf_thread_t *p_intf )
 {
+#ifdef HAVE_ISATTY
+    /* Check that stdin is a TTY */
+    if( !isatty( 0 ) )
+    {
+        msg_Warn( p_intf, "fd 0 is not a TTY" );
+        return 1;
+    }
+#endif
+
     /* Non-buffered stdout */
     setvbuf( stdout, (char *)NULL, _IOLBF, 0 );
 
@@ -108,7 +117,7 @@ static int intf_Open( intf_thread_t *p_intf )
     if( p_intf->p_sys == NULL )
     {
         msg_Err( p_intf, "out of memory" );
-        return( 1 );
+        return 1;
     }
 
 #ifdef WIN32
@@ -120,7 +129,7 @@ static int intf_Open( intf_thread_t *p_intf )
 #endif
 
     printf( "remote control interface initialized, `h' for help\n" );
-    return( 0 );
+    return 0;
 }
 
 /*****************************************************************************
index bc6a7b3b781edd787e9b48b328a2aa8e6ac17a63..331606684b8edf6cd95e5ebc2cc8168428f6181e 100644 (file)
@@ -4,7 +4,7 @@
  * decoders.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: input.c,v 1.204 2002/06/08 14:08:46 sam Exp $
+ * $Id: input.c,v 1.205 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -456,7 +456,7 @@ static int InitThread( input_thread_t * p_input )
 
     if( p_input->p_access_module == NULL )
     {
-        msg_Err( p_input, "no suitable access module for `%s/%s:%s'",
+        msg_Err( p_input, "no suitable access module for `%s/%s://%s'",
                  p_input->psz_access, p_input->psz_demux, p_input->psz_name );
         return -1;
     }
@@ -499,7 +499,7 @@ static int InitThread( input_thread_t * p_input )
 
     if( p_input->p_demux_module == NULL )
     {
-        msg_Err( p_input, "no suitable demux module for `%s/%s:%s'",
+        msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
                  p_input->psz_access, p_input->psz_demux, p_input->psz_name );
         module_Unneed( p_input->p_access_module );
         return -1;
index 6da18868660f622d85bf4edab8f270f8e51b144c..d0c2617eaf05cafc2b7458791a7c90887b8f3d82 100644 (file)
@@ -2,7 +2,7 @@
  * input_ext-plugins.c: useful functions for access and demux plug-ins
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: input_ext-plugins.c,v 1.12 2002/06/01 18:04:49 sam Exp $
+ * $Id: input_ext-plugins.c,v 1.13 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -667,7 +667,7 @@ void input_FDClose( input_thread_t * p_input )
 {
     input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
 
-    msg_Info( p_input, "closing `%s/%s:%s'", 
+    msg_Info( p_input, "closing `%s/%s://%s'", 
               p_input->psz_access, p_input->psz_demux, p_input->psz_name );
  
     close( p_access_data->i_handle );
@@ -681,7 +681,7 @@ void input_FDNetworkClose( input_thread_t * p_input )
 {
     input_socket_t * p_access_data = (input_socket_t *)p_input->p_access_data;
 
-    msg_Info( p_input, "closing network `%s/%s:%s'", 
+    msg_Info( p_input, "closing network `%s/%s://%s'", 
               p_input->psz_access, p_input->psz_demux, p_input->psz_name );
  
 #ifdef WIN32
index aba9abc1fc70e62c4a5dbe86a5e55a1fe8630a8c..3f52ed22a484e19df51f8d5bff5328964063a561 100644 (file)
@@ -4,7 +4,7 @@
  * and spawns threads.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: libvlc.c,v 1.10 2002/06/11 09:44:22 gbazin Exp $
+ * $Id: libvlc.c,v 1.11 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -92,6 +92,7 @@ void *             p_global_data;
 
 /* A list of all the currently allocated vlc objects */
 static volatile int i_vlc = 0;
+static volatile int i_unique = 0;
 static volatile vlc_t **pp_vlc = NULL;
 
 /*****************************************************************************
@@ -155,6 +156,8 @@ vlc_t * vlc_create( void )
     pp_vlc = realloc( pp_vlc, (i_vlc+1) * sizeof( vlc_t * ) );
     pp_vlc[ i_vlc ] = p_vlc;
     i_vlc++;
+    p_vlc->i_unique = i_unique;
+    i_unique++;
     vlc_mutex_unlock( p_vlc->p_global_lock );
 
     /* Update the handle status */
index d3c6e495eaa23bc9bc13feabf14fc9415520592e..0787afe087d912f0de24aa641177dc2af3edbd6b 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.h: main libvlc header
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.h,v 1.4 2002/06/11 09:44:22 gbazin Exp $
+ * $Id: libvlc.h,v 1.5 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
     "This option allows you to set the default path that the interface will " \
     "open when looking for a file.")
 
+#define PLUGIN_PATH_TEXT N_("plugin search path")
+#define PLUGIN_PATH_LONGTEXT N_( \
+    "This option allows you to specify an additional path for vlc to look" \
+    "for its plugins.")
+
 #define AOUT_TEXT N_("audio output module")
 #define AOUT_LONGTEXT N_( \
     "This option allows you to select the audio output method used by vlc. " \
@@ -318,6 +323,7 @@ ADD_BOOL_WITH_SHORT ( "verbose", 'v', 0, 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 )
+ADD_STRING  ( "plugin-path", NULL, NULL, PLUGIN_PATH_TEXT, PLUGIN_PATH_LONGTEXT )
 
 /* Audio options */
 ADD_CATEGORY_HINT( N_("Audio"), NULL)
index d6741e8c0377f079a663ed63e3350cc9be8a53d7..e961f309aeec83d0b0af67bf5ada358e9c843320 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.2 2002/06/01 18:04:49 sam Exp $
+ * $Id: messages.c,v 1.3 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -333,13 +333,15 @@ static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module,
 #           define GRAY    "\033[0m"
             static const char *ppsz_color[4] = { WHITE, RED, YELLOW, GRAY };
 
-            fprintf( stderr, "[" GREEN "%.8x" GRAY "] " "%s%s"
-                     ": %s%s" GRAY "\n", p_this->i_object_id, psz_module,
-                     ppsz_type[i_type], ppsz_color[i_type], psz_str );
+            fprintf( stderr, "[" GREEN "%.2x" GRAY ":" GREEN "%.6x" GRAY "] "
+                             "%s%s: %s%s" GRAY "\n", p_this->p_vlc->i_unique,
+                             p_this->i_object_id, psz_module,
+                             ppsz_type[i_type], ppsz_color[i_type], psz_str );
         }
         else
         {
-            fprintf( stderr, "[%.8x] %s%s: %s\n", p_this->i_object_id,
+            fprintf( stderr, "[%.2x:%.6x] %s%s: %s\n",
+                             p_this->p_vlc->i_unique, p_this->i_object_id,
                              psz_module, ppsz_type[i_type], psz_str );
         }
     }
index 41a14d5dca4b70c37894d7de2ee36a44a7d6c102..0e6ce0d5596a15fd18be6720e205d8771f18aff5 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.68 2002/06/11 09:44:22 gbazin Exp $
+ * $Id: modules.c,v 1.69 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -578,7 +578,8 @@ void module_Unneed( module_t * p_module )
 #ifdef HAVE_DYNAMIC_PLUGINS
 static void AllocateAllPlugins( vlc_object_t *p_this )
 {
-    static char * path[] = { ".", "plugins", PLUGIN_PATH, NULL, NULL };
+    /* Yes, there are two NULLs because we replace one with "plugin-path". */
+    char *          path[] = { "plugins", PLUGIN_PATH, NULL, NULL };
 
     char **         ppsz_path = path;
     char *          psz_fullpath;
@@ -591,6 +592,10 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
     DIR *           dir;
     struct dirent * file;
 
+    /* If the user provided a plugin path, we add it to the list */
+    path[ sizeof(path)/sizeof(char*) - 2 ] = config_GetPsz( p_this,
+                                                            "plugin-path" );
+
     for( ; *ppsz_path != NULL ; ppsz_path++ )
     {
         /* Store strlen(*ppsz_path) for later use. */
index dfdc2bb128a47f217e969e75bb3adc90c1271f6f..07808da187b8cd0091c154c964a000a3c359c0e0 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.1 2002/06/01 12:32:01 sam Exp $
+ * $Id: vlc.c,v 1.2 2002/06/27 19:05:17 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -68,8 +68,8 @@ int main(int i_argc, char *ppsz_argv[], char *ppsz_env[])
 
     /* Add background interfaces */
     //{ int i; for( i=10; i--; ) vlc_add_intf( p_vlc, "dummy", 0 ); }
-    vlc_add_intf( p_vlc, "dummy", VLC_FALSE );
-    vlc_add_intf( p_vlc, "logger", VLC_FALSE );
+    //vlc_add_intf( p_vlc, "dummy", VLC_FALSE );
+    //vlc_add_intf( p_vlc, "logger", VLC_FALSE );
     vlc_add_intf( p_vlc, "rc", VLC_FALSE );
 
     /* Add a blocking interface */