Commit ce80ca38 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

input: change time and length variable to integer

parent 72ab2078
......@@ -324,14 +324,14 @@ input_event_changed( vlc_object_t * p_this, char const * psz_cmd,
/* */
event.type = libvlc_MediaPlayerTimeChanged;
event.u.media_player_time_changed.new_time =
from_mtime(var_GetTime( p_input, "time" ));
from_mtime(var_GetInteger( p_input, "time" ));
libvlc_event_send( p_mi->p_event_manager, &event );
}
else if( newval.i_int == INPUT_EVENT_LENGTH )
{
event.type = libvlc_MediaPlayerLengthChanged;
event.u.media_player_length_changed.new_length =
from_mtime(var_GetTime( p_input, "length" ));
from_mtime(var_GetInteger( p_input, "length" ));
libvlc_event_send( p_mi->p_event_manager, &event );
}
else if( newval.i_int == INPUT_EVENT_CACHE )
......@@ -1158,7 +1158,7 @@ libvlc_time_t libvlc_media_player_get_length(
if( !p_input_thread )
return -1;
i_time = from_mtime(var_GetTime( p_input_thread, "length" ));
i_time = from_mtime(var_GetInteger( p_input_thread, "length" ));
vlc_object_release( p_input_thread );
return i_time;
......@@ -1173,7 +1173,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi )
if( !p_input_thread )
return -1;
i_time = from_mtime(var_GetTime( p_input_thread , "time" ));
i_time = from_mtime(var_GetInteger( p_input_thread , "time" ));
vlc_object_release( p_input_thread );
return i_time;
}
......@@ -1187,7 +1187,7 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
if( !p_input_thread )
return;
var_SetTime( p_input_thread, "time", to_mtime(i_time) );
var_SetInteger( p_input_thread, "time", to_mtime(i_time) );
vlc_object_release( p_input_thread );
}
......
......@@ -923,7 +923,7 @@ static int InputCallback( vlc_object_t *p_this, const char *psz_var,
/* Detect seeks
* XXX: This is way more convoluted than it should be... */
i_pos = var_GetTime( p_input, "time" );
i_pos = var_GetInteger( p_input, "time" );
if( !p_intf->p_sys->i_last_input_pos_event ||
!( var_GetInteger( p_input, "state" ) == PLAYING_S ) )
......
......@@ -49,10 +49,9 @@ MarshalPosition( intf_thread_t *p_intf, DBusMessageIter *container )
if( !p_input )
i_pos = 0;
else
{
i_pos = var_GetTime( p_input, "time" );
i_pos = var_GetInteger( p_input, "time" );
vlc_object_release( p_input );
}
......@@ -67,7 +66,6 @@ DBUS_METHOD( SetPosition )
REPLY_INIT;
dbus_int64_t i_pos;
vlc_value_t position;
char *psz_trackid, *psz_dbus_trackid;
input_item_t *p_item;
......@@ -102,10 +100,7 @@ DBUS_METHOD( SetPosition )
}
if( !strcmp( psz_trackid, psz_dbus_trackid ) )
{
position.i_time = (mtime_t) i_pos;
var_Set( p_input, "time", position );
}
var_SetInteger( p_input, "time", i_pos );
free( psz_trackid );
}
......@@ -120,8 +115,6 @@ DBUS_METHOD( Seek )
{
REPLY_INIT;
dbus_int64_t i_step;
vlc_value_t newpos;
mtime_t i_pos;
DBusError error;
dbus_error_init( &error );
......@@ -141,13 +134,8 @@ DBUS_METHOD( Seek )
input_thread_t *p_input = pl_CurrentInput( p_this );
if( p_input && var_GetBool( p_input, "can-seek" ) )
{
i_pos = var_GetTime( p_input, "time" );
newpos.i_time = (mtime_t) i_step + i_pos;
if( newpos.i_time < 0 )
newpos.i_time = 0;
var_Set( p_input, "time", newpos );
mtime_t i_pos = var_GetInteger( p_input, "time" ) + i_step;
var_SetInteger( p_input, "time", (i_pos >= 0) ? i_pos : 0 );
}
if( p_input )
......@@ -576,7 +564,7 @@ DBUS_SIGNAL( SeekedSignal )
if( p_input )
{
i_pos = var_GetTime( p_input, "time" );
i_pos = var_GetInteger( p_input, "time" );
vlc_object_release( p_input );
}
......
......@@ -1179,30 +1179,29 @@ static void DisplayPosition( intf_thread_t *p_intf, vout_thread_t *p_vout,
{
char psz_duration[MSTRTIME_MAX_SIZE];
char psz_time[MSTRTIME_MAX_SIZE];
vlc_value_t time, pos;
mtime_t i_seconds;
if( p_vout == NULL ) return;
ClearChannels( p_intf, p_vout );
var_Get( p_input, "time", &time );
i_seconds = time.i_time / 1000000;
secstotimestr ( psz_time, i_seconds );
int64_t t = var_GetInteger( p_input, "time" ) / CLOCK_FREQ;
int64_t l = var_GetInteger( p_input, "length" ) / CLOCK_FREQ;
var_Get( p_input, "length", &time );
if( time.i_time > 0 )
secstotimestr( psz_time, t );
if( l > 0 )
{
secstotimestr( psz_duration, time.i_time / 1000000 );
secstotimestr( psz_duration, l );
DisplayMessage( p_vout, "%s / %s", psz_time, psz_duration );
}
else if( i_seconds > 0 )
else if( t > 0 )
{
DisplayMessage( p_vout, "%s", psz_time );
}
if( var_GetBool( p_vout, "fullscreen" ) )
{
vlc_value_t pos;
var_Get( p_input, "position", &pos );
vout_OSDSlider( p_vout, p_intf->p_sys->slider_chan,
pos.f_float * 100, OSD_HOR_SLIDER );
......
......@@ -683,29 +683,17 @@ static void *Run( void *data )
}
else if( !strcmp( psz_cmd, "get_time" ) )
{
if( p_sys->p_input == NULL )
{
msg_rc("0");
}
else
{
vlc_value_t time;
var_Get( p_sys->p_input, "time", &time );
msg_rc( "%"PRIu64, time.i_time / 1000000);
}
int64_t t = 0;
if( p_sys->p_input != NULL )
t = var_GetInteger( p_sys->p_input, "time" ) / CLOCK_FREQ;
msg_rc( "%"PRIu64, t );
}
else if( !strcmp( psz_cmd, "get_length" ) )
{
if( p_sys->p_input == NULL )
{
msg_rc("0");
}
else
{
vlc_value_t time;
var_Get( p_sys->p_input, "length", &time );
msg_rc( "%"PRIu64, time.i_time / 1000000);
}
int64_t l = 0;
if( p_sys->p_input != NULL )
l = var_GetInteger( p_sys->p_input, "length" ) / CLOCK_FREQ;
msg_rc( "%"PRIu64, l );
}
else if( !strcmp( psz_cmd, "get_title" ) )
{
......@@ -905,7 +893,7 @@ static void PositionChanged( intf_thread_t *p_intf,
vlc_mutex_lock( &p_intf->p_sys->status_lock );
if( p_intf->p_sys->b_input_buffering )
msg_rc( STATUS_CHANGE "( time: %"PRId64"s )",
(var_GetTime( p_input, "time" )/1000000) );
(var_GetInteger( p_input, "time" ) / CLOCK_FREQ) );
p_intf->p_sys->b_input_buffering = false;
vlc_mutex_unlock( &p_intf->p_sys->status_lock );
}
......@@ -983,8 +971,8 @@ static int Input( vlc_object_t *p_this, char const *psz_cmd,
}
else
{
mtime_t t = ((int64_t)atoi( newval.psz_string )) * CLOCK_FREQ;
var_SetTime( p_input, "time", t );
mtime_t t = atoi( newval.psz_string );
var_SetInteger( p_input, "time", CLOCK_FREQ * t );
}
i_error = VLC_SUCCESS;
}
......
......@@ -433,13 +433,13 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (!timeA) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
timeA = var_GetTime(p_input, "time");
timeA = var_GetInteger(p_input, "time");
vlc_object_release(p_input);
}
} else if (!timeB) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
timeB = var_GetTime(p_input, "time");
timeB = var_GetInteger(p_input, "time");
vlc_object_release(p_input);
}
} else
......@@ -457,9 +457,9 @@ static VLCCoreInteraction *_o_sharedInstance = nil;
if (timeB) {
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
mtime_t currentTime = var_GetTime(p_input, "time");
mtime_t currentTime = var_GetInteger(p_input, "time");
if ( currentTime >= timeB || currentTime < timeA)
var_SetTime(p_input, "time", timeA);
var_SetInteger(p_input, "time", timeA);
vlc_object_release(p_input);
}
}
......
......@@ -117,19 +117,17 @@ static VLCStringUtility *_o_sharedInstance = nil;
{
assert(p_input != nil);
vlc_value_t time;
char psz_time[MSTRTIME_MAX_SIZE];
var_Get(p_input, "time", &time);
int64_t t = var_GetInteger(p_input, "time");
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
if (b_negative && dur > 0) {
mtime_t remaining = 0;
if (dur > time.i_time)
remaining = dur - time.i_time;
if (dur > t)
remaining = dur - t;
return [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
} else
return [NSString stringWithUTF8String:secstotimestr(psz_time, (time.i_time / 1000000))];
return [NSString stringWithUTF8String:secstotimestr(psz_time, t / CLOCK_FREQ )];
}
- (NSString *)stringForTime:(long long int)time
......
......@@ -233,11 +233,11 @@
input_thread_t * p_input = pl_CurrentInput(VLCIntf);
if (p_input) {
/* we can obviously only do that if an input is available */
vlc_value_t pos, length;
var_Get(p_input, "length", &length);
[o_specificTime_stepper setMaxValue: (length.i_time / 1000000)];
var_Get(p_input, "time", &pos);
[self setJumpTimeValue: (pos.i_time / 1000000)];
int64_t pos, length;
length = var_GetInteger(p_input, "length");
[o_specificTime_stepper setMaxValue: (length / CLOCK_FREQ)];
pos = var_GetInteger(p_input, "time");
[self setJumpTimeValue: (pos / CLOCK_FREQ)];
[NSApp beginSheet: o_specificTime_win modalForWindow: \
[NSApp mainWindow] modalDelegate: self didEndSelector: nil \
contextInfo: nil];
......
......@@ -545,10 +545,9 @@
f_updated = 10000. * pos.f_float;
[o_fs_timeSlider setFloatValue: f_updated];
vlc_value_t time;
char psz_time[MSTRTIME_MAX_SIZE];
var_Get(p_input, "time", &time);
int64_t t = var_GetInteger(p_input, "time");
mtime_t dur = input_item_GetDuration(input_GetItem(p_input));
// update total duration (right field)
......@@ -560,8 +559,8 @@
NSString *o_total_time;
if ([o_streamLength_txt timeRemaining]) {
mtime_t remaining = 0;
if (dur > time.i_time)
remaining = dur - time.i_time;
if (dur > t)
remaining = dur - t;
o_total_time = [NSString stringWithFormat: @"-%s", secstotimestr(psz_time, (remaining / 1000000))];
} else
o_total_time = [NSString stringWithUTF8String:secstotimestr(psz_time, (dur / 1000000))];
......@@ -570,7 +569,7 @@
}
// update current position (left field)
NSString *o_playback_pos = [NSString stringWithUTF8String:secstotimestr(psz_time, (time.i_time / 1000000))];
NSString *o_playback_pos = [NSString stringWithUTF8String:secstotimestr(psz_time, t / CLOCK_FREQ)];
[o_streamPosition_txt setStringValue: o_playback_pos];
vlc_object_release(p_input);
......
......@@ -1026,7 +1026,7 @@
mtime_t lastPos = (mtime_t)lastPosition.intValue * 1000000;
msg_Dbg(VLCIntf, "continuing playback at %lld", lastPos);
var_SetTime(p_input_thread, "time", lastPos);
var_SetInteger(p_input_thread, "time", lastPos);
if (returnValue == NSAlertOtherReturn)
config_PutInt(VLCIntf, "macosx-continue-playback", 1);
......@@ -1054,7 +1054,7 @@
NSMutableDictionary *mutDict = [[NSMutableDictionary alloc] initWithDictionary:[defaults objectForKey:@"recentlyPlayedMedia"]];
float relativePos = var_GetFloat(p_input_thread, "position");
mtime_t pos = var_GetTime(p_input_thread, "time") / 1000000;
mtime_t pos = var_GetInteger(p_input_thread, "time") / CLOCK_FREQ;
mtime_t dur = input_item_GetDuration(p_item) / 1000000;
NSMutableArray *mediaList = [[defaults objectForKey:@"recentlyPlayedMediaList"] mutableCopy];
......
......@@ -1098,10 +1098,10 @@ static int DrawStatus(intf_thread_t *intf)
repeat, random, loop);
default:
var_Get(p_input, "time", &val);
secstotimestr(buf1, val.i_time / CLOCK_FREQ);
var_Get(p_input, "length", &val);
secstotimestr(buf2, val.i_time / CLOCK_FREQ);
val.i_int = var_GetInteger(p_input, "time");
secstotimestr(buf1, val.i_int / CLOCK_FREQ);
val.i_int = var_GetInteger(p_input, "length");
secstotimestr(buf2, val.i_int / CLOCK_FREQ);
mvnprintw(y++, 0, COLS, _(" Position : %s/%s"), buf1, buf2);
......
......@@ -88,8 +88,8 @@ void GotoTimeDialog::toggleVisible()
reset();
if ( !isVisible() && THEMIM->getIM()->hasInput() )
{
int64_t i_time = var_GetTime( THEMIM->getInput(), "time" );
timeEdit->setTime( timeEdit->time().addSecs( i_time / 1000000 ) );
int64_t i_time = var_GetInteger( THEMIM->getInput(), "time" );
timeEdit->setTime( timeEdit->time().addSecs( i_time / CLOCK_FREQ ) );
}
QVLCDialog::toggleVisible();
if(isVisible())
......@@ -108,7 +108,7 @@ void GotoTimeDialog::close()
{
int64_t i_time = (int64_t)
( QTime( 0, 0, 0 ).msecsTo( timeEdit->time() ) ) * 1000;
var_SetTime( THEMIM->getInput(), "time", i_time );
var_SetInteger( THEMIM->getInput(), "time", i_time );
}
toggleVisible();
}
......
......@@ -171,8 +171,8 @@ void InputManager::delInput()
int64_t i_time = -1;
if( f_pos >= 0.05f && f_pos <= 0.95f
&& var_GetTime( p_input, "length" ) >= 60 * CLOCK_FREQ )
i_time = var_GetTime( p_input, "time");
&& var_GetInteger( p_input, "length" ) >= 60 * CLOCK_FREQ )
i_time = var_GetInteger( p_input, "time");
RecentsMRL::getInstance( p_intf )->setTime( qfu(uri), i_time );
free(uri);
......@@ -445,13 +445,10 @@ static int VbiEvent( vlc_object_t *, const char *,
void InputManager::UpdatePosition()
{
/* Update position */
int i_length;
int64_t i_time;
float f_pos;
i_length = var_GetTime( p_input , "length" ) / CLOCK_FREQ;
i_time = var_GetTime( p_input , "time");
f_pos = var_GetFloat( p_input , "position" );
emit positionUpdated( f_pos, i_time, i_length );
int64_t i_length = var_GetInteger( p_input , "length" );
int64_t i_time = var_GetInteger( p_input , "time");
float f_pos = var_GetFloat( p_input , "position" );
emit positionUpdated( f_pos, i_time, i_length / CLOCK_FREQ );
}
void InputManager::UpdateNavigation()
......@@ -982,12 +979,12 @@ void InputManager::setAtoB()
{
if( !timeA )
{
timeA = var_GetTime( THEMIM->getInput(), "time" );
timeA = var_GetInteger( THEMIM->getInput(), "time" );
}
else if( !timeB )
{
timeB = var_GetTime( THEMIM->getInput(), "time" );
var_SetTime( THEMIM->getInput(), "time" , timeA );
timeB = var_GetInteger( THEMIM->getInput(), "time" );
var_SetInteger( THEMIM->getInput(), "time" , timeA );
CONNECT( this, positionUpdated( float, int64_t, int ),
this, AtoBLoop( float, int64_t, int ) );
}
......@@ -1005,7 +1002,7 @@ void InputManager::setAtoB()
void InputManager::AtoBLoop( float, int64_t i_time, int )
{
if( timeB && i_time >= timeB )
var_SetTime( THEMIM->getInput(), "time" , timeA );
var_SetInteger( THEMIM->getInput(), "time" , timeA );
}
/**********************************************************************
......@@ -1128,7 +1125,7 @@ void MainInputManager::prev()
void MainInputManager::prevOrReset()
{
if( !p_input || var_GetTime( p_input , "time") < 10000 )
if( !p_input || var_GetInteger( p_input, "time") < INT64_C(10000) )
playlist_Prev( THEPL );
else
getIM()->sliderUpdate( 0.0 );
......
......@@ -434,7 +434,7 @@ void MainInterface::hideResumePanel()
void MainInterface::resumePlayback()
{
if( THEMIM->getIM()->hasInput() ) {
var_SetTime( THEMIM->getInput(), "time", i_resumeTime );
var_SetInteger( THEMIM->getInput(), "time", i_resumeTime );
}
hideResumePanel();
}
......
......@@ -77,8 +77,8 @@ string StreamTime::getAsStringCurrTime( bool bShortFormat ) const
if( !havePosition() )
return "-:--:--";
mtime_t time = var_GetTime( getIntf()->p_sys->p_input, "time" );
return formatTime( time / 1000000, bShortFormat );
mtime_t time = var_GetInteger( getIntf()->p_sys->p_input, "time" );
return formatTime( time / CLOCK_FREQ, bShortFormat );
}
......@@ -87,10 +87,10 @@ string StreamTime::getAsStringTimeLeft( bool bShortFormat ) const
if( !havePosition() )
return "-:--:--";
mtime_t time = var_GetTime( getIntf()->p_sys->p_input, "time" ),
duration = var_GetTime( getIntf()->p_sys->p_input, "length" );
mtime_t time = var_GetInteger( getIntf()->p_sys->p_input, "time" ),
duration = var_GetInteger( getIntf()->p_sys->p_input, "length" );
return formatTime( (duration - time) / 1000000, bShortFormat );
return formatTime( (duration - time) / CLOCK_FREQ, bShortFormat );
}
......@@ -99,6 +99,6 @@ string StreamTime::getAsStringDuration( bool bShortFormat ) const
if( !havePosition() )
return "-:--:--";
mtime_t time = var_GetTime( getIntf()->p_sys->p_input, "length" );
return formatTime( time / 1000000, bShortFormat );
mtime_t time = var_GetInteger( getIntf()->p_sys->p_input, "length" );
return formatTime( time / CLOCK_FREQ, bShortFormat );
}
......@@ -430,7 +430,7 @@ function get_time(var)
return function(name,client)
local input = vlc.object.input()
if input then
client:append(math.floor(vlc.var.get( input, var )))
client:append(math.floor(vlc.var.get( input, var ) / 1000000))
else
client:append("")
end
......
......@@ -456,8 +456,8 @@ getstatus = function (includecategories)
s.volume=vlc.volume.get()
if input then
s.length=math.floor(vlc.var.get(input,"length"))
s.time=math.floor(vlc.var.get(input,"time"))
s.length=math.floor(vlc.var.get(input,"length") / 1000000)
s.time=math.floor(vlc.var.get(input,"time") / 1000000)
s.position=vlc.var.get(input,"position")
s.currentplid=vlc.playlist.current()
s.audiodelay=vlc.var.get(input,"audio-delay")
......
......@@ -160,9 +160,9 @@ function seek(value)
else
local posTime = parsetime(value)
if string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
vlc.var.set(input,"time",vlc.var.get(input,"time") + posTime)
vlc.var.set(input,"time",vlc.var.get(input,"time") + (posTime * 1000000))
else
vlc.var.set(input,"time",posTime)
vlc.var.set(input,"time",posTime * 1000000)
end
end
end
......
......@@ -87,17 +87,17 @@ int input_vaControl( input_thread_t *p_input, int i_query, va_list args )
case INPUT_GET_LENGTH:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = var_GetTime( p_input, "length" );
*pi_64 = var_GetInteger( p_input, "length" );
return VLC_SUCCESS;
case INPUT_GET_TIME:
pi_64 = (int64_t*)va_arg( args, int64_t * );
*pi_64 = var_GetTime( p_input, "time" );
*pi_64 = var_GetInteger( p_input, "time" );
return VLC_SUCCESS;
case INPUT_SET_TIME:
i_64 = (int64_t)va_arg( args, int64_t );
return var_SetTime( p_input, "time", i_64 );
return var_SetInteger( p_input, "time", i_64 );
case INPUT_GET_RATE:
pi_int = (int*)va_arg( args, int * );
......
......@@ -65,7 +65,7 @@ void input_SendEventPosition( input_thread_t *p_input, double f_position, mtime_
var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
/* */
val.i_time = i_time;
val.i_int = i_time;
var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
Trigger( p_input, INPUT_EVENT_POSITION );
......@@ -75,12 +75,12 @@ void input_SendEventLength( input_thread_t *p_input, mtime_t i_length )
vlc_value_t val;
/* FIXME ugly + what about meta change event ? */
if( var_GetTime( p_input, "length" ) == i_length )
if( var_GetInteger( p_input, "length" ) == i_length )
return;
input_item_SetDuration( p_input->p->p_item, i_length );
val.i_time = i_length;
val.i_int = i_length;
var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL );
Trigger( p_input, INPUT_EVENT_LENGTH );
......
......@@ -627,7 +627,7 @@ static int MainLoopTryRepeat( input_thread_t *p_input, mtime_t *pi_start_mdate )
/* Seek to start position */
if( p_input->p->i_start > 0 )
{
val.i_time = p_input->p->i_start;
val.i_int = p_input->p->i_start;
input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &val );
}
else
......@@ -920,7 +920,7 @@ static void StartTitle( input_thread_t * p_input )
msg_Dbg( p_input, "starting at time: %ds",
(int)( p_input->p->i_start / CLOCK_FREQ ) );
s.i_time = p_input->p->i_start;
s.i_int = p_input->p->i_start;
input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &s );
}
if( p_input->p->i_stop > 0 && p_input->p->i_stop <= p_input->p->i_start )
......@@ -1674,7 +1674,7 @@ static bool Control( input_thread_t *p_input,
break;
}
i_time = val.i_time;
i_time = val.i_int;
if( i_time < 0 )
i_time = 0;
......@@ -1894,7 +1894,7 @@ static bool Control( input_thread_t *p_input,
if( i_type == INPUT_CONTROL_SET_SEEKPOINT_PREV )
{
int64_t i_seekpoint_time = p_input->p->input.title[i_title]->seekpoint[i_seekpoint]->i_time_offset;
int64_t i_input_time = var_GetTime( p_input, "time" );
int64_t i_input_time = var_GetInteger( p_input, "time" );
if( i_seekpoint_time >= 0 && i_input_time >= 0 )
{
if( i_input_time < i_seekpoint_time + 3000000 )
......@@ -2023,7 +2023,7 @@ static bool Control( input_thread_t *p_input,
break;
}
val.i_time = time_offset;
val.i_int = time_offset;
b_force_update = Control( p_input, INPUT_CONTROL_SET_TIME, val );
break;
}
......
......@@ -147,7 +147,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
var_Create( p_input, "position-offset", VLC_VAR_FLOAT );
/* Time */
var_Create( p_input, "time", VLC_VAR_TIME );
var_Create( p_input, "time", VLC_VAR_INTEGER );
var_Create( p_input, "time-offset", VLC_VAR_TIME ); /* relative */
/* Bookmark */
......@@ -212,7 +212,7 @@ void input_ControlVarInit ( input_thread_t *p_input )
/* Special read only objects variables for intf */
var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Create( p_input, "length", VLC_VAR_TIME );
var_Create( p_input, "length", VLC_VAR_INTEGER );
var_Create( p_input, "bit-rate", VLC_VAR_INTEGER );
var_Create( p_input, "sample-rate", VLC_VAR_INTEGER );
......@@ -594,12 +594,12 @@ static int PositionCallback( vlc_object_t *p_this, char const *psz_cmd,
else
{
/* Update "length" for better intf behavour */
const mtime_t i_length = var_GetTime( p_input, "length" );
const int64_t i_length = var_GetInteger( p_input, "length" );
if( i_length > 0 && newval.f_float >= 0.f && newval.f_float <= 1.f )
{
vlc_value_t val;
val.i_time = i_length * newval.f_float;
val.i_int = i_length * newval.f_float;
var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
}
......@@ -616,12 +616,12 @@ static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
/* Update "position" for better intf behavour */
const mtime_t i_length = var_GetTime( p_input, "length" );
if( i_length > 0 && newval.i_time >= 0 && newval.i_time <= i_length )
const int64_t i_length = var_GetInteger( p_input, "length" );
if( i_length > 0 && newval.i_int >= 0 && newval.i_int <= i_length )
{
vlc_value_t val;
val.f_float = (double)newval.i_time/(double)i_length;
val.f_float = (double)newval.i_int/(double)i_length;
var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
/*
* Notify the intf that a new event has been occurred.
......
......@@ -1097,7 +1097,7 @@ static int vlm_ControlMediaInstanceGetTimePosition( vlm_t *p_vlm, int64_t id, co
return VLC_EGENERIC;
if( pi_time )
*pi_time = var_GetTime( p_instance->p_input, "time" );
*pi_time = var_GetInteger( p_instance->p_input, "time" );
if( pd_position )
*pd_position = var_GetFloat( p_instance->p_input, "position" );
return VLC_SUCCESS;
......@@ -1115,7 +1115,7 @@ static int vlm_ControlMediaInstanceSetTimePosition( vlm_t *p_vlm, int64_t id, co
return VLC_EGENERIC;
if( i_time >= 0 )
return var_SetTime( p_instance->p_input, "time", i_time );
return var_SetInteger( p_instance->p_input, "time", i_time );
else if( d_position >= 0 && d_position <= 100 )
return var_SetFloat( p_instance->p_input, "position", d_position );
return VLC_EGENERIC;
......@@ -1141,8 +1141,8 @@ static int vlm_ControlMediaInstanceGets( vlm_t *p_vlm, int64_t id, vlm_media_ins
p_idsc->psz_name = strdup( p_instance->psz_name );
if( p_instance->p_input )
{
p_idsc->i_time = var_GetTime( p_instance->p_input, "time" );
p_idsc->i_length = var_GetTime( p_instance->p_input, "length" );
p_idsc->i_time = var_GetInteger( p_instance->p_input, "time" );
p_idsc->i_length = var_GetInteger( p_instance->p_input, "length" );
p_idsc->d_position = var_GetFloat( p_instance->p_input, "position" );
if( var_GetInteger( p_instance->p_input, "state" ) == PAUSE_S )
p_idsc->b_paused = true;
......
......@@ -1347,8 +1347,8 @@ static vlm_message_t *vlm_ShowMedia( vlm_media_sys_t *p_media )
vlm_MessageAdd( p_msg_instance, vlm_MessageNew( key, format, \
var_Get ## type( p_instance->p_input, key ) ) )
APPEND_INPUT_INFO( "position", "%f", Float );
APPEND_INPUT_INFO( "time", "%"PRIi64, Time );
APPEND_INPUT_INFO( "length", "%"PRIi64, Time );
APPEND_INPUT_INFO( "time", "%"PRId64, Integer );
APPEND_INPUT_INFO( "length", "%"PRId64, Integer );
APPEND_INPUT_INFO( "rate", "%f", Float );
APPEND_INPUT_INFO( "title", "%"PRId64, Integer );
APPEND_INPUT_INFO( "chapter", "%"PRId64, Integer );
......
......@@ -690,7 +690,7 @@ char *str_format_meta(input_thread_t *input, const char *s)
{
assert(input != NULL);
write_duration(stream, input_item_GetDuration(item)
- var_GetTime(input, "time"));
- var_GetInteger(input, "time"));
}
else if (!b_empty_if_na)
fputs("--:--:--", stream);
......@@ -747,7 +747,7 @@ char *str_format_meta(input_thread_t *input, const char *s)
break;
case 'T':
if (input != NULL)
write_duration(stream, var_GetTime(input, "time"));
write_duration(stream, var_GetInteger(input, "time"));
else if (!b_empty_if_na)
fputs("--:--:--", stream);
break;
......