[vlc-commits] playlist: create input resource structure at activation time
Rémi Denis-Courmont
git at videolan.org
Wed Oct 31 21:59:48 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Oct 31 22:53:06 2012 +0200| [a940e18df84903f9c6c519ff0ac79d8f416c15db] | committer: Rémi Denis-Courmont
playlist: create input resource structure at activation time
If the playlist is activated, then input resources are almost certainly
going to be used. This is a bit simpler.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a940e18df84903f9c6c519ff0ac79d8f416c15db
---
src/playlist/engine.c | 1 -
src/playlist/thread.c | 17 +++++++----------
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index a7f8694..326f1a7 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -323,7 +323,6 @@ void playlist_Destroy( playlist_t *p_playlist )
/* Already cleared when deactivating (if activated anyway) */
assert( !p_sys->p_input );
- assert( !p_sys->p_input_resource );
vlc_cond_destroy( &p_sys->signal );
vlc_mutex_destroy( &p_sys->lock );
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 5ccfa1e..68d11a2 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -58,6 +58,10 @@ void playlist_Activate( playlist_t *p_playlist )
/* */
playlist_private_t *p_sys = pl_priv(p_playlist);
+ p_sys->p_input_resource = input_resource_New( VLC_OBJECT( p_playlist ) );
+ if( unlikely(p_sys->p_input_resource == NULL) )
+ abort();
+
/* Start the playlist thread */
if( vlc_clone( &p_sys->thread, Thread, p_playlist,
VLC_THREAD_PRIORITY_LOW ) )
@@ -83,12 +87,8 @@ void playlist_Deactivate( playlist_t *p_playlist )
assert( !p_sys->p_input );
/* release input resources */
- if( p_sys->p_input_resource )
- {
- input_resource_Terminate( p_sys->p_input_resource );
- input_resource_Release( p_sys->p_input_resource );
- }
- p_sys->p_input_resource = NULL;
+ input_resource_Terminate( p_sys->p_input_resource );
+ input_resource_Release( p_sys->p_input_resource );
if( var_InheritBool( p_playlist, "media-library" ) )
playlist_MLDump( p_playlist );
@@ -237,8 +237,6 @@ static int PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
assert( p_sys->p_input == NULL );
- if( !p_sys->p_input_resource )
- p_sys->p_input_resource = input_resource_New( VLC_OBJECT( p_playlist ) );
input_thread_t *p_input_thread = input_Create( p_playlist, p_input, NULL, p_sys->p_input_resource );
if( p_input_thread )
{
@@ -523,8 +521,7 @@ static void LoopRequest( playlist_t *p_playlist )
{
p_sys->status.i_status = PLAYLIST_STOPPED;
- if( p_sys->p_input_resource &&
- input_resource_HasVout( p_sys->p_input_resource ) )
+ if( input_resource_HasVout( p_sys->p_input_resource ) )
{
/* XXX We can unlock if we don't issue the wait as we will be
* call again without anything else done between the calls */
More information about the vlc-commits
mailing list