*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
- * Gildas Bazin <gbazin@netcourrier.com>
+ * Gildas Bazin <gbazin@videolan.org>
* Derk-Jan Hartman <hartman at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
# include <locale.h>
#endif
+#ifdef HAVE_HAL
+# include <hal/libhal.h>
+#endif
+
#include "vlc_cpu.h" /* CPU detection */
#include "os_specific.h"
static int VerboseCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
+static void InitDeviceValues( vlc_t * );
+
/*****************************************************************************
* vlc_current_object: return the current object.
*****************************************************************************
#ifndef WIN32
if( config_GetInt( p_vlc, "daemon" ) )
{
- pid_t i_pid = 0;
+#if HAVE_DAEMON
+ if( daemon( 0, 0) != 0 )
+ {
+ msg_Err( p_vlc, "Unable to fork vlc to daemon mode" );
+ b_exit = VLC_TRUE;
+ }
+
+ p_vlc->p_libvlc->b_daemon = VLC_TRUE;
+
+#else
+ pid_t i_pid;
if( ( i_pid = fork() ) < 0 )
{
{
/* We are the child */
msg_Dbg( p_vlc, "daemon spawned" );
- close( 0 );
- close( 1 );
- close( 2 );
+ close( STDIN_FILENO );
+ close( STDOUT_FILENO );
+ close( STDERR_FILENO );
p_vlc->p_libvlc->b_daemon = VLC_TRUE;
}
+#endif
}
#endif
/* Translate "C" to the language code: "fr", "en_GB", "nl", "ru"... */
msg_Dbg( p_vlc, "translation test: code is \"%s\"", _("C") );
- textdomain( PACKAGE );
+ textdomain( PACKAGE_NAME );
#if defined( ENABLE_UTF8 )
- bind_textdomain_codeset( PACKAGE, "UTF-8" );
+ bind_textdomain_codeset( PACKAGE_NAME, "UTF-8" );
#endif
module_EndBank( p_vlc );
return VLC_EEXIT;
}
+ /*
+ * Init device values
+ */
+ InitDeviceValues( p_vlc );
+
/*
* Override default configuration with config file settings
*/
/*****************************************************************************
* VLC_VariableGet: get a vlc variable
*****************************************************************************/
-int VLC_Get( int i_object, char const *psz_var, vlc_value_t *p_value )
+int VLC_VariableGet( int i_object, char const *psz_var, vlc_value_t *p_value )
{
vlc_t *p_vlc = vlc_current_object( i_object );
int i_ret;
return VLC_ENOOBJ;
}
- i_ret = var_Get( p_vlc, psz_var, p_value );
+ i_ret = var_Get( p_vlc , psz_var, p_value );
if( i_object ) vlc_object_release( p_vlc );
return i_ret;
"locale" );
psz_path = psz_tmp;
#endif
- if( !bindtextdomain( PACKAGE, psz_path ) )
+ if( !bindtextdomain( PACKAGE_NAME, psz_path ) )
{
fprintf( stderr, "warning: no domain %s in directory %s\n",
- PACKAGE, psz_path );
+ PACKAGE_NAME, psz_path );
}
/* Set the default domain */
- textdomain( PACKAGE );
+ textdomain( PACKAGE_NAME );
#if defined( ENABLE_UTF8 )
- bind_textdomain_codeset( PACKAGE, "UTF-8" );
+ bind_textdomain_codeset( PACKAGE_NAME, "UTF-8" );
#endif
#endif
static void ShowConsole( void )
{
# ifndef UNDER_CE
+
+ if( getenv( "PWD" ) && getenv( "PS1" ) ) return; /* cygwin shell */
+
AllocConsole();
freopen( "CONOUT$", "w", stdout );
freopen( "CONOUT$", "w", stderr );
freopen( "CONIN$", "r", stdin );
# endif
+
return;
}
#endif
}
return VLC_SUCCESS;
}
+
+/*****************************************************************************
+ * InitDeviceValues: initialize device values
+ *****************************************************************************
+ * This function inits the dvd, vcd and cd-audio values
+ *****************************************************************************/
+static void InitDeviceValues( vlc_t *p_vlc )
+{
+#ifdef HAVE_HAL
+ LibHalContext * ctx;
+ int i, i_devices;
+ char **devices;
+ char *block_dev;
+ dbus_bool_t b_dvd;
+
+ if( ( ctx = hal_initialize( NULL, FALSE ) ) )
+ {
+ if( ( devices = hal_get_all_devices( ctx, &i_devices ) ) )
+ {
+ for( i = 0; i < i_devices; i++ )
+ {
+ if( !hal_device_property_exists( ctx, devices[ i ],
+ "storage.cdrom.dvd" ) )
+ {
+ continue;
+ }
+
+ b_dvd = hal_device_get_property_bool( ctx, devices[ i ],
+ "storage.cdrom.dvd" );
+ block_dev = hal_device_get_property_string( ctx, devices[ i ],
+ "block.device" );
+
+ if( b_dvd )
+ {
+ config_PutPsz( p_vlc, "dvd", block_dev );
+ }
+
+ config_PutPsz( p_vlc, "vcd", block_dev );
+ config_PutPsz( p_vlc, "cd-audio", block_dev );
+
+ hal_free_string( block_dev );
+ }
+ }
+
+ hal_shutdown( ctx );
+ }
+#endif
+}