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
04a4af73
Commit
04a4af73
authored
May 05, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The input_items array is private data.
Hide it before someone thinks (s)he can use it without locking libvlc.
parent
f3cf5c6e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
14 deletions
+19
-14
include/vlc_main.h
include/vlc_main.h
+0
-4
src/input/item.c
src/input/item.c
+10
-6
src/libvlc-common.c
src/libvlc-common.c
+4
-4
src/libvlc.h
src/libvlc.h
+5
-0
No files found.
include/vlc_main.h
View file @
04a4af73
...
...
@@ -47,10 +47,6 @@ struct libvlc_int_t
global_stats_t
*
p_stats
;
///< Global statistics
/* There is no real reason to keep a list of items, but not to break
* everything, let's keep it */
input_item_array_t
input_items
;
///< Array of all created input items
int
i_last_input_id
;
///< Last id of input item
/* Structure storing the action name / key associations */
struct
hotkey
...
...
src/input/item.c
View file @
04a4af73
...
...
@@ -183,6 +183,7 @@ char *input_ItemGetInfo( input_item_t *p_i,
static
void
input_ItemDestroy
(
gc_object_t
*
p_this
)
{
vlc_object_t
*
p_obj
=
(
vlc_object_t
*
)
p_this
->
p_destructor_arg
;
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_obj
->
p_libvlc
);
input_item_t
*
p_input
=
(
input_item_t
*
)
p_this
;
int
i
;
...
...
@@ -190,9 +191,9 @@ static void input_ItemDestroy ( gc_object_t *p_this )
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
object_lock
);
ARRAY_BSEARCH
(
p
_obj
->
p_libvlc
->
input_items
,
->
i_id
,
int
,
p_input
->
i_id
,
i
);
ARRAY_BSEARCH
(
p
riv
->
input_items
,
->
i_id
,
int
,
p_input
->
i_id
,
i
);
if
(
i
!=
-
1
)
ARRAY_REMOVE
(
p
_obj
->
p_libvlc
->
input_items
,
i
);
ARRAY_REMOVE
(
p
riv
->
input_items
,
i
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
object_lock
);
...
...
@@ -301,14 +302,15 @@ int input_ItemAddInfo( input_item_t *p_i,
input_item_t
*
__input_ItemGetById
(
vlc_object_t
*
p_obj
,
int
i_id
)
{
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_obj
->
p_libvlc
);
input_item_t
*
p_ret
=
NULL
;
int
i
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
object_lock
);
ARRAY_BSEARCH
(
p
_obj
->
p_libvlc
->
input_items
,
->
i_id
,
int
,
i_id
,
i
);
ARRAY_BSEARCH
(
p
riv
->
input_items
,
->
i_id
,
int
,
i_id
,
i
);
if
(
i
!=
-
1
)
p_ret
=
ARRAY_VAL
(
p
_obj
->
p_libvlc
->
input_items
,
i
);
p_ret
=
ARRAY_VAL
(
p
riv
->
input_items
,
i
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
object_lock
);
...
...
@@ -334,14 +336,16 @@ input_item_t *input_ItemNewWithType( vlc_object_t *p_obj, const char *psz_uri,
mtime_t
i_duration
,
int
i_type
)
{
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_obj
->
p_libvlc
);
DECMALLOC_NULL
(
p_input
,
input_item_t
);
input_ItemInit
(
p_obj
,
p_input
);
vlc_gc_init
(
p_input
,
input_ItemDestroy
,
(
void
*
)
p_obj
);
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
object_lock
);
p_input
->
i_id
=
++
p
_obj
->
p_libvlc
->
i_last_input_id
;
ARRAY_APPEND
(
p
_obj
->
p_libvlc
->
input_items
,
p_input
);
p_input
->
i_id
=
++
p
riv
->
i_last_input_id
;
ARRAY_APPEND
(
p
riv
->
input_items
,
p_input
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
object_lock
);
p_input
->
b_fixed_name
=
false
;
...
...
src/libvlc-common.c
View file @
04a4af73
...
...
@@ -720,8 +720,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
priv
->
p_stats_computer
=
NULL
;
/* Init the array that holds every input item */
ARRAY_INIT
(
p
_libvlc
->
input_items
);
p
_libvlc
->
i_last_input_id
=
0
;
ARRAY_INIT
(
p
riv
->
input_items
);
p
riv
->
i_last_input_id
=
0
;
/*
* Initialize hotkey handling
...
...
@@ -1003,13 +1003,13 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
#endif
bool
b_clean
=
true
;
FOREACH_ARRAY
(
input_item_t
*
p_del
,
p
_libvlc
->
input_items
)
FOREACH_ARRAY
(
input_item_t
*
p_del
,
p
riv
->
input_items
)
msg_Err
(
p_libvlc
,
"input item %p has not been deleted properly: refcount %d, name %s"
,
p_del
,
p_del
->
i_gc_refcount
,
p_del
->
psz_name
?
p_del
->
psz_name
:
"(null)"
);
b_clean
=
false
;
FOREACH_END
();
assert
(
b_clean
);
ARRAY_RESET
(
p
_libvlc
->
input_items
);
ARRAY_RESET
(
p
riv
->
input_items
);
msg_Dbg
(
p_libvlc
,
"removing stats"
);
vlc_mutex_destroy
(
&
p_libvlc
->
p_stats
->
lock
);
...
...
src/libvlc.h
View file @
04a4af73
...
...
@@ -212,6 +212,11 @@ typedef struct libvlc_priv_t
vlc_mutex_t
config_lock
;
///< config file lock
char
*
psz_configfile
;
///< location of config file
/* There is no real reason to keep a list of items, but not to break
* everything, let's keep it */
input_item_array_t
input_items
;
///< Array of all created input items
int
i_last_input_id
;
///< Last id of input item
/* Messages */
msg_bank_t
msg_bank
;
///< The message bank
int
i_verbose
;
///< info messages
...
...
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