mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
CLuaInstance: Use CLuaVideo for video, CLuaMisc for misc functions
- The old version of the video and misc functions is deprecated but still valid
This commit is contained in:
@@ -42,16 +42,42 @@ CLuaInstMisc* CLuaInstMisc::getInstance()
|
|||||||
return LuaInstMisc;
|
return LuaInstMisc;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLuaData *CLuaInstMisc::CheckData(lua_State *L, int narg)
|
CLuaMisc *CLuaInstMisc::MiscCheckData(lua_State *L, int n)
|
||||||
{
|
{
|
||||||
luaL_checktype(L, narg, LUA_TUSERDATA);
|
return *(CLuaMisc **) luaL_checkudata(L, n, LUA_MISC_CLASSNAME);
|
||||||
void *ud = luaL_checkudata(L, narg, LUA_CLASSNAME);
|
|
||||||
if (!ud)
|
|
||||||
fprintf(stderr, "[CLuaInstMisc::%s] wrong type %p, %d, %s\n", __func__, L, narg, LUA_CLASSNAME);
|
|
||||||
return *(CLuaData **)ud; // unbox pointer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::strFind_old(lua_State *L)
|
void CLuaInstMisc::LuaMiscRegister(lua_State *L)
|
||||||
|
{
|
||||||
|
luaL_Reg meth[] = {
|
||||||
|
{ "new", CLuaInstMisc::MiscNew },
|
||||||
|
{ "strFind", CLuaInstMisc::strFind },
|
||||||
|
{ "strSub", CLuaInstMisc::strSub },
|
||||||
|
{ "enableInfoClock", CLuaInstMisc::enableInfoClock },
|
||||||
|
{ "runScript", CLuaInstMisc::runScriptExt },
|
||||||
|
{ "GetRevision", CLuaInstMisc::GetRevision },
|
||||||
|
{ "checkVersion", CLuaInstMisc::checkVersion },
|
||||||
|
{ "__gc", CLuaInstMisc::MiscDelete },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
luaL_newmetatable(L, LUA_MISC_CLASSNAME);
|
||||||
|
luaL_setfuncs(L, meth, 0);
|
||||||
|
lua_pushvalue(L, -1);
|
||||||
|
lua_setfield(L, -1, "__index");
|
||||||
|
lua_setglobal(L, LUA_MISC_CLASSNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::MiscNew(lua_State *L)
|
||||||
|
{
|
||||||
|
CLuaMisc **udata = (CLuaMisc **) lua_newuserdata(L, sizeof(CLuaMisc *));
|
||||||
|
*udata = new CLuaMisc();
|
||||||
|
luaL_getmetatable(L, LUA_MISC_CLASSNAME);
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::strFind(lua_State *L)
|
||||||
{
|
{
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
if (numargs < 3) {
|
if (numargs < 3) {
|
||||||
@@ -75,7 +101,7 @@ int CLuaInstMisc::strFind_old(lua_State *L)
|
|||||||
else
|
else
|
||||||
ret = str.find(s2, pos);
|
ret = str.find(s2, pos);
|
||||||
|
|
||||||
// printf("####[%s:%d] str_len: %d, s2: %s, pos: %d, n: %d, ret: %d\n", __func__, __LINE__, str.length(), s2, pos, n, ret);
|
LUA_DEBUG("####[%s:%d] str_len: %d, s2: %s, pos: %d, n: %d, ret: %d\n", __func__, __LINE__, str.length(), s2, pos, n, ret);
|
||||||
if (ret == (int)std::string::npos)
|
if (ret == (int)std::string::npos)
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
else
|
else
|
||||||
@@ -83,7 +109,7 @@ int CLuaInstMisc::strFind_old(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::strSub_old(lua_State *L)
|
int CLuaInstMisc::strSub(lua_State *L)
|
||||||
{
|
{
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
if (numargs < 3) {
|
if (numargs < 3) {
|
||||||
@@ -102,35 +128,12 @@ int CLuaInstMisc::strSub_old(lua_State *L)
|
|||||||
std::string str(s1);
|
std::string str(s1);
|
||||||
ret = str.substr(pos, len);
|
ret = str.substr(pos, len);
|
||||||
|
|
||||||
// printf("####[%s:%d] str_len: %d, pos: %d, len: %d, ret_len: %d\n", __func__, __LINE__, str.length(), pos, len, ret.length());
|
LUA_DEBUG("####[%s:%d] str_len: %d, pos: %d, len: %d, ret_len: %d\n", __func__, __LINE__, str.length(), pos, len, ret.length());
|
||||||
lua_pushstring(L, ret.c_str());
|
lua_pushstring(L, ret.c_str());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::createChannelIDfromUrl_old(lua_State *L)
|
int CLuaInstMisc::enableInfoClock(lua_State *L)
|
||||||
{
|
|
||||||
int numargs = lua_gettop(L);
|
|
||||||
if (numargs < 2) {
|
|
||||||
printf("CLuaInstMisc::%s: no arguments\n", __func__);
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *url = luaL_checkstring(L, 2);
|
|
||||||
if (strlen(url) < 1 ) {
|
|
||||||
lua_pushnil(L);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
t_channel_id id = CREATE_CHANNEL_ID(0, 0, 0, url);
|
|
||||||
char id_str[17];
|
|
||||||
snprintf(id_str, sizeof(id_str), "%" PRIx64, id);
|
|
||||||
|
|
||||||
lua_pushstring(L, id_str);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CLuaInstMisc::enableInfoClock_old(lua_State *L)
|
|
||||||
{
|
{
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
@@ -140,11 +143,8 @@ int CLuaInstMisc::enableInfoClock_old(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::runScriptExt_old(lua_State *L)
|
int CLuaInstMisc::runScriptExt(lua_State *L)
|
||||||
{
|
{
|
||||||
CLuaData *W = CheckData(L, 1);
|
|
||||||
if (!W) return 0;
|
|
||||||
|
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
const char *script = luaL_checkstring(L, 2);
|
const char *script = luaL_checkstring(L, 2);
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
@@ -161,7 +161,7 @@ int CLuaInstMisc::runScriptExt_old(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::GetRevision_old(lua_State *L)
|
int CLuaInstMisc::GetRevision(lua_State *L)
|
||||||
{
|
{
|
||||||
unsigned int rev = 0;
|
unsigned int rev = 0;
|
||||||
std::string hw = "";
|
std::string hw = "";
|
||||||
@@ -174,7 +174,7 @@ int CLuaInstMisc::GetRevision_old(lua_State *L)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstMisc::checkVersion_old(lua_State *L)
|
int CLuaInstMisc::checkVersion(lua_State *L)
|
||||||
{
|
{
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
if (numargs < 3) {
|
if (numargs < 3) {
|
||||||
@@ -197,3 +197,61 @@ int CLuaInstMisc::checkVersion_old(lua_State *L)
|
|||||||
lua_pushinteger(L, 1); /* for backward compatibility */
|
lua_pushinteger(L, 1); /* for backward compatibility */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::MiscDelete(lua_State *L)
|
||||||
|
{
|
||||||
|
CLuaMisc *D = MiscCheckData(L, 1);
|
||||||
|
delete D;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------
|
||||||
|
deprecated functions
|
||||||
|
--------------------------------------------------------------- */
|
||||||
|
|
||||||
|
//#define MISC_FUNC_DEPRECATED miscFunctionDeprecated
|
||||||
|
#define MISC_FUNC_DEPRECATED(...)
|
||||||
|
|
||||||
|
void CLuaInstMisc::miscFunctionDeprecated(lua_State *L, std::string oldFunc)
|
||||||
|
{
|
||||||
|
std::string of = std::string("n:") + oldFunc + "()";
|
||||||
|
std::string nf = std::string("M = misc.new(); M:") + oldFunc + "()";
|
||||||
|
functionDeprecated(L, of.c_str(), nf.c_str());
|
||||||
|
printf(" [see also] \33[33m%s\33[0m\n", LUA_WIKI "/Kategorie:Lua:Neutrino-API:SonstigeFunktionen:de");
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::strFind_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "strFind");
|
||||||
|
return strFind(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::strSub_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "strSub");
|
||||||
|
return strSub(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::enableInfoClock_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "enableInfoClock");
|
||||||
|
return enableInfoClock(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::runScriptExt_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "runScript");
|
||||||
|
return runScriptExt(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::GetRevision_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "GetRevision");
|
||||||
|
return GetRevision(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstMisc::checkVersion_old(lua_State *L)
|
||||||
|
{
|
||||||
|
MISC_FUNC_DEPRECATED(L, "checkVersion");
|
||||||
|
return checkVersion(L);
|
||||||
|
}
|
||||||
|
@@ -21,34 +21,41 @@
|
|||||||
#ifndef _LUAMISCFUNCS_H
|
#ifndef _LUAMISCFUNCS_H
|
||||||
#define _LUAMISCFUNCS_H
|
#define _LUAMISCFUNCS_H
|
||||||
|
|
||||||
/*
|
|
||||||
class CLuaMisc
|
class CLuaMisc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLuaMisc() {};
|
CLuaMisc() {};
|
||||||
~CLuaMisc() {};
|
~CLuaMisc() {};
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
class CLuaInstMisc
|
class CLuaInstMisc
|
||||||
{
|
{
|
||||||
static CLuaData *CheckData(lua_State *L, int narg);
|
|
||||||
public:
|
public:
|
||||||
CLuaInstMisc() {};
|
CLuaInstMisc() {};
|
||||||
~CLuaInstMisc() {};
|
~CLuaInstMisc() {};
|
||||||
static CLuaInstMisc* getInstance();
|
static CLuaInstMisc* getInstance();
|
||||||
// static void MiscRegister(lua_State *L);
|
static void LuaMiscRegister(lua_State *L);
|
||||||
|
|
||||||
|
/* deprecated functions */
|
||||||
static int strFind_old(lua_State *L);
|
static int strFind_old(lua_State *L);
|
||||||
static int strSub_old(lua_State *L);
|
static int strSub_old(lua_State *L);
|
||||||
static int createChannelIDfromUrl_old(lua_State *L);
|
|
||||||
static int enableInfoClock_old(lua_State *L);
|
static int enableInfoClock_old(lua_State *L);
|
||||||
static int runScriptExt_old(lua_State *L);
|
static int runScriptExt_old(lua_State *L);
|
||||||
static int GetRevision_old(lua_State *L);
|
static int GetRevision_old(lua_State *L);
|
||||||
static int checkVersion_old(lua_State *L);
|
static int checkVersion_old(lua_State *L);
|
||||||
|
|
||||||
// private:
|
private:
|
||||||
// static CLuaMisc *MiscCheck(lua_State *L, int n);
|
static CLuaMisc *MiscCheckData(lua_State *L, int n);
|
||||||
|
static int MiscNew(lua_State *L);
|
||||||
|
static int strFind(lua_State *L);
|
||||||
|
static int strSub(lua_State *L);
|
||||||
|
static int enableInfoClock(lua_State *L);
|
||||||
|
static int runScriptExt(lua_State *L);
|
||||||
|
static int GetRevision(lua_State *L);
|
||||||
|
static int checkVersion(lua_State *L);
|
||||||
|
static int MiscDelete(lua_State *L);
|
||||||
|
|
||||||
|
static void miscFunctionDeprecated(lua_State *L, std::string oldFunc);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_LUAMISCFUNCS_H
|
#endif //_LUAMISCFUNCS_H
|
||||||
|
@@ -45,16 +45,43 @@ CLuaInstVideo* CLuaInstVideo::getInstance()
|
|||||||
return LuaInstVideo;
|
return LuaInstVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLuaData *CLuaInstVideo::CheckData(lua_State *L, int narg)
|
CLuaVideo *CLuaInstVideo::VideoCheckData(lua_State *L, int n)
|
||||||
{
|
{
|
||||||
luaL_checktype(L, narg, LUA_TUSERDATA);
|
return *(CLuaVideo **) luaL_checkudata(L, n, LUA_VIDEO_CLASSNAME);
|
||||||
void *ud = luaL_checkudata(L, narg, LUA_CLASSNAME);
|
|
||||||
if (!ud)
|
|
||||||
fprintf(stderr, "[CLuaInstVideo::%s] wrong type %p, %d, %s\n", __func__, L, narg, LUA_CLASSNAME);
|
|
||||||
return *(CLuaData **)ud; // unbox pointer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::setBlank_old(lua_State *L)
|
void CLuaInstVideo::LuaVideoRegister(lua_State *L)
|
||||||
|
{
|
||||||
|
luaL_Reg meth[] = {
|
||||||
|
{ "new", CLuaInstVideo::VideoNew },
|
||||||
|
{ "setBlank", CLuaInstVideo::setBlank },
|
||||||
|
{ "ShowPicture", CLuaInstVideo::ShowPicture },
|
||||||
|
{ "StopPicture", CLuaInstVideo::StopPicture },
|
||||||
|
{ "PlayFile", CLuaInstVideo::PlayFile },
|
||||||
|
{ "zapitStopPlayBack", CLuaInstVideo::zapitStopPlayBack },
|
||||||
|
{ "channelRezap", CLuaInstVideo::channelRezap },
|
||||||
|
{ "createChannelIDfromUrl", CLuaInstVideo::createChannelIDfromUrl },
|
||||||
|
{ "__gc", CLuaInstVideo::VideoDelete },
|
||||||
|
{ NULL, NULL }
|
||||||
|
};
|
||||||
|
|
||||||
|
luaL_newmetatable(L, LUA_VIDEO_CLASSNAME);
|
||||||
|
luaL_setfuncs(L, meth, 0);
|
||||||
|
lua_pushvalue(L, -1);
|
||||||
|
lua_setfield(L, -1, "__index");
|
||||||
|
lua_setglobal(L, LUA_VIDEO_CLASSNAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::VideoNew(lua_State *L)
|
||||||
|
{
|
||||||
|
CLuaVideo **udata = (CLuaVideo **) lua_newuserdata(L, sizeof(CLuaVideo *));
|
||||||
|
*udata = new CLuaVideo();
|
||||||
|
luaL_getmetatable(L, LUA_VIDEO_CLASSNAME);
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::setBlank(lua_State *L)
|
||||||
{
|
{
|
||||||
bool enable = true;
|
bool enable = true;
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
@@ -64,22 +91,22 @@ int CLuaInstVideo::setBlank_old(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::ShowPicture_old(lua_State *L)
|
int CLuaInstVideo::ShowPicture(lua_State *L)
|
||||||
{
|
{
|
||||||
const char *fname = luaL_checkstring(L, 2);
|
const char *fname = luaL_checkstring(L, 2);
|
||||||
CFrameBuffer::getInstance()->showFrame(fname);
|
CFrameBuffer::getInstance()->showFrame(fname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::StopPicture_old(lua_State */*L*/)
|
int CLuaInstVideo::StopPicture(lua_State */*L*/)
|
||||||
{
|
{
|
||||||
CFrameBuffer::getInstance()->stopFrame();
|
CFrameBuffer::getInstance()->stopFrame();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::PlayFile_old(lua_State *L)
|
int CLuaInstVideo::PlayFile(lua_State *L)
|
||||||
{
|
{
|
||||||
printf("CLuaInstVideo::%s %d\n", __func__, lua_gettop(L));
|
LUA_DEBUG("CLuaInstVideo::%s %d\n", __func__, lua_gettop(L));
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
|
|
||||||
if (numargs < 3) {
|
if (numargs < 3) {
|
||||||
@@ -87,13 +114,8 @@ int CLuaInstVideo::PlayFile_old(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLuaData *W = CheckData(L, 1);
|
if (CMoviePlayerGui::getInstance().getBlockedFromPlugin() == false)
|
||||||
if (!W)
|
|
||||||
return 0;
|
|
||||||
if (W->moviePlayerBlocked == false) {
|
|
||||||
CMoviePlayerGui::getInstance().setBlockedFromPlugin(true);
|
CMoviePlayerGui::getInstance().setBlockedFromPlugin(true);
|
||||||
W->moviePlayerBlocked = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *title;
|
const char *title;
|
||||||
const char *info1 = "";
|
const char *info1 = "";
|
||||||
@@ -118,7 +140,7 @@ int CLuaInstVideo::PlayFile_old(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::zapitStopPlayBack_old(lua_State *L)
|
int CLuaInstVideo::zapitStopPlayBack(lua_State *L)
|
||||||
{
|
{
|
||||||
bool stop = true;
|
bool stop = true;
|
||||||
int numargs = lua_gettop(L);
|
int numargs = lua_gettop(L);
|
||||||
@@ -133,10 +155,100 @@ int CLuaInstVideo::zapitStopPlayBack_old(lua_State *L)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CLuaInstVideo::channelRezap_old(lua_State */*L*/)
|
int CLuaInstVideo::channelRezap(lua_State */*L*/)
|
||||||
{
|
{
|
||||||
CNeutrinoApp::getInstance()->channelRezap();
|
CNeutrinoApp::getInstance()->channelRezap();
|
||||||
if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio)
|
if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio)
|
||||||
CFrameBuffer::getInstance()->showFrame("radiomode.jpg");
|
CFrameBuffer::getInstance()->showFrame("radiomode.jpg");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::createChannelIDfromUrl(lua_State *L)
|
||||||
|
{
|
||||||
|
int numargs = lua_gettop(L);
|
||||||
|
if (numargs < 2) {
|
||||||
|
printf("CLuaInstVideo::%s: no arguments\n", __func__);
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *url = luaL_checkstring(L, 2);
|
||||||
|
if (strlen(url) < 1 ) {
|
||||||
|
lua_pushnil(L);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
t_channel_id id = CREATE_CHANNEL_ID(0, 0, 0, url);
|
||||||
|
char id_str[17];
|
||||||
|
snprintf(id_str, sizeof(id_str), "%" PRIx64, id);
|
||||||
|
|
||||||
|
lua_pushstring(L, id_str);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::VideoDelete(lua_State *L)
|
||||||
|
{
|
||||||
|
CLuaVideo *D = VideoCheckData(L, 1);
|
||||||
|
delete D;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------
|
||||||
|
deprecated functions
|
||||||
|
--------------------------------------------------------------- */
|
||||||
|
|
||||||
|
//#define VIDEO_FUNC_DEPRECATED videoFunctionDeprecated
|
||||||
|
#define VIDEO_FUNC_DEPRECATED(...)
|
||||||
|
|
||||||
|
void CLuaInstVideo::videoFunctionDeprecated(lua_State *L, std::string oldFunc)
|
||||||
|
{
|
||||||
|
std::string of = std::string("n:") + oldFunc + "()";
|
||||||
|
std::string nf = std::string("video = video.new(); video:") + oldFunc + "()";
|
||||||
|
functionDeprecated(L, of.c_str(), nf.c_str());
|
||||||
|
printf(" [see also] \33[33m%s\33[0m\n", LUA_WIKI "/Kategorie:Lua:Neutrino-API:Videofunktionen:de");
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::setBlank_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "setBlank");
|
||||||
|
return setBlank(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::ShowPicture_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "ShowPicture");
|
||||||
|
return ShowPicture(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::StopPicture_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "StopPicture");
|
||||||
|
return StopPicture(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::PlayFile_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "PlayFile");
|
||||||
|
return PlayFile(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::zapitStopPlayBack_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "zapitStopPlayBack");
|
||||||
|
return zapitStopPlayBack(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::channelRezap_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "channelRezap");
|
||||||
|
return channelRezap(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CLuaInstVideo::createChannelIDfromUrl_old(lua_State *L)
|
||||||
|
{
|
||||||
|
VIDEO_FUNC_DEPRECATED(L, "createChannelIDfromUrl");
|
||||||
|
return createChannelIDfromUrl(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------- */
|
||||||
|
@@ -20,32 +20,43 @@
|
|||||||
#ifndef _LUAVIDEO_H
|
#ifndef _LUAVIDEO_H
|
||||||
#define _LUAVIDEO_H
|
#define _LUAVIDEO_H
|
||||||
|
|
||||||
/*
|
|
||||||
class CLuaVideo
|
class CLuaVideo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CLuaVideo() {};
|
CLuaVideo() {};
|
||||||
~CLuaVideo() {};
|
~CLuaVideo() {};
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
class CLuaInstVideo
|
class CLuaInstVideo
|
||||||
{
|
{
|
||||||
static CLuaData *CheckData(lua_State *L, int narg);
|
|
||||||
public:
|
public:
|
||||||
CLuaInstVideo() {};
|
CLuaInstVideo() {};
|
||||||
~CLuaInstVideo() {};
|
~CLuaInstVideo() {};
|
||||||
static CLuaInstVideo* getInstance();
|
static CLuaInstVideo* getInstance();
|
||||||
// static void LuaVideoRegister(lua_State *L);
|
static void LuaVideoRegister(lua_State *L);
|
||||||
|
|
||||||
|
/* deprecated functions */
|
||||||
static int setBlank_old(lua_State *L);
|
static int setBlank_old(lua_State *L);
|
||||||
static int ShowPicture_old(lua_State *L);
|
static int ShowPicture_old(lua_State *L);
|
||||||
static int StopPicture_old(lua_State *L);
|
static int StopPicture_old(lua_State *L);
|
||||||
static int PlayFile_old(lua_State *L);
|
static int PlayFile_old(lua_State *L);
|
||||||
static int zapitStopPlayBack_old(lua_State *L);
|
static int zapitStopPlayBack_old(lua_State *L);
|
||||||
static int channelRezap_old(lua_State *L);
|
static int channelRezap_old(lua_State *L);
|
||||||
|
static int createChannelIDfromUrl_old(lua_State *L);
|
||||||
|
|
||||||
// private:
|
private:
|
||||||
|
static CLuaVideo *VideoCheckData(lua_State *L, int n);
|
||||||
|
static int VideoNew(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 zapitStopPlayBack(lua_State *L);
|
||||||
|
static int channelRezap(lua_State *L);
|
||||||
|
static int createChannelIDfromUrl(lua_State *L);
|
||||||
|
static int VideoDelete(lua_State *L);
|
||||||
|
|
||||||
|
static void videoFunctionDeprecated(lua_State *L, std::string oldFunc);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_LUAVIDEO_H
|
#endif //_LUAVIDEO_H
|
||||||
|
@@ -495,7 +495,6 @@ const luaL_Reg CLuaInstance::methods[] =
|
|||||||
*/
|
*/
|
||||||
{ "strFind", CLuaInstMisc::getInstance()->strFind_old },
|
{ "strFind", CLuaInstMisc::getInstance()->strFind_old },
|
||||||
{ "strSub", CLuaInstMisc::getInstance()->strSub_old },
|
{ "strSub", CLuaInstMisc::getInstance()->strSub_old },
|
||||||
{ "createChannelIDfromUrl", CLuaInstMisc::getInstance()->createChannelIDfromUrl_old },
|
|
||||||
{ "enableInfoClock", CLuaInstMisc::getInstance()->enableInfoClock_old },
|
{ "enableInfoClock", CLuaInstMisc::getInstance()->enableInfoClock_old },
|
||||||
{ "runScript", CLuaInstMisc::getInstance()->runScriptExt_old },
|
{ "runScript", CLuaInstMisc::getInstance()->runScriptExt_old },
|
||||||
{ "GetRevision", CLuaInstMisc::getInstance()->GetRevision_old },
|
{ "GetRevision", CLuaInstMisc::getInstance()->GetRevision_old },
|
||||||
@@ -511,6 +510,7 @@ const luaL_Reg CLuaInstance::methods[] =
|
|||||||
{ "PlayFile", CLuaInstVideo::getInstance()->PlayFile_old },
|
{ "PlayFile", CLuaInstVideo::getInstance()->PlayFile_old },
|
||||||
{ "zapitStopPlayBack", CLuaInstVideo::getInstance()->zapitStopPlayBack_old },
|
{ "zapitStopPlayBack", CLuaInstVideo::getInstance()->zapitStopPlayBack_old },
|
||||||
{ "channelRezap", CLuaInstVideo::getInstance()->channelRezap_old },
|
{ "channelRezap", CLuaInstVideo::getInstance()->channelRezap_old },
|
||||||
|
{ "createChannelIDfromUrl", CLuaInstVideo::getInstance()->createChannelIDfromUrl_old },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -559,6 +559,8 @@ void CLuaInstance::registerFunctions()
|
|||||||
CLuaInstHintbox::getInstance()->HintboxRegister(lua);
|
CLuaInstHintbox::getInstance()->HintboxRegister(lua);
|
||||||
CLuaInstMenu::getInstance()->MenuRegister(lua);
|
CLuaInstMenu::getInstance()->MenuRegister(lua);
|
||||||
CLuaInstMessagebox::getInstance()->MessageboxRegister(lua);
|
CLuaInstMessagebox::getInstance()->MessageboxRegister(lua);
|
||||||
|
CLuaInstMisc::getInstance()->LuaMiscRegister(lua);
|
||||||
|
CLuaInstVideo::getInstance()->LuaVideoRegister(lua);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLuaData *CLuaInstance::CheckData(lua_State *L, int narg)
|
CLuaData *CLuaInstance::CheckData(lua_State *L, int narg)
|
||||||
@@ -589,7 +591,6 @@ int CLuaInstance::NewWindow(lua_State *L)
|
|||||||
CFBWindow *W = new CFBWindow(x, y, w, h);
|
CFBWindow *W = new CFBWindow(x, y, w, h);
|
||||||
D->fbwin = W;
|
D->fbwin = W;
|
||||||
D->rcinput = g_RCInput;
|
D->rcinput = g_RCInput;
|
||||||
D->moviePlayerBlocked = false;
|
|
||||||
lua_boxpointer(L, D);
|
lua_boxpointer(L, D);
|
||||||
luaL_getmetatable(L, className);
|
luaL_getmetatable(L, className);
|
||||||
lua_setmetatable(L, -2);
|
lua_setmetatable(L, -2);
|
||||||
@@ -613,14 +614,13 @@ int CLuaInstance::GCWindow(lua_State *L)
|
|||||||
CNeutrinoFonts::getInstance()->deleteDynFontExtAll();
|
CNeutrinoFonts::getInstance()->deleteDynFontExtAll();
|
||||||
|
|
||||||
/* restoreNeutrino at plugin closing, when blocked from plugin */
|
/* restoreNeutrino at plugin closing, when blocked from plugin */
|
||||||
if (w->moviePlayerBlocked &&
|
LUA_DEBUG(">>>>[%s:%d] (restoreNeutrino()) BlockedFromPlugin: %d, Playing: %d\n", __func__, __LINE__,
|
||||||
CMoviePlayerGui::getInstance().getBlockedFromPlugin() &&
|
CMoviePlayerGui::getInstance().getBlockedFromPlugin, CMoviePlayerGui::getInstance().Playing());
|
||||||
|
if (CMoviePlayerGui::getInstance().getBlockedFromPlugin() &&
|
||||||
CMoviePlayerGui::getInstance().Playing()) {
|
CMoviePlayerGui::getInstance().Playing()) {
|
||||||
// printf(">>>>[%s:%d] (restoreNeutrino()) moviePlayerBlocked: %d\n", __func__, __LINE__, w->moviePlayerBlocked);
|
CMoviePlayerGui::getInstance().setBlockedFromPlugin(false);
|
||||||
CMoviePlayerGui::getInstance().setBlockedFromPlugin(false);
|
CMoviePlayerGui::getInstance().restoreNeutrino();
|
||||||
w->moviePlayerBlocked = false;
|
}
|
||||||
CMoviePlayerGui::getInstance().restoreNeutrino();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete w->fbwin;
|
delete w->fbwin;
|
||||||
w->rcinput = NULL;
|
w->rcinput = NULL;
|
||||||
|
@@ -31,7 +31,7 @@ extern "C" {
|
|||||||
#include "luainstance_helpers.h"
|
#include "luainstance_helpers.h"
|
||||||
|
|
||||||
#define LUA_API_VERSION_MAJOR 1
|
#define LUA_API_VERSION_MAJOR 1
|
||||||
#define LUA_API_VERSION_MINOR 22
|
#define LUA_API_VERSION_MINOR 23
|
||||||
|
|
||||||
/* inspired by Steve Kemp http://www.steve.org.uk/ */
|
/* inspired by Steve Kemp http://www.steve.org.uk/ */
|
||||||
class CLuaInstance
|
class CLuaInstance
|
||||||
|
@@ -25,7 +25,12 @@
|
|||||||
//#define LUA_DEBUG printf
|
//#define LUA_DEBUG printf
|
||||||
#define LUA_DEBUG(...)
|
#define LUA_DEBUG(...)
|
||||||
|
|
||||||
#define LUA_CLASSNAME "neutrino"
|
#define LUA_CLASSNAME "neutrino"
|
||||||
|
#define LUA_VIDEO_CLASSNAME "video"
|
||||||
|
#define LUA_MISC_CLASSNAME "misc"
|
||||||
|
|
||||||
|
//#define LUA_WIKI "http://wiki.tuxbox.org/....."
|
||||||
|
#define LUA_WIKI "https://slknet.de/wiki/w"
|
||||||
|
|
||||||
/* the magic color that tells us we are using one of the palette colors */
|
/* the magic color that tells us we are using one of the palette colors */
|
||||||
#define MAGIC_COLOR 0x42424200
|
#define MAGIC_COLOR 0x42424200
|
||||||
@@ -72,7 +77,6 @@ struct CLuaData
|
|||||||
CRCInput *rcinput;
|
CRCInput *rcinput;
|
||||||
fontmap_t fontmap;
|
fontmap_t fontmap;
|
||||||
screenmap_t screenmap;
|
screenmap_t screenmap;
|
||||||
bool moviePlayerBlocked;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool _luaL_checkbool(lua_State *L, int numArg);
|
bool _luaL_checkbool(lua_State *L, int numArg);
|
||||||
|
Reference in New Issue
Block a user