Commit 856b6e43 authored by Jon Lech Johansen's avatar Jon Lech Johansen

* ./src/libvlc.c: initialize dvd/vcd/cd-audio values using HAL.

parent e3a6345c
......@@ -668,6 +668,13 @@ if test "${x_libraries}" = "NONE"; then
x_libraries="/usr/X11R6/lib"
fi
dnl Check for hal
PKG_CHECK_MODULES(HAL, hal >= 0.2.97,
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
VLC_ADD_LDFLAGS([vlc],[$HAL_LIBS])
VLC_ADD_CFLAGS([vlc],[$HAL_CFLAGS])],
[AC_MSG_WARN(HAL library not found)])
dnl Build the gtk_main plugins?
NEED_GTK_MAIN=no
NEED_GNOME_MAIN=no
......
......@@ -62,6 +62,10 @@
# include <locale.h>
#endif
#ifdef HAVE_HAL
# include <hal/libhal.h>
#endif
#include "vlc_cpu.h" /* CPU detection */
#include "os_specific.h"
......@@ -103,6 +107,8 @@ static int ConsoleWidth ( void );
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.
*****************************************************************************
......@@ -488,6 +494,11 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
return VLC_EEXIT;
}
/*
* Init device values
*/
InitDeviceValues( p_vlc );
/*
* Override default configuration with config file settings
*/
......@@ -2206,3 +2217,51 @@ static int VerboseCallback( vlc_object_t *p_this, const char *psz_variable,
}
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
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment