From ed26f2ea05a5151bbfe92e1f84748abd9edef5ce Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 14 Dec 2015 22:33:30 +0100 Subject: [PATCH] CLuaInstVideo: Add setSinglePlay() - When setSinglePlay() Neutrino returns after playing a movie immediately in the tv/radio modus back - Set Lua api version to 1.29 Example: video = video.new() video.setSinglePlay() video.PlayFile(...) --- src/gui/lua/lua_video.cpp | 20 +++++++++++++++++++- src/gui/lua/lua_video.h | 4 +++- src/gui/lua/luainstance.h | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index 3515f01bd..5dc90e6b4 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -62,6 +62,7 @@ void CLuaInstVideo::LuaVideoRegister(lua_State *L) { "channelRezap", CLuaInstVideo::channelRezap }, { "createChannelIDfromUrl", CLuaInstVideo::createChannelIDfromUrl }, { "getNeutrinoMode", CLuaInstVideo::getNeutrinoMode }, + { "setSinglePlay", CLuaInstVideo::setSinglePlay }, { "__gc", CLuaInstVideo::VideoDelete }, { NULL, NULL } }; @@ -115,7 +116,12 @@ int CLuaInstVideo::PlayFile(lua_State *L) return 0; } - if (CMoviePlayerGui::getInstance().getBlockedFromPlugin() == false) + bool sp = false; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + CLuaVideo *D = VideoCheckData(L, 1); + sp = D->singlePlay; + } + if ((sp == false) && (CMoviePlayerGui::getInstance().getBlockedFromPlugin() == false)) CMoviePlayerGui::getInstance().setBlockedFromPlugin(true); const char *title; @@ -193,6 +199,18 @@ int CLuaInstVideo::getNeutrinoMode(lua_State *L) return 1; } +int CLuaInstVideo::setSinglePlay(lua_State *L) +{ + bool mode = true; + int numargs = lua_gettop(L); + if (numargs > 1) + mode = _luaL_checkbool(L, 2); + + CLuaVideo *D = VideoCheckData(L, 1); + D->singlePlay = mode; + return 0; +} + 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 31df59778..f4ae6a216 100644 --- a/src/gui/lua/lua_video.h +++ b/src/gui/lua/lua_video.h @@ -23,7 +23,8 @@ class CLuaVideo { public: - CLuaVideo() {}; + bool singlePlay; + CLuaVideo() { singlePlay=false; }; ~CLuaVideo() {}; }; @@ -55,6 +56,7 @@ class CLuaInstVideo static int channelRezap(lua_State *L); static int createChannelIDfromUrl(lua_State *L); static int getNeutrinoMode(lua_State *L); + static int setSinglePlay(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.h b/src/gui/lua/luainstance.h index 1dd126c66..2d21eb0c6 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 28 +#define LUA_API_VERSION_MINOR 29 /* inspired by Steve Kemp http://www.steve.org.uk/ */ class CLuaInstance