Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
3fa2448e
Commit
3fa2448e
authored
Jun 21, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HAL probing module
parent
ef7464b0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
43 deletions
+111
-43
configure.ac
configure.ac
+4
-3
include/vlc_common.h
include/vlc_common.h
+1
-0
include/vlc_devices.h
include/vlc_devices.h
+4
-1
modules/misc/probe/Modules.am
modules/misc/probe/Modules.am
+1
-0
modules/misc/probe/hal.c
modules/misc/probe/hal.c
+101
-39
No files found.
configure.ac
View file @
3fa2448e
...
@@ -823,9 +823,9 @@ then
...
@@ -823,9 +823,9 @@ then
PKG_CHECK_MODULES(HAL, hal >= 0.5.0,
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_1, [] , [Define if you have the new HAL library API])
AC_DEFINE( HAVE_HAL, [], [Define if you have the HAL library] )
AC_DEFINE( HAVE_HAL, [], [Define if you have the HAL library] )
VLC_ADD_PLUGINS([hal])
VLC_ADD_PLUGINS([hal
probe_hal
])
VLC_ADD_LDFLAGS([vlc hal],[$HAL_LIBS])
VLC_ADD_LDFLAGS([vlc hal
probe_hal
],[$HAL_LIBS])
VLC_ADD_CFLAGS([vlc hal],[$HAL_CFLAGS])],
VLC_ADD_CFLAGS([vlc hal
probe_hal
],[$HAL_CFLAGS])],
dnl No hal 0.5 Test for 0.2
dnl No hal 0.5 Test for 0.2
[ PKG_CHECK_MODULES( HAL, hal >= 0.2.97,
[ PKG_CHECK_MODULES( HAL, hal >= 0.2.97,
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
[AC_DEFINE(HAVE_HAL, [], [Define if you have the HAL library])
...
@@ -5533,6 +5533,7 @@ AC_CONFIG_FILES([
...
@@ -5533,6 +5533,7 @@ AC_CONFIG_FILES([
modules/misc/testsuite/Makefile
modules/misc/testsuite/Makefile
modules/misc/playlist/Makefile
modules/misc/playlist/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/mux/rtp/Makefile
modules/mux/rtp/Makefile
...
...
include/vlc_common.h
View file @
3fa2448e
...
@@ -355,6 +355,7 @@ typedef struct vlc_acl_t vlc_acl_t;
...
@@ -355,6 +355,7 @@ typedef struct vlc_acl_t vlc_acl_t;
/* Misc */
/* Misc */
typedef
struct
iso639_lang_t
iso639_lang_t
;
typedef
struct
iso639_lang_t
iso639_lang_t
;
typedef
struct
device_t
device_t
;
/* block */
/* block */
typedef
struct
block_t
block_t
;
typedef
struct
block_t
block_t
;
...
...
include/vlc_devices.h
View file @
3fa2448e
...
@@ -41,9 +41,12 @@ struct device_t
...
@@ -41,9 +41,12 @@ struct device_t
{
{
int
i_capabilities
;
int
i_capabilities
;
int
i_media_type
;
int
i_media_type
;
vlc_bool_t
b_seen
;
char
*
psz_uri
;
char
*
psz_uri
;
char
*
psz_
media_
name
;
char
*
psz_name
;
};
};
static
inline
void
device_GetDVD
()
static
inline
void
device_GetDVD
()
{}
{}
#endif
modules/misc/probe/Modules.am
0 → 100644
View file @
3fa2448e
SOURCES_probe_hal = hal.c
modules/misc/probe/hal.c
View file @
3fa2448e
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
*****************************************************************************/
*****************************************************************************/
#include <vlc/vlc.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc_devices.h>
#include <vlc_devices.h>
#include <hal/libhal.h>
#include <hal/libhal.h>
...
@@ -40,6 +41,9 @@ static int Open ( vlc_object_t * );
...
@@ -40,6 +41,9 @@ static int Open ( vlc_object_t * );
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Update
(
intf_thread_t
*
p_intf
);
static
void
Update
(
intf_thread_t
*
p_intf
);
static
void
UpdateMedia
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
);
static
void
AddDevice
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
);
static
device_t
*
ParseDisc
(
intf_thread_t
*
p_intf
,
char
*
psz_device
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -57,19 +61,20 @@ vlc_module_end();
...
@@ -57,19 +61,20 @@ vlc_module_end();
static
int
Open
(
vlc_object_t
*
p_this
)
static
int
Open
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
vlc_value_t
val
;
DBusError
dbus_error
;
DBusError
dbus_error
;
DBusConnection
*
p_connection
;
DBusConnection
*
p_connection
;
intf_sys_t
*
p_sys
;
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
p_intf
->
p_sys
=
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
)
);
p_intf
->
p_sys
->
i_drives
=
0
;
p_intf
->
p_sys
->
i_devices
=
0
;
p_intf
->
p_sys
->
pp_devices
=
NULL
;
p_intf
->
pf_run
=
Run
;
p_intf
->
pf_run
=
Update
;
dbus_error_init
(
&
dbus_error
);
dbus_error_init
(
&
dbus_error
);
p_
intf
->
p_
sys
->
p_ctx
=
libhal_ctx_new
();
p_sys
->
p_ctx
=
libhal_ctx_new
();
if
(
!
p_
intf
->
p_
sys
->
p_ctx
)
if
(
!
p_sys
->
p_ctx
)
{
{
msg_Err
(
p_intf
,
"unable to create HAL context"
)
;
msg_Err
(
p_intf
,
"unable to create HAL context"
)
;
free
(
p_intf
->
p_sys
);
free
(
p_intf
->
p_sys
);
...
@@ -106,7 +111,7 @@ static void Close( vlc_object_t *p_this )
...
@@ -106,7 +111,7 @@ static void Close( vlc_object_t *p_this )
static
int
GetAllDevices
(
intf_thread_t
*
p_intf
,
device_t
***
ppp_devices
)
static
int
GetAllDevices
(
intf_thread_t
*
p_intf
,
device_t
***
ppp_devices
)
{
{
/
* Todo : fill the dst array */
/
// \todo : fill the dst array
return
p_intf
->
p_sys
->
i_devices
;
return
p_intf
->
p_sys
->
i_devices
;
}
}
...
@@ -118,15 +123,17 @@ static void Update( intf_thread_t * p_intf )
...
@@ -118,15 +123,17 @@ static void Update( intf_thread_t * p_intf )
vlc_bool_t
b_exists
;
vlc_bool_t
b_exists
;
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
p_
dev
->
b_seen
=
VLC_FALSE
;
p_
sys
->
pp_devices
[
j
]
->
b_seen
=
VLC_FALSE
;
if
(
(
devices
=
libhal_get_all_devices
(
p_sys
->
p_ctx
,
&
i_devices
,
NULL
)
)
)
/* CD/DVD */
if
(
(
devices
=
libhal_find_device_by_capability
(
p_sys
->
p_ctx
,
"storage.cdrom"
,
&
i_devices
,
NULL
)
)
)
{
{
device_t
*
p_device
;
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
{
{
device_t
*
p_dev
=
ParseDisc
(
p_intf
,
devices
[
i
]
);
b_exists
=
VLC_FALSE
;
b_exists
=
VLC_FALSE
;
p_dev
=
ParseDevice
(
p_sd
,
devices
[
i
]
);
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
{
{
...
@@ -135,6 +142,7 @@ static void Update( intf_thread_t * p_intf )
...
@@ -135,6 +142,7 @@ static void Update( intf_thread_t * p_intf )
{
{
b_exists
=
VLC_TRUE
;
b_exists
=
VLC_TRUE
;
p_dev
->
b_seen
=
VLC_TRUE
;
p_dev
->
b_seen
=
VLC_TRUE
;
UpdateMedia
(
p_intf
,
p_dev
);
break
;
break
;
}
}
if
(
!
b_exists
)
if
(
!
b_exists
)
...
@@ -155,42 +163,96 @@ static void AddDevice( intf_thread_t * p_intf, device_t *p_dev )
...
@@ -155,42 +163,96 @@ static void AddDevice( intf_thread_t * p_intf, device_t *p_dev )
/// \todo : emit variable
/// \todo : emit variable
}
}
static
device_t
*
ParseDisc
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
{
intf_sys_t
*
p_sys
=
p_intf
->
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
;
static
device_t
*
ParseDevice
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
UpdateMedia
(
p_intf
,
p_dev
);
return
p_dev
;
}
static
void
UpdateMedia
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
)
{
{
char
*
psz_disc_type
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
/* FIXME: The following code provides media detection, not device */
char
**
matching_media
;
/*
int
i_matching
,
i
;
if( libhal_device_property_exists( p_sys->p_ctx, psz_device,
vlc_bool_t
b_changed
=
VLC_FALSE
;;
"volume.disc.type", NULL ) )
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
++
)
{
{
psz_disc_type = libhal_device_get_property_string( p_sys->p_ctx,
if
(
libhal_device_property_exists
(
p_sys
->
p_ctx
,
matching_media
[
i
],
psz_device,
"volume.disc.type"
,
NULL
)
)
"volume.disc.type",
{
NULL );
char
*
psz_media_name
=
libhal_device_get_property_string
(
if( !strcmp( psz_disc_type, "dvd_rom" ) )
p_sys
->
p_ctx
,
{
matching_media
[
i
],
/// \todo This is a DVD
"volume.label"
,
NULL
);
//psz_name = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
if
(
psz_media_name
)
/// psz_device, "volume.label", NULL );
// psz_blockdevice = libhal_device_get_property_string( p_sd->p_sys->p_ctx,
// psz_device, "block.device", NULL );
// libhal_free_string( psz_device );
}
}
else if( !strcmp( psz_disc_type, "cd_rom" ) )
{
if( libhal_device_get_property_bool( p_sys->p_ctx, psz_device,
"volume.disc.has_audio" , NULL ) )
{
{
/// \todo This is a CDDA
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
=
VLC_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
;
}
}
libhal_free_string( psz_disc_type );
}
}
*/
if
(
b_changed
||
p_dev
->
i_media_type
!=
i_old_type
)
return
NULL
;
{
/// \todo emit changed signal
}
}
}
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