i = vlc_internals( p_obj )->i_object_type;
if( i == VLC_OBJECT_VOUT ||i == VLC_OBJECT_AOUT ||
p_obj == VLC_OBJECT(p_input->p->p_sout) ||
- i == VLC_OBJECT_DECODER || i == VLC_OBJECT_PACKETIZER )
+ i == VLC_OBJECT_DECODER )
return;
vlc_object_kill( p_obj );
* MainLoopDemux
* It asks the demuxer to demux some data
*/
-static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t *pi_start_mdate )
+static void MainLoopDemux( input_thread_t *p_input, bool *pb_changed, mtime_t i_start_mdate )
{
int i_ret;
*pb_changed = false;
if( ( p_input->p->i_stop > 0 && p_input->p->i_time >= p_input->p->i_stop ) ||
- ( p_input->p->i_run > 0 && *pi_start_mdate+p_input->p->i_run < mdate() ) )
+ ( p_input->p->i_run > 0 && i_start_mdate+p_input->p->i_run < mdate() ) )
i_ret = 0; /* EOF */
else
i_ret = demux_Demux( p_input->p->input.p_demux );
if( i_ret == 0 ) /* EOF */
{
- int i_repeat = var_GetInteger( p_input, "input-repeat" );
- if( i_repeat == 0 )
- {
- /* End of file - we do not set b_die because only the
- * playlist is allowed to do so. */
- msg_Dbg( p_input, "EOF reached" );
- p_input->p->input.b_eof = true;
- }
- else
- {
- vlc_value_t val;
-
- msg_Dbg( p_input, "repeating the same input (%d)", i_repeat );
- if( i_repeat > 0 )
- {
- i_repeat--;
- var_SetInteger( p_input, "input-repeat", i_repeat );
- }
-
- /* Seek to start title/seekpoint */
- val.i_int = p_input->p->input.i_title_start -
- p_input->p->input.i_title_offset;
- if( val.i_int < 0 || val.i_int >= p_input->p->input.i_title )
- val.i_int = 0;
- input_ControlPush( p_input,
- INPUT_CONTROL_SET_TITLE, &val );
-
- val.i_int = p_input->p->input.i_seekpoint_start -
- p_input->p->input.i_seekpoint_offset;
- if( val.i_int > 0 /* TODO: check upper boundary */ )
- input_ControlPush( p_input,
- INPUT_CONTROL_SET_SEEKPOINT, &val );
-
- /* Seek to start position */
- if( p_input->p->i_start > 0 )
- {
- val.i_time = p_input->p->i_start;
- input_ControlPush( p_input, INPUT_CONTROL_SET_TIME,
- &val );
- }
- else
- {
- val.f_float = 0.0;
- input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION,
- &val );
- }
-
- /* */
- *pi_start_mdate = mdate();
- }
+ msg_Dbg( p_input, "EOF reached" );
+ p_input->p->input.b_eof = true;
}
else if( i_ret < 0 )
{
}
}
+static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
+{
+ int i_repeat = var_GetInteger( p_input, "input-repeat" );
+ if( i_repeat == 0 )
+ return VLC_EGENERIC;
+
+ vlc_value_t val;
+
+ msg_Dbg( p_input, "repeating the same input (%d)", i_repeat );
+ if( i_repeat > 0 )
+ {
+ i_repeat--;
+ var_SetInteger( p_input, "input-repeat", i_repeat );
+ }
+
+ /* Seek to start title/seekpoint */
+ val.i_int = p_input->p->input.i_title_start -
+ p_input->p->input.i_title_offset;
+ if( val.i_int < 0 || val.i_int >= p_input->p->input.i_title )
+ val.i_int = 0;
+ input_ControlPush( p_input,
+ INPUT_CONTROL_SET_TITLE, &val );
+
+ val.i_int = p_input->p->input.i_seekpoint_start -
+ p_input->p->input.i_seekpoint_offset;
+ if( val.i_int > 0 /* TODO: check upper boundary */ )
+ input_ControlPush( p_input,
+ INPUT_CONTROL_SET_SEEKPOINT, &val );
+
+ /* Seek to start position */
+ if( p_input->p->i_start > 0 )
+ {
+ val.i_time = p_input->p->i_start;
+ input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &val );
+ }
+ else
+ {
+ val.f_float = 0.0;
+ input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &val );
+ }
+
+ /* */
+ *pi_start_mdate = mdate();
+ return VLC_SUCCESS;
+}
+
/**
* MainLoopInterface
* It update the variables used by the interfaces
{
if( !p_input->p->input.b_eof )
{
- MainLoopDemux( p_input, &b_force_update, &i_start_mdate );
+ MainLoopDemux( p_input, &b_force_update, i_start_mdate );
i_wakeup = es_out_GetWakeup( p_input->p->p_es_out );
}
}
else
{
- break;
+ if( MainLoopTryRepeat( p_input, &i_start_mdate ) )
+ break;
}
}
{
demux_Control( p_input->p->input.p_demux, DEMUX_SET_GROUP, -1,
val.p_list );
- var_FreeList( &val, NULL );
}
else
{
/* Split uri */
input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_dup );
+ /* FIXME: file:// handling plugins do not support URIs properly...
+ * So we pre-decoded the URI to a path for them. Note that we do not do it
+ * for non-standard VLC-specific schemes. */
+ if( !strcmp( psz_access, "file" ) )
+ {
+ if( psz_path[0] != '/' )
+ { /* host specified -> not supported currently */
+ msg_Err( p_input, "cannot open remote file `%s://%s'",
+ psz_access, psz_path );
+ msg_Info( p_input, "Did you mean `%s:///%s'?",
+ psz_access, psz_path );
+ goto error;
+ }
+ /* Remove HTML anchor if present (not supported). */
+ char *p = strchr( psz_path, '#' );
+ if( p )
+ *p = '\0';
+ /* Then URI-decode the path. */
+ decode_URI( psz_path );
+#ifdef WIN32
+ /* Strip leading slash in front of the drive letter */
+ psz_path++;
+#endif
+#if (DIR_SEP_CHAR != '/')
+ /* Turn slashes into anti-slashes */
+ for( char *s = strchr( psz_path, '/' ); s; s = strchr( s + 1, '/' ) )
+ *s = DIR_SEP_CHAR;
+#endif
+ }
+
msg_Dbg( p_input, "`%s' gives access `%s' demux `%s' path `%s'",
psz_mrl, psz_access, psz_demux, psz_path );
if( !p_input->b_preparsing )
{
/* Now try a real access */
in->p_access = access_New( p_input, psz_access, psz_demux, psz_path );
-
- /* Access failed, URL encoded ? */
- if( in->p_access == NULL && strchr( psz_path, '%' ) )
- {
- decode_URI( psz_path );
-
- msg_Dbg( p_input, "retrying with access `%s' demux `%s' path `%s'",
- psz_access, psz_demux, psz_path );
-
- in->p_access = access_New( p_input,
- psz_access, psz_demux, psz_path );
- }
if( in->p_access == NULL )
{
msg_Err( p_input, "open of `%s' failed: %s", psz_mrl,
{ ".part1.rar", "%s.part%.1d.rar",2, 9 },
{ ".part01.rar", "%s.part%.2d.rar",2, 99, },
{ ".part001.rar", "%s.part%.3d.rar",2, 999 },
- { ".rar", "%s.r%.2d", 1, 99 },
+ { ".rar", "%s.r%.2d", 0, 99 },
{ NULL, NULL, 0, 0 }
};