From 473af7b2eab2f1261e37e47d5c14af4e3b02dc61 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 14 Dec 2015 22:33:19 +0100 Subject: [PATCH] CLuaInstVideo: Add getNeutrinoMode() - Set Lua api version to 1.28 Example: video = video.new() if video.getNeutrinoMode() == NMODE.TS then messagebox.exec{title="Attention!", text="Movie player is busy.", buttons={ "ok" } } end --- src/gui/lua/lua_video.cpp | 7 +++++++ src/gui/lua/lua_video.h | 1 + src/gui/lua/luainstance.cpp | 19 ++++++++++++++++++- src/gui/lua/luainstance.h | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index c1f7207b4..3515f01bd 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -61,6 +61,7 @@ void CLuaInstVideo::LuaVideoRegister(lua_State *L) { "zapitStopPlayBack", CLuaInstVideo::zapitStopPlayBack }, { "channelRezap", CLuaInstVideo::channelRezap }, { "createChannelIDfromUrl", CLuaInstVideo::createChannelIDfromUrl }, + { "getNeutrinoMode", CLuaInstVideo::getNeutrinoMode }, { "__gc", CLuaInstVideo::VideoDelete }, { NULL, NULL } }; @@ -186,6 +187,12 @@ int CLuaInstVideo::createChannelIDfromUrl(lua_State *L) return 1; } +int CLuaInstVideo::getNeutrinoMode(lua_State *L) +{ + lua_pushinteger(L, (lua_Integer)CNeutrinoApp::getInstance()->getMode()); + return 1; +} + int CLuaInstVideo::VideoDelete(lua_State *L) { CLuaVideo *D = VideoCheckData(L, 1); diff --git a/src/gui/lua/lua_video.h b/src/gui/lua/lua_video.h index 39edbe122..31df59778 100644 --- a/src/gui/lua/lua_video.h +++ b/src/gui/lua/lua_video.h @@ -54,6 +54,7 @@ class CLuaInstVideo static int zapitStopPlayBack(lua_State *L); static int channelRezap(lua_State *L); static int createChannelIDfromUrl(lua_State *L); + static int getNeutrinoMode(lua_State *L); static int VideoDelete(lua_State *L); static void videoFunctionDeprecated(lua_State *L, std::string oldFunc); diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index bfba9584f..d3de36800 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -307,7 +307,6 @@ static void set_lua_variables(lua_State *L) { NULL, 0 } }; - table_key curl_status[] = { { "OK", (lua_Integer)CLuaInstCurl::LUA_CURL_OK }, @@ -318,6 +317,23 @@ static void set_lua_variables(lua_State *L) { NULL, 0 } }; + table_key neutrino_mode[] = + { + { "UNKNOWN", (lua_Integer)CNeutrinoApp::mode_unknown }, + { "TV", (lua_Integer)CNeutrinoApp::mode_tv }, + { "RADIO", (lua_Integer)CNeutrinoApp::mode_radio }, + { "SCART", (lua_Integer)CNeutrinoApp::mode_scart }, + { "STANDBY", (lua_Integer)CNeutrinoApp::mode_standby }, + { "AUDIO", (lua_Integer)CNeutrinoApp::mode_audio }, + { "PIC", (lua_Integer)CNeutrinoApp::mode_pic }, + { "TS", (lua_Integer)CNeutrinoApp::mode_ts }, + { "OFF", (lua_Integer)CNeutrinoApp::mode_off }, + { "WEBTV", (lua_Integer)CNeutrinoApp::mode_webtv }, + { "MASK", (lua_Integer)CNeutrinoApp::mode_mask }, + { "NOREZAP", (lua_Integer)CNeutrinoApp::norezap }, + { NULL, 0 } + }; + /* list of environment variable arrays to be exported */ lua_envexport e[] = { @@ -331,6 +347,7 @@ static void set_lua_variables(lua_State *L) { "CC", ccomponents }, { "DYNFONT", dynfont }, { "CURL", curl_status }, + { "NMODE", neutrino_mode }, { NULL, NULL } }; diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index e2bf16a8d..1dd126c66 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -31,7 +31,7 @@ extern "C" { #include "luainstance_helpers.h" #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 27 +#define LUA_API_VERSION_MINOR 28 /* inspired by Steve Kemp http://www.steve.org.uk/ */ class CLuaInstance