Commit c75dafab authored by Rafaël Carré's avatar Rafaël Carré

Remove support DBus & HAL APIs

Acked by DBus code maintainers
parent 5b49b6b1
...@@ -861,20 +861,13 @@ AC_ARG_ENABLE(hal, ...@@ -861,20 +861,13 @@ AC_ARG_ENABLE(hal,
if test "${enable_hal}" != "no" if test "${enable_hal}" != "no"
then then
PKG_CHECK_MODULES(HAL, hal >= 0.5.0, PKG_CHECK_MODULES(HAL, hal >= 0.5.0,
[ AC_DEFINE( HAVE_HAL_1, 1 , [Define if you have the new HAL library API]) [
AC_DEFINE( HAVE_HAL, 1, [Define if you have the HAL library] ) AC_DEFINE( HAVE_HAL, 1, [Define if you have the HAL library] )
VLC_ADD_PLUGIN([hal]) VLC_ADD_PLUGIN([hal])
VLC_ADD_PLUGIN([probe_hal]) VLC_ADD_PLUGIN([probe_hal])
VLC_ADD_LIBS([libvlc hal probe_hal],[$HAL_LIBS]) VLC_ADD_LIBS([libvlc hal probe_hal],[$HAL_LIBS])
VLC_ADD_CFLAGS([libvlc hal probe_hal],[$HAL_CFLAGS])], VLC_ADD_CFLAGS([libvlc hal probe_hal],[$HAL_CFLAGS])],
dnl No hal 0.5 Test for 0.2 [AC_MSG_ERROR([libhal >= 0.5.0 was not found. Install libhal-dev ?])]
[ PKG_CHECK_MODULES( HAL, hal >= 0.2.97,
[AC_DEFINE(HAVE_HAL, 1, [Define if you have the HAL library])
VLC_ADD_PLUGIN([hal])
VLC_ADD_LIBS([libvlc hal],[$HAL_LIBS])
VLC_ADD_CFLAGS([libvlc hal],[$HAL_CFLAGS])],
[AC_MSG_WARN(HAL library not found)])
]
) )
fi fi
...@@ -887,10 +880,7 @@ if test "${enable_dbus}" != "no" ...@@ -887,10 +880,7 @@ if test "${enable_dbus}" != "no"
then then
dnl api stable dbus dnl api stable dbus
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0, PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.0.0,
[ AC_DEFINE( HAVE_DBUS_3, 1, [Define if you have the D-BUS library API >= 1.0.0] ) [ AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LIBS([screensaver libvlc],[$DBUS_LIBS]) VLC_ADD_LIBS([screensaver libvlc],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver libvlc],[$DBUS_CFLAGS]) VLC_ADD_CFLAGS([screensaver libvlc],[$DBUS_CFLAGS])
dnl Check for dbus control interface dnl Check for dbus control interface
...@@ -912,49 +902,8 @@ then ...@@ -912,49 +902,8 @@ then
VLC_ADD_PLUGIN([inhibit]) VLC_ADD_PLUGIN([inhibit])
VLC_ADD_LIBS([inhibit],[$DBUS_LIBS]) VLC_ADD_LIBS([inhibit],[$DBUS_LIBS])
VLC_ADD_CFLAGS([inhibit],[$DBUS_CFLAGS]) VLC_ADD_CFLAGS([inhibit],[$DBUS_CFLAGS])
], ],
if ${PKG_CONFIG} --exists dbus-1 [AC_MSG_ERROR([Couldn't find DBus >= 1.0.0, install libdbus-dev ?])]
then
[AC_ARG_ENABLE(old-dbus,
[ --enable-old-dbus Deprecated D-Bus support (default disabled)])]
if test "${enable_old_dbus}" != "yes"
then
echo ""
echo "****** WARNING **** WARNING ***** WARNING *************"
echo "*** Your D-Bus version is < 1.0.0"
echo "*** You are using old and buggy software and so"
echo "*** D-Bus support has been disabled."
echo "*** Please upgrade D-Bus : http://dbus.freedesktop.org"
echo "*** Alternatively you can force the use of your old and"
echo "*** buggy D-Bus version by specifying --enable-old-dbus"
echo "*******************************************************"
echo ""
else
dnl not too old dbus
[ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.92,
[ AC_DEFINE( HAVE_DBUS_2, 1, [Define if you have the D-BUS library API >= 0.92] )
AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LIBS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
dnl older dbus
[ PKG_CHECK_MODULES(DBUS, dbus-1 >= 0.30,
[ AC_DEFINE( HAVE_DBUS_1, 1, [Define if you have the D-BUS library API >= 0.30 ] )
AC_DEFINE( HAVE_DBUS, 1, [Define if you have the D-BUS library] )
VLC_ADD_LIBS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
dnl much older dbus
[ PKG_CHECK_MODULES( DBUS, dbus-1,
[AC_DEFINE(HAVE_DBUS, 1, [Define if you have the D-BUS library])
VLC_ADD_LIBS([screensaver],[$DBUS_LIBS])
VLC_ADD_CFLAGS([screensaver],[$DBUS_CFLAGS])],
[AC_MSG_WARN(DBUS library not found)])
]
)]
)]
fi
fi
) )
fi fi
;; ;;
......
...@@ -57,9 +57,6 @@ ...@@ -57,9 +57,6 @@
#cmakedefine HAVE_D3D9_H #cmakedefine HAVE_D3D9_H
#cmakedefine HAVE_DAEMON #cmakedefine HAVE_DAEMON
#cmakedefine HAVE_DBUS #cmakedefine HAVE_DBUS
#cmakedefine HAVE_DBUS_1
#cmakedefine HAVE_DBUS_2
#cmakedefine HAVE_DBUS_3
#cmakedefine HAVE_DCGETTEXT #cmakedefine HAVE_DCGETTEXT
#cmakedefine HAVE_DDRAW_H #cmakedefine HAVE_DDRAW_H
#cmakedefine HAVE_DECL_FEOF_UNLOCKED #cmakedefine HAVE_DECL_FEOF_UNLOCKED
...@@ -122,7 +119,6 @@ ...@@ -122,7 +119,6 @@
#cmakedefine HAVE_GMTIME_R #cmakedefine HAVE_GMTIME_R
#cmakedefine HAVE_GOOM_GOOM_H #cmakedefine HAVE_GOOM_GOOM_H
#cmakedefine HAVE_HAL #cmakedefine HAVE_HAL
#cmakedefine HAVE_HAL_1
#cmakedefine HAVE_ICONV #cmakedefine HAVE_ICONV
#cmakedefine HAVE_ID3TAG_H #cmakedefine HAVE_ID3TAG_H
#cmakedefine HAVE_IF_NAMETOINDEX #cmakedefine HAVE_IF_NAMETOINDEX
......
...@@ -497,7 +497,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -497,7 +497,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
ui.updatesDays->hide(); ui.updatesDays->hide();
#endif #endif
/* ONE INSTANCE options */ /* ONE INSTANCE options */
#if defined( WIN32 ) || defined( HAVE_DBUS_3 ) || defined(__APPLE__) #if defined( WIN32 ) || defined( HAVE_DBUS ) || defined(__APPLE__)
CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode ); CONFIG_GENERIC( "one-instance", Bool, NULL, OneInterfaceMode );
CONFIG_GENERIC( "playlist-enqueue", Bool, NULL, CONFIG_GENERIC( "playlist-enqueue", Bool, NULL,
EnqueueOneInterfaceMode ); EnqueueOneInterfaceMode );
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#ifdef HAVE_DBUS #ifdef HAVE_DBUS
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h> #include <dbus/dbus.h>
#define GS_SERVICE "org.gnome.ScreenSaver" #define GS_SERVICE "org.gnome.ScreenSaver"
...@@ -56,11 +55,6 @@ ...@@ -56,11 +55,6 @@
#endif #endif
/* this is for dbus < 0.3 */
#ifndef HAVE_DBUS_1
#define dbus_bus_name_has_owner(connection, name, err) dbus_bus_service_exists(connection, name, err)
#endif
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
...@@ -123,11 +117,7 @@ static void Deactivate( vlc_object_t *p_this ) ...@@ -123,11 +117,7 @@ static void Deactivate( vlc_object_t *p_this )
if( p_intf->p_sys->p_connection ) if( p_intf->p_sys->p_connection )
{ {
# ifdef HAVE_DBUS_2
dbus_connection_unref( p_intf->p_sys->p_connection ); dbus_connection_unref( p_intf->p_sys->p_connection );
# else
dbus_connection_disconnect( p_intf->p_sys->p_connection );
# endif
} }
free( p_intf->p_sys ); free( p_intf->p_sys );
......
...@@ -49,36 +49,32 @@ ...@@ -49,36 +49,32 @@
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
*****************************************************************************/ *****************************************************************************/
#ifdef HAVE_HAL_1
/* store relation between item id and udi for ejection */ /* store relation between item id and udi for ejection */
struct udi_input_id_t struct udi_input_id_t
{ {
char *psz_udi; char *psz_udi;
input_item_t *p_item; input_item_t *p_item;
}; };
#endif
struct services_discovery_sys_t struct services_discovery_sys_t
{ {
LibHalContext *p_ctx; LibHalContext *p_ctx;
#ifdef HAVE_HAL_1
DBusConnection *p_connection; DBusConnection *p_connection;
int i_devices_number; int i_devices_number;
struct udi_input_id_t **pp_devices; struct udi_input_id_t **pp_devices;
#endif
}; };
static void Run ( services_discovery_t *p_intf ); static void Run ( services_discovery_t *p_intf );
static int Open ( vlc_object_t * ); static int Open ( vlc_object_t * );
static void Close( vlc_object_t * ); static void Close( vlc_object_t * );
#ifdef HAVE_HAL_1
/* HAL callbacks */ /* HAL callbacks */
void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi ); void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi );
void DeviceRemoved( LibHalContext *p_ctx, const char *psz_udi ); void DeviceRemoved( LibHalContext *p_ctx, const char *psz_udi );
/* to retrieve p_sd in HAL callbacks */ /* to retrieve p_sd in HAL callbacks */
services_discovery_t *p_sd_global; services_discovery_t *p_sd_global;
#endif
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
...@@ -105,19 +101,16 @@ static int Open( vlc_object_t *p_this ) ...@@ -105,19 +101,16 @@ static int Open( vlc_object_t *p_this )
if( !p_sys ) if( !p_sys )
return VLC_ENOMEM; return VLC_ENOMEM;
#ifdef HAVE_HAL_1
DBusError dbus_error; DBusError dbus_error;
DBusConnection *p_connection; DBusConnection *p_connection;
p_sd_global = p_sd; p_sd_global = p_sd;
p_sys->i_devices_number = 0; p_sys->i_devices_number = 0;
p_sys->pp_devices = NULL; p_sys->pp_devices = NULL;
#endif
p_sd->pf_run = Run; p_sd->pf_run = Run;
p_sd->p_sys = p_sys; p_sd->p_sys = p_sys;
#ifdef HAVE_HAL_1
dbus_error_init( &dbus_error ); dbus_error_init( &dbus_error );
p_sys->p_ctx = libhal_ctx_new(); p_sys->p_ctx = libhal_ctx_new();
...@@ -138,30 +131,21 @@ static int Open( vlc_object_t *p_this ) ...@@ -138,30 +131,21 @@ static int Open( vlc_object_t *p_this )
libhal_ctx_set_dbus_connection( p_sys->p_ctx, p_connection ); libhal_ctx_set_dbus_connection( p_sys->p_ctx, p_connection );
p_sys->p_connection = p_connection; p_sys->p_connection = p_connection;
if( !libhal_ctx_init( p_sys->p_ctx, &dbus_error ) ) if( !libhal_ctx_init( p_sys->p_ctx, &dbus_error ) )
#else
if( !(p_sys->p_ctx = hal_initialize( NULL, FALSE ) ) )
#endif
{ {
#ifdef HAVE_HAL_1
msg_Err( p_sd, "hal not available : %s", dbus_error.message ); msg_Err( p_sd, "hal not available : %s", dbus_error.message );
dbus_error_free( &dbus_error ); dbus_error_free( &dbus_error );
#else
msg_Err( p_sd, "hal not available" );
#endif
free( p_sys ); free( p_sys );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
#ifdef HAVE_HAL_1 if( !libhal_ctx_set_device_added( p_sys->p_ctx, DeviceAdded ) ||
if( !libhal_ctx_set_device_added( p_sys->p_ctx, DeviceAdded ) || !libhal_ctx_set_device_removed( p_sys->p_ctx, DeviceRemoved ) )
!libhal_ctx_set_device_removed( p_sys->p_ctx, DeviceRemoved ) ) {
{ msg_Err( p_sd, "unable to add callback" );
msg_Err( p_sd, "unable to add callback" ); dbus_error_free( &dbus_error );
dbus_error_free( &dbus_error ); free( p_sys );
free( p_sys ); return VLC_EGENERIC;
return VLC_EGENERIC; }
}
#endif
services_discovery_SetLocalizedName( p_sd, _("Devices") ); services_discovery_SetLocalizedName( p_sd, _("Devices") );
...@@ -175,7 +159,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -175,7 +159,7 @@ static void Close( vlc_object_t *p_this )
{ {
services_discovery_t *p_sd = ( services_discovery_t* )p_this; services_discovery_t *p_sd = ( services_discovery_t* )p_this;
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
#ifdef HAVE_HAL_1
dbus_connection_unref( p_sys->p_connection ); dbus_connection_unref( p_sys->p_connection );
struct udi_input_id_t *p_udi_entry; struct udi_input_id_t *p_udi_entry;
...@@ -188,20 +172,16 @@ static void Close( vlc_object_t *p_this ) ...@@ -188,20 +172,16 @@ static void Close( vlc_object_t *p_this )
free( p_udi_entry ); free( p_udi_entry );
} }
p_sys->pp_devices = NULL; p_sys->pp_devices = NULL;
#endif
free( p_sys ); free( p_sys );
} }
static void AddItem( services_discovery_t *p_sd, input_item_t * p_input static void AddItem( services_discovery_t *p_sd, input_item_t * p_input,
#ifdef HAVE_HAL_1 const char* psz_device )
, const char* psz_device
#endif
)
{ {
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
services_discovery_AddItem( p_sd, p_input, NULL /* no category */ ); services_discovery_AddItem( p_sd, p_input, NULL /* no category */ );
#ifdef HAVE_HAL_1
struct udi_input_id_t *p_udi_entry; struct udi_input_id_t *p_udi_entry;
p_udi_entry = malloc( sizeof( struct udi_input_id_t ) ); p_udi_entry = malloc( sizeof( struct udi_input_id_t ) );
if( !p_udi_entry ) if( !p_udi_entry )
...@@ -216,7 +196,6 @@ static void AddItem( services_discovery_t *p_sd, input_item_t * p_input ...@@ -216,7 +196,6 @@ static void AddItem( services_discovery_t *p_sd, input_item_t * p_input
vlc_gc_incref( p_input ); vlc_gc_incref( p_input );
p_udi_entry->p_item = p_input; p_udi_entry->p_item = p_input;
TAB_APPEND( p_sys->i_devices_number, p_sys->pp_devices, p_udi_entry ); TAB_APPEND( p_sys->i_devices_number, p_sys->pp_devices, p_udi_entry );
#endif
} }
static void AddDvd( services_discovery_t *p_sd, const char *psz_device ) static void AddDvd( services_discovery_t *p_sd, const char *psz_device )
...@@ -225,17 +204,12 @@ static void AddDvd( services_discovery_t *p_sd, const char *psz_device ) ...@@ -225,17 +204,12 @@ static void AddDvd( services_discovery_t *p_sd, const char *psz_device )
char *psz_uri; char *psz_uri;
char *psz_blockdevice; char *psz_blockdevice;
input_item_t *p_input; input_item_t *p_input;
#ifdef HAVE_HAL_1
psz_name = libhal_device_get_property_string( p_sd->p_sys->p_ctx, psz_name = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "volume.label", NULL ); psz_device, "volume.label", NULL );
psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx, psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "block.device", NULL ); psz_device, "block.device", NULL );
#else
psz_name = hal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "volume.label" );
psz_blockdevice = hal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "block.device" );
#endif
if( asprintf( &psz_uri, "dvd://%s", psz_blockdevice ) == -1 ) if( asprintf( &psz_uri, "dvd://%s", psz_blockdevice ) == -1 )
return; return;
/* Create the playlist item here */ /* Create the playlist item here */
...@@ -245,15 +219,12 @@ static void AddDvd( services_discovery_t *p_sd, const char *psz_device ) ...@@ -245,15 +219,12 @@ static void AddDvd( services_discovery_t *p_sd, const char *psz_device )
{ {
return; return;
} }
#ifdef HAVE_HAL_1
AddItem( p_sd, p_input, psz_device ); AddItem( p_sd, p_input, psz_device );
#else
AddItem( p_sd, p_input );
#endif
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
} }
#ifdef HAVE_HAL_1
static void DelItem( services_discovery_t *p_sd, const char* psz_udi ) static void DelItem( services_discovery_t *p_sd, const char* psz_udi )
{ {
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
...@@ -271,20 +242,16 @@ static void DelItem( services_discovery_t *p_sd, const char* psz_udi ) ...@@ -271,20 +242,16 @@ static void DelItem( services_discovery_t *p_sd, const char* psz_udi )
} }
} }
} }
#endif
static void AddCdda( services_discovery_t *p_sd, const char *psz_device ) static void AddCdda( services_discovery_t *p_sd, const char *psz_device )
{ {
char *psz_uri; char *psz_uri;
char *psz_blockdevice; char *psz_blockdevice;
input_item_t *p_input; input_item_t *p_input;
#ifdef HAVE_HAL_1
psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx, psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "block.device", NULL ); psz_device, "block.device", NULL );
#else
psz_blockdevice = hal_device_get_property_string( p_sd->p_sys->p_ctx,
psz_device, "block.device" );
#endif
if( asprintf( &psz_uri, "cdda://%s", psz_blockdevice ) == -1 ) if( asprintf( &psz_uri, "cdda://%s", psz_blockdevice ) == -1 )
return; return;
/* Create the item here */ /* Create the item here */
...@@ -292,11 +259,9 @@ static void AddCdda( services_discovery_t *p_sd, const char *psz_device ) ...@@ -292,11 +259,9 @@ static void AddCdda( services_discovery_t *p_sd, const char *psz_device )
free( psz_uri ); free( psz_uri );
if( !p_input ) if( !p_input )
return; return;
#ifdef HAVE_HAL_1
AddItem( p_sd, p_input, psz_device ); AddItem( p_sd, p_input, psz_device );
#else
AddItem( p_sd, p_input );
#endif
vlc_gc_decref( p_input ); vlc_gc_decref( p_input );
} }
...@@ -304,45 +269,26 @@ static void ParseDevice( services_discovery_t *p_sd, const char *psz_device ) ...@@ -304,45 +269,26 @@ static void ParseDevice( services_discovery_t *p_sd, const char *psz_device )
{ {
char *psz_disc_type; char *psz_disc_type;
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
#ifdef HAVE_HAL_1
if( libhal_device_property_exists( p_sys->p_ctx, psz_device, if( libhal_device_property_exists( p_sys->p_ctx, psz_device,
"volume.disc.type", NULL ) ) "volume.disc.type", NULL ) )
return;
psz_disc_type = libhal_device_get_property_string( p_sys->p_ctx,
psz_device,
"volume.disc.type",
NULL );
if( !strncmp( psz_disc_type, "dvd_r", 5 ) )
{ {
psz_disc_type = libhal_device_get_property_string( p_sys->p_ctx, if (libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
psz_device, "volume.disc.is_videodvd", NULL ) )
"volume.disc.type", AddDvd( p_sd, psz_device );
NULL ); }
#else else if( !strncmp( psz_disc_type, "cd_r", 4 ) )
if( hal_device_property_exists( p_sys->p_ctx, psz_device,
"volume.disc.type" ) )
{ {
psz_disc_type = hal_device_get_property_string( p_sys->p_ctx, if( libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
psz_device, "volume.disc.has_audio" , NULL ) )
"volume.disc.type" ); AddCdda( p_sd, psz_device );
#endif
if( !strncmp( psz_disc_type, "dvd_r", 5 ) )
{
#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,
"volume.disc.is_videodvd", NULL ) )
#endif
AddDvd( p_sd, psz_device );
}
else if( !strncmp( psz_disc_type, "cd_r", 4 ) )
{
#ifdef HAVE_HAL_1
if( libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
"volume.disc.has_audio" , NULL ) )
#else
if( hal_device_get_property_bool( p_sys->p_ctx, psz_device,
"volume.disc.has_audio" ) )
#endif
{
AddCdda( p_sd, psz_device );
}
}
} }
} }
...@@ -356,44 +302,30 @@ static void Run( services_discovery_t *p_sd ) ...@@ -356,44 +302,30 @@ static void Run( services_discovery_t *p_sd )
services_discovery_sys_t *p_sys = p_sd->p_sys; services_discovery_sys_t *p_sys = p_sd->p_sys;
/* parse existing devices first */ /* parse existing devices first */
#ifdef HAVE_HAL_1
if( ( devices = libhal_get_all_devices( p_sys->p_ctx, &i_devices, NULL ) ) ) 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 ) ) )
#endif
{ {
for( i = 0; i < i_devices; i++ ) for( i = 0; i < i_devices; i++ )
{ {
ParseDevice( p_sd, devices[ i ] ); ParseDevice( p_sd, devices[ i ] );
#ifdef HAVE_HAL_1
libhal_free_string( devices[ i ] ); libhal_free_string( devices[ i ] );
#else
hal_free_string( devices[ i ] );
#endif
} }
} }
#ifdef HAVE_HAL_1
while( !p_sd->b_die ) while( !p_sd->b_die )
{ {
/* look for events on the bus, blocking 1 second */ /* look for events on the bus, blocking 1 second */
dbus_connection_read_write_dispatch( p_sys->p_connection, 1000 ); dbus_connection_read_write_dispatch( p_sys->p_connection, 1000 );
/* HAL 0.5.8.1 can use libhal_ctx_get_dbus_connection(p_sys->p_ctx) */ /* HAL 0.5.8.1 can use libhal_ctx_get_dbus_connection(p_sys->p_ctx) */
} }
#endif
} }
#ifdef HAVE_HAL_1
void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi ) void DeviceAdded( LibHalContext *p_ctx, const char *psz_udi )
{ {
VLC_UNUSED(p_ctx); VLC_UNUSED(p_ctx);
ParseDevice( p_sd_global, psz_udi ); ParseDevice( p_sd_global, psz_udi );
} }
void DeviceRemoved( LibHalContext *p_ctx, const char *psz_udi ) void DeviceRemoved( LibHalContext *p_ctx, const char *psz_udi )
{ {
VLC_UNUSED(p_ctx); VLC_UNUSED(p_ctx);
DelItem( p_sd_global, psz_udi ); DelItem( p_sd_global, psz_udi );
} }
#endif
...@@ -1824,7 +1824,7 @@ vlc_module_begin(); ...@@ -1824,7 +1824,7 @@ vlc_module_begin();
change_need_restart(); change_need_restart();
#endif #endif
#if defined(HAVE_DBUS_3) #if defined(HAVE_DBUS)
add_bool( "one-instance", 0, NULL, ONEINSTANCE_DBUS_TEXT, add_bool( "one-instance", 0, NULL, ONEINSTANCE_DBUS_TEXT,
ONEINSTANCE_DBUS_LONGTEXT, true ); ONEINSTANCE_DBUS_LONGTEXT, true );
add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT, add_bool( "playlist-enqueue", 0, NULL, PLAYLISTENQUEUE_TEXT,
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
# include <locale.h> # include <locale.h>
#endif #endif
#ifdef HAVE_DBUS_3 #ifdef HAVE_DBUS
/* used for one-instance mode */ /* used for one-instance mode */
# include <dbus/dbus.h> # include <dbus/dbus.h>
#endif #endif
...@@ -506,7 +506,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -506,7 +506,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
system_Configure( p_libvlc, &i_argc, ppsz_argv ); system_Configure( p_libvlc, &i_argc, ppsz_argv );
/* FIXME: could be replaced by using Unix sockets */ /* FIXME: could be replaced by using Unix sockets */
#ifdef HAVE_DBUS_3 #ifdef HAVE_DBUS
dbus_threads_init_default(); dbus_threads_init_default();
if( config_GetInt( p_libvlc, "one-instance" ) > 0 ) if( config_GetInt( p_libvlc, "one-instance" ) > 0 )
...@@ -806,7 +806,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -806,7 +806,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
*/ */
libvlc_InternalAddIntf( p_libvlc, "hotkeys,none", false ); libvlc_InternalAddIntf( p_libvlc, "hotkeys,none", false );
#ifdef HAVE_DBUS_3 #ifdef HAVE_DBUS
/* loads dbus control interface if in one-instance mode /* loads dbus control interface if in one-instance mode
* we do it only when playlist exists, because dbus module needs it */ * we do it only when playlist exists, because dbus module needs it */
if( config_GetInt( p_libvlc, "one-instance" ) > 0 ) if( config_GetInt( p_libvlc, "one-instance" ) > 0 )
...@@ -1966,7 +1966,6 @@ static void InitDeviceValues( libvlc_int_t *p_vlc ) ...@@ -1966,7 +1966,6 @@ static void InitDeviceValues( libvlc_int_t *p_vlc )
char *block_dev = NULL; char *block_dev = NULL;
dbus_bool_t b_dvd; dbus_bool_t b_dvd;
#ifdef HAVE_HAL_1
DBusConnection *p_connection = NULL; DBusConnection *p_connection = NULL;
DBusError error; DBusError error;
...@@ -1982,41 +1981,20 @@ static void InitDeviceValues( libvlc_int_t *p_vlc ) ...@@ -1982,41 +1981,20 @@ static void InitDeviceValues( libvlc_int_t *p_vlc )
} }
libhal_ctx_set_dbus_connection( ctx, p_connection ); libhal_ctx_set_dbus_connection( ctx, p_connection );
if( libhal_ctx_init( ctx, &error ) ) if( libhal_ctx_init( ctx, &error ) )
#else
ctx = hal_initialize( NULL, FALSE );
if( ctx )
#endif
{ {
#ifdef HAVE_HAL_1
if( ( devices = libhal_get_all_devices( ctx, &i_devices, NULL ) ) ) if( ( devices = libhal_get_all_devices( ctx, &i_devices, NULL ) ) )
#else
if( ( devices = hal_get_all_devices( ctx, &i_devices ) ) )
#endif
{ {
for( i = 0; i < i_devices; i++ ) for( i = 0; i < i_devices; i++ )
{ {
#ifdef HAVE_HAL_1
if( !libhal_device_property_exists( ctx, devices[i], if( !libhal_device_property_exists( ctx, devices[i],
"storage.cdrom.dvd", NULL ) ) "storage.cdrom.dvd", NULL ) )
#else
if( !hal_device_property_exists( ctx, devices[ i ],
"storage.cdrom.dvd" ) )
#endif
{ {
continue; continue;
} }
#ifdef HAVE_HAL_1
b_dvd = libhal_device_get_property_bool( ctx, devices[ i ], b_dvd = libhal_device_get_property_bool( ctx, devices[ i ],
"storage.cdrom.dvd", NULL ); "storage.cdrom.dvd", NULL );
block_dev = libhal_device_get_property_string( ctx, block_dev = libhal_device_get_property_string( ctx,
devices[ i ], "block.device" , NULL ); devices[ i ], "block.device" , NULL );
#else
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" );
#endif
if( b_dvd ) if( b_dvd )
{ {
config_PutPsz( p_vlc, "dvd", block_dev ); config_PutPsz( p_vlc, "dvd", block_dev );
...@@ -2024,26 +2002,13 @@ static void InitDeviceValues( libvlc_int_t *p_vlc ) ...@@ -2024,26 +2002,13 @@ static void InitDeviceValues( libvlc_int_t *p_vlc )
config_PutPsz( p_vlc, "vcd", block_dev ); config_PutPsz( p_vlc, "vcd", block_dev );
config_PutPsz( p_vlc, "cd-audio", block_dev ); config_PutPsz( p_vlc, "cd-audio", block_dev );
#ifdef HAVE_HAL_1
libhal_free_string( block_dev ); libhal_free_string( block_dev );
#else
hal_free_string( block_dev );
#endif
} }
#ifdef HAVE_HAL_1
libhal_free_string_array( devices ); libhal_free_string_array( devices );
#else
hal_free_string_array( devices );
#endif
} }
#ifdef HAVE_HAL_1
libhal_ctx_shutdown( ctx, NULL ); libhal_ctx_shutdown( ctx, NULL );
dbus_connection_unref( p_connection ); dbus_connection_unref( p_connection );
libhal_ctx_free( ctx ); libhal_ctx_free( ctx );
#else
hal_shutdown( ctx );
#endif
} }
else else
{ {
......
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