X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Finput%2Finput.c;h=10743d18fb9abea37d1874fbdb7794bacc4f0213;hb=86afb9792b9990d47d036cdbc3a1f216152d0960;hp=f4a0e5089d36de89c5316b5c71cc4db49d10e3f1;hpb=d3d776685b767f1a4648d66e5ba00c495c69cb19;p=vlc diff --git a/src/input/input.c b/src/input/input.c index f4a0e5089d..10743d18fb 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -29,7 +29,7 @@ # include "config.h" #endif -#include +#include #include #include @@ -153,6 +153,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item, STATS_TIMER_INPUT_LAUNCHING ); MALLOC_NULL( p_input->p, input_thread_private_t ); + memset( p_input->p, 0, sizeof( input_thread_private_t ) ); /* One "randomly" selected input thread is responsible for computing * the global stats. Check if there is already someone doing this */ @@ -324,10 +325,7 @@ static void Destructor( input_thread_t * p_input ) if( priv->b_sout_keep ) SoutKeep( priv->p_sout ); else - { sout_DeleteInstance( priv->p_sout ); - priv->p_sout = NULL; - } } #endif vlc_gc_decref( p_input->p->input.p_item ); @@ -386,7 +384,7 @@ input_thread_t *__input_CreateThreadExtended( vlc_object_t *p_parent, } /** - * Initialize an input thread and run it. This thread will clean after himself, + * Initialize an input thread and run it. This thread will clean after itself, * you can forget about it. It can work either in blocking or non-blocking mode * * \param p_parent a vlc_object @@ -553,7 +551,7 @@ static int Run( input_thread_t *p_input ) /* We have finished */ p_input->b_eof = true; - playlist_Signal( p_input->p_libvlc->p_playlist ); + playlist_Signal( libvlc_priv (p_input->p_libvlc)->p_playlist ); } /* Wait until we are asked to die */ @@ -1419,20 +1417,27 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item, * XXX it might be unusable but this will be checked later */ if( b_keep_sout ) { - p_sout = vlc_object_find( p_parent->p_libvlc, VLC_OBJECT_SOUT, - FIND_CHILD ); - if( p_sout ) + playlist_t *p_playlist = vlc_object_find( p_parent->p_libvlc, + VLC_OBJECT_PLAYLIST, FIND_CHILD ); + if( p_playlist ) { - if( p_sout->p_parent != VLC_OBJECT( p_sout->p_libvlc ) ) + 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 ); - p_sout = NULL; - } - else - { - vlc_object_detach( p_sout ); /* Remove it from the GC */ - vlc_object_release( p_sout ); + if( p_sout->p_parent != VLC_OBJECT( p_playlist ) ) + { + vlc_object_release( p_sout ); + p_sout = NULL; + } + else + { + vlc_object_detach( p_sout ); /* Remove it from the GC */ + vlc_object_release( p_sout ); + } } + vlc_mutex_unlock( &p_playlist->gc_lock ); + vlc_object_release( p_playlist ); } } @@ -1444,8 +1449,16 @@ static sout_instance_t *SoutFind( vlc_object_t *p_parent, input_item_t *p_item, static void SoutKeep( sout_instance_t *p_sout ) { - msg_Dbg( p_sout, "sout has been kept" ); - vlc_object_attach( p_sout, p_sout->p_libvlc ); + playlist_t * p_playlist = vlc_object_find( p_sout, VLC_OBJECT_PLAYLIST, + FIND_PARENT ); + if( p_playlist ) + { + msg_Dbg( p_sout, "sout has been kept" ); + vlc_object_attach( p_sout, p_playlist ); + vlc_object_release( p_playlist ); + } + else + sout_DeleteInstance( p_sout ); } /***************************************************************************** @@ -2110,7 +2123,6 @@ static int UpdateFromAccess( input_thread_t *p_input ) vlc_meta_t *p_meta = vlc_meta_New(); access_Control( p_input->p->input.p_access,ACCESS_GET_META, p_meta ); InputUpdateMeta( p_input, p_meta ); - var_SetInteger( p_input->p_libvlc->p_playlist, "item-change", p_input->p->input.p_item->i_id ); p_access->info.i_update &= ~INPUT_UPDATE_META; } @@ -2149,14 +2161,6 @@ static int UpdateFromAccess( input_thread_t *p_input ) static void UpdateItemLength( input_thread_t *p_input, int64_t i_length ) { input_item_SetDuration( p_input->p->input.p_item, (mtime_t) i_length ); - - if( !p_input->b_preparsing ) - { - pl_Yield( p_input ); - var_SetInteger( p_input->p_libvlc->p_playlist, "item-change", - p_input->p->input.p_item->i_id ); - pl_Release( p_input ); - } } /***************************************************************************** @@ -2165,27 +2169,8 @@ static void UpdateItemLength( input_thread_t *p_input, int64_t i_length ) static input_source_t *InputSourceNew( input_thread_t *p_input ) { input_source_t *in = (input_source_t*) malloc( sizeof( input_source_t ) ); - - if( !in ) - { - msg_Err( p_input, "out of memory for new input source" ); - return NULL; - } - - in->p_item = NULL; - in->p_access = NULL; - in->p_stream = NULL; - in->p_demux = NULL; - in->b_title_demux = false; - TAB_INIT( in->i_title, in->title ); - in->b_can_pause = true; - in->b_can_pace_control = true; - in->b_can_rate_control = true; - in->b_rescale_ts = true; - in->b_eof = false; - in->f_fps = 0.0; - in->i_cr_average = 0; - + if( in ) + memset( in, 0, sizeof( input_source_t ) ); return in; } @@ -2820,6 +2805,12 @@ void MRLSplit( char *psz_dup, const char **ppsz_access, const char **ppsz_demux, psz_demux = strchr( psz_access, '/' ); if( psz_demux ) *psz_demux++ = '\0'; + + /* We really don't want module name substitution here! */ + if( psz_access[0] == '$' ) + psz_access++; + if( psz_demux && psz_demux[0] == '$' ) + psz_demux++; } else {