[vlc-commits] modules: transform vlc_tick_t value to milliseconds with MS_FROM_VLC_TICK

Steve Lhomme git at videolan.org
Fri Jul 6 16:07:43 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Jun  6 12:25:34 2018 +0200| [18449933c8ce61ec8e72d4dfba3149f7050d8433] | committer: Steve Lhomme

modules: transform vlc_tick_t value to milliseconds with MS_FROM_VLC_TICK

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

 modules/control/hotkeys.c | 4 ++--
 modules/demux/gme.c       | 2 +-
 modules/misc/stats.c      | 8 ++++----
 modules/mux/asf.c         | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 1f2645bcbc..c875cbbea2 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -734,7 +734,7 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
                 var_SetInteger( p_input, "spu-delay", i_delay );
                 ClearChannels( p_vout, slider_chan );
                 DisplayMessage( p_vout, _( "Subtitle delay %i ms" ),
-                                (int)(i_delay/1000) );
+                                (int)MS_FROM_VLC_TICK(i_delay) );
                 free(list);
             }
             break;
@@ -751,7 +751,7 @@ static int PutAction( intf_thread_t *p_intf, input_thread_t *p_input,
                 var_SetInteger( p_input, "audio-delay", i_delay );
                 ClearChannels( p_vout, slider_chan );
                 DisplayMessage( p_vout, _( "Audio delay %i ms" ),
-                                 (int)(i_delay/1000) );
+                                 (int)MS_FROM_VLC_TICK(i_delay) );
             }
             break;
         }
diff --git a/modules/demux/gme.c b/modules/demux/gme.c
index b3c4ab20a4..6fc9018603 100644
--- a/modules/demux/gme.c
+++ b/modules/demux/gme.c
@@ -272,7 +272,7 @@ static int Control (demux_t *demux, int query, va_list args)
              || (sys->titlev[sys->track_id]->i_length == 0))
                 break;
 
-            int seek = (sys->titlev[sys->track_id]->i_length / 1000) * pos;
+            int seek = MS_FROM_VLC_TICK(sys->titlev[sys->track_id]->i_length) * pos;
             if (gme_seek (sys->emu, seek))
                 break;
             return VLC_SUCCESS;
diff --git a/modules/misc/stats.c b/modules/misc/stats.c
index 892311c338..e99402a2b8 100644
--- a/modules/misc/stats.c
+++ b/modules/misc/stats.c
@@ -55,9 +55,9 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
     if( p_block->i_buffer == kBufferSize )
     {
         msg_Dbg( p_dec, "got %"PRIu64" ms",
-                 *(vlc_tick_t *)p_block->p_buffer  / 1000 );
+                 MS_FROM_VLC_TICK(*(vlc_tick_t *)p_block->p_buffer) );
         msg_Dbg( p_dec, "got %"PRIu64" ms offset",
-                 (vlc_tick_now() - *(vlc_tick_t *)p_block->p_buffer) / 1000 );
+                 MS_FROM_VLC_TICK(vlc_tick_now() - *(vlc_tick_t *)p_block->p_buffer) );
         *(vlc_tick_t *)(p_pic->p->p_pixels) = *(vlc_tick_t *)p_block->p_buffer;
     }
     else
@@ -108,7 +108,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
     p_block->i_dts = p_pict->date;
 
     msg_Dbg( p_enc, "putting %"PRIu64"ms",
-             *(vlc_tick_t*)p_block->p_buffer / 1000 );
+             MS_FROM_VLC_TICK(*(vlc_tick_t*)p_block->p_buffer) );
     return p_block;
 }
 
@@ -152,7 +152,7 @@ static int Demux( demux_t *p_demux )
     p_block->i_dts = p_block->i_pts = date_Increment( &p_sys->pts, kBufferSize );
 
     msg_Dbg( p_demux, "demux got %"PRId64" ms offset",
-             (vlc_tick_now() - *(vlc_tick_t *)p_block->p_buffer) / 1000 );
+             MS_FROM_VLC_TICK(vlc_tick_now() - *(vlc_tick_t *)p_block->p_buffer) );
 
     //es_out_SetPCR( p_demux->out, p_block->i_pts );
 
diff --git a/modules/mux/asf.c b/modules/mux/asf.c
index 8dd40b7784..f236651a4c 100644
--- a/modules/mux/asf.c
+++ b/modules/mux/asf.c
@@ -1156,7 +1156,7 @@ static block_t *asf_packet_flush( sout_mux_t *p_mux )
     bo_add_u8( &bo, 0x11 );
     bo_add_u8( &bo, 0x5d );
     bo_addle_u16( &bo, i_pad );
-    bo_addle_u32( &bo, (p_sys->i_pk_dts - p_sys->i_dts_first) / 1000 +
+    bo_addle_u32( &bo, MS_FROM_VLC_TICK(p_sys->i_pk_dts - p_sys->i_dts_first) +
                   p_sys->i_preroll_time );
     bo_addle_u16( &bo, 0 /* data->i_length */ );
     bo_add_u8( &bo, 0x80 | p_sys->i_pk_frame );
@@ -1216,7 +1216,7 @@ static block_t *asf_packet_create( sout_mux_t *p_mux,
         bo_addle_u32( &bo, i_pos );
         bo_add_u8   ( &bo, 0x08 );  /* flags */
         bo_addle_u32( &bo, i_data );
-        bo_addle_u32( &bo, (data->i_dts - p_sys->i_dts_first) / 1000 +
+        bo_addle_u32( &bo, MS_FROM_VLC_TICK(data->i_dts - p_sys->i_dts_first) +
                       p_sys->i_preroll_time );
         bo_addle_u16( &bo, i_payload );
         bo_add_mem  ( &bo, &p_data[i_pos], i_payload );



More information about the vlc-commits mailing list