mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
CLuaInstance::PlayFile: Function now returns the status of buttons
- Set Lua api version to 1.1
return code defined LUA Variables
--------------------------------------------------
0 = normal exit PLAYSTATE.NORMAL
1 = aborted by stop button PLAYSTATE.STOP
2 = next button PLAYSTATE.NEXT
3 = prev button PLAYSTATE.PREV
Origin commit data
------------------
Branch: ni/coolstream
Commit: b56be92d59
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2015-09-04 (Fri, 04 Sep 2015)
Origin message was:
------------------
CLuaInstance::PlayFile: Function now returns the status of buttons
- Set Lua api version to 1.1
return code defined LUA Variables
--------------------------------------------------
0 = normal exit PLAYSTATE.NORMAL
1 = aborted by stop button PLAYSTATE.STOP
2 = next button PLAYSTATE.NEXT
3 = prev button PLAYSTATE.PREV
------------------
This commit was generated by Migit
This commit is contained in:
@@ -277,7 +277,6 @@ static void set_lua_variables(lua_State *L)
|
||||
{ "EXIT_REPAINT", menu_return::RETURN_EXIT_REPAINT },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
table_key apiversion[] =
|
||||
{
|
||||
{ "MAJOR", LUA_API_VERSION_MAJOR },
|
||||
@@ -285,6 +284,15 @@ static void set_lua_variables(lua_State *L)
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
table_key playstate[] =
|
||||
{
|
||||
{ "NORMAL", CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL },
|
||||
{ "STOP", CMoviePlayerGui::PLUGIN_PLAYSTATE_STOP },
|
||||
{ "NEXT", CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT },
|
||||
{ "PREV", CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* list of environment variable arrays to be exported */
|
||||
lua_envexport e[] =
|
||||
{
|
||||
@@ -294,6 +302,7 @@ static void set_lua_variables(lua_State *L)
|
||||
{ "CORNER", corners },
|
||||
{ "MENU_RETURN", menureturn },
|
||||
{ "APIVERSION", apiversion },
|
||||
{ "PLAYSTATE", playstate },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -727,8 +736,10 @@ int CLuaInstance::PlayFile(lua_State *L)
|
||||
std::string si2(info2);
|
||||
std::string sf(fname);
|
||||
CMoviePlayerGui::getInstance().SetFile(st, sf, si1, si2);
|
||||
CMoviePlayerGui::getInstance().exec(NULL, "http");
|
||||
return 0;
|
||||
CMoviePlayerGui::getInstance().exec(NULL, "http_lua");
|
||||
int ret = CMoviePlayerGui::getInstance().getKeyPressed();
|
||||
lua_pushinteger(L, ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int CLuaInstance::strFind(lua_State *L)
|
||||
|
@@ -34,7 +34,7 @@ extern "C" {
|
||||
#include <vector>
|
||||
|
||||
#define LUA_API_VERSION_MAJOR 1
|
||||
#define LUA_API_VERSION_MINOR 0
|
||||
#define LUA_API_VERSION_MINOR 1
|
||||
|
||||
/* this is stored as userdata in the lua_State */
|
||||
struct CLuaData
|
||||
|
@@ -168,6 +168,8 @@ void CMoviePlayerGui::Init(void)
|
||||
info_1 = "";
|
||||
info_2 = "";
|
||||
filelist_it = filelist.end();
|
||||
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL;
|
||||
isLuaPlay = false;
|
||||
}
|
||||
|
||||
void CMoviePlayerGui::cutNeutrino()
|
||||
@@ -279,6 +281,12 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey)
|
||||
is_file_player = true;
|
||||
PlayFile();
|
||||
}
|
||||
else if (actionKey == "http_lua") {
|
||||
isHTTP = true;
|
||||
isLuaPlay = true;
|
||||
is_file_player = true;
|
||||
PlayFile();
|
||||
}
|
||||
else {
|
||||
return menu_return::RETURN_REPAINT;
|
||||
}
|
||||
@@ -402,6 +410,7 @@ void CMoviePlayerGui::ClearFlags()
|
||||
isMovieBrowser = false;
|
||||
isBookmark = false;
|
||||
isHTTP = false;
|
||||
isLuaPlay = false;
|
||||
isUPNP = false;
|
||||
isWebTV = false;
|
||||
isYT = false;
|
||||
@@ -852,6 +861,7 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
bool update_lcd = true;
|
||||
int eof = 0;
|
||||
bool at_eof = !(playstate >= CMoviePlayerGui::PLAY);;
|
||||
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL;
|
||||
while (playstate >= CMoviePlayerGui::PLAY)
|
||||
{
|
||||
if (update_lcd) {
|
||||
@@ -906,6 +916,15 @@ void CMoviePlayerGui::PlayFileLoop(void)
|
||||
g_PluginList->startPlugin_by_name(g_settings.movieplayer_plugin.c_str ());
|
||||
} else if (msg == (neutrino_msg_t) g_settings.mpkey_stop) {
|
||||
playstate = CMoviePlayerGui::STOPPED;
|
||||
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_STOP;
|
||||
ClearQueue();
|
||||
} else if (isLuaPlay && (msg == (neutrino_msg_t) CRCInput::RC_right)) {
|
||||
playstate = CMoviePlayerGui::STOPPED;
|
||||
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT;
|
||||
ClearQueue();
|
||||
} else if (isLuaPlay && (msg == (neutrino_msg_t) CRCInput::RC_left)) {
|
||||
playstate = CMoviePlayerGui::STOPPED;
|
||||
keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV;
|
||||
ClearQueue();
|
||||
} else if ((!filelist.empty() && msg == (neutrino_msg_t) CRCInput::RC_right)) {
|
||||
if (filelist_it < (filelist.end() - 1)) {
|
||||
|
@@ -67,6 +67,14 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
REW = 6
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PLUGIN_PLAYSTATE_NORMAL = 0,
|
||||
PLUGIN_PLAYSTATE_STOP = 1,
|
||||
PLUGIN_PLAYSTATE_NEXT = 2,
|
||||
PLUGIN_PLAYSTATE_PREV = 3
|
||||
};
|
||||
|
||||
enum repeat_mode_enum { REPEAT_OFF = 0, REPEAT_TRACK = 1, REPEAT_ALL = 2 };
|
||||
|
||||
private:
|
||||
@@ -80,6 +88,8 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
bool playing;
|
||||
bool time_forced;
|
||||
CMoviePlayerGui::state playstate;
|
||||
int keyPressed;
|
||||
bool isLuaPlay;
|
||||
int speed;
|
||||
int startposition;
|
||||
int position;
|
||||
@@ -206,6 +216,7 @@ class CMoviePlayerGui : public CMenuTarget
|
||||
void selectSubtitle();
|
||||
void showSubtitle(neutrino_msg_data_t data);
|
||||
void clearSubtitle(bool lock = false);
|
||||
int getKeyPressed() { return keyPressed; };
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user