Commit 79786424 authored by Laurent Aimar's avatar Laurent Aimar

* input.c: fixed total length in playlist.

parent 196a0c98
...@@ -56,6 +56,8 @@ static vlc_bool_t Control( input_thread_t *, int, vlc_value_t ); ...@@ -56,6 +56,8 @@ static vlc_bool_t Control( input_thread_t *, int, vlc_value_t );
static void UpdateFromAccess( input_thread_t * ); static void UpdateFromAccess( input_thread_t * );
static void UpdateFromDemux( input_thread_t * ); static void UpdateFromDemux( input_thread_t * );
static void UpdateItemLength( input_thread_t *, int64_t i_length );
static void ParseOption( input_thread_t *p_input, const char *psz_option ); static void ParseOption( input_thread_t *p_input, const char *psz_option );
static void DecodeUrl ( char * ); static void DecodeUrl ( char * );
...@@ -450,15 +452,7 @@ static int Run( input_thread_t *p_input ) ...@@ -450,15 +452,7 @@ static int Run( input_thread_t *p_input )
if( old_val.i_time != val.i_time ) if( old_val.i_time != val.i_time )
{ {
char psz_buffer[MSTRTIME_MAX_SIZE]; UpdateItemLength( p_input, i_length );
vlc_mutex_lock( &p_input->input.p_item->lock );
p_input->input.p_item->i_duration = i_length;
vlc_mutex_unlock( &p_input->input.p_item->lock );
input_Control( p_input, INPUT_ADD_INFO,
_("General"), _("Duration"),
msecstotimestr( psz_buffer, i_length / 1000 ) );
} }
} }
...@@ -563,7 +557,8 @@ static int Init( input_thread_t * p_input ) ...@@ -563,7 +557,8 @@ static int Init( input_thread_t * p_input )
&val.i_time ) && val.i_time > 0 ) &val.i_time ) && val.i_time > 0 )
{ {
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL ); var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
/* TODO update playlist meta data */
UpdateItemLength( p_input, val.i_time );
} }
/* Start time*/ /* Start time*/
/* Set start time */ /* Set start time */
...@@ -1401,6 +1396,21 @@ static void UpdateFromAccess( input_thread_t *p_input ) ...@@ -1401,6 +1396,21 @@ static void UpdateFromAccess( input_thread_t *p_input )
p_access->info.i_update &= ~INPUT_UPDATE_SIZE; p_access->info.i_update &= ~INPUT_UPDATE_SIZE;
} }
/*****************************************************************************
* UpdateItemLength:
*****************************************************************************/
static void UpdateItemLength( input_thread_t *p_input, int64_t i_length )
{
char psz_buffer[MSTRTIME_MAX_SIZE];
vlc_mutex_lock( &p_input->input.p_item->lock );
p_input->input.p_item->i_duration = i_length;
vlc_mutex_unlock( &p_input->input.p_item->lock );
input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"),
msecstotimestr( psz_buffer, i_length / 1000 ) );
}
/***************************************************************************** /*****************************************************************************
* InputSourceNew: * InputSourceNew:
*****************************************************************************/ *****************************************************************************/
......
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