diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 746b9d31c7..481614a99e 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 91 +#define LUA_API_VERSION_MINOR 92 diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index dfd2de27d6..bdf7414e86 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include "luainstance.h" #include "lua_video.h" @@ -70,6 +71,9 @@ void CLuaInstVideo::LuaVideoRegister(lua_State *L) { "getNeutrinoMode", CLuaInstVideo::getNeutrinoMode }, { "setSinglePlay", CLuaInstVideo::setSinglePlay }, { "__gc", CLuaInstVideo::VideoDelete }, +#ifdef SCREENSHOT + { "Screenshot", CLuaInstVideo::Screenshot }, +#endif { NULL, NULL } }; @@ -351,6 +355,36 @@ int CLuaInstVideo::VideoDelete(lua_State *L) return 0; } +#ifdef SCREENSHOT +int CLuaInstVideo::Screenshot(lua_State *L) +{ + CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; + + int numargs = lua_gettop(L); + if (numargs < 2) { + printf("CLuaInstVideo::%s: not enough arguments (%d, expected 1)\n", __func__, numargs-1); + return 0; + } + + bool enableOSD = true; + bool enableVideo = true; + std::string filename = "screenshot"; + tableLookup(L, "name", filename); + tableLookup(L, "osd", enableOSD); + tableLookup(L, "video", enableVideo); + CScreenShot * screenshot = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); + if(screenshot){ + screenshot->EnableOSD(enableOSD); + screenshot->EnableVideo(enableVideo); + if (!screenshot->StartSync()){ + printf("CLuaInstVideo::%s: Error\n", __func__); + } + delete screenshot; + } + return 0; +} +#endif /* -------------------------------------------------------------- deprecated functions diff --git a/src/gui/lua/lua_video.h b/src/gui/lua/lua_video.h index 4cfe08e038..55d94da12e 100644 --- a/src/gui/lua/lua_video.h +++ b/src/gui/lua/lua_video.h @@ -65,7 +65,9 @@ class CLuaInstVideo static int getNeutrinoMode(lua_State *L); static int setSinglePlay(lua_State *L); static int VideoDelete(lua_State *L); - +#ifdef SCREENSHOT + static int Screenshot(lua_State *L); +#endif static void videoFunctionDeprecated(lua_State *L, std::string oldFunc); };