Commit 3ccc2863 authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

input: Don't assume the playlist always exists.

parent 45c03700
...@@ -598,13 +598,16 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args ) ...@@ -598,13 +598,16 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
static void NotifyPlaylist( input_thread_t *p_input ) static void NotifyPlaylist( input_thread_t *p_input )
{ {
playlist_t *p_playlist = pl_Get( p_input ); /* FIXME: We need to avoid that dependency on the playlist
if( p_playlist->b_die ) * because it is a circular dependency:
* ( playlist -> input -> playlist ) */
playlist_t *p_playlist = vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT );
if( !p_playlist )
return; return;
vlc_object_yield( p_playlist );
var_SetInteger( p_playlist, "item-change", var_SetInteger( p_playlist, "item-change",
p_input->p->input.p_item->i_id ); p_input->p->input.p_item->i_id );
pl_Release( p_input ); vlc_object_release( p_playlist );
} }
static void UpdateBookmarksOption( input_thread_t *p_input ) static void UpdateBookmarksOption( input_thread_t *p_input )
......
...@@ -1680,12 +1680,17 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args ) ...@@ -1680,12 +1680,17 @@ static int EsOutControl( es_out_t *out, int i_query, va_list args )
} }
} }
{ {
playlist_t * p_playlist = pl_Yield( p_sys->p_input ); /* FIXME: we don't want to depend on the playlist */
PL_LOCK; playlist_t * p_playlist = vlc_object_find( p_sys->p_input,
p_playlist->gc_date = mdate(); VLC_OBJECT_PLAYLIST, FIND_PARENT );
vlc_object_signal_unlocked( p_playlist ); if( p_playlist )
PL_UNLOCK; {
pl_Release( p_playlist ); PL_LOCK;
p_playlist->gc_date = mdate();
vlc_object_signal_unlocked( p_playlist );
PL_UNLOCK;
vlc_object_release( p_playlist );
}
} }
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -40,10 +40,10 @@ ...@@ -40,10 +40,10 @@
#include <vlc_sout.h> #include <vlc_sout.h>
#include "../stream_output/stream_output.h" #include "../stream_output/stream_output.h"
#include <vlc_playlist.h>
#include <vlc_interface.h> #include <vlc_interface.h>
#include <vlc_url.h> #include <vlc_url.h>
#include <vlc_charset.h> #include <vlc_charset.h>
#include <vlc_playlist.h>
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
# include <sys/stat.h> # include <sys/stat.h>
...@@ -502,7 +502,15 @@ static int Run( input_thread_t *p_input ) ...@@ -502,7 +502,15 @@ static int Run( input_thread_t *p_input )
{ {
/* If we failed, wait before we are killed, and exit */ /* If we failed, wait before we are killed, and exit */
p_input->b_error = VLC_TRUE; p_input->b_error = VLC_TRUE;
playlist_Signal( pl_Get( p_input ) );
/* FIXME: we don't want to depend on the playlist */
playlist_t * p_playlist = vlc_object_find( p_input,
VLC_OBJECT_PLAYLIST, FIND_PARENT );
if( p_playlist )
{
playlist_Signal( p_playlist );
vlc_object_release( p_playlist );
}
Error( p_input ); Error( p_input );
...@@ -1373,27 +1381,31 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item, ...@@ -1373,27 +1381,31 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item,
if( b_keep_sout ) if( b_keep_sout )
{ {
/* Remove the sout from the playlist garbage collector */ /* Remove the sout from the playlist garbage collector */
playlist_t *p_playlist = pl_Yield( p_parent ); /* FIXME: we don't want to depend on the playlist */
playlist_t * p_playlist = vlc_object_find( p_parent,
vlc_mutex_lock( &p_playlist->gc_lock ); VLC_OBJECT_PLAYLIST, FIND_PARENT );
p_sout = vlc_object_find( p_playlist, VLC_OBJECT_SOUT, FIND_CHILD ); if( p_playlist )
if( p_sout )
{ {
if( p_sout->p_parent != VLC_OBJECT(p_playlist) ) vlc_mutex_lock( &p_playlist->gc_lock );
p_sout = vlc_object_find( p_playlist, VLC_OBJECT_SOUT, FIND_CHILD );
if( p_sout )
{ {
vlc_object_release( p_sout ); if( p_sout->p_parent != VLC_OBJECT(p_playlist) )
p_sout = NULL; {
} vlc_object_release( p_sout );
else p_sout = NULL;
{ }
vlc_object_detach( p_sout ); /* Remove it from the GC */ else
{
vlc_object_detach( p_sout ); /* Remove it from the GC */
vlc_object_release( p_sout ); vlc_object_release( p_sout );
}
} }
} vlc_mutex_unlock( &p_playlist->gc_lock );
vlc_mutex_unlock( &p_playlist->gc_lock );
pl_Release( p_parent ); vlc_object_release( p_playlist );
}
} }
if( pb_sout_keep ) if( pb_sout_keep )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment