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(...)
This commit is contained in:
M. Liebmann
2015-12-14 22:33:30 +01:00
parent 473af7b2ea
commit ed26f2ea05
3 changed files with 23 additions and 3 deletions

View File

@@ -62,6 +62,7 @@ void CLuaInstVideo::LuaVideoRegister(lua_State *L)
{ "channelRezap", CLuaInstVideo::channelRezap }, { "channelRezap", CLuaInstVideo::channelRezap },
{ "createChannelIDfromUrl", CLuaInstVideo::createChannelIDfromUrl }, { "createChannelIDfromUrl", CLuaInstVideo::createChannelIDfromUrl },
{ "getNeutrinoMode", CLuaInstVideo::getNeutrinoMode }, { "getNeutrinoMode", CLuaInstVideo::getNeutrinoMode },
{ "setSinglePlay", CLuaInstVideo::setSinglePlay },
{ "__gc", CLuaInstVideo::VideoDelete }, { "__gc", CLuaInstVideo::VideoDelete },
{ NULL, NULL } { NULL, NULL }
}; };
@@ -115,7 +116,12 @@ int CLuaInstVideo::PlayFile(lua_State *L)
return 0; 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); CMoviePlayerGui::getInstance().setBlockedFromPlugin(true);
const char *title; const char *title;
@@ -193,6 +199,18 @@ int CLuaInstVideo::getNeutrinoMode(lua_State *L)
return 1; 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) int CLuaInstVideo::VideoDelete(lua_State *L)
{ {
CLuaVideo *D = VideoCheckData(L, 1); CLuaVideo *D = VideoCheckData(L, 1);

View File

@@ -23,7 +23,8 @@
class CLuaVideo class CLuaVideo
{ {
public: public:
CLuaVideo() {}; bool singlePlay;
CLuaVideo() { singlePlay=false; };
~CLuaVideo() {}; ~CLuaVideo() {};
}; };
@@ -55,6 +56,7 @@ class CLuaInstVideo
static int channelRezap(lua_State *L); static int channelRezap(lua_State *L);
static int createChannelIDfromUrl(lua_State *L); static int createChannelIDfromUrl(lua_State *L);
static int getNeutrinoMode(lua_State *L); static int getNeutrinoMode(lua_State *L);
static int setSinglePlay(lua_State *L);
static int VideoDelete(lua_State *L); static int VideoDelete(lua_State *L);
static void videoFunctionDeprecated(lua_State *L, std::string oldFunc); static void videoFunctionDeprecated(lua_State *L, std::string oldFunc);

View File

@@ -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 28 #define LUA_API_VERSION_MINOR 29
/* inspired by Steve Kemp http://www.steve.org.uk/ */ /* inspired by Steve Kemp http://www.steve.org.uk/ */
class CLuaInstance class CLuaInstance