diff --git a/configure.ac b/configure.ac
index de690210a..9a31c7511 100644
--- a/configure.ac
+++ b/configure.ac
@@ -283,6 +283,7 @@ src/driver/Makefile
src/gui/Makefile
src/gui/bedit/Makefile
src/gui/components/Makefile
+src/gui/lua/Makefile
src/gui/widget/Makefile
src/system/Makefile
src/system/mtdutils/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index eb7c9f311..6af8b9908 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -86,6 +86,7 @@ neutrino_LDADD = \
gui/movieinfo.o \
gui/libneutrino_gui2.a \
gui/components/libneutrino_gui_components.a \
+ gui/lua/libneutrino_gui_lua.a \
eitd/libsectionsd.a \
gui/volumebar.o \
driver/libneutrino_driver.a \
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
index e4f4cf2a8..fb5f20e78 100644
--- a/src/gui/Makefile.am
+++ b/src/gui/Makefile.am
@@ -16,6 +16,10 @@ noinst_HEADERS = version.h
SUBDIRS = bedit components widget
+if ENABLE_LUA
+SUBDIRS += lua
+endif
+
AM_CPPFLAGS += \
-I$(top_builddir) \
-I$(top_srcdir) \
@@ -32,12 +36,6 @@ AM_CPPFLAGS += \
@CURL_CFLAGS@ \
@FREETYPE_CFLAGS@
-if ENABLE_LUA
-AM_CPPFLAGS += \
- @LUA_CFLAGS@
-endif
-
-
if BOXTYPE_COOL
if BOXMODEL_APOLLO
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
@@ -125,11 +123,6 @@ libneutrino_gui_a_SOURCES += \
test_menu.cpp
endif
-if ENABLE_LUA
-libneutrino_gui_a_SOURCES += \
- luainstance.cpp
-endif
-
libneutrino_gui2_a_SOURCES = \
cam_menu.cpp \
color.cpp \
diff --git a/src/gui/lua/Makefile.am b/src/gui/lua/Makefile.am
new file mode 100644
index 000000000..5cdc6226c
--- /dev/null
+++ b/src/gui/lua/Makefile.am
@@ -0,0 +1,33 @@
+AM_CPPFLAGS = -fno-rtti -D__STDC_FORMAT_MACROS
+
+AM_CPPFLAGS += \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/src \
+ -I$(top_srcdir)/src/zapit/include \
+ -I$(top_srcdir)/lib \
+ -I$(top_srcdir)/lib/libeventserver \
+ -I$(top_srcdir)/lib/libnet \
+ -I$(top_srcdir)/lib/libconfigfile \
+ -I$(top_srcdir)/lib/connection \
+ -I$(top_srcdir)/lib/xmltree \
+ -I$(top_srcdir)/lib/libupnpclient \
+ -I$(top_srcdir)/lib/jsoncpp/include \
+ @SIGC_CFLAGS@ \
+ @CURL_CFLAGS@ \
+ @FREETYPE_CFLAGS@ \
+ @LUA_CFLAGS@
+
+if BOXTYPE_COOL
+if BOXMODEL_APOLLO
+AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
+else
+AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream
+endif
+endif
+
+noinst_LIBRARIES = libneutrino_gui_lua.a
+
+libneutrino_gui_lua_a_SOURCES = \
+ luainstance.cpp \
+ lua_video.cpp
diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp
new file mode 100644
index 000000000..f33437e4d
--- /dev/null
+++ b/src/gui/lua/lua_video.cpp
@@ -0,0 +1,91 @@
+/*
+ * lua video functions
+ *
+ * (C) 2014 [CST ]Focus
+ * (C) 2014-2015 M. Liebmann (micha-bbg)
+ *
+ * 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, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+#include "luainstance.h"
+
+extern cVideo * videoDecoder;
+
+int CLuaInstance::setBlank(lua_State *L)
+{
+ bool enable = true;
+ int numargs = lua_gettop(L);
+ if (numargs > 1)
+ enable = _luaL_checkbool(L, 2);
+ videoDecoder->setBlank(enable);
+ return 0;
+}
+
+int CLuaInstance::ShowPicture(lua_State *L)
+{
+ const char *fname = luaL_checkstring(L, 2);
+ CFrameBuffer::getInstance()->showFrame(fname);
+ return 0;
+}
+
+int CLuaInstance::StopPicture(lua_State */*L*/)
+{
+ CFrameBuffer::getInstance()->stopFrame();
+ return 0;
+}
+
+int CLuaInstance::PlayFile(lua_State *L)
+{
+ printf("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
+ int numargs = lua_gettop(L);
+
+ if (numargs < 3) {
+ printf("CLuaInstance::%s: not enough arguments (%d, expected 3)\n", __func__, numargs);
+ return 0;
+ }
+
+ const char *title;
+ const char *info1 = "";
+ const char *info2 = "";
+ const char *fname;
+
+ title = luaL_checkstring(L, 2);
+ fname = luaL_checkstring(L, 3);
+ if (numargs > 3)
+ info1 = luaL_checkstring(L, 4);
+ if (numargs > 4)
+ info2 = luaL_checkstring(L, 5);
+ printf("CLuaInstance::%s: title %s file %s\n", __func__, title, fname);
+ std::string st(title);
+ std::string si1(info1);
+ std::string si2(info2);
+ std::string sf(fname);
+ CMoviePlayerGui::getInstance().SetFile(st, sf, si1, si2);
+ CMoviePlayerGui::getInstance().exec(NULL, "http_lua");
+ int ret = CMoviePlayerGui::getInstance().getKeyPressed();
+ lua_pushinteger(L, ret);
+ return 1;
+}
diff --git a/src/gui/lua/lua_video.inc b/src/gui/lua/lua_video.inc
new file mode 100644
index 000000000..01ba76707
--- /dev/null
+++ b/src/gui/lua/lua_video.inc
@@ -0,0 +1,5 @@
+
+static int setBlank(lua_State *L);
+static int ShowPicture(lua_State *L);
+static int StopPicture(lua_State *L);
+static int PlayFile(lua_State *L);
diff --git a/src/gui/luainstance.cpp b/src/gui/lua/luainstance.cpp
similarity index 98%
rename from src/gui/luainstance.cpp
rename to src/gui/lua/luainstance.cpp
index 0dcc3fad9..9e4efc89e 100644
--- a/src/gui/luainstance.cpp
+++ b/src/gui/lua/luainstance.cpp
@@ -36,10 +36,10 @@
#include
#include
#include
+#include
#include
#include "luainstance.h"
-#include
/* the magic color that tells us we are using one of the palette colors */
#define MAGIC_COLOR 0x42424200
@@ -411,7 +411,7 @@ bool CLuaInstance::_luaL_checkbool(lua_State *L, int numArg)
lua_Debug ar;
lua_getstack(L, 0, &ar);
lua_getinfo(L, "n", &ar);
- luaL_error(L, "bad argument #%d to '%s' (%s expected, got %s)\n",
+ luaL_error(L, "bad argument #%d to '%s' (%s expected, got %s)\n",
numArg-1, ar.name,
lua_typename(L, LUA_TBOOLEAN),
lua_typename(L, lua_type(L, numArg)));
@@ -436,8 +436,8 @@ void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const c
lua_Debug ar;
lua_getstack(L, 1, &ar);
lua_getinfo(L, "Sl", &ar);
- printf("[Lua Script] \33[1;31m%s\33[0m %s \33[33m%s\33[0m %s \33[1;33m%s\33[0m.\n (%s:%d)\n",
- g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED1),
+ printf("[Lua Script] \33[1;31m%s\33[0m %s \33[33m%s\33[0m %s \33[1;33m%s\33[0m.\n (%s:%d)\n",
+ g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED1),
g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED2), oldFunc,
g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED3), newFunc,
ar.short_src, ar.currentline);
@@ -568,19 +568,21 @@ const luaL_Reg CLuaInstance::methods[] =
{ "getRenderWidth", CLuaInstance::getRenderWidth },
{ "GetSize", CLuaInstance::GetSize },
{ "DisplayImage", CLuaInstance::DisplayImage },
- { "setBlank", CLuaInstance::setBlank },
- { "ShowPicture", CLuaInstance::ShowPicture },
- { "StopPicture", CLuaInstance::StopPicture },
{ "Blit", CLuaInstance::Blit },
{ "GetLanguage", CLuaInstance::GetLanguage },
{ "runScript", CLuaInstance::runScriptExt },
- { "PlayFile", CLuaInstance::PlayFile },
{ "strFind", CLuaInstance::strFind },
{ "strSub", CLuaInstance::strSub },
{ "checkVersion", CLuaInstance::checkVersion },
{ "createChannelIDfromUrl", CLuaInstance::createChannelIDfromUrl },
{ "enableInfoClock", CLuaInstance::enableInfoClock },
{ "getDynFont", CLuaInstance::getDynFont },
+
+ /* gui/lua/lua_video.cpp*/
+ { "setBlank", CLuaInstance::setBlank },
+ { "ShowPicture", CLuaInstance::ShowPicture },
+ { "StopPicture", CLuaInstance::StopPicture },
+ { "PlayFile", CLuaInstance::PlayFile },
{ NULL, NULL }
};
@@ -879,63 +881,6 @@ int CLuaInstance::DisplayImage(lua_State *L)
return 0;
}
-extern cVideo * videoDecoder;
-
-int CLuaInstance::setBlank(lua_State *L)
-{
- bool enable = true;
- int numargs = lua_gettop(L);
- if (numargs > 1)
- enable = _luaL_checkbool(L, 2);
- videoDecoder->setBlank(enable);
- return 0;
-}
-
-int CLuaInstance::ShowPicture(lua_State *L)
-{
- const char *fname = luaL_checkstring(L, 2);
- CFrameBuffer::getInstance()->showFrame(fname);
- return 0;
-}
-
-int CLuaInstance::StopPicture(lua_State */*L*/)
-{
- CFrameBuffer::getInstance()->stopFrame();
- return 0;
-}
-
-int CLuaInstance::PlayFile(lua_State *L)
-{
- printf("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
- int numargs = lua_gettop(L);
-
- if (numargs < 3) {
- printf("CLuaInstance::%s: not enough arguments (%d, expected 3)\n", __func__, numargs);
- return 0;
- }
- const char *title;
- const char *info1 = "";
- const char *info2 = "";
- const char *fname;
-
- title = luaL_checkstring(L, 2);
- fname = luaL_checkstring(L, 3);
- if (numargs > 3)
- info1 = luaL_checkstring(L, 4);
- if (numargs > 4)
- info2 = luaL_checkstring(L, 5);
- printf("CLuaInstance::%s: title %s file %s\n", __func__, title, fname);
- std::string st(title);
- std::string si1(info1);
- std::string si2(info2);
- std::string sf(fname);
- CMoviePlayerGui::getInstance().SetFile(st, sf, si1, si2);
- CMoviePlayerGui::getInstance().exec(NULL, "http_lua");
- int ret = CMoviePlayerGui::getInstance().getKeyPressed();
- lua_pushinteger(L, ret);
- return 1;
-}
-
int CLuaInstance::strFind(lua_State *L)
{
int numargs = lua_gettop(L);
diff --git a/src/gui/luainstance.h b/src/gui/lua/luainstance.h
similarity index 98%
rename from src/gui/luainstance.h
rename to src/gui/lua/luainstance.h
index 9d44e45b2..45135ebd4 100644
--- a/src/gui/luainstance.h
+++ b/src/gui/lua/luainstance.h
@@ -251,10 +251,6 @@ private:
static int runScriptExt(lua_State *L);
static int GetSize(lua_State *L);
static int DisplayImage(lua_State *L);
- static int setBlank(lua_State *L);
- static int ShowPicture(lua_State *L);
- static int StopPicture(lua_State *L);
- static int PlayFile(lua_State *L);
static int strFind(lua_State *L);
static int strSub(lua_State *L);
@@ -346,6 +342,9 @@ private:
static int createChannelIDfromUrl(lua_State *L);
static int enableInfoClock(lua_State *L);
static int getDynFont(lua_State *L);
+
+#include "lua_video.inc"
+
};
#endif /* _LUAINSTANCE_H */
diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp
index 55c4714f6..e6e3560e4 100644
--- a/src/gui/plugins.cpp
+++ b/src/gui/plugins.cpp
@@ -69,7 +69,7 @@ extern cVideo * videoDecoder;
#include "plugins.h"
#include
-#include
+#include
extern CPlugins * g_PluginList; /* neutrino.cpp */
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
diff --git a/src/system/luaserver.cpp b/src/system/luaserver.cpp
index 1c346ef78..f7e0626d9 100644
--- a/src/system/luaserver.cpp
+++ b/src/system/luaserver.cpp
@@ -50,7 +50,7 @@ chmod +x /lib/tuxbox/luaplugins/test.lua
#include
#include
#include
-#include
+#include
#include "luaserver.h"