[vlc-commits] input: use vlc_tick_t for the input "length" variable

Steve Lhomme git at videolan.org
Thu Sep 20 12:43:55 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 20 10:59:31 2018 +0200| [88b7d8513600efdc440d8408c96c77538d382c18] | committer: Steve Lhomme

input: use vlc_tick_t for the input "length" variable

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88b7d8513600efdc440d8408c96c77538d382c18
---

 modules/control/hotkeys.c               | 2 +-
 modules/gui/macosx/VLCCoreInteraction.m | 6 +++---
 src/input/var.c                         | 2 +-
 src/input/vlm.c                         | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index ae61de4a65..b4a323c29b 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -1526,7 +1526,7 @@ static void DisplayPosition( vout_thread_t *p_vout, int slider_chan,
     ClearChannels( p_vout, slider_chan );
 
     int64_t t = SEC_FROM_VLC_TICK(var_GetInteger( p_input, "time" ));
-    int64_t l = var_GetInteger( p_input, "length" ) / CLOCK_FREQ;
+    int64_t l = SEC_FROM_VLC_TICK(var_GetInteger( p_input, "length" ));
 
     secstotimestr( psz_time, t );
 
diff --git a/modules/gui/macosx/VLCCoreInteraction.m b/modules/gui/macosx/VLCCoreInteraction.m
index 6c2fa3b5ee..9b7ffc04df 100644
--- a/modules/gui/macosx/VLCCoreInteraction.m
+++ b/modules/gui/macosx/VLCCoreInteraction.m
@@ -260,14 +260,14 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
         return 0;
 
     input_thread_t * p_input = pl_CurrentInput(p_intf);
-    int64_t i_duration = -1;
+    vlc_tick_t i_duration;
     if (!p_input)
-        return i_duration;
+        return -1;
 
     i_duration = var_GetInteger(p_input, "length");
     vlc_object_release(p_input);
 
-    return (i_duration / 1000000);
+    return SEC_FROM_VLC_TICK(i_duration);
 }
 
 - (NSURL*)URLOfCurrentPlaylistItem
diff --git a/src/input/var.c b/src/input/var.c
index ca674a0a25..30f9d7e94f 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -866,7 +866,7 @@ 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 behaviour */
-    const int64_t i_length = var_GetInteger( p_input, "length" );
+    const vlc_tick_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;
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 4faac54146..2182cb87ae 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -1123,7 +1123,7 @@ static int vlm_ControlMediaInstanceGets( vlm_t *p_vlm, int64_t id, vlm_media_ins
         if( p_instance->p_input )
         {
             p_idsc->i_time = US_FROM_VLC_TICK(var_GetInteger( p_instance->p_input, "time" ));
-            p_idsc->i_length = var_GetInteger( p_instance->p_input, "length" );
+            p_idsc->i_length = US_FROM_VLC_TICK(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;



More information about the vlc-commits mailing list