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
e7dc693e
Commit
e7dc693e
authored
Jan 24, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some more unused exceptions
parent
7c912f1e
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
49 additions
and
87 deletions
+49
-87
include/vlc/libvlc_media_list.h
include/vlc/libvlc_media_list.h
+6
-17
src/control/flat_media_list_view.c
src/control/flat_media_list_view.c
+1
-1
src/control/hierarchical_media_list_view.c
src/control/hierarchical_media_list_view.c
+2
-1
src/control/hierarchical_node_media_list_view.c
src/control/hierarchical_node_media_list_view.c
+4
-4
src/control/media.c
src/control/media.c
+1
-1
src/control/media_discoverer.c
src/control/media_discoverer.c
+3
-3
src/control/media_list.c
src/control/media_list.c
+11
-27
src/control/media_list_internal.h
src/control/media_list_internal.h
+2
-4
src/control/media_list_path.h
src/control/media_list_path.h
+1
-1
src/control/media_list_player.c
src/control/media_list_player.c
+6
-6
src/control/media_list_view.c
src/control/media_list_view.c
+4
-4
test/libvlc/media_list.c
test/libvlc/media_list.c
+8
-18
No files found.
include/vlc/libvlc_media_list.h
View file @
e7dc693e
...
@@ -83,12 +83,9 @@ VLC_DEPRECATED_API void
...
@@ -83,12 +83,9 @@ VLC_DEPRECATED_API void
*
*
* \param p_ml a media list instance
* \param p_ml a media list instance
* \param p_mi media instance to add
* \param p_mi media instance to add
* \param p_e initialized exception object
*/
*/
VLC_PUBLIC_API
void
VLC_PUBLIC_API
void
libvlc_media_list_set_media
(
libvlc_media_list_t
*
,
libvlc_media_list_set_media
(
libvlc_media_list_t
*
p_ml
,
libvlc_media_t
*
p_md
);
libvlc_media_t
*
,
libvlc_exception_t
*
);
/**
/**
* Get media instance from this media list instance. This action will increase
* Get media instance from this media list instance. This action will increase
...
@@ -96,12 +93,10 @@ VLC_PUBLIC_API void
...
@@ -96,12 +93,10 @@ VLC_PUBLIC_API void
* The libvlc_media_list_lock should NOT be held upon entering this function.
* The libvlc_media_list_lock should NOT be held upon entering this function.
*
*
* \param p_ml a media list instance
* \param p_ml a media list instance
* \param p_e initialized exception object
* \return media instance
* \return media instance
*/
*/
VLC_PUBLIC_API
libvlc_media_t
*
VLC_PUBLIC_API
libvlc_media_t
*
libvlc_media_list_media
(
libvlc_media_list_t
*
,
libvlc_media_list_media
(
libvlc_media_list_t
*
p_ml
);
libvlc_exception_t
*
);
/**
/**
* Add media instance to media list
* Add media instance to media list
...
@@ -147,12 +142,10 @@ VLC_PUBLIC_API void
...
@@ -147,12 +142,10 @@ VLC_PUBLIC_API void
* The libvlc_media_list_lock should be held upon entering this function.
* The libvlc_media_list_lock should be held upon entering this function.
*
*
* \param p_ml a media list instance
* \param p_ml a media list instance
* \param p_e initialized exception object
* \return number of items in media list
* \return number of items in media list
*/
*/
VLC_PUBLIC_API
int
VLC_PUBLIC_API
int
libvlc_media_list_count
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_count
(
libvlc_media_list_t
*
p_ml
);
libvlc_exception_t
*
p_e
);
/**
/**
* List media instance in media list at a position
* List media instance in media list at a position
...
@@ -173,13 +166,11 @@ VLC_PUBLIC_API libvlc_media_t *
...
@@ -173,13 +166,11 @@ VLC_PUBLIC_API libvlc_media_t *
*
*
* \param p_ml a media list instance
* \param p_ml a media list instance
* \param p_mi media list instance
* \param p_mi media list instance
* \param p_e initialized exception object
* \return position of media instance
* \return position of media instance
*/
*/
VLC_PUBLIC_API
int
VLC_PUBLIC_API
int
libvlc_media_list_index_of_item
(
libvlc_media_list_t
*
,
libvlc_media_list_index_of_item
(
libvlc_media_list_t
*
p_ml
,
libvlc_media_t
*
,
libvlc_media_t
*
p_mi
);
libvlc_exception_t
*
);
/**
/**
* This indicates if this media list is read-only from a user point of view
* This indicates if this media list is read-only from a user point of view
...
@@ -238,12 +229,10 @@ VLC_PUBLIC_API libvlc_media_list_view_t *
...
@@ -238,12 +229,10 @@ VLC_PUBLIC_API libvlc_media_list_view_t *
* The p_event_manager is immutable, so you don't have to hold the lock
* The p_event_manager is immutable, so you don't have to hold the lock
*
*
* \param p_ml a media list instance
* \param p_ml a media list instance
* \param p_ex an excpetion instance
* \return libvlc_event_manager
* \return libvlc_event_manager
*/
*/
VLC_PUBLIC_API
libvlc_event_manager_t
*
VLC_PUBLIC_API
libvlc_event_manager_t
*
libvlc_media_list_event_manager
(
libvlc_media_list_t
*
,
libvlc_media_list_event_manager
(
libvlc_media_list_t
*
p_ml
);
libvlc_exception_t
*
);
/** @} media_list */
/** @} media_list */
...
...
src/control/flat_media_list_view.c
View file @
e7dc693e
...
@@ -148,7 +148,7 @@ import_mlist_rec( libvlc_media_list_view_t * p_mlv,
...
@@ -148,7 +148,7 @@ import_mlist_rec( libvlc_media_list_view_t * p_mlv,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
int
i
,
count
;
int
i
,
count
;
count
=
libvlc_media_list_count
(
p_mlist
,
p_e
);
count
=
libvlc_media_list_count
(
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
...
...
src/control/hierarchical_media_list_view.c
View file @
e7dc693e
...
@@ -53,7 +53,8 @@ static int
...
@@ -53,7 +53,8 @@ static int
hierarch_media_list_view_count
(
libvlc_media_list_view_t
*
p_mlv
,
hierarch_media_list_view_count
(
libvlc_media_list_view_t
*
p_mlv
,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
return
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
p_e
);
VLC_UNUSED
(
p_e
);
return
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
}
}
/**************************************************************************
/**************************************************************************
...
...
src/control/hierarchical_node_media_list_view.c
View file @
e7dc693e
...
@@ -59,7 +59,7 @@ hierarch_node_media_list_view_count( libvlc_media_list_view_t * p_mlv,
...
@@ -59,7 +59,7 @@ hierarch_node_media_list_view_count( libvlc_media_list_view_t * p_mlv,
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
/* FIXME: we may want to cache that */
/* FIXME: we may want to cache that */
int
i
,
ret
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
p_e
);
int
i
,
ret
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
libvlc_media_list_t
*
p_submlist
;
libvlc_media_list_t
*
p_submlist
;
ret
=
0
;
ret
=
0
;
...
@@ -90,7 +90,7 @@ hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
...
@@ -90,7 +90,7 @@ hierarch_node_media_list_view_item_at_index( libvlc_media_list_view_t * p_mlv,
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
libvlc_media_list_t
*
p_submlist
;
libvlc_media_list_t
*
p_submlist
;
trace
(
"%d
\n
"
,
index
);
trace
(
"%d
\n
"
,
index
);
int
i
,
current_index
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
p_e
);
int
i
,
current_index
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
current_index
=
-
1
;
current_index
=
-
1
;
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
...
@@ -140,7 +140,7 @@ index_of_item( libvlc_media_list_view_t * p_mlv, libvlc_media_t * p_md )
...
@@ -140,7 +140,7 @@ index_of_item( libvlc_media_list_view_t * p_mlv, libvlc_media_t * p_md )
libvlc_media_t
*
p_iter_md
;
libvlc_media_t
*
p_iter_md
;
libvlc_media_list_t
*
p_submlist
;
libvlc_media_list_t
*
p_submlist
;
int
i
,
current_index
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
NULL
);
int
i
,
current_index
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
current_index
=
-
1
;
current_index
=
-
1
;
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
...
@@ -164,7 +164,7 @@ item_is_already_added( libvlc_media_t * p_md )
...
@@ -164,7 +164,7 @@ item_is_already_added( libvlc_media_t * p_md )
p_submlist
=
libvlc_media_subitems
(
p_md
);
p_submlist
=
libvlc_media_subitems
(
p_md
);
if
(
!
p_submlist
)
return
false
;
if
(
!
p_submlist
)
return
false
;
int
count
=
libvlc_media_list_count
(
p_submlist
,
NULL
);
int
count
=
libvlc_media_list_count
(
p_submlist
);
libvlc_media_list_release
(
p_submlist
);
libvlc_media_list_release
(
p_submlist
);
return
count
>
1
;
return
count
>
1
;
}
}
...
...
src/control/media.c
View file @
e7dc693e
...
@@ -102,7 +102,7 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
...
@@ -102,7 +102,7 @@ static void input_item_subitem_added( const vlc_event_t *p_event,
if
(
!
p_md
->
p_subitems
)
if
(
!
p_md
->
p_subitems
)
{
{
p_md
->
p_subitems
=
libvlc_media_list_new
(
p_md
->
p_libvlc_instance
,
NULL
);
p_md
->
p_subitems
=
libvlc_media_list_new
(
p_md
->
p_libvlc_instance
,
NULL
);
libvlc_media_list_set_media
(
p_md
->
p_subitems
,
p_md
,
NULL
);
libvlc_media_list_set_media
(
p_md
->
p_subitems
,
p_md
);
}
}
if
(
p_md
->
p_subitems
)
if
(
p_md
->
p_subitems
)
{
{
...
...
src/control/media_discoverer.c
View file @
e7dc693e
...
@@ -88,7 +88,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
...
@@ -88,7 +88,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
/* Insert the md into the root list */
/* Insert the md into the root list */
libvlc_media_list_lock
(
p_mdis
->
p_mlist
);
libvlc_media_list_lock
(
p_mdis
->
p_mlist
);
_libvlc_media_list_add_media
(
p_mdis
->
p_mlist
,
p_catmd
,
NULL
);
_libvlc_media_list_add_media
(
p_mdis
->
p_mlist
,
p_catmd
);
libvlc_media_list_unlock
(
p_mdis
->
p_mlist
);
libvlc_media_list_unlock
(
p_mdis
->
p_mlist
);
/* We don't release the mlist cause the dictionary
/* We don't release the mlist cause the dictionary
...
@@ -98,7 +98,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
...
@@ -98,7 +98,7 @@ static void services_discovery_item_added( const vlc_event_t * p_event,
}
}
libvlc_media_list_lock
(
p_mlist
);
libvlc_media_list_lock
(
p_mlist
);
_libvlc_media_list_add_media
(
p_mlist
,
p_md
,
NULL
);
_libvlc_media_list_add_media
(
p_mlist
,
p_md
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_list_unlock
(
p_mlist
);
libvlc_media_release
(
p_md
);
libvlc_media_release
(
p_md
);
...
@@ -115,7 +115,7 @@ static void services_discovery_item_removed( const vlc_event_t * p_event,
...
@@ -115,7 +115,7 @@ static void services_discovery_item_removed( const vlc_event_t * p_event,
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
libvlc_media_discoverer_t
*
p_mdis
=
user_data
;
libvlc_media_discoverer_t
*
p_mdis
=
user_data
;
int
i
,
count
=
libvlc_media_list_count
(
p_mdis
->
p_mlist
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mdis
->
p_mlist
);
libvlc_media_list_lock
(
p_mdis
->
p_mlist
);
libvlc_media_list_lock
(
p_mdis
->
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
...
...
src/control/media_list.c
View file @
e7dc693e
...
@@ -288,11 +288,9 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
...
@@ -288,11 +288,9 @@ libvlc_media_list_add_file_content( libvlc_media_list_t * p_mlist,
* set_media (Public)
* set_media (Public)
**************************************************************************/
**************************************************************************/
void
libvlc_media_list_set_media
(
libvlc_media_list_t
*
p_mlist
,
void
libvlc_media_list_set_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_md
,
libvlc_media_t
*
p_md
)
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
vlc_mutex_lock
(
&
p_mlist
->
object_lock
);
vlc_mutex_lock
(
&
p_mlist
->
object_lock
);
libvlc_media_release
(
p_mlist
->
p_md
);
libvlc_media_release
(
p_mlist
->
p_md
);
libvlc_media_retain
(
p_md
);
libvlc_media_retain
(
p_md
);
...
@@ -310,11 +308,9 @@ void libvlc_media_list_set_media( libvlc_media_list_t * p_mlist,
...
@@ -310,11 +308,9 @@ void libvlc_media_list_set_media( libvlc_media_list_t * p_mlist,
* media.
* media.
**************************************************************************/
**************************************************************************/
libvlc_media_t
*
libvlc_media_t
*
libvlc_media_list_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_media
(
libvlc_media_list_t
*
p_mlist
)
libvlc_exception_t
*
p_e
)
{
{
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
VLC_UNUSED
(
p_e
);
vlc_mutex_lock
(
&
p_mlist
->
object_lock
);
vlc_mutex_lock
(
&
p_mlist
->
object_lock
);
p_md
=
p_mlist
->
p_md
;
p_md
=
p_mlist
->
p_md
;
...
@@ -328,12 +324,10 @@ libvlc_media_list_media( libvlc_media_list_t * p_mlist,
...
@@ -328,12 +324,10 @@ libvlc_media_list_media( libvlc_media_list_t * p_mlist,
/**************************************************************************
/**************************************************************************
* libvlc_media_list_count (Public)
* libvlc_media_list_count (Public)
*
*
* Lock should be h
o
ld when entering.
* Lock should be h
e
ld when entering.
**************************************************************************/
**************************************************************************/
int
libvlc_media_list_count
(
libvlc_media_list_t
*
p_mlist
,
int
libvlc_media_list_count
(
libvlc_media_list_t
*
p_mlist
)
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
return
vlc_array_count
(
&
p_mlist
->
items
);
return
vlc_array_count
(
&
p_mlist
->
items
);
}
}
...
@@ -348,16 +342,13 @@ void libvlc_media_list_add_media(
...
@@ -348,16 +342,13 @@ void libvlc_media_list_add_media(
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
if
(
mlist_is_writable
(
p_mlist
,
p_e
)
)
if
(
mlist_is_writable
(
p_mlist
,
p_e
)
)
_libvlc_media_list_add_media
(
p_mlist
,
p_md
,
p_e
);
_libvlc_media_list_add_media
(
p_mlist
,
p_md
);
}
}
/* LibVLC internal version */
/* LibVLC internal version */
void
_libvlc_media_list_add_media
(
void
_libvlc_media_list_add_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_md
)
libvlc_media_t
*
p_md
,
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
libvlc_media_retain
(
p_md
);
libvlc_media_retain
(
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
vlc_array_count
(
&
p_mlist
->
items
),
notify_item_addition
(
p_mlist
,
p_md
,
vlc_array_count
(
&
p_mlist
->
items
),
...
@@ -379,17 +370,15 @@ void libvlc_media_list_insert_media(
...
@@ -379,17 +370,15 @@ void libvlc_media_list_insert_media(
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
if
(
mlist_is_writable
(
p_mlist
,
p_e
)
)
if
(
mlist_is_writable
(
p_mlist
,
p_e
)
)
_libvlc_media_list_insert_media
(
p_mlist
,
p_md
,
index
,
p_e
);
_libvlc_media_list_insert_media
(
p_mlist
,
p_md
,
index
);
}
}
/* LibVLC internal version */
/* LibVLC internal version */
void
_libvlc_media_list_insert_media
(
void
_libvlc_media_list_insert_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_md
,
libvlc_media_t
*
p_md
,
int
index
,
int
index
)
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
libvlc_media_retain
(
p_md
);
libvlc_media_retain
(
p_md
);
notify_item_addition
(
p_mlist
,
p_md
,
index
,
EventWillHappen
);
notify_item_addition
(
p_mlist
,
p_md
,
index
,
EventWillHappen
);
...
@@ -464,11 +453,8 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist,
...
@@ -464,11 +453,8 @@ libvlc_media_list_item_at_index( libvlc_media_list_t * p_mlist,
* Warning: this function returns the first matching item.
* Warning: this function returns the first matching item.
**************************************************************************/
**************************************************************************/
int
libvlc_media_list_index_of_item
(
libvlc_media_list_t
*
p_mlist
,
int
libvlc_media_list_index_of_item
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_searched_md
,
libvlc_media_t
*
p_searched_md
)
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
int
i
;
int
i
;
for
(
i
=
0
;
i
<
vlc_array_count
(
&
p_mlist
->
items
);
i
++
)
for
(
i
=
0
;
i
<
vlc_array_count
(
&
p_mlist
->
items
);
i
++
)
...
@@ -519,9 +505,7 @@ void libvlc_media_list_unlock( libvlc_media_list_t * p_mlist )
...
@@ -519,9 +505,7 @@ void libvlc_media_list_unlock( libvlc_media_list_t * p_mlist )
* The p_event_manager is immutable, so you don't have to hold the lock
* The p_event_manager is immutable, so you don't have to hold the lock
**************************************************************************/
**************************************************************************/
libvlc_event_manager_t
*
libvlc_event_manager_t
*
libvlc_media_list_event_manager
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_event_manager
(
libvlc_media_list_t
*
p_mlist
)
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
return
p_mlist
->
p_event_manager
;
return
p_mlist
->
p_event_manager
;
}
}
src/control/media_list_internal.h
View file @
e7dc693e
...
@@ -58,13 +58,11 @@ struct libvlc_media_list_t
...
@@ -58,13 +58,11 @@ struct libvlc_media_list_t
/* Media List */
/* Media List */
void
_libvlc_media_list_add_media
(
void
_libvlc_media_list_add_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_md
,
libvlc_media_t
*
p_md
);
libvlc_exception_t
*
p_e
);
void
_libvlc_media_list_insert_media
(
void
_libvlc_media_list_insert_media
(
libvlc_media_list_t
*
p_mlist
,
libvlc_media_list_t
*
p_mlist
,
libvlc_media_t
*
p_md
,
int
index
,
libvlc_media_t
*
p_md
,
int
index
);
libvlc_exception_t
*
p_e
);
void
_libvlc_media_list_remove_index
(
void
_libvlc_media_list_remove_index
(
libvlc_media_list_t
*
p_mlist
,
int
index
,
libvlc_media_list_t
*
p_mlist
,
int
index
,
...
...
src/control/media_list_path.h
View file @
e7dc693e
...
@@ -119,7 +119,7 @@ static libvlc_media_list_path_t
...
@@ -119,7 +119,7 @@ static libvlc_media_list_path_t
get_path_rec
(
const
libvlc_media_list_path_t
path
,
libvlc_media_list_t
*
p_current_mlist
,
libvlc_media_t
*
p_searched_md
)
get_path_rec
(
const
libvlc_media_list_path_t
path
,
libvlc_media_list_t
*
p_current_mlist
,
libvlc_media_t
*
p_searched_md
)
{
{
int
i
,
count
;
int
i
,
count
;
count
=
libvlc_media_list_count
(
p_current_mlist
,
NULL
);
count
=
libvlc_media_list_count
(
p_current_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_media_t
*
p_md
=
libvlc_media_list_item_at_index
(
p_current_mlist
,
i
,
NULL
);
libvlc_media_t
*
p_md
=
libvlc_media_list_item_at_index
(
p_current_mlist
,
i
,
NULL
);
...
...
src/control/media_list_player.c
View file @
e7dc693e
...
@@ -116,7 +116,7 @@ static inline void assert_locked(libvlc_media_list_player_t * p_mlp)
...
@@ -116,7 +116,7 @@ static inline void assert_locked(libvlc_media_list_player_t * p_mlp)
static
inline
libvlc_event_manager_t
*
mlist_em
(
libvlc_media_list_player_t
*
p_mlp
)
static
inline
libvlc_event_manager_t
*
mlist_em
(
libvlc_media_list_player_t
*
p_mlp
)
{
{
assert_locked
(
p_mlp
);
assert_locked
(
p_mlp
);
return
libvlc_media_list_event_manager
(
p_mlp
->
p_mlist
,
NULL
);
return
libvlc_media_list_event_manager
(
p_mlp
->
p_mlist
);
}
}
static
inline
libvlc_event_manager_t
*
mplayer_em
(
libvlc_media_list_player_t
*
p_mlp
)
static
inline
libvlc_event_manager_t
*
mplayer_em
(
libvlc_media_list_player_t
*
p_mlp
)
...
@@ -144,7 +144,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
...
@@ -144,7 +144,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
if
(
!
p_mlp
->
current_playing_item_path
)
if
(
!
p_mlp
->
current_playing_item_path
)
{
{
if
(
!
libvlc_media_list_count
(
p_mlp
->
p_mlist
,
NULL
))
if
(
!
libvlc_media_list_count
(
p_mlp
->
p_mlist
))
return
NULL
;
return
NULL
;
return
libvlc_media_list_path_with_root_index
(
0
);
return
libvlc_media_list_path_with_root_index
(
0
);
}
}
...
@@ -172,7 +172,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
...
@@ -172,7 +172,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
ret
[
depth
-
1
]
++
;
/* set to next element */
ret
[
depth
-
1
]
++
;
/* set to next element */
/* If this goes beyond the end of the list */
/* If this goes beyond the end of the list */
while
(
ret
[
depth
-
1
]
>=
libvlc_media_list_count
(
p_parent_of_playing_item
,
NULL
))
while
(
ret
[
depth
-
1
]
>=
libvlc_media_list_count
(
p_parent_of_playing_item
))
{
{
depth
--
;
depth
--
;
if
(
depth
<=
0
)
if
(
depth
<=
0
)
...
@@ -218,7 +218,7 @@ find_last_item( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t current_
...
@@ -218,7 +218,7 @@ find_last_item( libvlc_media_list_t * p_mlist, libvlc_media_list_path_t current_
if
(
p_sublist
)
if
(
p_sublist
)
{
{
int
i_count
=
libvlc_media_list_count
(
p_sublist
,
NULL
);
int
i_count
=
libvlc_media_list_count
(
p_sublist
);
if
(
i_count
>
0
)
if
(
i_count
>
0
)
{
{
/* Add the last sublist item to the path. */
/* Add the last sublist item to the path. */
...
@@ -252,7 +252,7 @@ get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
...
@@ -252,7 +252,7 @@ get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
if
(
!
p_mlp
->
current_playing_item_path
)
if
(
!
p_mlp
->
current_playing_item_path
)
{
{
if
(
!
libvlc_media_list_count
(
p_mlp
->
p_mlist
,
NULL
))
if
(
!
libvlc_media_list_count
(
p_mlp
->
p_mlist
))
return
NULL
;
return
NULL
;
return
libvlc_media_list_path_with_root_index
(
0
);
return
libvlc_media_list_path_with_root_index
(
0
);
}
}
...
@@ -285,7 +285,7 @@ get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
...
@@ -285,7 +285,7 @@ get_previous_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
// Is looping enabled?
// Is looping enabled?
if
(
b_loop
)
if
(
b_loop
)
{
{
int
i_count
=
libvlc_media_list_count
(
p_parent_of_playing_item
,
NULL
);
int
i_count
=
libvlc_media_list_count
(
p_parent_of_playing_item
);
/* Set current play item to the last element in the list */
/* Set current play item to the last element in the list */
ret
[
0
]
=
i_count
-
1
;
ret
[
0
]
=
i_count
-
1
;
...
...
src/control/media_list_view.c
View file @
e7dc693e
...
@@ -64,7 +64,7 @@ install_md_listener( libvlc_media_list_view_t * p_mlv,
...
@@ -64,7 +64,7 @@ install_md_listener( libvlc_media_list_view_t * p_mlv,
if
((
p_mlist
=
libvlc_media_subitems
(
p_md
)))
if
((
p_mlist
=
libvlc_media_subitems
(
p_md
)))
{
{
libvlc_media_list_lock
(
p_mlist
);
libvlc_media_list_lock
(
p_mlist
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_event_t
added_event
;
libvlc_event_t
added_event
;
...
@@ -116,7 +116,7 @@ uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
...
@@ -116,7 +116,7 @@ uninstall_md_listener( libvlc_media_list_view_t * p_mlv,
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
);
media_list_item_removed
,
p_mlv
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_media_t
*
p_submd
;
libvlc_media_t
*
p_submd
;
...
@@ -203,7 +203,7 @@ libvlc_media_list_view_set_ml_notification_callback(
...
@@ -203,7 +203,7 @@ libvlc_media_list_view_set_ml_notification_callback(
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_event_attach
(
p_mlv
->
p_mlist
->
p_event_manager
,
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
,
NULL
);
media_list_item_removed
,
p_mlv
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
...
@@ -387,7 +387,7 @@ libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv )
...
@@ -387,7 +387,7 @@ libvlc_media_list_view_release( libvlc_media_list_view_t * p_mlv )
libvlc_MediaListItemDeleted
,
libvlc_MediaListItemDeleted
,
media_list_item_removed
,
p_mlv
);
media_list_item_removed
,
p_mlv
);
}
}
int
i
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
,
NULL
);
int
i
,
count
=
libvlc_media_list_count
(
p_mlv
->
p_mlist
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_media_t
*
p_md
;
libvlc_media_t
*
p_md
;
...
...
test/libvlc/media_list.c
View file @
e7dc693e
...
@@ -50,41 +50,31 @@ static void test_media_list (const char ** argv, int argc)
...
@@ -50,41 +50,31 @@ static void test_media_list (const char ** argv, int argc)
libvlc_media_list_add_media
(
ml
,
md2
,
&
ex
);
libvlc_media_list_add_media
(
ml
,
md2
,
&
ex
);
catch
();
catch
();
assert
(
libvlc_media_list_count
(
ml
,
&
ex
)
==
2
);
assert
(
libvlc_media_list_count
(
ml
)
==
2
);
catch
();
assert
(
libvlc_media_list_index_of_item
(
ml
,
md1
)
==
0
);
assert
(
libvlc_media_list_index_of_item
(
ml
,
md2
)
==
1
);
assert
(
libvlc_media_list_index_of_item
(
ml
,
md1
,
&
ex
)
==
0
);
catch
();
assert
(
libvlc_media_list_index_of_item
(
ml
,
md2
,
&
ex
)
==
1
);
catch
();
libvlc_media_list_remove_index
(
ml
,
0
,
&
ex
);
/* removing first item */
libvlc_media_list_remove_index
(
ml
,
0
,
&
ex
);
/* removing first item */
catch
();
catch
();
/* test if second item was moved on first place */
/* test if second item was moved on first place */
assert
(
libvlc_media_list_index_of_item
(
ml
,
md2
,
&
ex
)
==
0
);
assert
(
libvlc_media_list_index_of_item
(
ml
,
md2
)
==
0
);
catch
();
libvlc_media_list_add_media
(
ml
,
md1
,
&
ex
);
/* add 2 items */
libvlc_media_list_add_media
(
ml
,
md1
,
&
ex
);
/* add 2 items */
catch
();
catch
();
libvlc_media_list_add_media
(
ml
,
md1
,
&
ex
);
libvlc_media_list_add_media
(
ml
,
md1
,
&
ex
);
catch
();
catch
();
/* there should be 3 pieces */
/* there should be 3 pieces */
assert
(
libvlc_media_list_count
(
ml
,
&
ex
)
==
3
);
assert
(
libvlc_media_list_count
(
ml
)
==
3
);
catch
();
libvlc_media_list_insert_media
(
ml
,
md3
,
2
,
&
ex
);
libvlc_media_list_insert_media
(
ml
,
md3
,
2
,
&
ex
);
catch
();
catch
();
/* there should be 4 pieces */
/* there should be 4 pieces */
assert
(
libvlc_media_list_count
(
ml
,
&
ex
)
==
4
);
assert
(
libvlc_media_list_count
(
ml
)
==
4
);
catch
();
/* test inserting on right place */
/* test inserting on right place */
assert
(
libvlc_media_list_index_of_item
(
ml
,
md3
,
&
ex
)
==
2
);
assert
(
libvlc_media_list_index_of_item
(
ml
,
md3
)
==
2
);
catch
();
/* test right returning descriptor*/
/* test right returning descriptor*/
assert
(
libvlc_media_list_item_at_index
(
ml
,
0
,
&
ex
)
==
md2
);
assert
(
libvlc_media_list_item_at_index
(
ml
,
0
,
&
ex
)
==
md2
);
...
@@ -120,7 +110,7 @@ static void test_media_list (const char ** argv, int argc)
...
@@ -120,7 +110,7 @@ static void test_media_list (const char ** argv, int argc)
/* try to find non inserted item */
/* try to find non inserted item */
int
i_non_exist
=
0
;
int
i_non_exist
=
0
;
i_non_exist
=
libvlc_media_list_index_of_item
(
ml
,
md4
,
&
ex
);
i_non_exist
=
libvlc_media_list_index_of_item
(
ml
,
md4
);
assert
(
i_non_exist
==
-
1
);
assert
(
i_non_exist
==
-
1
);
libvlc_media_release
(
md1
);
libvlc_media_release
(
md1
);
...
...
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