]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
* Added a session announcement protol module (enabled by default).
[vlc] / src / libvlc.c
index 9a08cf642eb0b2cdb235bc4e2286e867b1f934fe..2d6679aa60deb2309443849df2757157263c593e 100644 (file)
@@ -2,7 +2,7 @@
  * libvlc.c: main libvlc source
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: libvlc.c,v 1.43 2002/11/06 09:26:25 sam Exp $
+ * $Id: libvlc.c,v 1.49 2002/12/03 16:29:04 gitan Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>                                                 /* ENOMEM */
+#include <vlc/vlc.h>
+
+#ifdef HAVE_ERRNO_H
+#   include <errno.h>                                              /* ENOMEM */
+#endif
 #include <stdio.h>                                              /* sprintf() */
 #include <string.h>                                            /* strerror() */
 #include <stdlib.h>                                                /* free() */
 
-#include <vlc/vlc.h>
-
 #ifndef WIN32
 #   include <netinet/in.h>                            /* BSD: struct in_addr */
 #endif
 
 #ifdef HAVE_UNISTD_H
 #   include <unistd.h>
-#elif defined( _MSC_VER ) && defined( _WIN32 )
+#elif defined( _MSC_VER ) && defined( _WIN32 ) && !defined( UNDER_CE )
 #   include <io.h>
 #endif
 
 #ifdef WIN32                       /* optind, getopt(), included in unistd.h */
-#   include "extras/GNUgetopt/getopt.h"
+#   include "extras/getopt.h"
 #endif
 
 #ifdef HAVE_LOCALE_H
@@ -274,7 +276,7 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
     /* Check for short help option */
     if( config_GetInt( p_vlc, "help" ) )
     {
-        fprintf( stderr, _("Usage: %s [options] [items]...\n\n"),
+        fprintf( stdout, _("Usage: %s [options] [items]...\n\n"),
                          p_vlc->psz_object_name );
         Usage( p_vlc, "main" );
         Usage( p_vlc, "help" );
@@ -753,7 +755,15 @@ int VLC_Play( int i_object )
     {
         return VLC_ENOOBJ;
     }
+    
+    /* add pseudo sap interface; non blocking */
+    if( config_GetInt( p_vlc, "sap" ) )
+    {
+        msg_Dbg( p_vlc, "adding sap interface" );
+        VLC_AddIntf( 0, "sap", VLC_FALSE );
+    }
 
+    
     p_playlist = vlc_object_find( p_vlc, VLC_OBJECT_PLAYLIST, FIND_CHILD );
 
     if( !p_playlist )
@@ -828,7 +838,7 @@ int VLC_Stop( int i_object )
     {
         vlc_object_detach( p_vout );
         vlc_object_release( p_vout );
-        vout_DestroyThread( p_vout );
+        vout_Destroy( p_vout );
     }
 
     /*
@@ -1046,7 +1056,7 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
             {
             case CONFIG_HINT_CATEGORY:
             case CONFIG_HINT_USAGE:
-                fprintf( stderr, " %s\n", p_item->psz_text );
+                fprintf( stdout, " %s\n", p_item->psz_text );
                 break;
 
             case CONFIG_ITEM_STRING:
@@ -1149,13 +1159,13 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
                 if( p_item->i_type == CONFIG_ITEM_BOOL &&
                     !b_help_module )
                 {
-                    fprintf( stderr, psz_format, p_item->psz_name, psz_prefix,
+                    fprintf( stdout, psz_format, p_item->psz_name, psz_prefix,
                              p_item->psz_name, psz_bra, psz_type, psz_ket,
                              psz_spaces, p_item->psz_text, psz_suf );
                 }
                 else
                 {
-                    fprintf( stderr, psz_format, p_item->psz_name, "", "",
+                    fprintf( stdout, psz_format, p_item->psz_name, "", "",
                              psz_bra, psz_type, psz_ket, psz_spaces,
                              p_item->psz_text, psz_suf );
                 }
@@ -1172,7 +1182,7 @@ static void Usage( vlc_t *p_this, char const *psz_module_name )
     vlc_list_release( p_list );
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-        fprintf( stderr, _("\nPress the RETURN key to continue...\n") );
+        fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
         getchar();
 #endif
 }
@@ -1196,10 +1206,10 @@ static void ListModules( vlc_t *p_this )
 #endif
 
     /* Usage */
-    fprintf( stderr, _("Usage: %s [options] [items]...\n\n"),
+    fprintf( stdout, _("Usage: %s [options] [items]...\n\n"),
                      p_this->p_vlc->psz_object_name );
 
-    fprintf( stderr, _("[module]              [description]\n") );
+    fprintf( stdout, _("[module]              [description]\n") );
 
     /* List all modules */
     p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
@@ -1217,7 +1227,7 @@ static void ListModules( vlc_t *p_this )
         if( i < 0 ) i = 0;
         psz_spaces[i] = 0;
 
-        fprintf( stderr, "  %s%s %s\n", (*pp_parser)->psz_object_name,
+        fprintf( stdout, "  %s%s %s\n", (*pp_parser)->psz_object_name,
                          psz_spaces, (*pp_parser)->psz_longname );
 
         psz_spaces[i] = ' ';
@@ -1226,7 +1236,7 @@ static void ListModules( vlc_t *p_this )
     vlc_list_release( p_list );
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-        fprintf( stderr, _("\nPress the RETURN key to continue...\n") );
+        fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
         getchar();
 #endif
 }
@@ -1242,15 +1252,15 @@ static void Version( void )
     ShowConsole();
 #endif
 
-    fprintf( stderr, VERSION_MESSAGE "\n" );
-    fprintf( stderr,
+    fprintf( stdout, VERSION_MESSAGE "\n" );
+    fprintf( stdout,
       _("This program comes with NO WARRANTY, to the extent permitted by "
         "law.\nYou may redistribute it under the terms of the GNU General "
         "Public License;\nsee the file named COPYING for details.\n"
         "Written by the VideoLAN team at Ecole Centrale, Paris.\n") );
 
 #ifdef WIN32        /* Pause the console because it's destroyed when we exit */
-    fprintf( stderr, _("\nPress the RETURN key to continue...\n") );
+    fprintf( stdout, _("\nPress the RETURN key to continue...\n") );
     getchar();
 #endif
 }
@@ -1263,10 +1273,12 @@ static void Version( void )
 #ifdef WIN32 /*  */
 static void ShowConsole( void )
 {
+#   ifndef UNDER_CE
     AllocConsole();
     freopen( "CONOUT$", "w", stdout );
     freopen( "CONOUT$", "w", stderr );
     freopen( "CONIN$", "r", stdin );
+#   endif
     return;
 }
 #endif