[vlc-commits] Lua: set playlist object explicitly in state

Rémi Denis-Courmont git at videolan.org
Sun Jan 5 12:44:58 CET 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jan  5 13:39:30 2014 +0200| [781ff75140b51aa17096e7a2e424bbb1836fc4b5] | committer: Rémi Denis-Courmont

Lua: set playlist object explicitly in state

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

 modules/lua/Makefile.am      |    2 +-
 modules/lua/demux.c          |    1 -
 modules/lua/extension.c      |    1 +
 modules/lua/intf.c           |    1 +
 modules/lua/libs/equalizer.c |    1 -
 modules/lua/libs/input.c     |    1 -
 modules/lua/libs/misc.c      |   10 ++++++++++
 modules/lua/libs/objects.c   |    1 -
 modules/lua/libs/playlist.c  |   10 ----------
 modules/lua/libs/playlist.h  |   30 ------------------------------
 modules/lua/libs/sd.c        |    1 -
 modules/lua/libs/volume.c    |    1 -
 modules/lua/vlc.h            |    3 +++
 13 files changed, 16 insertions(+), 47 deletions(-)

diff --git a/modules/lua/Makefile.am b/modules/lua/Makefile.am
index 673fc69..38a1b8d 100644
--- a/modules/lua/Makefile.am
+++ b/modules/lua/Makefile.am
@@ -20,7 +20,7 @@ liblua_plugin_la_SOURCES = \
 	lua/libs/net.c \
 	lua/libs/objects.c lua/libs/objects.h \
 	lua/libs/osd.c \
-	lua/libs/playlist.c lua/libs/playlist.h \
+	lua/libs/playlist.c \
 	lua/libs/sd.c \
 	lua/libs/stream.c \
 	lua/libs/strings.c \
diff --git a/modules/lua/demux.c b/modules/lua/demux.c
index a84fd66..c46c3f9 100644
--- a/modules/lua/demux.c
+++ b/modules/lua/demux.c
@@ -37,7 +37,6 @@
 
 #include "vlc.h"
 #include "libs.h"
-#include "libs/playlist.h"
 
 
 /*****************************************************************************
diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 291c4bb..6913fa1 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -808,6 +808,7 @@ static lua_State* GetLuaState( extensions_manager_t *p_mgr,
             return NULL;
         }
         vlclua_set_this( L, p_mgr );
+        vlclua_set_playlist_internal( L, pl_Get(p_mgr) );
         vlclua_extension_set( L, p_ext );
 
         luaL_openlibs( L );
diff --git a/modules/lua/intf.c b/modules/lua/intf.c
index 5df4492..f23eed3 100644
--- a/modules/lua/intf.c
+++ b/modules/lua/intf.c
@@ -242,6 +242,7 @@ static int Start_LuaIntf( vlc_object_t *p_this, const char *name )
     }
 
     vlclua_set_this( L, p_intf );
+    vlclua_set_playlist_internal( L, pl_Get(p_intf) );
 
     luaL_openlibs( L );
 
diff --git a/modules/lua/libs/equalizer.c b/modules/lua/libs/equalizer.c
index e2e8aa3..512bae1 100644
--- a/modules/lua/libs/equalizer.c
+++ b/modules/lua/libs/equalizer.c
@@ -40,7 +40,6 @@
 #include "input.h"
 #include "../libs.h"
 #include "../vlc.h"
-#include "playlist.h"
 #include "../../audio_filter/equalizer_presets.h"
 
 #if !defined _WIN32
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 3e347bf..1cceb28 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -41,7 +41,6 @@
 
 #include "../vlc.h"
 #include "input.h"
-#include "playlist.h"
 #include "../libs.h"
 #include "../extension.h"
 
diff --git a/modules/lua/libs/misc.c b/modules/lua/libs/misc.c
index b2e0839..81b5a7e 100644
--- a/modules/lua/libs/misc.c
+++ b/modules/lua/libs/misc.c
@@ -73,6 +73,16 @@ vlc_object_t * vlclua_get_this( lua_State *L )
     return vlclua_get_object( L, vlclua_set_this );
 }
 
+void vlclua_set_playlist_internal( lua_State *L, playlist_t *pl )
+{
+    vlclua_set_object( L, vlclua_set_playlist_internal, pl );
+}
+
+playlist_t *vlclua_get_playlist_internal( lua_State *L )
+{
+    return vlclua_get_object( L, vlclua_set_playlist_internal );
+}
+
 /*****************************************************************************
  * VLC error code translation
  *****************************************************************************/
