/*****************************************************************************
* Local prototypes
*****************************************************************************/
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
/* store relation between item id and udi for ejection */
struct udi_input_id_t
{
LibHalContext *p_ctx;
playlist_item_t *p_node_cat;
playlist_item_t *p_node_one;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
int i_devices_number;
struct udi_input_id_t **pp_devices;
#endif
static int Open ( vlc_object_t * );
static void Close( vlc_object_t * );
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
/* HAL callbacks */
void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi );
void DeviceRemoved( LibHalContext *p_ctx, const char *psz_udi );
playlist_t *p_playlist;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
DBusError dbus_error;
DBusConnection *p_connection;
p_sd->pf_run = Run;
p_sd->p_sys = p_sys;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
dbus_error_init( &dbus_error );
p_sys->p_ctx = libhal_ctx_new();
if( !(p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) )
#endif
{
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
msg_Err( p_sd, "hal not available : %s", dbus_error.message );
dbus_error_free( &dbus_error );
#else
return VLC_EGENERIC;
}
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
if( !libhal_ctx_set_device_added( p_sys->p_ctx, DeviceAdded ) ||
!libhal_ctx_set_device_removed( p_sys->p_ctx, DeviceRemoved ) )
{
vlc_object_release( p_playlist );
}
free( p_sys );
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
struct udi_input_id_t *p_udi_entry;
while( p_sys->i_devices_number > 0 )
}
static void AddItem( services_discovery_t *p_sd, input_item_t * p_input
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
,char* psz_device
#endif
)
vlc_object_release( p_playlist );
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
struct udi_input_id_t *p_udi_entry;
p_udi_entry = malloc( sizeof( struct udi_input_id_t ) );
if( !p_udi_entry )
char *psz_uri;
char *psz_blockdevice;
input_item_t *p_input;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
psz_name = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "volume.label", NULL );
psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
{
return;
}
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
AddItem( p_sd, p_input, psz_device );
#else
AddItem( p_sd, p_input );
#endif
}
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
static void DelItem( services_discovery_t *p_sd, char* psz_udi )
{
services_discovery_sys_t *p_sys = p_sd->p_sys;
char *psz_uri;
char *psz_blockdevice;
input_item_t *p_input;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "block.device", NULL );
#else
free( psz_uri );
if( !p_input )
return;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
AddItem( p_sd, p_input, psz_device );
#else
AddItem( p_sd, p_input );
{
char *psz_disc_type;
services_discovery_sys_t *p_sys = p_sd->p_sys;
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
if( libhal_device_property_exists( p_sys->p_ctx, psz_device,
"volume.disc.type", NULL ) )
{
#endif
if( !strcmp( psz_disc_type, "dvd_rom" ) )
{
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
/* hal 0.2.9.7 (HAVE_HAL) has not is_videodvd
* but hal 0.5.0 (HAVE_HAL_1) has */
if (libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
}
else if( !strcmp( psz_disc_type, "cd_rom" ) )
{
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
if( libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
"volume.disc.has_audio" , NULL ) )
#else
services_discovery_sys_t *p_sys = p_sd->p_sys;
/* parse existing devices first */
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
if( ( devices = libhal_get_all_devices( p_sys->p_ctx, &i_devices, NULL ) ) )
#else
if( ( devices = hal_get_all_devices( p_sys->p_ctx, &i_devices ) ) )
for( i = 0; i < i_devices; i++ )
{
ParseDevice( p_sd, devices[ i ] );
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
libhal_free_string( devices[ i ] );
#else
hal_free_string( devices[ i ] );
}
}
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
while( !p_sd->b_die )
{
/* look for events on the bus, blocking 1 second */
}
-#if defined( HAVE_HAL_1 ) && defined( HAVE_DBUS_2 )
+#ifdef HAVE_HAL_1
void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi )
{
ParseDevice( p_sd_global, (char*) psz_udi );