[vlc-commits] lua: use helper function to convert from vlc_tick_t to floating point seconds
Steve Lhomme
git at videolan.org
Thu Jul 5 16:17:06 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Jun 12 12:03:33 2018 +0200| [69b25f403d8aed4f45138d6ba277042c4fa6a91c] | committer: Steve Lhomme
lua: use helper function to convert from vlc_tick_t to floating point seconds
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=69b25f403d8aed4f45138d6ba277042c4fa6a91c
---
modules/lua/libs/input.c | 2 +-
modules/lua/libs/playlist.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 112bde23af..01c5424381 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -339,7 +339,7 @@ static int vlclua_input_item_name( lua_State *L )
static int vlclua_input_item_duration( lua_State *L )
{
vlc_tick_t duration = input_item_GetDuration( vlclua_input_item_get_internal( L ) );
- lua_pushnumber( L, ((double)duration)/(double)CLOCK_FREQ );
+ lua_pushnumber( L, secf_from_vlc_tick(duration) );
return 1;
}
diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
index 5cf879ea7a..0becc434c5 100644
--- a/modules/lua/libs/playlist.c
+++ b/modules/lua/libs/playlist.c
@@ -250,7 +250,7 @@ static void push_playlist_item( lua_State *L, playlist_item_t *p_item )
if( p_input->i_duration < 0 )
lua_pushnumber( L, -1 );
else
- lua_pushnumber( L, ((double)p_input->i_duration)*1e-6 );
+ lua_pushnumber( L, secf_from_vlc_tick(p_input->i_duration) );
lua_setfield( L, -2, "duration" );
lua_pushinteger( L, p_item->i_nb_played );
lua_setfield( L, -2, "nb_played" );
More information about the vlc-commits
mailing list