Commit 6c261166 authored by damienf's avatar damienf
Browse files

- use nearest integer value from integer division (i.e. round() ) in volume...

- use nearest integer value from integer division (i.e. round() ) in volume and time calculation, looks more accurate that way.
parent 5e45f57e
......@@ -79,7 +79,7 @@ int libvlc_audio_get_volume( libvlc_instance_t *p_instance,
aout_VolumeGet( p_instance->p_libvlc_int, &i_volume );
return i_volume*200/AOUT_VOLUME_MAX;
return (i_volume*200+AOUT_VOLUME_MAX/2)/AOUT_VOLUME_MAX;
}
......@@ -91,7 +91,8 @@ void libvlc_audio_set_volume( libvlc_instance_t *p_instance, int i_volume,
{
if( i_volume >= 0 && i_volume <= 200 )
{
i_volume = i_volume * AOUT_VOLUME_MAX / 200;
i_volume = (i_volume * AOUT_VOLUME_MAX + 100) / 200;
aout_VolumeSet( p_instance->p_libvlc_int, i_volume );
}
else
......
......@@ -68,7 +68,7 @@ vlc_int64_t libvlc_input_get_length( libvlc_input_t *p_input,
var_Get( p_input_thread, "length", &val );
vlc_object_release( p_input_thread );
return val.i_time/1000LL;
return (val.i_time+500LL)/1000LL;
}
vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
......@@ -82,7 +82,7 @@ vlc_int64_t libvlc_input_get_time( libvlc_input_t *p_input,
var_Get( p_input_thread , "time", &val );
vlc_object_release( p_input_thread );
return val.i_time/1000LL;
return (val.i_time+500LL)/1000LL;
}
void libvlc_input_set_time( libvlc_input_t *p_input, vlc_int64_t time,
......
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