Commit 2f6053d6 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

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).
parent 1905cebd
...@@ -4559,7 +4559,7 @@ PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services d ...@@ -4559,7 +4559,7 @@ PKG_ENABLE_MODULES_VLC([BONJOUR], [], [avahi-client >= 0.6], [Bonjour services d
dnl dnl
dnl HAL services discovery 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
dnl MTP devices services discovery dnl MTP devices services discovery
...@@ -5188,7 +5188,6 @@ AC_CONFIG_FILES([ ...@@ -5188,7 +5188,6 @@ AC_CONFIG_FILES([
modules/misc/osd/Makefile modules/misc/osd/Makefile
modules/misc/stats/Makefile modules/misc/stats/Makefile
modules/misc/xml/Makefile modules/misc/xml/Makefile
modules/misc/probe/Makefile
modules/mux/Makefile modules/mux/Makefile
modules/mux/mpeg/Makefile modules/mux/mpeg/Makefile
modules/packetizer/Makefile modules/packetizer/Makefile
......
/*****************************************************************************
* vlc_devices.h : Devices handling
*****************************************************************************
* Copyright (C) 1999-2006 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* 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
...@@ -132,7 +132,6 @@ $Id$ ...@@ -132,7 +132,6 @@ $Id$
* growl: announce currently playing stream to growl * growl: announce currently playing stream to growl
* growl_udp: growl UDP notification plugin * growl_udp: growl UDP notification plugin
* h264: H264 decoder * h264: H264 decoder
* hal: Linux HAL services discovery module
* hd1000a: audio output module for the Roku HD1000 Set-Top-Box * hd1000a: audio output module for the Roku HD1000 Set-Top-Box
* hd1000v: video 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 * headphone_channel_mixer: headphone channel mixer with virtual spatialization effect
......
BASE_SUBDIRS = dummy memcpy notify testsuite playlist stats osd xml probe BASE_SUBDIRS = dummy memcpy notify testsuite playlist stats osd xml
EXTRA_SUBDIRS = lua EXTRA_SUBDIRS = lua
SUBDIRS = $(BASE_SUBDIRS) SUBDIRS = $(BASE_SUBDIRS)
......
/*****************************************************************************
* hal.c : HAL probing module
*****************************************************************************
* Copyright (C) 2004 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* 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 <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_devices.h>
#include <hal/libhal.h>
/*****************************************************************************
* 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
}
}
...@@ -17,7 +17,6 @@ include/vlc_config.h ...@@ -17,7 +17,6 @@ include/vlc_config.h
include/vlc_configuration.h include/vlc_configuration.h
include/vlc_demux.h include/vlc_demux.h
include/vlc/deprecated.h include/vlc/deprecated.h
include/vlc_devices.h
include/vlc_epg.h include/vlc_epg.h
include/vlc_es.h include/vlc_es.h
include/vlc_es_out.h include/vlc_es_out.h
...@@ -146,7 +145,6 @@ src/misc/beos_specific.cpp ...@@ -146,7 +145,6 @@ src/misc/beos_specific.cpp
src/misc/block.c src/misc/block.c
src/misc/cpu.c src/misc/cpu.c
src/misc/darwin_specific.c src/misc/darwin_specific.c
src/misc/devices.c
src/misc/error.c src/misc/error.c
src/misc/es_format.c src/misc/es_format.c
src/misc/events.c src/misc/events.c
......
...@@ -109,7 +109,6 @@ noinst_HEADERS = \ ...@@ -109,7 +109,6 @@ noinst_HEADERS = \
../include/mmx.h \ ../include/mmx.h \
../include/vlc_codec_synchro.h \ ../include/vlc_codec_synchro.h \
../include/vlc_codecs.h \ ../include/vlc_codecs.h \
../include/vlc_devices.h \
../include/vlc_fixups.h \ ../include/vlc_fixups.h \
../include/vlc_interface.h \ ../include/vlc_interface.h \
../include/vlc_intf_strings.h \ ../include/vlc_intf_strings.h \
...@@ -433,7 +432,6 @@ SOURCES_libvlc_common = \ ...@@ -433,7 +432,6 @@ SOURCES_libvlc_common = \
misc/update.c \ misc/update.c \
misc/update_crypto.c \ misc/update_crypto.c \
misc/xml.c \ misc/xml.c \
misc/devices.c \
extras/libc.c \ extras/libc.c \
misc/filter.c \ misc/filter.c \
misc/filter_chain.c \ misc/filter_chain.c \
......
/*****************************************************************************
* devices.c : Handling of devices probing
*****************************************************************************
* Copyright (C) 1998-2004 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
*
* 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 <vlc_common.h>
#include <vlc/intf.h>
#include <vlc_devices.h>
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
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