]> git.sesse.net Git - vlc/blobdiff - src/libvlc.c
Fix --file-logging on windows (that was stupid...)
[vlc] / src / libvlc.c
index 335687ee084fec14b90d3b3b8cc598058ce5baf3..c0e37f7a223d455ce6fa78adb08fe486f256986d 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * libvlc.c: libvlc instances creation and deletion, interfaces handling
  *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
+ * Copyright (C) 1998-2008 VLC authors and VideoLAN
  * $Id$
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Derk-Jan Hartman <hartman at videolan dot org>
  *          RĂ©mi Denis-Courmont <rem # videolan : org>
  *
- * 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
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 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.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /** \file
@@ -37,7 +37,7 @@
 #endif
 
 #include <vlc_common.h>
-#include "control/libvlc_internal.h"
+#include "../lib/libvlc_internal.h"
 #include <vlc_input.h>
 
 #include "modules/modules.h"
 #include <string.h>
 #include <stdlib.h>                                                /* free() */
 
-#ifndef WIN32
-#   include <netinet/in.h>                            /* BSD: struct in_addr */
-#endif
-
-#ifdef HAVE_UNISTD_H
-#   include <unistd.h>
-#elif defined( WIN32 ) && !defined( UNDER_CE )
-#   include <io.h>
-#endif
-
 #include "config/vlc_getopt.h"
 
 #ifdef HAVE_LOCALE_H
 #   include <locale.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h> /* isatty() */
+#endif
 
 #ifdef HAVE_DBUS
 /* used for one-instance mode */
@@ -99,7 +92,7 @@
  * The evil global variables. We handle them with care, don't worry.
  *****************************************************************************/
 
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__OS2__)
 static bool b_daemon = false;
 #endif
 
@@ -200,7 +193,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
 
     /* Initialize mutexes */
     vlc_mutex_init( &priv->ml_lock );
-    vlc_mutex_init( &priv->timer_lock );
     vlc_ExitInit( &priv->exit );
 
     return p_libvlc;
@@ -525,8 +517,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     vlc_object_set_name( p_libvlc, "main" );
 
     priv->b_stats = var_InheritBool( p_libvlc, "stats" );
-    priv->i_timers = 0;
-    priv->pp_timers = NULL;
 
     /*
      * Initialize hotkey handling
@@ -534,8 +524,14 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     priv->actions = vlc_InitActions( p_libvlc );
 
     /* Create a variable for showing the fullscreen interface */
+    var_Create( p_libvlc, "intf-toggle-fscontrol", VLC_VAR_BOOL );
+    var_SetBool( p_libvlc, "intf-toggle-fscontrol", true );
+
+    /* Create a variable for the Boss Key */
+    var_Create( p_libvlc, "intf-boss", VLC_VAR_VOID );
+
+    /* Create a variable for showing the main interface */
     var_Create( p_libvlc, "intf-show", VLC_VAR_BOOL );
-    var_SetBool( p_libvlc, "intf-show", true );
 
     /* Create a variable for showing the right click menu */
     var_Create( p_libvlc, "intf-popupmenu", VLC_VAR_BOOL );
@@ -666,8 +662,11 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
 # endif
 #endif
 
-    if( var_InheritBool( p_libvlc, "file-logging" ) &&
-        !var_InheritBool( p_libvlc, "syslog" ) )
+    if( var_InheritBool( p_libvlc, "file-logging" )
+#ifdef HAVE_SYSLOG_H
+        && !var_InheritBool( p_libvlc, "syslog" )
+#endif
+        )
     {
         intf_Create( p_libvlc, "logger,none" );
     }
@@ -703,7 +702,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     var_Create( p_libvlc, "drawable-clip-right", VLC_VAR_INTEGER );
     var_Create( p_libvlc, "drawable-nsobject", VLC_VAR_ADDRESS );
 #endif
-#ifdef WIN32
+#if defined (WIN32) || defined (__OS2__)
     var_Create( p_libvlc, "drawable-hwnd", VLC_VAR_INTEGER );
 #endif
 
@@ -770,12 +769,10 @@ void libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
 
     /* Free playlist now, all threads are gone */
     playlist_Destroy( p_playlist );
-    stats_TimersDumpAll( p_libvlc );
-    stats_TimersCleanAll( p_libvlc );
 
     msg_Dbg( p_libvlc, "removing stats" );
 
-#ifndef WIN32
+#if !defined( WIN32 ) && !defined( __OS2__ )
     char* psz_pidfile = NULL;
 
     if( b_daemon )
@@ -825,7 +822,6 @@ void libvlc_InternalDestroy( libvlc_int_t *p_libvlc )
 
     /* Destroy mutexes */
     vlc_ExitDestroy( &priv->exit );
-    vlc_mutex_destroy( &priv->timer_lock );
     vlc_mutex_destroy( &priv->ml_lock );
 
 #ifndef NDEBUG /* Hack to dump leaked objects tree */
@@ -851,7 +847,7 @@ int libvlc_InternalAddIntf( libvlc_int_t *p_libvlc, char const *psz_module )
         char *psz_interface = var_CreateGetNonEmptyString( p_libvlc, "intf" );
         if( !psz_interface ) /* "intf" has not been set */
         {
-#ifndef WIN32
+#if !defined( WIN32 ) && !defined( __OS2__ )
             if( b_daemon )
                  /* Daemon mode hack.
                   * We prefer the dummy interface if none is specified. */