Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
1bda3b7e
Commit
1bda3b7e
authored
Nov 27, 2005
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support for new HAL API
parent
e7c9581a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
136 additions
and
12 deletions
+136
-12
configure.ac
configure.ac
+15
-6
modules/services_discovery/hal.c
modules/services_discovery/hal.c
+73
-3
src/libvlc.c
src/libvlc.c
+48
-3
No files found.
configure.ac
View file @
1bda3b7e
...
...
@@ -724,12 +724,21 @@ AC_ARG_ENABLE(hal,
if test "${enable_hal}" != "no" -a "${SYS}" = "linux"
then
PKG_CHECK_MODULES(HAL, hal >= 0.2.97,
PKG_CHECK_MODULES(HAL, hal >= 0.5.0,
[ AC_DEFINE( HAVE_HAL_1, [] , [Define if you have the new HAL library API])
AC_DEFINE( HAVE_HAL, [], [Define if you have the HAL library] )
VLC_ADD_PLUGINS([hal])
VLC_ADD_LDFLAGS([vlc hal],[$HAL_LIBS])
VLC_ADD_CFLAGS([vlc hal],[$HAL_CFLAGS])],
dnl No hal 0.5 Test for 0.2
[ PKG_CHECK_MODULES( HAL, hal >= 0.2.97,
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
VLC_ADD_PLUGINS([hal])
VLC_ADD_LDFLAGS([vlc hal],[$HAL_LIBS])
VLC_ADD_CFLAGS([vlc hal],[$HAL_CFLAGS])],
[AC_MSG_WARN(HAL library not found)])
]
)
fi
dnl Build the gtk_main plugins?
...
...
modules/services_discovery/hal.c
View file @
1bda3b7e
...
...
@@ -103,13 +103,39 @@ static int Open( vlc_object_t *p_this )
playlist_t
*
p_playlist
;
playlist_view_t
*
p_view
;
DBusError
dbus_error
;
DBusConnection
*
p_connection
;
p_sd
->
pf_run
=
Run
;
p_sd
->
p_sys
=
p_sys
;
if
(
!
(
p_sys
->
p_ctx
=
hal_initialize
(
NULL
,
FALSE
)
)
)
dbus_error_init
(
&
dbus_error
);
#ifdef HAVE_HAL_1
p_sys
->
p_ctx
=
libhal_ctx_new
();
if
(
!
p_sys
->
p_ctx
)
{
msg_Err
(
p_sd
,
"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_sd
,
"Unable to connect to DBUS: %s"
,
dbus_error
.
message
);
dbus_error_free
(
&
dbus_error
);
free
(
p_sys
);
return
VLC_EGENERIC
;
}
libhal_ctx_set_dbus_connection
(
p_sys
->
p_ctx
,
p_connection
);
if
(
!
libhal_ctx_init
(
p_sys
->
p_ctx
,
&
dbus_error
)
)
#else
if
(
!
(
p_sys
->
p_ctx
=
hal_initialize
(
NULL
,
FALSE
)
)
)
#endif
{
msg_Err
(
p_sd
,
"hal not available : %s"
,
dbus_error
.
message
);
dbus_error_free
(
&
dbus_error
);
free
(
p_sys
);
msg_Err
(
p_sd
,
"hal not available"
);
return
VLC_EGENERIC
;
}
...
...
@@ -160,16 +186,27 @@ static void AddDvd( services_discovery_t *p_sd, char *psz_device )
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
playlist_t
*
p_playlist
;
playlist_item_t
*
p_item
;
#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
,
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
asprintf
(
&
psz_uri
,
"dvd://%s"
,
psz_blockdevice
);
/* Create the playlist item here */
p_item
=
playlist_ItemNew
(
p_sd
,
psz_uri
,
psz_name
);
free
(
psz_uri
);
#ifdef HAVE_HAL_1
libhal_free_string
(
psz_device
);
#else
hal_free_string
(
psz_device
);
#endif
if
(
!
p_item
)
{
return
;
...
...
@@ -197,14 +234,23 @@ static void AddCdda( services_discovery_t *p_sd, char *psz_device )
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
playlist_t
*
p_playlist
;
playlist_item_t
*
p_item
;
#ifdef HAVE_HAL_1
psz_blockdevice
=
libhal_device_get_property_string
(
p_sd
->
p_sys
->
p_ctx
,
psz_device
,
"block.device"
,
NULL
);
#else
psz_blockdevice
=
hal_device_get_property_string
(
p_sd
->
p_sys
->
p_ctx
,
psz_device
,
"block.device"
);
#endif
asprintf
(
&
psz_uri
,
"cdda://%s"
,
psz_blockdevice
);
/* Create the playlist item here */
p_item
=
playlist_ItemNew
(
p_sd
,
psz_uri
,
psz_name
);
free
(
psz_uri
);
#ifdef HAVE_HAL_1
libhal_free_string
(
psz_device
);
#else
hal_free_string
(
psz_device
);
#endif
if
(
!
p_item
)
{
return
;
...
...
@@ -229,24 +275,44 @@ static void ParseDevice( services_discovery_t *p_sd, char *psz_device )
{
char
*
psz_disc_type
;
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
,
"volume.disc.type"
,
NULL
)
)
{
psz_disc_type
=
libhal_device_get_property_string
(
p_sys
->
p_ctx
,
psz_device
,
"volume.disc.type"
,
NULL
);
#else
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
,
psz_device
,
"volume.disc.type"
);
#endif
if
(
!
strcmp
(
psz_disc_type
,
"dvd_rom"
)
)
{
AddDvd
(
p_sd
,
psz_device
);
}
else
if
(
!
strcmp
(
psz_disc_type
,
"cd_rom"
)
)
{
if
(
hal_device_get_property_bool
(
p_sys
->
p_ctx
,
psz_device
,
"volume.disc.has_audio"
)
)
#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
);
}
}
#ifdef HAVE_HAL_1
libhal_free_string
(
psz_disc_type
);
#else
hal_free_string
(
psz_disc_type
);
#endif
}
}
...
...
@@ -260,7 +326,11 @@ static void Run( services_discovery_t *p_sd )
services_discovery_sys_t
*
p_sys
=
p_sd
->
p_sys
;
/* parse existing devices first */
#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
)
)
)
#endif
{
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
{
...
...
src/libvlc.c
View file @
1bda3b7e
...
...
@@ -2553,24 +2553,54 @@ static void InitDeviceValues( vlc_t *p_vlc )
char
**
devices
;
char
*
block_dev
;
dbus_bool_t
b_dvd
;
DBusConnection
*
p_connection
;
DBusError
error
;
#ifdef HAVE_HAL_1
ctx
=
libhal_ctx_new
();
if
(
!
ctx
)
return
;
dbus_error_init
(
&
error
);
p_connection
=
dbus_bus_get
(
DBUS_BUS_SYSTEM
,
&
error
);
if
(
dbus_error_is_set
(
&
error
)
)
{
dbus_error_free
(
&
error
);
return
;
}
libhal_ctx_set_dbus_connection
(
ctx
,
p_connection
);
if
(
libhal_ctx_init
(
ctx
,
&
error
)
)
#else
if
(
(
ctx
=
hal_initialize
(
NULL
,
FALSE
)
)
)
#endif
{
#ifdef HAVE_HAL_1
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
++
)
{
#ifdef HAVE_HAL_1
if
(
!
libhal_device_property_exists
(
ctx
,
devices
[
i
],
"storage.cdrom.dvd"
,
NULL
)
)
#else
if
(
!
hal_device_property_exists
(
ctx
,
devices
[
i
],
"storage.cdrom.dvd"
)
)
#endif
{
continue
;
}
#ifdef HAVE_HAL_1
b_dvd
=
libhal_device_get_property_bool
(
ctx
,
devices
[
i
],
"storage.cdrom.dvd"
,
NULL
);
block_dev
=
libhal_device_get_property_string
(
ctx
,
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
)
{
config_PutPsz
(
p_vlc
,
"dvd"
,
block_dev
);
...
...
@@ -2578,13 +2608,28 @@ static void InitDeviceValues( vlc_t *p_vlc )
config_PutPsz
(
p_vlc
,
"vcd"
,
block_dev
);
config_PutPsz
(
p_vlc
,
"cd-audio"
,
block_dev
);
#ifdef HAVE_HAL_1
libhal_free_string
(
block_dev
);
#else
hal_free_string
(
block_dev
);
#endif
}
#ifdef HAVE_HAL_1
libhal_free_string_array
(
devices
);
#else
hal_free_string_array
(
devices
);
#endif
}
#ifdef HAVE_HAL_1
libhal_ctx_shutdown
(
ctx
,
NULL
);
#else
hal_shutdown
(
ctx
);
#endif
}
else
{
msg_Warn
(
p_vlc
,
"Unable to get HAL device properties"
);
}
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment