mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 23:13:00 +02:00
CLuaInstance: Move luainstance into a separate directory (src/gui/lua)
- Move video functions from luainstance.cpp to lua_video.cpp
- For the future, provided the individual classes
(eg menu, CComponents etc.) to move in separate files.
Origin commit data
------------------
Branch: ni/coolstream
Commit: 464f929437
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-12-08 (Tue, 08 Dec 2015)
Origin message was:
------------------
CLuaInstance: Move luainstance into a separate directory (src/gui/lua)
- Move video functions from luainstance.cpp to lua_video.cpp
- For the future, provided the individual classes
(eg menu, CComponents etc.) to move in separate files.
------------------
This commit was generated by Migit
This commit is contained in:
@@ -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
|
||||
|
@@ -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 \
|
||||
|
@@ -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 \
|
||||
|
33
src/gui/lua/Makefile.am
Normal file
33
src/gui/lua/Makefile.am
Normal file
@@ -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
|
91
src/gui/lua/lua_video.cpp
Normal file
91
src/gui/lua/lua_video.cpp
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <global.h>
|
||||
#include <system/debug.h>
|
||||
#include <gui/movieplayer.h>
|
||||
#include <video.h>
|
||||
#include <neutrino.h>
|
||||
|
||||
#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;
|
||||
}
|
5
src/gui/lua/lua_video.inc
Normal file
5
src/gui/lua/lua_video.inc
Normal file
@@ -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);
|
@@ -36,10 +36,10 @@
|
||||
#include <gui/infoclock.h>
|
||||
#include <driver/neutrinofonts.h>
|
||||
#include <driver/pictureviewer/pictureviewer.h>
|
||||
#include <video.h>
|
||||
#include <neutrino.h>
|
||||
|
||||
#include "luainstance.h"
|
||||
#include <video.h>
|
||||
|
||||
/* 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);
|
@@ -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 */
|
@@ -69,7 +69,7 @@ extern cVideo * videoDecoder;
|
||||
#include "plugins.h"
|
||||
|
||||
#include <daemonc/remotecontrol.h>
|
||||
#include <gui/luainstance.h>
|
||||
#include <gui/lua/luainstance.h>
|
||||
|
||||
extern CPlugins * g_PluginList; /* neutrino.cpp */
|
||||
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
||||
|
@@ -50,7 +50,7 @@ chmod +x /lib/tuxbox/luaplugins/test.lua
|
||||
#include <system/helpers.h>
|
||||
#include <system/set_threadname.h>
|
||||
#include <luaclient/luaclient.h>
|
||||
#include <gui/luainstance.h>
|
||||
#include <gui/lua/luainstance.h>
|
||||
|
||||
#include "luaserver.h"
|
||||
|
||||
|
Reference in New Issue
Block a user