[vlc-commits] modules: transform vlc_tick_t value to seconds with SEC_FROM_VLC_TICK

Steve Lhomme git at videolan.org
Wed Sep 19 13:23:47 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May 31 15:19:26 2018 +0200| [b3f5af2dd76247306ac55e535831dda8811a8cda] | committer: Steve Lhomme

modules: transform vlc_tick_t value to seconds with SEC_FROM_VLC_TICK

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

 modules/control/oldrc.c | 8 ++++----
 modules/demux/avi/avi.c | 8 ++++----
 modules/demux/oggseek.c | 2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/control/oldrc.c b/modules/control/oldrc.c
index 56bde3a38f..8c43b3e7bc 100644
--- a/modules/control/oldrc.c
+++ b/modules/control/oldrc.c
@@ -697,14 +697,14 @@ static void *Run( void *data )
         {
             int64_t t = 0;
             if( p_sys->p_input != NULL )
-                t = var_GetInteger( p_sys->p_input, "time" ) / CLOCK_FREQ;
+                t = SEC_FROM_VLC_TICK(var_GetInteger( p_sys->p_input, "time" ));
             msg_rc( "%"PRIu64, t );
         }
         else if( !strcmp( psz_cmd, "get_length" ) )
         {
             int64_t l = 0;
             if( p_sys->p_input != NULL )
-                l = var_GetInteger( p_sys->p_input, "length" ) / CLOCK_FREQ;
+                l = SEC_FROM_VLC_TICK(var_GetInteger( p_sys->p_input, "length" ));
             msg_rc( "%"PRIu64, l );
         }
         else if( !strcmp( psz_cmd, "get_title" ) )
@@ -905,7 +905,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_GetInteger( p_input, "time" ) / CLOCK_FREQ) );
+                SEC_FROM_VLC_TICK(var_GetInteger( p_input, "time" )) );
     p_intf->p_sys->b_input_buffering = false;
     vlc_mutex_unlock( &p_intf->p_sys->status_lock );
 }
@@ -1158,7 +1158,7 @@ static void print_playlist( intf_thread_t *p_intf, playlist_item_t *p_item, int
     {
         if( p_item->pp_children[i]->p_input->i_duration != INPUT_DURATION_INDEFINITE )
         {
-            secstotimestr( psz_buffer, p_item->pp_children[i]->p_input->i_duration / CLOCK_FREQ );
+            secstotimestr( psz_buffer, SEC_FROM_VLC_TICK(p_item->pp_children[i]->p_input->i_duration) );
             msg_rc( "|%*s- %s (%s)", 2 * i_level, "", p_item->pp_children[i]->p_input->psz_name, psz_buffer );
         }
         else
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index be4840f5c4..335fbccfe1 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1421,7 +1421,7 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_date, double f_ratio, bool b_acc
 {
     demux_sys_t *p_sys = p_demux->p_sys;
     msg_Dbg( p_demux, "seek requested: %"PRId64" seconds %2.2f%%",
-             i_date / CLOCK_FREQ, f_ratio * 100 );
+             SEC_FROM_VLC_TICK(i_date), f_ratio * 100 );
 
     if( p_sys->b_seekable )
     {
@@ -1550,7 +1550,7 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_date, double f_ratio, bool b_acc
         es_out_SetPCR( p_demux->out, VLC_TICK_0 + p_sys->i_time );
         if( b_accurate )
             es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, VLC_TICK_0 + i_date );
-        msg_Dbg( p_demux, "seek: %"PRId64" seconds", p_sys->i_time /CLOCK_FREQ );
+        msg_Dbg( p_demux, "seek: %"PRId64" seconds", SEC_FROM_VLC_TICK(p_sys->i_time) );
         return VLC_SUCCESS;
 
 failandresetpos:
@@ -1723,7 +1723,7 @@ static int64_t AVI_PTSToChunk( avi_track_t *tk, vlc_tick_t i_pts )
         return 0;
 
     i_pts = AVI_Rescale( i_pts, tk->i_scale, tk->i_rate );
-    return i_pts / CLOCK_FREQ;
+    return SEC_FROM_VLC_TICK(i_pts);
 }
 
 static int64_t AVI_PTSToByte( avi_track_t *tk, vlc_tick_t i_pts )
@@ -3010,7 +3010,7 @@ static vlc_tick_t  AVI_MovieGetLength( demux_t *p_demux )
         msg_Dbg( p_demux,
                  "stream[%d] length:%"PRId64" (based on index)",
                  i,
-                 i_length );
+                 SEC_FROM_VLC_TICK(i_length) );
         i_maxlength = __MAX( i_maxlength, i_length );
     }
 
diff --git a/modules/demux/oggseek.c b/modules/demux/oggseek.c
index bd3e6e90f2..190bf5c7b6 100644
--- a/modules/demux/oggseek.c
+++ b/modules/demux/oggseek.c
@@ -285,7 +285,7 @@ void Oggseek_ProbeEnd( demux_t *p_demux )
                     i_length = Ogg_GranuleToTime( p_sys->pp_stream[i], i_granule,
                                                   !p_sys->pp_stream[i]->b_contiguous, false );
                     if( i_length > VLC_TICK_INVALID )
-                        p_sys->i_length = __MAX( p_sys->i_length, (i_length - VLC_TICK_0) / 1000000 );
+                        p_sys->i_length = __MAX( p_sys->i_length, SEC_FROM_VLC_TICK(i_length - VLC_TICK_0) );
                     break;
                 }
             }



More information about the vlc-commits mailing list