From b4a2856e1cb21a742b2ecb984dfac52a97a27437 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Thu, 3 Mar 2016 09:03:46 +0100 Subject: [PATCH] movieplayer: Use Lua scripts for selecting live stream urls --- data/locale/deutsch.locale | 4 + data/locale/english.locale | 4 + src/gui/Makefile.am | 1 + src/gui/infoviewer_bb.cpp | 28 ++++++ src/gui/movieplayer.cpp | 173 +++++++++++++++++++++++++++++++++-- src/gui/movieplayer.h | 15 ++- src/gui/user_menue.cpp | 16 +++- src/gui/user_menue_setup.cpp | 1 + src/gui/webtv_setup.cpp | 81 +++++++++++++++- src/gui/webtv_setup.h | 12 +++ src/neutrino.cpp | 13 ++- src/neutrino_menue.h | 3 +- src/system/locals.h | 4 + src/system/locals_intern.h | 4 + src/system/settings.h | 5 + 15 files changed, 351 insertions(+), 13 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 07b224a61..bdb6f03fa 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -878,6 +878,10 @@ ledcontroler.off LED1 & LED2 aus ledcontroler.on.all LED1 & LED2 an ledcontroler.on.led1 LED1 an ledcontroler.on.led2 LED2 an +livestream.head Livestreams +livestream.read_data Lese Daten... +livestream.resolution Auflösung +livestream.scriptpath Script Verzeichnis lua.boolparam_deprecated1 Achtung! lua.boolparam_deprecated2 Die Verwendung von Zahl oder String lua.boolparam_deprecated3 für einen Boolean Parameter ist veraltet.\n Bitte nutzen Sie native Bool Werte zB: diff --git a/data/locale/english.locale b/data/locale/english.locale index 63ce34062..84cdea9a5 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -878,6 +878,10 @@ ledcontroler.off Led1 & Led2 off ledcontroler.on.all Led1 & Led2 on ledcontroler.on.led1 Led1 on ledcontroler.on.led2 Led2 on +livestream.head Live streams +livestream.read_data Read data... +livestream.resolution Resolution +livestream.scriptpath Script path lua.boolparam_deprecated1 Caution! lua.boolparam_deprecated2 The use of number or string lua.boolparam_deprecated3 for a Boolean parameter is deprecated.\n Please use native bool values eg. diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 73c963593..509a67b5a 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -32,6 +32,7 @@ AM_CPPFLAGS += \ -I$(top_srcdir)/lib/connection \ -I$(top_srcdir)/lib/xmltree \ -I$(top_srcdir)/lib/libupnpclient \ + -I$(top_srcdir)/lib/jsoncpp/include \ @SIGC_CFLAGS@ \ @CURL_CFLAGS@ \ @FREETYPE_CFLAGS@ \ diff --git a/src/gui/infoviewer_bb.cpp b/src/gui/infoviewer_bb.cpp index 9a68fe310..4910008c6 100644 --- a/src/gui/infoviewer_bb.cpp +++ b/src/gui/infoviewer_bb.cpp @@ -222,6 +222,13 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_RED; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); +#if 0 + if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + text = g_Locale->getText(LOCALE_LIVESTREAM_RESOLUTION); + active = true; + break; + } +#endif if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_red, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) @@ -237,6 +244,13 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_GREEN; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); +#if 0 + if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + text = g_Locale->getText(LOCALE_LIVESTREAM_RESOLUTION); + active = true; + break; + } +#endif if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_green, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) @@ -252,6 +266,13 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_YELLOW; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); +#if 1 + if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + text = g_Locale->getText(LOCALE_LIVESTREAM_RESOLUTION); + active = true; + break; + } +#endif if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_yellow, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) @@ -267,6 +288,13 @@ void CInfoViewerBB::getBBButtonInfo() icon = NEUTRINO_ICON_BUTTON_BLUE; frameBuffer->getIconSize(icon.c_str(), &w, &h); mode = CNeutrinoApp::getInstance()->getMode(); +#if 0 + if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + text = g_Locale->getText(LOCALE_LIVESTREAM_RESOLUTION); + active = true; + break; + } +#endif if (mode == NeutrinoMessages::mode_ts) { text = CKeybindSetup::getMoviePlayerButtonName(CRCInput::RC_blue, active, g_settings.infobar_buttons_usertitle); if (!text.empty()) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index c8ce5df13..64dbe07e1 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -61,6 +62,7 @@ #include #include #include +#include #include #include @@ -70,6 +72,7 @@ #include #include #include +#include #include extern cVideo * videoDecoder; @@ -199,6 +202,7 @@ void CMoviePlayerGui::Init(void) blockedFromPlugin = false; m_screensaver = false; m_idletime = time(NULL); + liveStreamList.clear(); } void CMoviePlayerGui::cutNeutrino() @@ -683,7 +687,131 @@ void* CMoviePlayerGui::bgPlayThread(void *arg) pthread_exit(NULL); } -bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan) +bool CMoviePlayerGui::sortStreamList(livestream_info_t info1, livestream_info_t info2) +{ + return (info1.res1 < info2.res1); +} + +bool CMoviePlayerGui::luaGetUrl(const std::string &script, const std::string &file, std::vector &streamList) +{ + CHintBox* box = new CHintBox(LOCALE_MESSAGEBOX_INFO, g_Locale->getText(LOCALE_LIVESTREAM_READ_DATA)); + box->paint(); + + std::string result_code = ""; + std::string result_string = ""; + + std::vector args; + args.push_back(file); + + CLuaInstance *lua = new CLuaInstance(); + lua->runScript(script.c_str(), &args, &result_code, &result_string); + delete lua; + + if ((result_code != "0") || result_string.empty()) { + if (box != NULL) { + box->hide(); + delete box; + } + return false; + } + + Json::Value root; + Json::Value data; + Json::Reader reader; + bool parsedSuccess = reader.parse(result_string, root, false); + if (!parsedSuccess) { + printf("Failed to parse JSON\n"); + printf("%s\n", reader.getFormattedErrorMessages().c_str()); + if (box != NULL) { + box->hide(); + delete box; + } + return false; + } + + livestream_info_t info; + for(size_t i = 0; i < root.size(); ++i) { + data = root[i]["url"]; info.url = data.asString(); + data = root[i]["name"]; info.name = data.asString(); + data = root[i]["band"]; info.bandwidth = atoi(data.asString().c_str()); + data = root[i]["res1"]; std::string tmp = data.asString(); info.res1 = atoi(tmp.c_str()); + data = root[i]["res2"]; info.resolution = tmp + "x" + data.asString(); + streamList.push_back(info); + } + + /* sort streamlist */ + std::sort(streamList.begin(), streamList.end(), sortStreamList); + + /* remove duplicate resolutions */ + livestream_info_t *_info; + int res_old = 0; + for (size_t i = 0; i < streamList.size(); ++i) { + _info = &(streamList[i]); + if (res_old == _info->res1) + streamList.erase(streamList.begin()+i); + res_old = _info->res1; + } + + if (box != NULL) { + box->hide(); + delete box; + } + + return true; +} + +bool CMoviePlayerGui::selectLivestream(std::vector &streamList, int res, livestream_info_t* info) +{ + livestream_info_t* _info; + int _res = res; + +#if 0 + printf("\n"); + for (size_t i = 0; i < streamList.size(); ++i) { + _info = &(streamList[i]); + printf("%d - _info->res1: %4d, _info->res: %9s, _info->bandwidth: %d\n", i, _info->res1, (_info->resolution).c_str(), _info->bandwidth); + } + printf("\n"); +#endif + + bool resIO = false; + while (1) { + size_t i; + for (i = 0; i < streamList.size(); ++i) { + _info = &(streamList[i]); + if (_info->res1 == _res) { + info->url = _info->url; + info->name = _info->name; + info->resolution = _info->resolution; + info->res1 = _info->res1; + info->bandwidth = _info->bandwidth; + return true; + } + } + /* Required resolution not found, decreasing resolution */ + for (i = streamList.size(); i > 0; --i) { + _info = &(streamList[i-1]); + if (_info->res1 < _res) { + _res = _info->res1; + resIO = true; + break; + } + } + /* Required resolution not found, increasing resolution */ + if (resIO == false) { + for (i = 0; i < streamList.size(); ++i) { + _info = &(streamList[i]); + if (_info->res1 > _res) { + _res = _info->res1; + break; + } + } + } + } + return false; +} + +bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan, const std::string &script) { printf("%s: starting...\n", __func__); static CZapProtection *zp = NULL; @@ -715,6 +843,40 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st } } + static t_channel_id oldChan = 0; + std::string realUrl = file; + std::string _pretty_name = name; + std::string _epgTitle = name; + std::string _script = script; + livestream_info_t info; + if (!_script.empty()) { + if (_script.find("/") == std::string::npos) + _script = g_settings.livestreamScriptPath + "/" + _script; + + size_t pos = _script.find(".lua"); + if ((file_exists(_script.c_str())) && (pos != std::string::npos) && (_script.length()-pos == 4)) { + if ((oldChan != chan) || liveStreamList.empty()) { + liveStreamList.clear(); + if (!luaGetUrl(_script, file, liveStreamList)) + return false; + oldChan = chan; + } + + if (!selectLivestream(liveStreamList, g_settings.livestreamResolution, &info)) + return false; + + realUrl = info.url; + if (!info.name.empty()) { + _pretty_name = info.name; + _epgTitle = info.name; + } + if (!info.resolution.empty()) + _epgTitle += (std::string)" (" + info.resolution + ")"; + } + else + return false; + } + OpenThreads::ScopedLock m_lock(mutex); instance_bg->Cleanup(); @@ -724,12 +886,11 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st instance_bg->isWebTV = true; instance_bg->is_file_player = true; instance_bg->isHTTP = true; + instance_bg->file_name = realUrl; + instance_bg->pretty_name = _pretty_name; - instance_bg->file_name = file; - instance_bg->pretty_name = name; - - instance_bg->movie_info.epgTitle = name; - instance_bg->movie_info.epgChannel = file; + instance_bg->movie_info.epgTitle = _epgTitle; + instance_bg->movie_info.epgChannel = realUrl; instance_bg->movie_info.epgId = chan; instance_bg->p_movie_info = &movie_info; diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index 53621ab9d..49ce48ba5 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -85,6 +85,15 @@ class CMoviePlayerGui : public CMenuTarget enum repeat_mode_enum { REPEAT_OFF = 0, REPEAT_TRACK = 1, REPEAT_ALL = 2 }; private: + typedef struct livestream_info_t + { + std::string url; + std::string name; + std::string resolution; + int res1; + int bandwidth; + } livestream_info_struct_t; + CFrameBuffer * frameBuffer; int m_LastMode; @@ -159,6 +168,7 @@ class CMoviePlayerGui : public CMenuTarget std::string Path_local; int menu_ret; bool autoshot_done; + std::vector liveStreamList; /* playback from bookmark */ static CBookmarkManager * bookmarkmanager; @@ -207,6 +217,9 @@ class CMoviePlayerGui : public CMenuTarget void EnableClockAndMute(bool enable); static void *ShowStartHint(void *arg); static void* bgPlayThread(void *arg); + static bool sortStreamList(livestream_info_t info1, livestream_info_t info2); + bool selectLivestream(std::vector &streamList, int res, livestream_info_t* info); + bool luaGetUrl(const std::string &script, const std::string &file, std::vector &streamList); CMoviePlayerGui(const CMoviePlayerGui&) {}; CMoviePlayerGui(); @@ -227,7 +240,7 @@ class CMoviePlayerGui : public CMenuTarget int timeshift; int file_prozent; void SetFile(std::string &name, std::string &file, std::string info1="", std::string info2="") { pretty_name = name; file_name = file; info_1 = info1; info_2 = info2; } - bool PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan); + bool PlayBackgroundStart(const std::string &file, const std::string &name, t_channel_id chan, const std::string &script=""); void stopPlayBack(void); void setLastMode(int m) { m_LastMode = m; } void Pause(bool b = true); diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 0b082ff10..a129fc617 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -71,12 +71,14 @@ #include #include #include +#include #include #include #include #include +#include #include extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ @@ -178,7 +180,9 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) else menu->addItem(GenericMenuSeparator); - bool _mode_ts = CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_ts; + bool _mode_ts = CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_ts; + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); std::string itemstr_last("1"); @@ -264,6 +268,8 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) { if (g_RemoteControl->subChannels.empty()) break; + if (_mode_webtv) + break; // NVOD/SubService- Kanal! CMenuWidget *tmpNVODSelector = new CMenuWidget(g_RemoteControl->are_subchannels ? LOCALE_NVODSELECTOR_SUBSERVICE : LOCALE_NVODSELECTOR_STARTTIME, NEUTRINO_ICON_VIDEO); if (!subchanselect.getNVODMenu(tmpNVODSelector)) { @@ -430,6 +436,13 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg) menu_item = new CMenuDForwarder(LOCALE_SERVICEMENU_UPDATE, true, NULL, new CSoftwareUpdate(), NULL, key, icon); menu_item->setHint(NEUTRINO_ICON_HINT_SW_UPDATE, LOCALE_MENU_HINT_SW_UPDATE); break; + case SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION: + if (!_mode_webtv) + break; + keyhelper.get(&key,&icon); + menu_item = new CMenuDForwarder(LOCALE_LIVESTREAM_RESOLUTION, true, NULL, new CWebTVResolution(), NULL, key, icon); + //menu_item->setHint(xx, yy); + break; case -1: // plugin { int number_of_plugins = g_PluginList->getNumberOfPlugins(); @@ -511,6 +524,7 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu continue; case SNeutrinoSettings::ITEM_NONE: case SNeutrinoSettings::ITEM_BAR: + case SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION: continue; case SNeutrinoSettings::ITEM_EPG_MISC: return_title = true; diff --git a/src/gui/user_menue_setup.cpp b/src/gui/user_menue_setup.cpp index 249bcbc76..643e0a2db 100644 --- a/src/gui/user_menue_setup.cpp +++ b/src/gui/user_menue_setup.cpp @@ -111,6 +111,7 @@ static keyvals usermenu_items[] = { SNeutrinoSettings::ITEM_HDDMENU, LOCALE_HDD_SETTINGS, usermenu_show }, { SNeutrinoSettings::ITEM_NETSETTINGS, LOCALE_MAINSETTINGS_NETWORK, usermenu_show }, { SNeutrinoSettings::ITEM_SWUPDATE, LOCALE_SERVICEMENU_UPDATE, usermenu_show }, + { SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION,LOCALE_LIVESTREAM_RESOLUTION, usermenu_show }, { SNeutrinoSettings::ITEM_MAX, NONEXISTANT_LOCALE, usermenu_show } }; diff --git a/src/gui/webtv_setup.cpp b/src/gui/webtv_setup.cpp index e5cfe48f0..49a585560 100644 --- a/src/gui/webtv_setup.cpp +++ b/src/gui/webtv_setup.cpp @@ -29,7 +29,9 @@ #include #include #include +#include #include +#include #include #include "webtv_setup.h" @@ -41,6 +43,17 @@ CWebTVSetup::CWebTVSetup() changed = false; } +#define LIVESTREAM_RESOLUTION_OPTION_COUNT 6 +const CMenuOptionChooser::keyval_ext LIVESTREAM_RESOLUTION_OPTIONS[LIVESTREAM_RESOLUTION_OPTION_COUNT] = +{ + { 1920, NONEXISTANT_LOCALE, "1920x1080" }, + { 1280, NONEXISTANT_LOCALE, "1280x720" }, + { 854, NONEXISTANT_LOCALE, "854x480" }, + { 640, NONEXISTANT_LOCALE, "640x360" }, + { 426, NONEXISTANT_LOCALE, "426x240" }, + { 128, NONEXISTANT_LOCALE, "128x72" } +}; + #define CWebTVSetupFooterButtonCount 2 static const struct button_label CWebTVSetupFooterButtons[CWebTVSetupFooterButtonCount] = { { NEUTRINO_ICON_BUTTON_RED, LOCALE_WEBTV_XML_DEL }, @@ -91,6 +104,11 @@ int CWebTVSetup::exec(CMenuTarget* parent, const std::string & actionKey) } return res; } + if (actionKey == "script_path") { + const char *action_str = "ScriptPath"; + chooserDir(g_settings.livestreamScriptPath, false, action_str); + return res; + } if(parent) parent->hide(); @@ -108,10 +126,26 @@ int CWebTVSetup::Show() m->addKey(CRCInput::RC_red, this, "d"); m->addKey(CRCInput::RC_green, this, "a"); - m->addIntroItems(LOCALE_WEBTV_HEAD, LOCALE_WEBTV_XML); + m->addIntroItems(LOCALE_WEBTV_HEAD, LOCALE_LIVESTREAM_HEAD); + + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); + + CMenuForwarder *mf; + int shortcut = 1; + mf = new CMenuForwarder(LOCALE_LIVESTREAM_SCRIPTPATH, !_mode_webtv, g_settings.livestreamScriptPath, this, "script_path", CRCInput::convertDigitToKey(shortcut++)); + m->addItem(mf); +#if 0 + mf = new CMenuForwarder(LOCALE_LIVESTREAM_RESOLUTION, _mode_webtv, NULL, new CWebTVResolution(), NULL, CRCInput::convertDigitToKey(shortcut++)); + m->addItem(mf); +#endif + + m->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_WEBTV_XML)); + item_offset = m->getItemsCount(); for (std::list::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); ++it) m->addItem(new CMenuForwarder(*it, true, NULL, this, "c")); + m->setFooter(CWebTVSetupFooterButtons, CWebTVSetupFooterButtonCount); //Why we need here an extra buttonbar? int res = m->exec(NULL, ""); @@ -131,4 +165,49 @@ int CWebTVSetup::Show() return res; } + +/* ## CWebTVResolution ############################################# */ + +CWebTVResolution::CWebTVResolution() +{ + width = 40; +} + +int CWebTVResolution::exec(CMenuTarget* parent, const std::string& /*actionKey*/) +{ + if (parent) + parent->hide(); + + return Show(); +} + +int CWebTVResolution::Show() +{ + m = new CMenuWidget(LOCALE_WEBTV_HEAD, NEUTRINO_ICON_MOVIEPLAYER, width, MN_WIDGET_ID_LIVESTREAM_RESOLUTION); + m->addIntroItems(LOCALE_LIVESTREAM_HEAD); + + CMenuOptionChooser *mc; + mc = new CMenuOptionChooser(LOCALE_LIVESTREAM_RESOLUTION, &g_settings.livestreamResolution, + LIVESTREAM_RESOLUTION_OPTIONS, LIVESTREAM_RESOLUTION_OPTION_COUNT, + true, NULL, CRCInput::RC_nokey, NULL, true); + m->addItem(mc); + + int oldRes = g_settings.livestreamResolution; + int res = m->exec(NULL, ""); + m->hide(); + delete m; + + bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv) && + (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); + if (oldRes != g_settings.livestreamResolution && _mode_webtv) { + CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); + if (cc && IS_WEBTV(cc->getChannelID())) { + CMoviePlayerGui::getInstance().stopPlayBack(); + CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName()); + } + } + + return res; +} + // vim:ts=4 diff --git a/src/gui/webtv_setup.h b/src/gui/webtv_setup.h index ed6d4ab96..0a39332bc 100644 --- a/src/gui/webtv_setup.h +++ b/src/gui/webtv_setup.h @@ -40,4 +40,16 @@ class CWebTVSetup : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); int Show(); }; + +class CWebTVResolution : public CMenuTarget +{ + private: + int width; + CMenuWidget *m; + public: + CWebTVResolution(); + int exec(CMenuTarget* parent, const std::string & actionKey); + int Show(); +}; + #endif diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 7ac6970c1..20ab45c24 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -288,7 +288,7 @@ const lcd_setting_struct_t lcd_setting[SNeutrinoSettings::LCD_SETTING_COUNT] = static SNeutrinoSettings::usermenu_t usermenu_default[] = { { CRCInput::RC_red, "2,3,4,13", "", "red" }, { CRCInput::RC_green, "6", "", "green" }, - { CRCInput::RC_yellow, "7", "", "yellow" }, + { CRCInput::RC_yellow, "7,31", "", "yellow" }, { CRCInput::RC_blue, "12,11,20,21,19,14,29,30,15", "", "blue" }, { CRCInput::RC_play, "9", "", "5" }, { CRCInput::RC_audio, "27", "", "6" }, @@ -906,6 +906,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infoClockBackground = configfile.getInt32("infoClockBackground", 0); g_settings.infoClockSeconds = configfile.getInt32("infoClockSeconds", 1); + g_settings.livestreamResolution = configfile.getInt32("livestreamResolution", 1920); + g_settings.livestreamScriptPath = configfile.getString("livestreamScriptPath", PLUGINDIR_VAR "/webtv"); + if(erg) configfile.setModifiedFlag(true); return erg; @@ -1342,6 +1345,9 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("infoClockSeconds", g_settings.infoClockSeconds); configfile.setInt32("easymenu", g_settings.easymenu); + configfile.setInt32("livestreamResolution", g_settings.livestreamResolution); + configfile.setString("livestreamScriptPath", g_settings.livestreamScriptPath); + if(strcmp(fname, NEUTRINO_SETTINGS_FILE) || configfile.getModifiedFlag()) configfile.saveConfig(fname); } @@ -2704,7 +2710,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); if (cc && (chid == cc->getChannelID())) { CMoviePlayerGui::getInstance().stopPlayBack(); - if (CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID())) + if (CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName())) delete [] (unsigned char*) data; else g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data); @@ -3293,7 +3299,8 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); if (cc && IS_WEBTV(cc->getChannelID())) { CMoviePlayerGui::getInstance().stopPlayBack(); - CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID()); + if (!CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName())) + g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data); } } } diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 735c88ee4..bbc976c78 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -113,7 +113,8 @@ enum MN_WIDGET_ID //web tv setup MN_WIDGET_ID_WEBTVSETUP, - + MN_WIDGET_ID_LIVESTREAM_RESOLUTION, + //misc settings MN_WIDGET_ID_MISCSETUP, MN_WIDGET_ID_MISCSETUP_GENERAL, diff --git a/src/system/locals.h b/src/system/locals.h index ebb211634..7ed5c56ee 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -905,6 +905,10 @@ typedef enum LOCALE_LEDCONTROLER_ON_ALL, LOCALE_LEDCONTROLER_ON_LED1, LOCALE_LEDCONTROLER_ON_LED2, + LOCALE_LIVESTREAM_HEAD, + LOCALE_LIVESTREAM_READ_DATA, + LOCALE_LIVESTREAM_RESOLUTION, + LOCALE_LIVESTREAM_SCRIPTPATH, LOCALE_LUA_BOOLPARAM_DEPRECATED1, LOCALE_LUA_BOOLPARAM_DEPRECATED2, LOCALE_LUA_BOOLPARAM_DEPRECATED3, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index ec84ab93f..d2fc1f5e2 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -905,6 +905,10 @@ const char * locale_real_names[] = "ledcontroler.on.all", "ledcontroler.on.led1", "ledcontroler.on.led2", + "livestream.head", + "livestream.read_data", + "livestream.resolution", + "livestream.scriptpath", "lua.boolparam_deprecated1", "lua.boolparam_deprecated2", "lua.boolparam_deprecated3", diff --git a/src/system/settings.h b/src/system/settings.h index 80a15f3a9..446a69406 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -739,6 +739,9 @@ struct SNeutrinoSettings std::string font_file; std::string ttx_font_file; + int livestreamResolution; + std::string livestreamScriptPath; + // USERMENU typedef enum { @@ -783,6 +786,8 @@ struct SNeutrinoSettings ITEM_NETSETTINGS = 29, ITEM_SWUPDATE = 30, + ITEM_LIVESTREAM_RESOLUTION = 31, + ITEM_MAX // MUST be always the last in the list } USER_ITEM; typedef struct {