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
839552a5
Commit
839552a5
authored
Jun 02, 2009
by
Pierre d'Herbemont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc: Fix media_list_player's test by using asynchronous event handler on media.
parent
7da96633
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
6 deletions
+41
-6
src/control/media_list_path.h
src/control/media_list_path.h
+20
-0
src/control/media_list_player.c
src/control/media_list_player.c
+20
-4
test/libvlc/media_list_player.c
test/libvlc/media_list_player.c
+1
-2
No files found.
src/control/media_list_path.h
View file @
839552a5
...
@@ -27,6 +27,23 @@
...
@@ -27,6 +27,23 @@
typedef
int
*
libvlc_media_list_path_t
;
/* (Media List Player Internal) */
typedef
int
*
libvlc_media_list_path_t
;
/* (Media List Player Internal) */
/**************************************************************************
* path_dump (Media List Player Internal)
**************************************************************************/
static
inline
void
libvlc_media_list_path_dump
(
libvlc_media_list_path_t
path
)
{
if
(
!
path
)
{
printf
(
"NULL path
\n
"
);
return
;
}
int
i
;
for
(
i
=
0
;
path
[
i
]
!=
-
1
;
i
++
)
printf
(
"%s%d"
,
i
>
0
?
"/"
:
""
,
path
[
i
]);
printf
(
"
\n
"
);
}
/**************************************************************************
/**************************************************************************
* path_empty (Media List Player Internal)
* path_empty (Media List Player Internal)
**************************************************************************/
**************************************************************************/
...
@@ -187,7 +204,10 @@ libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, libvlc_medi
...
@@ -187,7 +204,10 @@ libvlc_media_list_parentlist_at_path( libvlc_media_list_t * p_mlist, libvlc_medi
libvlc_media_list_release
(
p_current_mlist
);
libvlc_media_list_release
(
p_current_mlist
);
if
(
path
[
i
+
1
]
==
-
1
)
if
(
path
[
i
+
1
]
==
-
1
)
{
libvlc_media_list_retain
(
p_current_mlist
);
return
p_current_mlist
;
return
p_current_mlist
;
}
p_md
=
libvlc_media_list_item_at_index
(
p_current_mlist
,
path
[
i
],
NULL
);
p_md
=
libvlc_media_list_item_at_index
(
p_current_mlist
,
path
[
i
],
NULL
);
...
...
src/control/media_list_player.c
View file @
839552a5
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include "media_internal.h" // Abuse, could and should be removed
#include "media_internal.h" // Abuse, could and should be removed
#include "media_list_path.h"
#include "media_list_path.h"
//#define DEBUG_MEDIA_LIST_PLAYER
struct
libvlc_media_list_player_t
struct
libvlc_media_list_player_t
{
{
...
@@ -92,6 +93,9 @@ get_next_path( libvlc_media_list_player_t * p_mlp )
...
@@ -92,6 +93,9 @@ get_next_path( libvlc_media_list_player_t * p_mlp )
ret
=
libvlc_media_list_path_copy
(
p_mlp
->
current_playing_item_path
);
ret
=
libvlc_media_list_path_copy
(
p_mlp
->
current_playing_item_path
);
ret
[
depth
-
1
]
++
;
// Play next element
/* If this goes beyong 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
,
NULL
)
)
{
{
depth
--
;
depth
--
;
...
@@ -137,7 +141,10 @@ media_player_reached_end( const libvlc_event_t * p_event,
...
@@ -137,7 +141,10 @@ media_player_reached_end( const libvlc_event_t * p_event,
}
}
libvlc_media_release
(
p_md
);
libvlc_media_release
(
p_md
);
libvlc_media_release
(
p_current_md
);
libvlc_media_release
(
p_current_md
);
libvlc_media_list_player_next
(
p_mlp
,
NULL
);
libvlc_exception_t
e
;
libvlc_exception_init
(
&
e
);
libvlc_media_list_player_next
(
p_mlp
,
&
e
);
libvlc_exception_clear
(
&
e
);
// Don't worry if there was an error
}
}
/**************************************************************************
/**************************************************************************
...
@@ -193,7 +200,7 @@ uninstall_playlist_observer( libvlc_media_list_player_t * p_mlp )
...
@@ -193,7 +200,7 @@ uninstall_playlist_observer( libvlc_media_list_player_t * p_mlp )
static
void
static
void
install_media_player_observer
(
libvlc_media_list_player_t
*
p_mlp
)
install_media_player_observer
(
libvlc_media_list_player_t
*
p_mlp
)
{
{
libvlc_event_attach
(
libvlc_media_player_event_manager
(
p_mlp
->
p_mi
,
NULL
),
libvlc_event_attach
_async
(
libvlc_media_player_event_manager
(
p_mlp
->
p_mi
,
NULL
),
libvlc_MediaPlayerEndReached
,
libvlc_MediaPlayerEndReached
,
media_player_reached_end
,
p_mlp
,
NULL
);
media_player_reached_end
,
p_mlp
,
NULL
);
}
}
...
@@ -206,9 +213,7 @@ static void
...
@@ -206,9 +213,7 @@ static void
uninstall_media_player_observer
(
libvlc_media_list_player_t
*
p_mlp
)
uninstall_media_player_observer
(
libvlc_media_list_player_t
*
p_mlp
)
{
{
if
(
!
p_mlp
->
p_mi
)
if
(
!
p_mlp
->
p_mi
)
{
return
;
return
;
}
libvlc_event_detach
(
libvlc_media_player_event_manager
(
p_mlp
->
p_mi
,
NULL
),
libvlc_event_detach
(
libvlc_media_player_event_manager
(
p_mlp
->
p_mi
,
NULL
),
libvlc_MediaPlayerEndReached
,
libvlc_MediaPlayerEndReached
,
...
@@ -370,6 +375,12 @@ void libvlc_media_list_player_set_media_list(
...
@@ -370,6 +375,12 @@ void libvlc_media_list_player_set_media_list(
{
{
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
vlc_mutex_lock
(
&
p_mlp
->
object_lock
);
if
(
!
p_mlist
)
{
libvlc_exception_raise
(
p_e
,
"No media list provided"
);
return
;
}
if
(
libvlc_media_list_player_is_playing
(
p_mlp
,
p_e
)
)
if
(
libvlc_media_list_player_is_playing
(
p_mlp
,
p_e
)
)
{
{
libvlc_media_player_stop
(
p_mlp
->
p_mi
,
p_e
);
libvlc_media_player_stop
(
p_mlp
->
p_mi
,
p_e
);
...
@@ -522,6 +533,11 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
...
@@ -522,6 +533,11 @@ void libvlc_media_list_player_next( libvlc_media_list_player_t * p_mlp,
path
=
get_next_path
(
p_mlp
);
path
=
get_next_path
(
p_mlp
);
#ifdef DEBUG_MEDIA_LIST_PLAYER
printf
(
"Playing:"
);
libvlc_media_list_path_dump
(
path
);
#endif
if
(
!
path
)
if
(
!
path
)
{
{
libvlc_media_list_unlock
(
p_mlp
->
p_mlist
);
libvlc_media_list_unlock
(
p_mlp
->
p_mlist
);
...
...
test/libvlc/media_list_player.c
View file @
839552a5
...
@@ -198,7 +198,6 @@ int main (void)
...
@@ -198,7 +198,6 @@ int main (void)
test_media_list_player_pause_stop
(
test_defaults_args
,
test_defaults_nargs
);
test_media_list_player_pause_stop
(
test_defaults_args
,
test_defaults_nargs
);
test_media_list_player_play_item_at_index
(
test_defaults_args
,
test_defaults_nargs
);
test_media_list_player_play_item_at_index
(
test_defaults_args
,
test_defaults_nargs
);
if
(
0
)
// Core hangs here, because it doesn't support callback removal from callbacks (variable)
test_media_list_player_next
(
test_defaults_args
,
test_defaults_nargs
);
test_media_list_player_next
(
test_defaults_args
,
test_defaults_nargs
);
return
0
;
return
0
;
...
...
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