diff --git a/modules/lua/libs/objects.c b/modules/lua/libs/objects.c
index 287a42c..6517816 100644
--- a/modules/lua/libs/objects.c
+++ b/modules/lua/libs/objects.c
@@ -38,7 +38,6 @@
 #include "../vlc.h"
 #include "../libs.h"
 #include "objects.h"
-#include "playlist.h"
 #include "input.h"
 
 /*****************************************************************************
diff --git a/modules/lua/libs/playlist.c b/modules/lua/libs/playlist.c
index 29f5e4b..8dfd048 100644
--- a/modules/lua/libs/playlist.c
+++ b/modules/lua/libs/playlist.c
@@ -40,18 +40,8 @@
 #include "../vlc.h"
 #include "../libs.h"
 #include "input.h"
-#include "playlist.h"
 #include "variables.h"
 
-/*****************************************************************************
- * Internal lua<->vlc utils
- *****************************************************************************/
-playlist_t *vlclua_get_playlist_internal( lua_State *L )
-{
-    vlc_object_t *p_this = vlclua_get_this( L );
-    return pl_Get( p_this );
-}
-
 static int vlclua_playlist_prev( lua_State * L )
 {
     playlist_t *p_playlist = vlclua_get_playlist_internal( L );
diff --git a/modules/lua/libs/playlist.h b/modules/lua/libs/playlist.h
deleted file mode 100644
index 5015c4c..0000000
--- a/modules/lua/libs/playlist.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*****************************************************************************
- * playlist.h
- *****************************************************************************
- * Copyright (C) 2007-2008 the VideoLAN team
- * $Id$
- *
- * Authors: Antoine Cellerier <dionoea at videolan tod org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifndef VLC_LUA_PLAYLIST_H
-#define VLC_LUA_PLAYLIST_H
-
-playlist_t *vlclua_get_playlist_internal( lua_State * );
-
-#endif
-
diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index fa4d7bf..4bbf1d7 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -41,7 +41,6 @@
 
 #include "../vlc.h"
 #include "../libs.h"
-#include "playlist.h"
 
 /*****************************************************************************
  *
diff --git a/modules/lua/libs/volume.c b/modules/lua/libs/volume.c
index 6b9409f..b361647 100644
--- a/modules/lua/libs/volume.c
+++ b/modules/lua/libs/volume.c
@@ -41,7 +41,6 @@
 
 #include "../vlc.h"
 #include "../libs.h"
-#include "playlist.h"
 
 /*****************************************************************************
  * Volume related
diff --git a/modules/lua/vlc.h b/modules/lua/vlc.h
index d98f7fc..16bea84 100644
--- a/modules/lua/vlc.h
+++ b/modules/lua/vlc.h
@@ -113,6 +113,9 @@ void vlclua_set_this( lua_State *, vlc_object_t * );
 #define vlclua_set_this(a, b) vlclua_set_this(a, VLC_OBJECT(b))
 vlc_object_t * vlclua_get_this( lua_State * );
 
+void vlclua_set_playlist_internal( lua_State *, playlist_t * );
+playlist_t * vlclua_get_playlist_internal( lua_State * );
+
 /*****************************************************************************
  * Lua function bridge
  *****************************************************************************/



More information about the vlc-commits mailing list