Commit 519fe4ca authored by Rémi Duraffort's avatar Rémi Duraffort

lua: also implement timer:getoverrun()

parent d45d5293
...@@ -248,10 +248,12 @@ static int vlclua_action_id( lua_State *L ) ...@@ -248,10 +248,12 @@ static int vlclua_action_id( lua_State *L )
* Timer functions * Timer functions
*****************************************************************************/ *****************************************************************************/
static int vlclua_timer_schedule( lua_State *L ); static int vlclua_timer_schedule( lua_State *L );
static int vlclua_timer_getoverrun( lua_State *L);
static const luaL_Reg vlclua_timer_reg[] = { static const luaL_Reg vlclua_timer_reg[] = {
{ "schedule", vlclua_timer_schedule }, { "schedule", vlclua_timer_schedule },
{ NULL, NULL } { "getoverrun", vlclua_timer_getoverrun },
{ NULL, NULL }
}; };
typedef struct typedef struct
...@@ -275,6 +277,16 @@ static int vlclua_timer_schedule( lua_State *L ) ...@@ -275,6 +277,16 @@ static int vlclua_timer_schedule( lua_State *L )
return 0; return 0;
} }
static int vlclua_timer_getoverrun( lua_State *L )
{
vlclua_timer_t **pp_timer = (vlclua_timer_t**)luaL_checkudata(L, 1, "timer" );
if( !pp_timer || !*pp_timer )
luaL_error( L, "Can't get pointer to timer" );
lua_pushinteger( L, vlc_timer_getoverrun( (*pp_timer)->timer ) );
return 1;
}
static void vlclua_timer_callback( void *data ) static void vlclua_timer_callback( void *data )
{ {
vlclua_timer_t *p_timer = (vlclua_timer_t*)data; vlclua_timer_t *p_timer = (vlclua_timer_t*)data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment