# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <ctype.h>
#include <limits.h>
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 */
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 );
}
/**
- * 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
/* 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 */
* 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 );
}
}
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 );
}
/*****************************************************************************
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;
}
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 );
- }
}
/*****************************************************************************
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;
}
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
{