diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 3db7bf092..a0edcdd4c 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1236,6 +1236,7 @@ ledcontroler.on.led2 LED2 an livestream.head Livestreams livestream.read_data Lese Daten ... livestream.resolution Auflösung +livestream.resolution.prefered Bevorzugte Auflösung livestream.scriptpath Script Verzeichnis lua.boolparam_deprecated1 Achtung! lua.boolparam_deprecated2 Die Verwendung von Zahl oder String diff --git a/data/locale/english.locale b/data/locale/english.locale index ba1695880..868f187d9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1236,6 +1236,7 @@ ledcontroler.on.led2 LED2 on livestream.head Live streams livestream.read_data Read data ... livestream.resolution Resolution +livestream.resolution.prefered Prefered resolution livestream.scriptpath Script path lua.boolparam_deprecated1 Caution! lua.boolparam_deprecated2 The use of number or string diff --git a/src/gui/webchannels_setup.cpp b/src/gui/webchannels_setup.cpp index 5bd1a6cb3..136422944 100644 --- a/src/gui/webchannels_setup.cpp +++ b/src/gui/webchannels_setup.cpp @@ -40,6 +40,20 @@ #include #include +const CMenuOptionChooser::keyval_ext LIVESTREAM_RESOLUTION_OPTIONS[] = +{ +#if !HAVE_CST_HARDWARE + { 3840, NONEXISTANT_LOCALE, "3840x2160" }, + { 2560, NONEXISTANT_LOCALE, "2560x1440" }, +#endif + { 1920, NONEXISTANT_LOCALE, "1920x1080" }, + { 1280, NONEXISTANT_LOCALE, "1280x720" }, + { 854, NONEXISTANT_LOCALE, "854x480" }, + { 640, NONEXISTANT_LOCALE, "640x360" }, + { 480, NONEXISTANT_LOCALE, "480x270" } +}; +#define LIVESTREAM_RESOLUTION_OPTION_COUNT (sizeof(LIVESTREAM_RESOLUTION_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext)) + CWebChannelsSetup::CWebChannelsSetup() { webradio = false; @@ -199,23 +213,28 @@ int CWebChannelsSetup::Show() int shortcut = 1; - CMenuForwarder *mf; - -#if 0 bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); +#if 0 bool _mode_webradio = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webradio) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); + CMenuForwarder *mf; + mf = new CMenuForwarder(LOCALE_LIVESTREAM_SCRIPTPATH, !_mode_webtv || !_mode_webradio, g_settings.livestreamScriptPath, this, "script_path", CRCInput::convertDigitToKey(shortcut++)); m->addItem(mf); #endif + CMenuOptionChooser *mc; + if (!webradio) { - mf = new CMenuForwarder(LOCALE_LIVESTREAM_RESOLUTION, true, NULL, new CWebTVResolution(), NULL, CRCInput::convertDigitToKey(shortcut++)); - m->addItem(mf); + mc = new CMenuOptionChooser(LOCALE_LIVESTREAM_RESOLUTION_PREFERED, &g_settings.livestreamResolutionPrefered, LIVESTREAM_RESOLUTION_OPTIONS, LIVESTREAM_RESOLUTION_OPTION_COUNT, true, NULL, CRCInput::convertDigitToKey(shortcut++), "", true); + m->addItem(mc); + + mc = new CMenuOptionChooser(LOCALE_LIVESTREAM_RESOLUTION, &g_settings.livestreamResolution, LIVESTREAM_RESOLUTION_OPTIONS, LIVESTREAM_RESOLUTION_OPTION_COUNT, _mode_webtv, this, CRCInput::convertDigitToKey(shortcut++), "", true); + m->addItem(mc); m->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, webradio ? LOCALE_WEBRADIO_XML : LOCALE_WEBTV_XML)); } @@ -301,6 +320,11 @@ bool CWebChannelsSetup::changeNotify(const neutrino_locale_t OptionName, void */ changed = true; ret = menu_return::RETURN_REPAINT; } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_LIVESTREAM_RESOLUTION)) + { + CWebTVResolution webtvresolution; + webtvresolution.RestartStream(); + } return ret; } @@ -436,20 +460,6 @@ CWebTVResolution::CWebTVResolution() width = 40; } -const CMenuOptionChooser::keyval_ext LIVESTREAM_RESOLUTION_OPTIONS[] = -{ -#if !HAVE_CST_HARDWARE - { 3840, NONEXISTANT_LOCALE, "3840x2160" }, - { 2560, NONEXISTANT_LOCALE, "2560x1440" }, -#endif - { 1920, NONEXISTANT_LOCALE, "1920x1080" }, - { 1280, NONEXISTANT_LOCALE, "1280x720" }, - { 854, NONEXISTANT_LOCALE, "854x480" }, - { 640, NONEXISTANT_LOCALE, "640x360" }, - { 480, NONEXISTANT_LOCALE, "480x270" } -}; -#define LIVESTREAM_RESOLUTION_OPTION_COUNT (sizeof(LIVESTREAM_RESOLUTION_OPTIONS)/sizeof(CMenuOptionChooser::keyval_ext)) - int CWebTVResolution::exec(CMenuTarget *parent, const std::string & /*actionKey*/) { if (parent) @@ -476,19 +486,24 @@ int CWebTVResolution::Show() bool _mode_webtv = (CNeutrinoApp::getInstance()->getMode() == NeutrinoModes::mode_webtv) && (!CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()); + if (oldRes != g_settings.livestreamResolution && _mode_webtv) - { - CZapitChannel *cc = CZapit::getInstance()->GetCurrentChannel(); - if (cc && IS_WEBCHAN(cc->getChannelID())) - { - CMoviePlayerGui::getInstance().stopPlayBack(); - CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName()); - } - } + RestartStream(); return res; } +void CWebTVResolution::RestartStream() +{ + CZapitChannel *cc = CZapit::getInstance()->GetCurrentChannel(); + if (cc && IS_WEBCHAN(cc->getChannelID())) + { + CMoviePlayerGui::getInstance().stopPlayBack(); + CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName()); + } +} + + const char *CWebTVResolution::getResolutionValue() { for (unsigned int i = 0; i < LIVESTREAM_RESOLUTION_OPTION_COUNT; ++i) diff --git a/src/gui/webchannels_setup.h b/src/gui/webchannels_setup.h index 797c969db..944d86325 100644 --- a/src/gui/webchannels_setup.h +++ b/src/gui/webchannels_setup.h @@ -65,6 +65,7 @@ class CWebTVResolution : public CMenuTarget CMenuWidget *m; public: CWebTVResolution(); + void RestartStream(); const char *getResolutionValue(); int exec(CMenuTarget *parent, const std::string &actionKey); int Show(); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index fa056e385..21d433225 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -973,6 +973,7 @@ int CNeutrinoApp::loadSetup(const char *fname) g_settings.xmltv_xml_auto.clear(); g_settings.livestreamResolution = configfile.getInt32("livestreamResolution", 1920); + g_settings.livestreamResolutionPrefered = configfile.getInt32("livestreamResolutionPrefered", 1280); g_settings.livestreamScriptPath = configfile.getString("livestreamScriptPath", WEBTVDIR); // plugins @@ -2030,6 +2031,7 @@ void CNeutrinoApp::saveSetup(const char *fname) configfile.setInt32("xmltv_xml_count", g_settings.xmltv_xml.size()); configfile.setInt32("livestreamResolution", g_settings.livestreamResolution); + configfile.setInt32("livestreamResolutionPrefered", g_settings.livestreamResolutionPrefered); configfile.setString("livestreamScriptPath", g_settings.livestreamScriptPath); // plugins diff --git a/src/system/locals.h b/src/system/locals.h index 150370590..771b91b53 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1263,6 +1263,7 @@ typedef enum LOCALE_LIVESTREAM_HEAD, LOCALE_LIVESTREAM_READ_DATA, LOCALE_LIVESTREAM_RESOLUTION, + LOCALE_LIVESTREAM_RESOLUTION_PREFERED, LOCALE_LIVESTREAM_SCRIPTPATH, LOCALE_LUA_BOOLPARAM_DEPRECATED1, LOCALE_LUA_BOOLPARAM_DEPRECATED2, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 94f5f0073..edc059161 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1263,6 +1263,7 @@ const char * locale_real_names[] = "livestream.head", "livestream.read_data", "livestream.resolution", + "livestream.resolution.prefered", "livestream.scriptpath", "lua.boolparam_deprecated1", "lua.boolparam_deprecated2", diff --git a/src/system/settings.h b/src/system/settings.h index 54ef47f43..a4d3b9ac3 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -755,6 +755,7 @@ struct SNeutrinoSettings std::list xmltv_xml_auto; int livestreamResolution; + int livestreamResolutionPrefered; std::string livestreamScriptPath; // plugins