mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
CLuaInstance: Move video functions in separate class
- No api changes, code only
This commit is contained in:
@@ -32,10 +32,29 @@
|
||||
#include <neutrino.h>
|
||||
|
||||
#include "luainstance.h"
|
||||
#include "lua_video.h"
|
||||
|
||||
extern cVideo * videoDecoder;
|
||||
|
||||
int CLuaInstance::setBlank(lua_State *L)
|
||||
CLuaInstVideo* CLuaInstVideo::getInstance()
|
||||
{
|
||||
static CLuaInstVideo* LuaInstVideo = NULL;
|
||||
|
||||
if(!LuaInstVideo)
|
||||
LuaInstVideo = new CLuaInstVideo();
|
||||
return LuaInstVideo;
|
||||
}
|
||||
|
||||
CLuaData *CLuaInstVideo::CheckData(lua_State *L, int narg)
|
||||
{
|
||||
luaL_checktype(L, narg, LUA_TUSERDATA);
|
||||
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)
|
||||
{
|
||||
bool enable = true;
|
||||
int numargs = lua_gettop(L);
|
||||
@@ -45,26 +64,26 @@ int CLuaInstance::setBlank(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::ShowPicture(lua_State *L)
|
||||
int CLuaInstVideo::ShowPicture_old(lua_State *L)
|
||||
{
|
||||
const char *fname = luaL_checkstring(L, 2);
|
||||
CFrameBuffer::getInstance()->showFrame(fname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::StopPicture(lua_State */*L*/)
|
||||
int CLuaInstVideo::StopPicture_old(lua_State */*L*/)
|
||||
{
|
||||
CFrameBuffer::getInstance()->stopFrame();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::PlayFile(lua_State *L)
|
||||
int CLuaInstVideo::PlayFile_old(lua_State *L)
|
||||
{
|
||||
printf("CLuaInstance::%s %d\n", __func__, lua_gettop(L));
|
||||
printf("CLuaInstVideo::%s %d\n", __func__, lua_gettop(L));
|
||||
int numargs = lua_gettop(L);
|
||||
|
||||
if (numargs < 3) {
|
||||
printf("CLuaInstance::%s: not enough arguments (%d, expected 3)\n", __func__, numargs);
|
||||
printf("CLuaInstVideo::%s: not enough arguments (%d, expected 3)\n", __func__, numargs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -87,7 +106,7 @@ int CLuaInstance::PlayFile(lua_State *L)
|
||||
info1 = luaL_checkstring(L, 4);
|
||||
if (numargs > 4)
|
||||
info2 = luaL_checkstring(L, 5);
|
||||
printf("CLuaInstance::%s: title %s file %s\n", __func__, title, fname);
|
||||
printf("CLuaInstVideo::%s: title %s file %s\n", __func__, title, fname);
|
||||
std::string st(title);
|
||||
std::string si1(info1);
|
||||
std::string si2(info2);
|
||||
@@ -99,7 +118,7 @@ int CLuaInstance::PlayFile(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CLuaInstance::zapitStopPlayBack(lua_State *L)
|
||||
int CLuaInstVideo::zapitStopPlayBack_old(lua_State *L)
|
||||
{
|
||||
bool stop = true;
|
||||
int numargs = lua_gettop(L);
|
||||
@@ -114,7 +133,7 @@ int CLuaInstance::zapitStopPlayBack(lua_State *L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CLuaInstance::channelRezap(lua_State */*L*/)
|
||||
int CLuaInstVideo::channelRezap_old(lua_State */*L*/)
|
||||
{
|
||||
CNeutrinoApp::getInstance()->channelRezap();
|
||||
if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio)
|
||||
|
51
src/gui/lua/lua_video.h
Normal file
51
src/gui/lua/lua_video.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* lua video functions
|
||||
*
|
||||
* (C) 2014 [CST ]Focus
|
||||
* (C) 2014-2015 M. Liebmann (micha-bbg)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _LUAVIDEO_H
|
||||
#define _LUAVIDEO_H
|
||||
|
||||
/*
|
||||
class CLuaVideo
|
||||
{
|
||||
public:
|
||||
CLuaVideo() {};
|
||||
~CLuaVideo() {};
|
||||
};
|
||||
*/
|
||||
|
||||
class CLuaInstVideo
|
||||
{
|
||||
static CLuaData *CheckData(lua_State *L, int narg);
|
||||
public:
|
||||
CLuaInstVideo() {};
|
||||
~CLuaInstVideo() {};
|
||||
static CLuaInstVideo* getInstance();
|
||||
// static void LuaVideoRegister(lua_State *L);
|
||||
|
||||
static int setBlank_old(lua_State *L);
|
||||
static int ShowPicture_old(lua_State *L);
|
||||
static int StopPicture_old(lua_State *L);
|
||||
static int PlayFile_old(lua_State *L);
|
||||
static int zapitStopPlayBack_old(lua_State *L);
|
||||
static int channelRezap_old(lua_State *L);
|
||||
|
||||
// private:
|
||||
};
|
||||
|
||||
#endif //_LUAVIDEO_H
|
@@ -1,7 +0,0 @@
|
||||
|
||||
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);
|
@@ -29,7 +29,6 @@
|
||||
#include <system/settings.h>
|
||||
#include <system/set_threadname.h>
|
||||
#include <gui/widget/msgbox.h>
|
||||
#include <gui/widget/messagebox.h>
|
||||
#include <gui/widget/keyboard_input.h>
|
||||
#include <gui/filebrowser.h>
|
||||
#include <gui/movieplayer.h>
|
||||
@@ -41,6 +40,7 @@
|
||||
|
||||
#include "luainstance.h"
|
||||
#include "lua_configfile.h"
|
||||
#include "lua_video.h"
|
||||
|
||||
static void set_lua_variables(lua_State *L)
|
||||
{
|
||||
@@ -489,13 +489,16 @@ const luaL_Reg CLuaInstance::methods[] =
|
||||
{ "enableInfoClock", CLuaInstance::enableInfoClock },
|
||||
{ "getDynFont", CLuaInstance::getDynFont },
|
||||
|
||||
/* gui/lua/lua_video.cpp*/
|
||||
{ "setBlank", CLuaInstance::setBlank },
|
||||
{ "ShowPicture", CLuaInstance::ShowPicture },
|
||||
{ "StopPicture", CLuaInstance::StopPicture },
|
||||
{ "PlayFile", CLuaInstance::PlayFile },
|
||||
{ "zapitStopPlayBack", CLuaInstance::zapitStopPlayBack },
|
||||
{ "channelRezap", CLuaInstance::channelRezap },
|
||||
/*
|
||||
lua_video.cpp
|
||||
Deprecated, for the future separate class for video
|
||||
*/
|
||||
{ "setBlank", CLuaInstVideo::getInstance()->setBlank_old },
|
||||
{ "ShowPicture", CLuaInstVideo::getInstance()->ShowPicture_old },
|
||||
{ "StopPicture", CLuaInstVideo::getInstance()->StopPicture_old },
|
||||
{ "PlayFile", CLuaInstVideo::getInstance()->PlayFile_old },
|
||||
{ "zapitStopPlayBack", CLuaInstVideo::getInstance()->zapitStopPlayBack_old },
|
||||
{ "channelRezap", CLuaInstVideo::getInstance()->channelRezap_old },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@@ -34,7 +34,6 @@ extern "C" {
|
||||
|
||||
#include "luainstance_helpers.h"
|
||||
|
||||
|
||||
#define LUA_API_VERSION_MAJOR 1
|
||||
#define LUA_API_VERSION_MINOR 22
|
||||
|
||||
@@ -294,8 +293,6 @@ private:
|
||||
static int enableInfoClock(lua_State *L);
|
||||
static int getDynFont(lua_State *L);
|
||||
|
||||
#include "lua_video.inc"
|
||||
|
||||
};
|
||||
|
||||
#endif /* _LUAINSTANCE_H */
|
||||
|
Reference in New Issue
Block a user