[vlc-commits] modules: transform float to vlc_tick_t using vlc_tick_from_sec()

Steve Lhomme git at videolan.org
Thu Sep 20 17:02:10 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Sep 20 16:54:41 2018 +0200| [da3d63268f2b2c24580cfe018df7a7b9e591c6d9] | committer: Steve Lhomme

modules: transform float to vlc_tick_t using vlc_tick_from_sec()

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

 modules/demux/mp4/heif.c                          | 5 ++---
 modules/demux/ogg.c                               | 2 +-
 modules/spu/subsdelay.c                           | 4 ++--
 modules/stream_out/chromecast/chromecast_ctrl.cpp | 2 +-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
index ad9dd6a9ac..b8f07b99b7 100644
--- a/modules/demux/mp4/heif.c
+++ b/modules/demux/mp4/heif.c
@@ -476,10 +476,9 @@ int OpenHEIF( vlc_object_t * p_this )
         return VLC_ENOMEM;
     }
 
-    p_sys->i_image_duration = var_InheritFloat( p_demux, "heif-image-duration" );
+    p_sys->i_image_duration = vlc_tick_from_sec(var_InheritFloat( p_demux, "heif-image-duration" ));
     if( p_sys->i_image_duration <= 0 )
-        p_sys->i_image_duration = HEIF_DEFAULT_DURATION;
-    p_sys->i_image_duration *= CLOCK_FREQ;
+        p_sys->i_image_duration = VLC_TICK_FROM_SEC(HEIF_DEFAULT_DURATION);
 
     MP4_Box_t *p_infe = NULL;
     while( (p_infe = NextAtom( p_root, ATOM_infe, "meta/iinf/infe", p_infe )) )
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index c05733df9a..6e165962b5 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -750,7 +750,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
             if( p_sys->i_length > 0 && p_sys->i_pcr != VLC_TICK_INVALID )
             {
                 *pf =  (double) p_sys->i_pcr /
-                       (double) ( p_sys->i_length * CLOCK_FREQ );
+                       (double) vlc_tick_from_sec( p_sys->i_length );
             }
             else if( stream_Size( p_demux->s ) > 0 )
             {
diff --git a/modules/spu/subsdelay.c b/modules/spu/subsdelay.c
index 5e23dc6c9b..7297c968b8 100644
--- a/modules/spu/subsdelay.c
+++ b/modules/spu/subsdelay.c
@@ -1169,7 +1169,7 @@ static vlc_tick_t SubsdelayEstimateDelay( filter_t *p_filter, subsdelay_heap_ent
 
     if( i_mode == SUBSDELAY_MODE_ABSOLUTE )
     {
-        return ( p_entry->p_source->i_stop - p_entry->p_source->i_start + (vlc_tick_t)( CLOCK_FREQ * p_sys->f_factor ) );
+        return ( p_entry->p_source->i_stop - p_entry->p_source->i_start + vlc_tick_from_sec( p_sys->f_factor ) );
     }
 
     if( i_mode == SUBSDELAY_MODE_RELATIVE_SOURCE_CONTENT )
@@ -1179,7 +1179,7 @@ static vlc_tick_t SubsdelayEstimateDelay( filter_t *p_filter, subsdelay_heap_ent
             //FIXME: We only use a single segment here
             i_rank = SubsdelayGetTextRank( p_entry->p_subpic->p_region->p_text->psz_text );
 
-            return (vlc_tick_t)( i_rank * CLOCK_FREQ * p_sys->f_factor );
+            return vlc_tick_from_sec( p_sys->f_factor * i_rank );
         }
 
         /* content is unavailable, calculation mode should be based on source delay */
diff --git a/modules/stream_out/chromecast/chromecast_ctrl.cpp b/modules/stream_out/chromecast/chromecast_ctrl.cpp
index 441dba7d17..4c08f8b57a 100644
--- a/modules/stream_out/chromecast/chromecast_ctrl.cpp
+++ b/modules/stream_out/chromecast/chromecast_ctrl.cpp
@@ -1076,7 +1076,7 @@ States intf_sys_t::state() const
 
 vlc_tick_t intf_sys_t::timeCCToVLC(double time)
 {
-    return vlc_tick_t(time * (double)CLOCK_FREQ);
+    return vlc_tick_from_sec(time);
 }
 
 std::string intf_sys_t::timeVLCToCC(vlc_tick_t time)



More information about the vlc-commits mailing list