From 5e8cccbe2356d8095283d26e160e459767f4ac75 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 3 Mar 2016 09:03:59 +0100 Subject: [PATCH] user_menu: get resolution value for livestreams Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5a9bee721d1b5b11369d419c112ea0ccb0e02042 Author: vanhofen Date: 2016-03-03 (Thu, 03 Mar 2016) Origin message was: ------------------ - user_menu: get resolution value for livestreams ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/user_menue.cpp | 33 ++++++++++++++++++++++++--------- src/gui/webtv_setup.cpp | 10 +++++++++- src/gui/webtv_setup.h | 1 + 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/gui/user_menue.cpp b/src/gui/user_menue.cpp index 7cd5a19c8..60e5f6b37 100644 --- a/src/gui/user_menue.cpp +++ b/src/gui/user_menue.cpp @@ -79,10 +79,12 @@ #include #include +#include #include extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ extern CPlugins * g_PluginList; /* neutrino.cpp */ +extern cVideo * videoDecoder; #if !HAVE_SPARK_HARDWARE extern CCAMMenuHandler * g_CamHandler; #endif @@ -525,15 +527,28 @@ const char *CUserMenu::getUserMenuButtonName(int button, bool &active, bool retu case SNeutrinoSettings::ITEM_NONE: case SNeutrinoSettings::ITEM_BAR: case SNeutrinoSettings::ITEM_LIVESTREAM_RESOLUTION: - if(loc == NONEXISTANT_LOCALE && !text) { - /* TODO - get const char *valname from struct - keyval_ext LIVESTREAM_RESOLUTION_OPTIONS - */ - text = to_string(g_settings.livestreamResolution).c_str(); - } else - return_title = true; - active = true; + if (mode == NeutrinoMessages::mode_webtv && !CZapit::getInstance()->GetCurrentChannel()->getScriptName().empty()) { + if(loc == NONEXISTANT_LOCALE && !text) { + CWebTVResolution webtvres; + text = webtvres.getResolutionValue(); + if (!(videoDecoder->getBlank())) + { + int xres = 0, yres = 0, framerate; + videoDecoder->getPictureInfo(xres, yres, framerate); + if (xres && yres) + { + std::string res = to_string(xres) + "x" + to_string(yres); + if (res.compare(text)) + { + std::string tmp = (string)text + " (" + res + ")"; + text = tmp.c_str(); + } + } + } + } else + return_title = true; + active = true; + } continue; case SNeutrinoSettings::ITEM_EPG_MISC: return_title = true; diff --git a/src/gui/webtv_setup.cpp b/src/gui/webtv_setup.cpp index cd8fa5bd8..9e0edf26f 100644 --- a/src/gui/webtv_setup.cpp +++ b/src/gui/webtv_setup.cpp @@ -210,4 +210,12 @@ int CWebTVResolution::Show() return res; } -// vim:ts=4 +const char *CWebTVResolution::getResolutionValue() +{ + for (unsigned int i = 0; i < LIVESTREAM_RESOLUTION_OPTION_COUNT; ++i) + { + if (g_settings.livestreamResolution == LIVESTREAM_RESOLUTION_OPTIONS[i].key) + return LIVESTREAM_RESOLUTION_OPTIONS[i].valname; + } + return ""; +} diff --git a/src/gui/webtv_setup.h b/src/gui/webtv_setup.h index 0a39332bc..698719ee8 100644 --- a/src/gui/webtv_setup.h +++ b/src/gui/webtv_setup.h @@ -48,6 +48,7 @@ class CWebTVResolution : public CMenuTarget CMenuWidget *m; public: CWebTVResolution(); + const char *getResolutionValue(); int exec(CMenuTarget* parent, const std::string & actionKey); int Show(); };