[vlc-commits] Lua: use vlc_mwait_i11e()

Rémi Denis-Courmont git at videolan.org
Mon Jul 6 19:04:59 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Jul  6 20:01:56 2015 +0300| [66e5c332db70ec7d179ae3bb7e76ae93cca46ea8] | committer: Rémi Denis-Courmont

Lua: use vlc_mwait_i11e()

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

 modules/lua/libs/misc.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index 067af57..2674b81 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -34,11 +34,14 @@
 # include "config.h"
 #endif
 
+#include <math.h>
+
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_meta.h>
 #include <vlc_interface.h>
 #include <vlc_keys.h>
+#include <vlc_interrupt.h>
 
 #include "../vlc.h"
 #include "../libs.h"
@@ -132,7 +135,13 @@ static int vlclua_mdate( lua_State *L )
 static int vlclua_mwait( lua_State *L )
 {
     double f = luaL_checknumber( L, 1 );
-    mwait( (int64_t)f );
+
+    vlc_interrupt_t *oint = vlclua_set_interrupt( L );
+    int ret = vlc_mwait_i11e( llround(f) );
+
+    vlc_interrupt_set( oint );
+    if( ret )
+        return luaL_error( L, "Interrupted." );
     return 0;
 }
 



More information about the vlc-commits mailing list