]> git.sesse.net Git - vlc/blobdiff - modules/misc/lua/libs/misc.c
Remove config_GetUserConfDir
[vlc] / modules / misc / lua / libs / misc.c
index 549839b29a914d42bf40767f2c774aaa020d10f5..e080d2776cf6dc4bd36637c7366acd7e97590d4f 100644 (file)
@@ -105,7 +105,7 @@ static int vlclua_quit( lua_State *L )
     vlc_object_t *p_this = vlclua_get_this( L );
     /* The rc.c code also stops the playlist ... not sure if this is needed
      * though. */
-    vlc_object_kill( p_this->p_libvlc );
+    libvlc_Quit( p_this->p_libvlc );
     return 0;
 }
 
@@ -126,13 +126,15 @@ static int vlclua_userdatadir( lua_State *L )
 
 static int vlclua_homedir( lua_State *L )
 {
-    lua_pushstring( L, config_GetHomeDir() );
+    char *home = config_GetUserDir( VLC_HOME_DIR );
+    lua_pushstring( L, home );
+    free( home );
     return 1;
 }
 
 static int vlclua_configdir( lua_State *L )
 {
-    char *dir = config_GetUserConfDir();
+    char *dir = config_GetUserDir( VLC_CONFIG_DIR );
     lua_pushstring( L, dir );
     free( dir );
     return 1;
@@ -162,6 +164,7 @@ static int vlclua_datadir_list( lua_State *L )
         lua_rawseti( L, -2, i );
         i ++;
     }
+    vlclua_dir_list_free( ppsz_dir_list );
     return 1;
 }
 /*****************************************************************************
@@ -169,17 +172,15 @@ static int vlclua_datadir_list( lua_State *L )
  *****************************************************************************/
 static int vlclua_lock_and_wait( lua_State *L )
 {
-    vlc_object_t *p_this = vlclua_get_this( L );
-    int b_quit = vlc_object_lock_and_wait( p_this );
-    lua_pushboolean( L, b_quit );
-    return 1;
-}
+    intf_thread_t *p_intf = (intf_thread_t *)vlclua_get_this( L );
+    intf_sys_t *p_sys = p_intf->p_sys;
 
-static int vlclua_signal( lua_State *L )
-{
-    vlc_object_t *p_this = vlclua_get_this( L );
-    vlc_object_signal( p_this );
-    return 0;
+    vlc_mutex_lock( &p_sys->lock );
+    while( !p_sys->exiting )
+        vlc_cond_wait( &p_sys->wait, &p_sys->lock );
+    vlc_mutex_unlock( &p_sys->lock );
+    lua_pushboolean( L, 1 );
+    return 1;
 }
 
 static int vlclua_mdate( lua_State *L )
@@ -188,10 +189,17 @@ static int vlclua_mdate( lua_State *L )
     return 1;
 }
 
+static int vlclua_mwait( lua_State *L )
+{
+    double f = luaL_checknumber( L, 1 );
+    mwait( (int64_t)f );
+    return 0;
+}
+
 static int vlclua_intf_should_die( lua_State *L )
 {
     intf_thread_t *p_intf = (intf_thread_t*)vlclua_get_this( L );
-    lua_pushboolean( L, intf_ShouldDie( p_intf ) );
+    lua_pushboolean( L, p_intf->p_sys->exiting );
     return 1;
 }
 
@@ -211,9 +219,9 @@ static const luaL_Reg vlclua_misc_reg[] = {
     { "datadir_list", vlclua_datadir_list },
 
     { "mdate", vlclua_mdate },
+    { "mwait", vlclua_mwait },
 
     { "lock_and_wait", vlclua_lock_and_wait },
-    { "signal", vlclua_signal },
 
     { "should_die", vlclua_intf_should_die },
     { "quit", vlclua_quit },