/* Allocate descriptor */
p_input = Create( p_parent, p_item, NULL, VLC_TRUE );
- p_input->i_flags |= OBJECT_FLAGS_NODBG;
+ p_input->i_flags |= OBJECT_FLAGS_QUIET;
p_input->i_flags |= OBJECT_FLAGS_NOINTERACT;
/* Now we can attach our new input */
p_input->b_eof = VLC_TRUE;
}
- /* Wait we are asked to die */
+ /* Wait until we are asked to die */
if( !p_input->b_die )
{
Error( p_input );
if( !p_input->b_eof && !p_input->b_error && p_input->input.b_eof )
{
- /* We have finish to demux data but not to play them */
+ /* We have finished demuxing data but not playing it */
while( !p_input->b_die )
{
if( input_EsOutDecodersEmpty( p_input->p_es_out ) )
msleep( INPUT_IDLE_SLEEP );
}
+
/* We have finished */
p_input->b_eof = VLC_TRUE;
}
/* Prepare statistics */
#define INIT_COUNTER( p, type, compute ) p_input->counters.p_##p = \
stats_CounterCreate( p_input, VLC_VAR_##type, STATS_##compute);
- if( p_input->p_libvlc->b_stats )
+ if( p_input->p_libvlc_global->b_stats )
{
INIT_COUNTER( read_bytes, INTEGER, COUNTER );
INIT_COUNTER( read_packets, INTEGER, COUNTER );
free( psz );
return VLC_EGENERIC;
}
- if( p_input->p_libvlc->b_stats )
+ if( p_input->p_libvlc_global->b_stats )
{
INIT_COUNTER( sout_sent_packets, INTEGER, COUNTER );
INIT_COUNTER (sout_sent_bytes, INTEGER, COUNTER );
}
/* initialization is complete */
- p_input->i_state = PLAYING_S;
-
- val.i_int = PLAYING_S;
- var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
+ input_ChangeState(p_input, PLAYING_S);
return VLC_SUCCESS;
*****************************************************************************/
static void End( input_thread_t * p_input )
{
- vlc_value_t val;
int i;
msg_Dbg( p_input, "closing input" );
/* We are at the end */
- p_input->i_state = END_S;
-
- val.i_int = END_S;
- var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
+ input_ChangeState(p_input, END_S);
/* Clean control variables */
input_ControlVarClean( p_input );
if( p_input->p_es_out )
input_EsOutDelete( p_input->p_es_out );
-#define CL_CO( c ) stats_CounterClean( p_input->counters.p_##c )
-
+#define CL_CO( c ) stats_CounterClean( p_input->counters.p_##c ); p_input->counters.p_##c = NULL;
+ if( p_input->p_libvlc_global->b_stats )
+ {
+ vlc_mutex_lock( &p_input->counters.counters_lock );
CL_CO( read_bytes );
CL_CO( read_packets );
CL_CO( demux_read );
CL_CO( decoded_audio) ;
CL_CO( decoded_video );
CL_CO( decoded_sub) ;
+ vlc_mutex_unlock( &p_input->counters.counters_lock );
+ }
/* Close optional stream output instance */
if( p_input->p_sout )
vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
vlc_value_t keep;
+ vlc_mutex_lock( &p_input->counters.counters_lock );
CL_CO( sout_sent_packets );
CL_CO( sout_sent_bytes );
CL_CO( sout_send_bitrate );
+ vlc_mutex_unlock( &p_input->counters.counters_lock );
if( var_Get( p_input, "sout-keep", &keep ) >= 0 && keep.b_bool && p_pl )
{
{
int64_t i_pts_delay;
+ input_ChangeState( p_input, OPENING_S);
+
/* Now try a real access */
in->p_access = access2_New( p_input, psz_access, psz_demux, psz_path,
b_quick );
if( in->p_access == NULL )
{
msg_Err( p_input, "no suitable access module for `%s'", psz_mrl );
- intf_UserFatal( VLC_OBJECT( p_input),
- _("Errors"),"Unable to open '%s'", psz_mrl );
+ intf_UserFatal( VLC_OBJECT( p_input), VLC_FALSE,
+ _("Your input can't be opened"),
+ _("VLC is unable to open the MRL '%s'."
+ " Check the log for details."), psz_mrl );
goto error;
}
var_Set( p_input, "seekable", val );
}
+ input_ChangeState( p_input, BUFFERING_S);
+
/* Create the stream_t */
in->p_stream = stream_AccessNew( in->p_access, b_quick );
if( in->p_stream == NULL )
{
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
psz_access, psz_demux, psz_path );
- intf_UserFatal( VLC_OBJECT( p_input), _("Errors"),
- "Unrecognized format for '%s'", psz_mrl );
+ intf_UserFatal( VLC_OBJECT( p_input), VLC_FALSE,
+ _("Can't recognize the input's format"),
+ _("The format of '%s' can't be detected. "
+ "Have a look the log for details."), psz_mrl );
goto error;
}