[vlc-commits] lua: sd: set input item duration directly
Rémi Denis-Courmont
git at videolan.org
Sun May 14 21:29:18 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun May 14 21:43:22 2017 +0300| [6b486f0cf0327a3d56e169daaf5626ede855f921] | committer: Rémi Denis-Courmont
lua: sd: set input item duration directly
No need to lock here. The item is not visible to any other threads
until services_discovery_Add(Sub)Item().
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b486f0cf0327a3d56e169daaf5626ede855f921
---
modules/lua/libs/sd.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 219f3e31a8..9a59033d25 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -34,6 +34,7 @@
#endif
#include <assert.h>
+#include <math.h>
#include <vlc_common.h>
#include <vlc_services_discovery.h>
#include <vlc_playlist.h>
@@ -179,7 +180,7 @@ static input_item_t *vlclua_sd_create_item( services_discovery_t *p_sd,
lua_getfield( L, -1, "duration" );
if( lua_isnumber( L, -1 ) )
- input_item_SetDuration( p_input, (lua_tonumber( L, -1 )*1e6) );
+ p_input->i_duration = llround(lua_tonumber( L, -1 ) * 1e6);
else if( !lua_isnil( L, -1 ) )
msg_Warn( p_sd, "Item duration should be a number (in seconds)." );
lua_pop( L, 1 );
More information about the vlc-commits
mailing list