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
dea4749b
Commit
dea4749b
authored
Jun 22, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* Create new types for device probing
* Beginning of core implementation
parent
29f94bbc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
57 deletions
+66
-57
include/main.h
include/main.h
+17
-21
include/vlc_common.h
include/vlc_common.h
+2
-0
include/vlc_devices.h
include/vlc_devices.h
+10
-0
modules/misc/probe/hal.c
modules/misc/probe/hal.c
+36
-36
src/Makefile.am
src/Makefile.am
+1
-0
No files found.
include/main.h
View file @
dea4749b
...
@@ -33,32 +33,28 @@ struct libvlc_t
...
@@ -33,32 +33,28 @@ struct libvlc_t
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
/* Initialization boolean */
vlc_bool_t
b_ready
;
///< Initialization boolean
vlc_bool_t
b_ready
;
uint32_t
i_cpu
;
///< CPU extensions
/* CPU extensions */
int
i_verbose
;
///< info messages
uint32_t
i_cpu
;
vlc_bool_t
b_color
;
///< color messages?
/* Generic settings */
int
i_verbose
;
/* info messages */
vlc_bool_t
b_color
;
/* color messages? */
/* Object structure data */
/* Object structure data */
int
i_counter
;
/* object counter */
int
i_counter
;
///< object counter
int
i_objects
;
/* Attached objects count */
int
i_objects
;
///< Attached objects count
vlc_object_t
**
pp_objects
;
/* Array of all objects */
vlc_object_t
**
pp_objects
;
///< Array of all objects
msg_bank_t
msg_bank
;
///< The message bank
/* The message bank */
module_bank_t
*
p_module_bank
;
///< The module bank
msg_bank_t
msg_bank
;
/* The module bank */
vlc_bool_t
b_stats
;
///< Should we collect stats
module_bank_t
*
p_module_bank
;
/* Timers handling */
vlc_mutex_t
timer_lock
;
///< Lock to protect timers
int
i_timers
;
///< Number of timers
counter_t
**
pp_timers
;
///< Array of all timers
/* Do stats ? - We keep this boolean to avoid unneeded lookups */
intf_thread_t
*
p_probe
;
///< Devices prober
vlc_bool_t
b_stats
;
vlc_mutex_t
timer_lock
;
int
i_timers
;
counter_t
**
pp_timers
;
/* Arch-specific variables */
/* Arch-specific variables */
#if !defined( WIN32 )
#if !defined( WIN32 )
...
...
include/vlc_common.h
View file @
dea4749b
...
@@ -356,6 +356,8 @@ typedef struct vlc_acl_t vlc_acl_t;
...
@@ -356,6 +356,8 @@ 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
;
typedef
struct
device_t
device_t
;
typedef
struct
device_probe_t
device_probe_t
;
typedef
struct
probe_sys_t
probe_sys_t
;
/* block */
/* block */
typedef
struct
block_t
block_t
;
typedef
struct
block_t
block_t
;
...
...
include/vlc_devices.h
View file @
dea4749b
...
@@ -46,6 +46,16 @@ struct device_t
...
@@ -46,6 +46,16 @@ struct device_t
char
*
psz_name
;
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
()
static
inline
void
device_GetDVD
()
{}
{}
...
...
modules/misc/probe/hal.c
View file @
dea4749b
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
*****************************************************************************/
*****************************************************************************/
struct
intf
_sys_t
struct
probe
_sys_t
{
{
LibHalContext
*
p_ctx
;
LibHalContext
*
p_ctx
;
int
i_devices
;
int
i_devices
;
...
@@ -40,10 +40,10 @@ struct intf_sys_t
...
@@ -40,10 +40,10 @@ struct intf_sys_t
static
int
Open
(
vlc_object_t
*
);
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
(
device_probe_t
*
p_probe
);
static
void
UpdateMedia
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
);
static
void
UpdateMedia
(
device_probe_t
*
p_probe
,
device_t
*
p_dev
);
static
void
AddDevice
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
);
static
void
AddDevice
(
device_probe_t
*
p_probe
,
device_t
*
p_dev
);
static
device_t
*
ParseDisc
(
intf_thread_t
*
p_intf
,
char
*
psz_device
);
static
device_t
*
ParseDisc
(
device_probe_t
*
p_probe
,
char
*
psz_device
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -60,38 +60,38 @@ vlc_module_end();
...
@@ -60,38 +60,38 @@ 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
;
device_probe_t
*
p_probe
=
(
device_probe
_t
*
)
p_this
;
DBusError
dbus_error
;
DBusError
dbus_error
;
DBusConnection
*
p_connection
;
DBusConnection
*
p_connection
;
intf
_sys_t
*
p_sys
;
probe
_sys_t
*
p_sys
;
p_
intf
->
p_sys
=
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf
_sys_t
)
);
p_
probe
->
p_sys
=
p_sys
=
(
probe_sys_t
*
)
malloc
(
sizeof
(
probe
_sys_t
)
);
p_
intf
->
p_sys
->
i_devices
=
0
;
p_
probe
->
p_sys
->
i_devices
=
0
;
p_
intf
->
p_sys
->
pp_devices
=
NULL
;
p_
probe
->
p_sys
->
pp_devices
=
NULL
;
p_
intf
->
pf_run
=
Update
;
p_
probe
->
pf_run
=
Update
;
dbus_error_init
(
&
dbus_error
);
dbus_error_init
(
&
dbus_error
);
p_sys
->
p_ctx
=
libhal_ctx_new
();
p_sys
->
p_ctx
=
libhal_ctx_new
();
if
(
!
p_sys
->
p_ctx
)
if
(
!
p_sys
->
p_ctx
)
{
{
msg_Err
(
p_
intf
,
"unable to create HAL context"
)
;
msg_Err
(
p_
probe
,
"unable to create HAL context"
)
;
free
(
p_
intf
->
p_sys
);
free
(
p_
probe
->
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
p_connection
=
dbus_bus_get
(
DBUS_BUS_SYSTEM
,
&
dbus_error
);
p_connection
=
dbus_bus_get
(
DBUS_BUS_SYSTEM
,
&
dbus_error
);
if
(
dbus_error_is_set
(
&
dbus_error
)
)
if
(
dbus_error_is_set
(
&
dbus_error
)
)
{
{
msg_Err
(
p_
intf
,
"unable to connect to DBUS: %s"
,
dbus_error
.
message
);
msg_Err
(
p_
probe
,
"unable to connect to DBUS: %s"
,
dbus_error
.
message
);
dbus_error_free
(
&
dbus_error
);
dbus_error_free
(
&
dbus_error
);
free
(
p_
intf
->
p_sys
);
free
(
p_
probe
->
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
libhal_ctx_set_dbus_connection
(
p_
intf
->
p_sys
->
p_ctx
,
p_connection
);
libhal_ctx_set_dbus_connection
(
p_
probe
->
p_sys
->
p_ctx
,
p_connection
);
if
(
!
libhal_ctx_init
(
p_
intf
->
p_sys
->
p_ctx
,
&
dbus_error
)
)
if
(
!
libhal_ctx_init
(
p_
probe
->
p_sys
->
p_ctx
,
&
dbus_error
)
)
{
{
msg_Err
(
p_
intf
,
"hal not available : %s"
,
dbus_error
.
message
);
msg_Err
(
p_
probe
,
"hal not available : %s"
,
dbus_error
.
message
);
dbus_error_free
(
&
dbus_error
);
dbus_error_free
(
&
dbus_error
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -104,20 +104,20 @@ static int Open( vlc_object_t *p_this )
...
@@ -104,20 +104,20 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
static
void
Close
(
vlc_object_t
*
p_this
)
{
{
intf_thread_t
*
p_intf
=
(
intf_thread
_t
*
)
p_this
;
device_probe_t
*
p_probe
=
(
device_probe
_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
probe_sys_t
*
p_sys
=
p_probe
->
p_sys
;
free
(
p_sys
);
free
(
p_sys
);
}
}
static
int
GetAllDevices
(
intf_thread_t
*
p_intf
,
device_t
***
ppp_devices
)
static
int
GetAllDevices
(
device_probe_t
*
p_probe
,
device_t
***
ppp_devices
)
{
{
/// \todo : fill the dst array
/// \todo : fill the dst array
return
p_
intf
->
p_sys
->
i_devices
;
return
p_
probe
->
p_sys
->
i_devices
;
}
}
static
void
Update
(
intf_thread_t
*
p_intf
)
static
void
Update
(
device_probe_t
*
p_probe
)
{
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
probe_sys_t
*
p_sys
=
p_probe
->
p_sys
;
int
i
,
i_devices
,
j
;
int
i
,
i_devices
,
j
;
char
**
devices
;
char
**
devices
;
vlc_bool_t
b_exists
;
vlc_bool_t
b_exists
;
...
@@ -132,7 +132,7 @@ static void Update( intf_thread_t * p_intf )
...
@@ -132,7 +132,7 @@ static void Update( intf_thread_t * p_intf )
{
{
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
for
(
i
=
0
;
i
<
i_devices
;
i
++
)
{
{
device_t
*
p_dev
=
ParseDisc
(
p_
intf
,
devices
[
i
]
);
device_t
*
p_dev
=
ParseDisc
(
p_
probe
,
devices
[
i
]
);
b_exists
=
VLC_FALSE
;
b_exists
=
VLC_FALSE
;
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
...
@@ -142,11 +142,11 @@ static void Update( intf_thread_t * p_intf )
...
@@ -142,11 +142,11 @@ 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
);
UpdateMedia
(
p_
probe
,
p_dev
);
break
;
break
;
}
}
if
(
!
b_exists
)
if
(
!
b_exists
)
AddDevice
(
p_
intf
,
p_dev
);
AddDevice
(
p_
probe
,
p_dev
);
}
}
}
}
}
}
...
@@ -154,18 +154,18 @@ static void Update( intf_thread_t * p_intf )
...
@@ -154,18 +154,18 @@ static void Update( intf_thread_t * p_intf )
}
}
static
void
AddDevice
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
)
static
void
AddDevice
(
device_probe_t
*
p_probe
,
device_t
*
p_dev
)
{
{
INSERT_ELEM
(
p_
intf
->
p_sys
->
pp_devices
,
INSERT_ELEM
(
p_
probe
->
p_sys
->
pp_devices
,
p_
intf
->
p_sys
->
i_devices
,
p_
probe
->
p_sys
->
i_devices
,
p_
intf
->
p_sys
->
i_devices
,
p_
probe
->
p_sys
->
i_devices
,
p_dev
);
p_dev
);
/// \todo : emit variable
/// \todo : emit variable
}
}
static
device_t
*
ParseDisc
(
intf_thread_t
*
p_intf
,
char
*
psz_device
)
static
device_t
*
ParseDisc
(
device_probe_t
*
p_probe
,
char
*
psz_device
)
{
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
probe_sys_t
*
p_sys
=
p_probe
->
p_sys
;
device_t
*
p_dev
;
device_t
*
p_dev
;
char
*
block_dev
;
char
*
block_dev
;
dbus_bool_t
b_dvd
;
dbus_bool_t
b_dvd
;
...
@@ -193,13 +193,13 @@ static device_t * ParseDisc( intf_thread_t *p_intf, char *psz_device )
...
@@ -193,13 +193,13 @@ static device_t * ParseDisc( intf_thread_t *p_intf, char *psz_device )
else
else
p_dev
->
i_capabilities
=
DEVICE_CAN_CD
;
p_dev
->
i_capabilities
=
DEVICE_CAN_CD
;
UpdateMedia
(
p_
intf
,
p_dev
);
UpdateMedia
(
p_
probe
,
p_dev
);
return
p_dev
;
return
p_dev
;
}
}
static
void
UpdateMedia
(
intf_thread_t
*
p_intf
,
device_t
*
p_dev
)
static
void
UpdateMedia
(
device_probe_t
*
p_probe
,
device_t
*
p_dev
)
{
{
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
probe_sys_t
*
p_sys
=
p_probe
->
p_sys
;
char
**
matching_media
;
char
**
matching_media
;
int
i_matching
,
i
;
int
i_matching
,
i
;
vlc_bool_t
b_changed
=
VLC_FALSE
;;
vlc_bool_t
b_changed
=
VLC_FALSE
;;
...
...
src/Makefile.am
View file @
dea4749b
...
@@ -322,6 +322,7 @@ SOURCES_libvlc_common = \
...
@@ -322,6 +322,7 @@ SOURCES_libvlc_common = \
misc/vlm.c
\
misc/vlm.c
\
misc/xml.c
\
misc/xml.c
\
misc/hashtables.c
\
misc/hashtables.c
\
misc/devices.c
\
extras/libc.c
\
extras/libc.c
\
control/core.c
\
control/core.c
\
control/playlist.c
\
control/playlist.c
\
...
...
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