From 2f6053d68f73fda8f96e3d03a88296aa6874e5e8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Wed, 14 Oct 2009 20:13:41 +0300 Subject: [PATCH] Remove HAL plugin It was ever dead code within VLC. On top of that, HAL is now officially deprecated in favor of libudev (and higher level D-Bus middlewares). --- configure.ac | 3 +- include/vlc_devices.h | 68 --------- modules/LIST | 1 - modules/misc/Modules.am | 2 +- modules/misc/probe/Modules.am | 1 - modules/misc/probe/hal.c | 271 ---------------------------------- po/POTFILES.in | 2 - src/Makefile.am | 2 - src/misc/devices.c | 58 -------- 9 files changed, 2 insertions(+), 406 deletions(-) delete mode 100644 include/vlc_devices.h delete mode 100644 modules/misc/probe/Modules.am delete mode 100644 modules/misc/probe/hal.c delete mode 100644 src/misc/devices.c diff --git a/configure.ac b/configure.ac index 5ca0f96892..83d643fa3b 100644 --- a/configure.ac +++ b/configure.ac @@ -4559,7 +4559,7 @@ PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services d dnl dnl HAL services discovery -PKG_ENABLE_MODULES_VLC([HAL], [], [hal >= 0.5.0], [Linux HAL services discovery], [auto]) +PKG_CHECK_MODULES([HAL], [hal >= 0.5.0],, [true]) dnl dnl MTP devices services discovery @@ -5188,7 +5188,6 @@ AC_CONFIG_FILES([ modules/misc/osd/Makefile modules/misc/stats/Makefile modules/misc/xml/Makefile - modules/misc/probe/Makefile modules/mux/Makefile modules/mux/mpeg/Makefile modules/packetizer/Makefile diff --git a/include/vlc_devices.h b/include/vlc_devices.h deleted file mode 100644 index ba0d5f8090..0000000000 --- a/include/vlc_devices.h +++ /dev/null @@ -1,68 +0,0 @@ -/***************************************************************************** - * vlc_devices.h : Devices handling - ***************************************************************************** - * Copyright (C) 1999-2006 the VideoLAN team - * $Id$ - * - * Authors: Clément Stenac - * - * 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 - * (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. - * - * 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. - *****************************************************************************/ - -#ifndef VLC_DEVICES_H -#define VLC_DEVICES_H 1 - -/** - * \file - * This file implements functions, structures for probing devices (DVD, CD, VCD) - */ - -enum -{ - DEVICE_CAN_DVD, - DEVICE_CAN_CD, -}; - -enum -{ - MEDIA_TYPE_CDDA, - MEDIA_TYPE_VCD, - MEDIA_TYPE_DVD, -}; - -struct device_t -{ - int i_capabilities; - int i_media_type; - bool b_seen; - char *psz_uri; - char *psz_name; -}; - -struct device_probe_t -{ - VLC_COMMON_MEMBERS; - int i_devices; - device_t **pp_devices; - - probe_sys_t *p_sys; - void ( *pf_run ) ( device_probe_t * ); /** Run function */ -}; - -static inline void device_GetDVD(void) -{ -} - -#endif diff --git a/modules/LIST b/modules/LIST index 51762b5808..2a69e1615e 100644 --- a/modules/LIST +++ b/modules/LIST @@ -132,7 +132,6 @@ $Id$ * growl: announce currently playing stream to growl * growl_udp: growl UDP notification plugin * h264: H264 decoder - * hal: Linux HAL services discovery module * hd1000a: audio output module for the Roku HD1000 Set-Top-Box * hd1000v: video output module for the Roku HD1000 Set-Top-Box * headphone_channel_mixer: headphone channel mixer with virtual spatialization effect diff --git a/modules/misc/Modules.am b/modules/misc/Modules.am index 4559f955da..024a4556ae 100644 --- a/modules/misc/Modules.am +++ b/modules/misc/Modules.am @@ -1,4 +1,4 @@ -BASE_SUBDIRS = dummy memcpy notify testsuite playlist stats osd xml probe +BASE_SUBDIRS = dummy memcpy notify testsuite playlist stats osd xml EXTRA_SUBDIRS = lua SUBDIRS = $(BASE_SUBDIRS) diff --git a/modules/misc/probe/Modules.am b/modules/misc/probe/Modules.am deleted file mode 100644 index e508b67e59..0000000000 --- a/modules/misc/probe/Modules.am +++ /dev/null @@ -1 +0,0 @@ -SOURCES_probe_hal = hal.c diff --git a/modules/misc/probe/hal.c b/modules/misc/probe/hal.c deleted file mode 100644 index 7bb6dcbb5d..0000000000 --- a/modules/misc/probe/hal.c +++ /dev/null @@ -1,271 +0,0 @@ -/***************************************************************************** - * hal.c : HAL probing module - ***************************************************************************** - * Copyright (C) 2004 the VideoLAN team - * $Id$ - * - * Authors: Clément Stenac - * - * 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 - * (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. - * - * 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. - *****************************************************************************/ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#include - -/***************************************************************************** - * Local prototypes - *****************************************************************************/ -struct probe_sys_t -{ - DBusConnection *p_connection; - LibHalContext *p_ctx; - int i_devices; - device_t **pp_devices; -}; - -static int Open ( vlc_object_t * ); -static void Close( vlc_object_t * ); - -static void Update ( device_probe_t *p_probe ); -static void UpdateMedia( device_probe_t *p_probe, device_t *p_dev ); -static void AddDevice( device_probe_t * p_probe, device_t *p_dev ); -static device_t * ParseDisc( device_probe_t *p_probe, char *psz_device ); - -/***************************************************************************** - * Module descriptor - *****************************************************************************/ -vlc_module_begin () - set_description( N_("HAL devices detection") ) - set_capability( "devices probe", 0 ) - set_callbacks( Open, Close ) -vlc_module_end () - - -/***************************************************************************** - * Open: initialize and create stuff - *****************************************************************************/ -static int Open( vlc_object_t *p_this ) -{ - device_probe_t *p_probe = (device_probe_t *)p_this; - DBusError dbus_error; - DBusConnection *p_connection; - probe_sys_t *p_sys; - - p_probe->p_sys = p_sys = malloc( sizeof( probe_sys_t ) ); - p_probe->p_sys->i_devices = 0; - p_probe->p_sys->pp_devices = NULL; - - p_probe->pf_run = Update; - - dbus_error_init( &dbus_error ); - - p_sys->p_ctx = libhal_ctx_new(); - if( !p_sys->p_ctx ) - { - msg_Err( p_probe, "unable to create HAL context") ; - free( p_sys ); - return VLC_EGENERIC; - } - p_connection = dbus_bus_get( DBUS_BUS_SYSTEM, &dbus_error ); - if( dbus_error_is_set( &dbus_error ) ) - { - msg_Err( p_probe, "unable to connect to DBUS: %s", dbus_error.message ); - goto error; - } - p_sys->p_connection = p_connection; - libhal_ctx_set_dbus_connection( p_sys->p_ctx, p_connection ); - if( !libhal_ctx_init( p_sys->p_ctx, &dbus_error ) ) - { - msg_Err( p_probe, "hal not available : %s", dbus_error.message ); - dbus_connection_unref( p_connection ); - goto error; - } - return VLC_SUCCESS; -error: - dbus_error_free( &dbus_error ); - libhal_ctx_free( p_sys->p_ctx ); - free( p_sys ); - return VLC_EGENERIC; -} - -/***************************************************************************** - * Close: - *****************************************************************************/ -static void Close( vlc_object_t *p_this ) -{ - device_probe_t *p_probe = (device_probe_t *) p_this; - probe_sys_t *p_sys = p_probe->p_sys; - dbus_connection_unref( p_sys->p_connection ); - libhal_ctx_free( p_sys->p_ctx ); - free( p_sys ); -} -#if 0 -static int GetAllDevices( device_probe_t *p_probe, device_t ***ppp_devices ) -{ - /// \todo : fill the dst array - return p_probe->p_sys->i_devices; -} -#endif -static void Update( device_probe_t * p_probe ) -{ - probe_sys_t *p_sys = p_probe->p_sys; - int i, i_devices, j; - char **devices; - bool b_exists; - int canc = vlc_savecancel(); - - for ( j = 0 ; j < p_sys->i_devices; j++ ) - p_sys->pp_devices[j]->b_seen = false; - - /* CD/DVD */ - if( ( devices = libhal_find_device_by_capability( p_sys->p_ctx, - "storage.cdrom", - &i_devices, NULL ) ) ) - { - for( i = 0; i < i_devices; i++ ) - { - device_t *p_dev = ParseDisc( p_probe, devices[ i ] ); - b_exists = false; - - for ( j = 0 ; j < p_sys->i_devices; j++ ) - { - if( !strcmp( p_sys->pp_devices[j]->psz_uri, - p_dev->psz_uri ) ) - { - b_exists = true; - p_dev->b_seen = true; - UpdateMedia( p_probe, p_dev ); - break; - } - if( !b_exists ) - AddDevice( p_probe, p_dev ); - } - } - } - /// \todo Remove unseen devices - vlc_restorecancel( canc ); -} - - -static void AddDevice( device_probe_t * p_probe, device_t *p_dev ) -{ - INSERT_ELEM( p_probe->p_sys->pp_devices, - p_probe->p_sys->i_devices, - p_probe->p_sys->i_devices, - p_dev ); - /// \todo : emit variable -} - -static device_t * ParseDisc( device_probe_t *p_probe, char *psz_device ) -{ - probe_sys_t *p_sys = p_probe->p_sys; - device_t *p_dev; - char *block_dev; - dbus_bool_t b_dvd; - - if( !libhal_device_property_exists( p_sys->p_ctx, psz_device, - "storage.cdrom.dvd", NULL ) ) - return NULL; - - p_dev = (device_t *)malloc( sizeof( device_t ) ); - p_dev->i_media_type = p_dev->i_capabilities = 0; - p_dev->psz_name = p_dev->psz_uri = NULL; - - block_dev = libhal_device_get_property_string( p_sys->p_ctx, psz_device, - "block.device" , NULL ); - if( block_dev ) - { - p_dev->psz_uri = strdup( block_dev ); - libhal_free_string( block_dev ); - } - - b_dvd = libhal_device_get_property_bool( p_sys->p_ctx, psz_device, - "storage.cdrom.dvd", NULL ); - if( b_dvd ) - p_dev->i_capabilities = DEVICE_CAN_DVD | DEVICE_CAN_CD; - else - p_dev->i_capabilities = DEVICE_CAN_CD; - - UpdateMedia( p_probe, p_dev ); - return p_dev; -} - -static void UpdateMedia( device_probe_t *p_probe, device_t *p_dev ) -{ - probe_sys_t *p_sys = p_probe->p_sys; - char **matching_media; - int i_matching, i; - bool b_changed = false;; - int i_old_type = p_dev->i_media_type; - p_dev->i_media_type = 0; - - /* Find the media in the drive */ - matching_media = libhal_manager_find_device_string_match( p_sys->p_ctx, - "block.device", p_dev->psz_uri, - &i_matching, NULL ); - for( i = 0; i < i_matching; i++ ) - { - if( libhal_device_property_exists( p_sys->p_ctx, matching_media[i], - "volume.disc.type", NULL ) ) - { - char *psz_media_name = libhal_device_get_property_string( - p_sys->p_ctx, - matching_media[i], - "volume.label", NULL ); - if( psz_media_name ) - { - if( p_dev->psz_name && strcmp( p_dev->psz_name, psz_media_name)) - { - free( p_dev->psz_name ); - p_dev->psz_name = NULL; - b_changed = true; - } - if( !p_dev->psz_name ) - p_dev->psz_name = strdup( psz_media_name ); - libhal_free_string( psz_media_name ); - } - - if( libhal_device_get_property_bool( p_sys->p_ctx, - matching_media[i], - "volume.disc.is_videodvd", NULL) ) - p_dev->i_media_type = MEDIA_TYPE_DVD; - else if( libhal_device_get_property_bool( p_sys->p_ctx, - matching_media[i], - "volume.disc.is_vcd", NULL) || - libhal_device_get_property_bool( p_sys->p_ctx, - matching_media[i], - "volume.disc.is_svcd", NULL) ) - p_dev->i_media_type = MEDIA_TYPE_VCD; - else if( libhal_device_get_property_bool( p_sys->p_ctx, - matching_media[i], - "volume.disc.has_audio", NULL) ) - p_dev->i_media_type = MEDIA_TYPE_CDDA; - - break; - } - } - if( b_changed || p_dev->i_media_type != i_old_type ) - { - /// \todo emit changed signal - } -} diff --git a/po/POTFILES.in b/po/POTFILES.in index b1fa6ce352..0489eb5d4d 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -17,7 +17,6 @@ include/vlc_config.h include/vlc_configuration.h include/vlc_demux.h include/vlc/deprecated.h -include/vlc_devices.h include/vlc_epg.h include/vlc_es.h include/vlc_es_out.h @@ -146,7 +145,6 @@ src/misc/beos_specific.cpp src/misc/block.c src/misc/cpu.c src/misc/darwin_specific.c -src/misc/devices.c src/misc/error.c src/misc/es_format.c src/misc/events.c diff --git a/src/Makefile.am b/src/Makefile.am index 92e6ce9562..5ceb0d1e6a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -109,7 +109,6 @@ noinst_HEADERS = \ ../include/mmx.h \ ../include/vlc_codec_synchro.h \ ../include/vlc_codecs.h \ - ../include/vlc_devices.h \ ../include/vlc_fixups.h \ ../include/vlc_interface.h \ ../include/vlc_intf_strings.h \ @@ -433,7 +432,6 @@ SOURCES_libvlc_common = \ misc/update.c \ misc/update_crypto.c \ misc/xml.c \ - misc/devices.c \ extras/libc.c \ misc/filter.c \ misc/filter_chain.c \ diff --git a/src/misc/devices.c b/src/misc/devices.c deleted file mode 100644 index a1cc534dac..0000000000 --- a/src/misc/devices.c +++ /dev/null @@ -1,58 +0,0 @@ -/***************************************************************************** - * devices.c : Handling of devices probing - ***************************************************************************** - * Copyright (C) 1998-2004 the VideoLAN team - * $Id$ - * - * Authors: Clément Stenac - * - * 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 - * (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. - * - * 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. - *****************************************************************************/ - -#if 0 - -/***************************************************************************** - * Preamble - *****************************************************************************/ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include - -static intf_thread_t *p_probe_thread = NULL; - -void devices_ProbeCreate( vlc_object_t *p_this ) -{ - intf_thread_t * p_probe; - - /* Allocate structure */ - p_probe = vlc_object_create( p_this, VLC_OBJECT_INTF ); - if( !p_probe ) - return; - p_probe->p_module = module_need( p_probe, "devices probe", NULL, false ); - if( p_probe->p_module == NULL ) - { - msg_Err( p_this, "no devices probing module could be loaded" ); - vlc_object_release( p_probe ); - return; - } - - p_probe_thread = p_probe; -} - -#endif -- 2.39.2