Commit ca334665 authored by Laurent Aimar's avatar Laurent Aimar

* input: introduce 'position', 'time', 'length', 'state' and 'rate'

 object variables and begin to use pf_demux_control.
 * variables: new time type handling.
parent 8e8dada2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* demux.c * demux.c
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2003 VideoLAN * Copyright (C) 1999-2003 VideoLAN
* $Id: demux.c,v 1.1 2003/08/02 16:43:59 fenrir Exp $ * $Id: demux.c,v 1.2 2003/09/07 22:51:11 fenrir Exp $
* *
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
...@@ -48,3 +48,109 @@ int demux_Control ( input_thread_t *p_input, int i_query, ... ) ...@@ -48,3 +48,109 @@ int demux_Control ( input_thread_t *p_input, int i_query, ... )
return i_result; return i_result;
} }
static void SeekOffset( input_thread_t *p_input, int64_t i_pos );
int demux_vaControlDefault( input_thread_t *p_input, int i_query, va_list args )
{
int i_ret;
double f, *pf;
int64_t i64, *pi64;
vlc_mutex_lock( &p_input->stream.stream_lock );
switch( i_query )
{
case DEMUX_GET_POSITION:
pf = (double*)va_arg( args, double * );
if( p_input->stream.p_selected_area->i_size <= 0 )
{
*pf = 0.0;
}
else
{
*pf = (double)p_input->stream.p_selected_area->i_tell /
(double)p_input->stream.p_selected_area->i_size;
}
i_ret = VLC_SUCCESS;
break;
case DEMUX_SET_POSITION:
f = (double)va_arg( args, double );
if( p_input->stream.b_seekable && p_input->pf_seek != NULL && f >= 0.0 && f <= 1.0 )
{
SeekOffset( p_input, (int64_t)(f * (double)p_input->stream.p_selected_area->i_size) );
i_ret = VLC_SUCCESS;
}
else
{
i_ret = VLC_EGENERIC;
}
break;
case DEMUX_GET_TIME:
pi64 = (int64_t*)va_arg( args, int64_t * );
if( p_input->stream.i_mux_rate > 0 )
{
*pi64 = (int64_t)1000000 *
( p_input->stream.p_selected_area->i_tell / 50 ) /
p_input->stream.i_mux_rate;
i_ret = VLC_SUCCESS;
}
else
{
*pi64 = 0;
i_ret = VLC_EGENERIC;
}
break;
case DEMUX_SET_TIME:
i64 = (int64_t)va_arg( args, int64_t );
if( p_input->stream.i_mux_rate > 0 &&
p_input->stream.b_seekable && p_input->pf_seek != NULL && i64 >= 0 )
{
SeekOffset( p_input, i64 * 50 *
(int64_t)p_input->stream.i_mux_rate /
(int64_t)1000000 );
i_ret = VLC_SUCCESS;
}
else
{
i_ret = VLC_EGENERIC;
}
break;
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)va_arg( args, int64_t * );
if( p_input->stream.i_mux_rate > 0 )
{
*pi64 = (int64_t)1000000 *
( p_input->stream.p_selected_area->i_size / 50 ) /
p_input->stream.i_mux_rate;
i_ret = VLC_SUCCESS;
}
else
{
*pi64 = 0;
i_ret = VLC_EGENERIC;
}
break;
default:
msg_Err( p_input, "unknown query in demux_vaControlDefault !!!" );
i_ret = VLC_EGENERIC;
break;
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
return i_ret;
}
static void SeekOffset( input_thread_t *p_input, int64_t i_pos )
{
/* Reinitialize buffer manager. */
input_AccessReinit( p_input );
vlc_mutex_unlock( &p_input->stream.stream_lock );
p_input->pf_seek( p_input, i_pos );
vlc_mutex_lock( &p_input->stream.stream_lock );
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* decoders. * decoders.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2002 VideoLAN * Copyright (C) 1998-2002 VideoLAN
* $Id: input.c,v 1.236 2003/08/02 15:22:07 fenrir Exp $ * $Id: input.c,v 1.237 2003/09/07 22:51:11 fenrir Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <vlc/vout.h> #include <vlc/vout.h>
#include "vlc_interface.h" #include "vlc_interface.h"
#include "ninput.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes * Local prototypes
...@@ -58,6 +59,17 @@ static void EndThread ( input_thread_t *p_input ); ...@@ -58,6 +59,17 @@ static void EndThread ( input_thread_t *p_input );
static void ParseOption ( input_thread_t *p_input, static void ParseOption ( input_thread_t *p_input,
const char *psz_option ); const char *psz_option );
/*****************************************************************************
* Callbacks
*****************************************************************************/
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
static int StateCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
static int RateCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data );
/***************************************************************************** /*****************************************************************************
* input_CreateThread: creates a new input thread * input_CreateThread: creates a new input thread
...@@ -70,6 +82,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, ...@@ -70,6 +82,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
{ {
input_thread_t * p_input; /* thread descriptor */ input_thread_t * p_input; /* thread descriptor */
input_info_category_t * p_info; input_info_category_t * p_info;
vlc_value_t val;
int i; int i;
/* Allocate descriptor */ /* Allocate descriptor */
...@@ -95,6 +108,43 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, ...@@ -95,6 +108,43 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_input, "sout-keep", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
/* play status */
/* position variable */
var_Create( p_input, "position", VLC_VAR_FLOAT ); /* position 0.0 -> 1.0 */
val.f_float = 0.0;
var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
var_AddCallback( p_input, "position", PositionCallback, NULL );
/* time variable */
var_Create( p_input, "time", VLC_VAR_TIME );
val.i_time = 0;
var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
var_AddCallback( p_input, "time", TimeCallback, NULL );
/* length variable */
var_Create( p_input, "length", VLC_VAR_TIME );
val.i_time = 0;
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
/* rate variable */
var_Create( p_input, "rate", VLC_VAR_INTEGER );
var_Create( p_input, "rate-slower", VLC_VAR_VOID );
var_Create( p_input, "rate-faster", VLC_VAR_VOID );
val.i_int = DEFAULT_RATE;
var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
var_AddCallback( p_input, "rate", RateCallback, NULL );
var_AddCallback( p_input, "rate-slower", RateCallback, NULL );
var_AddCallback( p_input, "rate-faster", RateCallback, NULL );
/* state variable */
var_Create( p_input, "state", VLC_VAR_INTEGER );
val.i_int = INIT_S;
var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
var_AddCallback( p_input, "state", StateCallback, NULL );
/* Initialize thread properties */ /* Initialize thread properties */
p_input->b_eof = 0; p_input->b_eof = 0;
...@@ -153,7 +203,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, ...@@ -153,7 +203,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent,
p_input->stream.p_selected_area = p_input->stream.pp_areas[0]; p_input->stream.p_selected_area = p_input->stream.pp_areas[0];
/* Initialize stream control properties. */ /* Initialize stream control properties. */
p_input->stream.control.i_status = PLAYING_S; p_input->stream.control.i_status = INIT_S;
p_input->stream.control.i_rate = DEFAULT_RATE; p_input->stream.control.i_rate = DEFAULT_RATE;
p_input->stream.control.b_mute = 0; p_input->stream.control.b_mute = 0;
p_input->stream.control.b_grayscale = config_GetInt( p_input, "grayscale" ); p_input->stream.control.b_grayscale = config_GetInt( p_input, "grayscale" );
...@@ -226,6 +276,9 @@ void input_DestroyThread( input_thread_t *p_input ) ...@@ -226,6 +276,9 @@ void input_DestroyThread( input_thread_t *p_input )
*****************************************************************************/ *****************************************************************************/
static int RunThread( input_thread_t *p_input ) static int RunThread( input_thread_t *p_input )
{ {
vlc_value_t val;
mtime_t i_update_next = -1;
/* Signal right now, otherwise we'll get stuck in a peek */ /* Signal right now, otherwise we'll get stuck in a peek */
vlc_thread_ready( p_input ); vlc_thread_ready( p_input );
...@@ -240,9 +293,13 @@ static int RunThread( input_thread_t *p_input ) ...@@ -240,9 +293,13 @@ static int RunThread( input_thread_t *p_input )
/* initialization is complete */ /* initialization is complete */
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.b_changed = 1; p_input->stream.b_changed = 1;
p_input->stream.control.i_status = PLAYING_S;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
val.i_int = PLAYING_S;
var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
while( !p_input->b_die && !p_input->b_error && !p_input->b_eof ) while( !p_input->b_die && !p_input->b_error && !p_input->b_eof )
{ {
unsigned int i, i_count; unsigned int i, i_count;
...@@ -304,17 +361,14 @@ static int RunThread( input_thread_t *p_input ) ...@@ -304,17 +361,14 @@ static int RunThread( input_thread_t *p_input )
if( p_input->stream.p_selected_area->i_seek != NO_SEEK ) if( p_input->stream.p_selected_area->i_seek != NO_SEEK )
{ {
if( p_input->stream.b_seekable if( p_input->stream.p_selected_area->i_size > 0 )
&& p_input->pf_seek != NULL )
{ {
off_t i_new_pos; unsigned int i;
double f = (double)p_input->stream.p_selected_area->i_seek /
/* Reinitialize buffer manager. */ (double)p_input->stream.p_selected_area->i_size;
input_AccessReinit( p_input );
i_new_pos = p_input->stream.p_selected_area->i_seek;
vlc_mutex_unlock( &p_input->stream.stream_lock ); vlc_mutex_unlock( &p_input->stream.stream_lock );
p_input->pf_seek( p_input, i_new_pos ); demux_Control( p_input, DEMUX_SET_POSITION, f );
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
/* Escape all decoders for the stream discontinuity they /* Escape all decoders for the stream discontinuity they
...@@ -323,8 +377,7 @@ static int RunThread( input_thread_t *p_input ) ...@@ -323,8 +377,7 @@ static int RunThread( input_thread_t *p_input )
for( i = 0; i < p_input->stream.i_pgrm_number; i++ ) for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
{ {
pgrm_descriptor_t * p_pgrm pgrm_descriptor_t * p_pgrm=p_input->stream.pp_programs[i];
= p_input->stream.pp_programs[i];
/* Reinitialize synchro. */ /* Reinitialize synchro. */
p_pgrm->i_synchro_state = SYNCHRO_REINIT; p_pgrm->i_synchro_state = SYNCHRO_REINIT;
...@@ -375,6 +428,28 @@ static int RunThread( input_thread_t *p_input ) ...@@ -375,6 +428,28 @@ static int RunThread( input_thread_t *p_input )
{ {
p_input->b_error = 1; p_input->b_error = 1;
} }
if( !p_input->b_error && !p_input->b_eof && i_update_next < mdate() )
{
double d;
/* update input status variables */
if( !demux_Control( p_input, DEMUX_GET_POSITION, &d ) )
{
val.f_float = (float)d;
var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
}
if( !demux_Control( p_input, DEMUX_GET_TIME, &val.i_time ) )
{
var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
}
if( !demux_Control( p_input, DEMUX_GET_LENGTH, &val.i_time ) )
{
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
}
i_update_next = mdate() + 200000LL;
}
} }
if( p_input->b_error || p_input->b_eof ) if( p_input->b_error || p_input->b_eof )
...@@ -474,7 +549,21 @@ static int InitThread( input_thread_t * p_input ) ...@@ -474,7 +549,21 @@ static int InitThread( input_thread_t * p_input )
if( input_AccessInit( p_input ) == -1 ) if( input_AccessInit( p_input ) == -1 )
{ {
return -1; return VLC_EGENERIC;
}
/* Initialize optional stream output. (before demuxer)*/
var_Get( p_input, "sout", &val );
if( val.psz_string != NULL )
{
if ( *val.psz_string && (p_input->stream.p_sout =
sout_NewInstance( p_input, val.psz_string )) == NULL )
{
msg_Err( p_input, "cannot start stream output instance, aborting" );
free( val.psz_string );
return VLC_EGENERIC;
}
free( val.psz_string );
} }
/* Find and open appropriate access module */ /* Find and open appropriate access module */
...@@ -499,7 +588,11 @@ static int InitThread( input_thread_t * p_input ) ...@@ -499,7 +588,11 @@ static int InitThread( input_thread_t * p_input )
{ {
msg_Err( p_input, "no suitable access module for `%s/%s://%s'", msg_Err( p_input, "no suitable access module for `%s/%s://%s'",
p_input->psz_access, p_input->psz_demux, p_input->psz_name ); p_input->psz_access, p_input->psz_demux, p_input->psz_name );
return -1; if ( p_input->stream.p_sout != NULL )
{
sout_DeleteInstance( p_input->stream.p_sout );
}
return VLC_EGENERIC;
} }
/* Waiting for stream. */ /* Waiting for stream. */
...@@ -524,7 +617,11 @@ static int InitThread( input_thread_t * p_input ) ...@@ -524,7 +617,11 @@ static int InitThread( input_thread_t * p_input )
if( p_input->b_die || p_input->b_error || p_input->b_eof ) if( p_input->b_die || p_input->b_error || p_input->b_eof )
{ {
module_Unneed( p_input, p_input->p_access ); module_Unneed( p_input, p_input->p_access );
return -1; if ( p_input->stream.p_sout != NULL )
{
sout_DeleteInstance( p_input->stream.p_sout );
}
return VLC_EGENERIC;
} }
} }
} }
...@@ -538,27 +635,14 @@ static int InitThread( input_thread_t * p_input ) ...@@ -538,27 +635,14 @@ static int InitThread( input_thread_t * p_input )
msg_Err( p_input, "no suitable demux module for `%s/%s://%s'", msg_Err( p_input, "no suitable demux module for `%s/%s://%s'",
p_input->psz_access, p_input->psz_demux, p_input->psz_name ); p_input->psz_access, p_input->psz_demux, p_input->psz_name );
module_Unneed( p_input, p_input->p_access ); module_Unneed( p_input, p_input->p_access );
return -1; if ( p_input->stream.p_sout != NULL )
}
/* Initialize optional stream output. */
var_Get( p_input, "sout", &val );
if( val.psz_string != NULL )
{
if ( *val.psz_string && (p_input->stream.p_sout =
sout_NewInstance( p_input, val.psz_string )) == NULL )
{ {
msg_Err( p_input, "cannot start stream output instance, aborting" ); sout_DeleteInstance( p_input->stream.p_sout );
free( val.psz_string );
module_Unneed( p_input, p_input->p_access );
module_Unneed( p_input, p_input->p_demux );
return -1;
} }
return VLC_EGENERIC;
free( val.psz_string );
} }
return 0; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
...@@ -580,8 +664,6 @@ static void ErrorThread( input_thread_t *p_input ) ...@@ -580,8 +664,6 @@ static void ErrorThread( input_thread_t *p_input )
*****************************************************************************/ *****************************************************************************/
static void EndThread( input_thread_t * p_input ) static void EndThread( input_thread_t * p_input )
{ {
vlc_object_t *p_object;
#ifdef HAVE_SYS_TIMES_H #ifdef HAVE_SYS_TIMES_H
/* Display statistics */ /* Display statistics */
struct tms cpu_usage; struct tms cpu_usage;
...@@ -601,7 +683,25 @@ static void EndThread( input_thread_t * p_input ) ...@@ -601,7 +683,25 @@ static void EndThread( input_thread_t * p_input )
/* Close optional stream output instance */ /* Close optional stream output instance */
if ( p_input->stream.p_sout != NULL ) if ( p_input->stream.p_sout != NULL )
{ {
sout_DeleteInstance( p_input->stream.p_sout ); vlc_object_t *p_pl = vlc_object_find( p_input, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
vlc_value_t keep;
if( var_Get( p_input, "sout-keep", &keep ) >= 0 && keep.b_bool && p_pl )
{
/* attach sout to the playlist */
msg_Warn( p_input, "keeping sout" );
vlc_object_detach( p_input->stream.p_sout );
vlc_object_attach( p_input->stream.p_sout, p_pl );
}
else
{
msg_Warn( p_input, "destroying sout" );
sout_DeleteInstance( p_input->stream.p_sout );
}
if( p_pl )
{
vlc_object_release( p_pl );
}
} }
/* Free demultiplexer's data */ /* Free demultiplexer's data */
...@@ -616,15 +716,6 @@ static void EndThread( input_thread_t * p_input ) ...@@ -616,15 +716,6 @@ static void EndThread( input_thread_t * p_input )
msg_Dbg( p_input, "freeing info structures..."); msg_Dbg( p_input, "freeing info structures...");
input_DelInfo( p_input ); input_DelInfo( p_input );
/* Close the video output that should have been re-attached
* to our object */
while( ( p_object = vlc_object_find( p_input, VLC_OBJECT_VOUT, FIND_CHILD ) ) != NULL )
{
vlc_object_detach( p_object );
vlc_object_release( p_object );
vout_Destroy( (vout_thread_t *)p_object );
}
free( p_input->psz_source ); free( p_input->psz_source );
if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource ); if ( p_input->psz_dupsource != NULL ) free( p_input->psz_dupsource );
...@@ -727,3 +818,88 @@ static void ParseOption( input_thread_t *p_input, const char *psz_option ) ...@@ -727,3 +818,88 @@ static void ParseOption( input_thread_t *p_input, const char *psz_option )
if( psz_name ) free( psz_name ); if( psz_name ) free( psz_name );
return; return;
} }
/*****************************************************************************
* Callbacks (position, time, state, rate )
*****************************************************************************/
static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t *)p_this;
msg_Warn( p_input, "cmd=%s old=%f new=%f",
psz_cmd,
oldval.f_float, newval.f_float );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_seek =
(int64_t)( newval.f_float * (double)p_input->stream.p_selected_area->i_size );
vlc_mutex_unlock( &p_input->stream.stream_lock );
return VLC_SUCCESS;
}
static int TimeCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t *)p_this;
/* FIXME TODO FIXME */
msg_Warn( p_input, "cmd=%s old=%lld new=%lld",
psz_cmd,
oldval.i_time, newval.i_time );
vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_seek =
newval.i_time / 1000000 * 50 * p_input->stream.i_mux_rate;
vlc_mutex_unlock( &p_input->stream.stream_lock );
return VLC_SUCCESS;
}
static int StateCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t *)p_this;
msg_Warn( p_input, "cmd=%s old=%d new=%d",
psz_cmd, oldval.i_int, newval.i_int );
switch( newval.i_int )
{
case PLAYING_S:
input_SetStatus( p_input, INPUT_STATUS_PLAY );
return VLC_SUCCESS;
case PAUSE_S:
input_SetStatus( p_input, INPUT_STATUS_PAUSE );
return VLC_SUCCESS;
case END_S:
input_SetStatus( p_input, INPUT_STATUS_END );
return VLC_SUCCESS;
default:
msg_Err( p_input, "cannot set new state (invalid)" );
return VLC_EGENERIC;
}
}
static int RateCallback ( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
input_thread_t *p_input = (input_thread_t *)p_this;
if( !strcmp( psz_cmd, "rate-slower" ) )
{
input_SetStatus( p_input, INPUT_STATUS_SLOWER );
}
else if( !strcmp( psz_cmd, "rate-faster" ) )
{
input_SetStatus( p_input, INPUT_STATUS_FASTER );
}
else
{
msg_Warn( p_input, "cmd=%s old=%d new=%d",
psz_cmd, oldval.i_int, newval.i_int );
input_SetRate( p_input, newval.i_int );
}
return VLC_SUCCESS;
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management * input_clock.c: Clock/System date convertions, stream management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999-2001 VideoLAN * Copyright (C) 1999-2001 VideoLAN
* $Id: input_clock.c,v 1.41 2003/08/08 16:50:27 gbazin Exp $ * $Id: input_clock.c,v 1.42 2003/09/07 22:51:11 fenrir Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -147,6 +147,7 @@ void input_ClockInit( pgrm_descriptor_t * p_pgrm ) ...@@ -147,6 +147,7 @@ void input_ClockInit( pgrm_descriptor_t * p_pgrm )
int input_ClockManageControl( input_thread_t * p_input, int input_ClockManageControl( input_thread_t * p_input,
pgrm_descriptor_t * p_pgrm, mtime_t i_clock ) pgrm_descriptor_t * p_pgrm, mtime_t i_clock )
{ {
vlc_value_t val;
int i_return_value = UNDEF_S; int i_return_value = UNDEF_S;
vlc_mutex_lock( &p_input->stream.stream_lock ); vlc_mutex_lock( &p_input->stream.stream_lock );
...@@ -205,6 +206,12 @@ int input_ClockManageControl( input_thread_t * p_input, ...@@ -205,6 +206,12 @@ int input_ClockManageControl( input_thread_t * p_input,
input_EscapeAudioDiscontinuity( p_input ); input_EscapeAudioDiscontinuity( p_input );
} }
val.i_int = p_input->stream.control.i_rate;
var_Change( p_input, "rate", VLC_VAR_SETVALUE, &val, NULL );
val.i_int = p_input->stream.control.i_status;
var_Change( p_input, "state", VLC_VAR_SETVALUE, &val, NULL );
p_input->stream.i_new_status = UNDEF_S; p_input->stream.i_new_status = UNDEF_S;
p_input->stream.i_new_rate = UNDEF_S; p_input->stream.i_new_rate = UNDEF_S;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling * variables.c: routines for object variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: variables.c,v 1.29 2003/07/23 23:05:25 gbazin Exp $ * $Id: variables.c,v 1.30 2003/09/07 22:51:11 fenrir Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -46,10 +46,7 @@ static int CmpBool( vlc_value_t v, vlc_value_t w ) { return v.b_bool ? w.b_bool ...@@ -46,10 +46,7 @@ static int CmpBool( vlc_value_t v, vlc_value_t w ) { return v.b_bool ? w.b_bool
static int CmpInt( vlc_value_t v, vlc_value_t w ) { return v.i_int == w.i_int ? 0 : v.i_int > w.i_int ? 1 : -1; } static int CmpInt( vlc_value_t v, vlc_value_t w ) { return v.i_int == w.i_int ? 0 : v.i_int > w.i_int ? 1 : -1; }
static int CmpTime( vlc_value_t v, vlc_value_t w ) static int CmpTime( vlc_value_t v, vlc_value_t w )
{ {
mtime_t v_time,w_time; return v.i_time == w.i_time ? 0 : v.i_time > w.i_time ? 1 : -1;
v_time = ( (mtime_t)v.time.i_high << 32 ) + v.time.i_low;
w_time = ( (mtime_t)w.time.i_high << 32 ) + w.time.i_low;
return v_time == w_time ? 0 : v_time > w_time ? 1 : -1;
} }
static int CmpString( vlc_value_t v, vlc_value_t w ) { return strcmp( v.psz_string, w.psz_string ); } static int CmpString( vlc_value_t v, vlc_value_t w ) { return strcmp( v.psz_string, w.psz_string ); }
static int CmpFloat( vlc_value_t v, vlc_value_t w ) { return v.f_float == w.f_float ? 0 : v.f_float > w.f_float ? 1 : -1; } static int CmpFloat( vlc_value_t v, vlc_value_t w ) { return v.f_float == w.f_float ? 0 : v.f_float > w.f_float ? 1 : -1; }
...@@ -237,8 +234,7 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type ) ...@@ -237,8 +234,7 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
break; break;
case VLC_VAR_TIME: case VLC_VAR_TIME:
p_var->pf_cmp = CmpTime; p_var->pf_cmp = CmpTime;
p_var->val.time.i_low = 0; p_var->val.i_time = 0;
p_var->val.time.i_high = 0;
break; break;
case VLC_VAR_ADDRESS: case VLC_VAR_ADDRESS:
p_var->pf_cmp = CmpAddress; p_var->pf_cmp = CmpAddress;
......
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