Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
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
{
VLC_COMMON_MEMBERS
/* Initialization boolean */
vlc_bool_t
b_ready
;
/* CPU extensions */
uint32_t
i_cpu
;
/* Generic settings */
int
i_verbose
;
/* info messages */
vlc_bool_t
b_color
;
/* color messages? */
vlc_bool_t
b_ready
;
///< Initialization boolean
uint32_t
i_cpu
;
///< CPU extensions
int
i_verbose
;
///< info messages
vlc_bool_t
b_color
;
///< color messages?
/* Object structure data */
int
i_counter
;
/* object counter */
int
i_objects
;
/* Attached objects count */
vlc_object_t
**
pp_objects
;
/* Array of all objects */
int
i_counter
;
///< object counter
int
i_objects
;
///< Attached objects count
vlc_object_t
**
pp_objects
;
///< Array of all objects
msg_bank_t
msg_bank
;
///< The message bank
/* The message bank */
msg_bank_t
msg_bank
;
module_bank_t
*
p_module_bank
;
///< The module bank
/* The module bank */
module_bank_t
*
p_module_bank
;
vlc_bool_t
b_stats
;
///< Should we collect stats
/* 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 */
vlc_bool_t
b_stats
;
vlc_mutex_t
timer_lock
;
int
i_timers
;
counter_t
**
pp_timers
;
intf_thread_t
*
p_probe
;
///< Devices prober
/* Arch-specific variables */
#if !defined( WIN32 )
...
...
include/vlc_common.h
View file @
dea4749b
...
...
@@ -356,6 +356,8 @@ typedef struct vlc_acl_t vlc_acl_t;
/* Misc */
typedef
struct
iso639_lang_t
iso639_lang_t
;
typedef
struct
device_t
device_t
;
typedef
struct
device_probe_t
device_probe_t
;
typedef
struct
probe_sys_t
probe_sys_t
;
/* block */
typedef
struct
block_t
block_t
;
...
...
include/vlc_devices.h
View file @
dea4749b
...
...
@@ -46,6 +46,16 @@ struct device_t
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
()
{}
...
...
modules/misc/probe/hal.c
View file @
dea4749b
...
...
@@ -30,7 +30,7 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
struct
intf
_sys_t
struct
probe
_sys_t
{
LibHalContext
*
p_ctx
;
int
i_devices
;
...
...
@@ -40,10 +40,10 @@ struct intf_sys_t
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
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
);
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
...
...
@@ -60,38 +60,38 @@ vlc_module_end();
*****************************************************************************/
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
;
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_
intf
->
p_sys
->
i_devices
=
0
;
p_
intf
->
p_sys
->
pp_devices
=
NULL
;
p_
probe
->
p_sys
=
p_sys
=
(
probe_sys_t
*
)
malloc
(
sizeof
(
probe
_sys_t
)
);
p_
probe
->
p_sys
->
i_devices
=
0
;
p_
probe
->
p_sys
->
pp_devices
=
NULL
;
p_
intf
->
pf_run
=
Update
;
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_
intf
,
"unable to create HAL context"
)
;
free
(
p_
intf
->
p_sys
);
msg_Err
(
p_
probe
,
"unable to create HAL context"
)
;
free
(
p_
probe
->
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_
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
);
free
(
p_
intf
->
p_sys
);
free
(
p_
probe
->
p_sys
);
return
VLC_EGENERIC
;
}
libhal_ctx_set_dbus_connection
(
p_
intf
->
p_sys
->
p_ctx
,
p_connection
);
if
(
!
libhal_ctx_init
(
p_
intf
->
p_sys
->
p_ctx
,
&
dbus_error
)
)
libhal_ctx_set_dbus_connection
(
p_
probe
->
p_sys
->
p_ctx
,
p_connection
);
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
);
free
(
p_sys
);
return
VLC_EGENERIC
;
...
...
@@ -104,20 +104,20 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
{
intf_thread_t
*
p_intf
=
(
intf_thread
_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
device_probe_t
*
p_probe
=
(
device_probe
_t
*
)
p_this
;
probe_sys_t
*
p_sys
=
p_probe
->
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
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
;
char
**
devices
;
vlc_bool_t
b_exists
;
...
...
@@ -132,7 +132,7 @@ static void Update( intf_thread_t * p_intf )
{
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
;
for
(
j
=
0
;
j
<
p_sys
->
i_devices
;
j
++
)
...
...
@@ -142,11 +142,11 @@ static void Update( intf_thread_t * p_intf )
{
b_exists
=
VLC_TRUE
;
p_dev
->
b_seen
=
VLC_TRUE
;
UpdateMedia
(
p_
intf
,
p_dev
);
UpdateMedia
(
p_
probe
,
p_dev
);
break
;
}
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 )
}
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
,
p_
intf
->
p_sys
->
i_devices
,
p_
intf
->
p_sys
->
i_devices
,
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
(
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
;
char
*
block_dev
;
dbus_bool_t
b_dvd
;
...
...
@@ -193,13 +193,13 @@ static device_t * ParseDisc( intf_thread_t *p_intf, char *psz_device )
else
p_dev
->
i_capabilities
=
DEVICE_CAN_CD
;
UpdateMedia
(
p_
intf
,
p_dev
);
UpdateMedia
(
p_
probe
,
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
;
int
i_matching
,
i
;
vlc_bool_t
b_changed
=
VLC_FALSE
;;
...
...
src/Makefile.am
View file @
dea4749b
...
...
@@ -322,6 +322,7 @@ SOURCES_libvlc_common = \
misc/vlm.c
\
misc/xml.c
\
misc/hashtables.c
\
misc/devices.c
\
extras/libc.c
\
control/core.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