Display of livestream infos in IV if no EPG data available

This commit is contained in:
M. Liebmann
2016-03-03 09:04:11 +01:00
parent 66258704bf
commit eb1826ebee
4 changed files with 118 additions and 10 deletions

View File

@@ -162,6 +162,9 @@ void CInfoViewer::Init()
rt_x = rt_y = rt_h = rt_w = 0;
infobar_txt = NULL;
_livestreamInfo1.clear();
_livestreamInfo2.clear();
}
/*
@@ -533,6 +536,10 @@ void CInfoViewer::show_current_next(bool new_chan, int epgpos)
loc = LOCALE_INFOVIEWER_EPGWAIT;
else
loc = LOCALE_INFOVIEWER_EPGNOTLOAD;
_livestreamInfo1.clear();
_livestreamInfo2.clear();
if (!showLivestreamInfo())
display_Info(g_Locale->getText(loc), NULL);
} else {
show_Data ();
@@ -924,6 +931,66 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext)
break;
}
}
bool CInfoViewer::showLivestreamInfo()
{
CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel();
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webtv &&
cc->getEpgID() == 0 && !cc->getScriptName().empty()) {
std::string livestreamInfo1 = "";
std::string livestreamInfo2 = "";
std::string tmp1 = "";
CMoviePlayerGui::getInstance().getLivestreamInfo(&livestreamInfo1, &tmp1);
if (!(videoDecoder->getBlank())) {
int xres, yres, framerate;
std::string tmp2;
videoDecoder->getPictureInfo(xres, yres, framerate);
switch (framerate) {
case 0:
tmp2 = "23.976fps";
break;
case 1:
tmp2 = "24fps";
break;
case 2:
tmp2 = "25fps";
break;
case 3:
tmp2 = "29,976fps";
break;
case 4:
tmp2 = "30fps";
break;
case 5:
tmp2 = "50fps";
break;
case 6:
tmp2 = "50,94fps";
break;
case 7:
tmp2 = "60fps";
break;
default:
tmp2 = g_Locale->getText(LOCALE_STREAMINFO_FRAMERATE_UNKNOWN);
break;
}
livestreamInfo2 = to_string(xres) + "x" + to_string(yres) + ", " + tmp2;
if (!tmp1.empty())
livestreamInfo2 += (std::string)", " + tmp1;
}
if (livestreamInfo1 != _livestreamInfo1 || livestreamInfo2 != _livestreamInfo2) {
display_Info(livestreamInfo1.c_str(), livestreamInfo2.c_str());
_livestreamInfo1 = livestreamInfo1;
_livestreamInfo2 = livestreamInfo2;
infoViewerBB->showBBButtons(true /*paintFooter*/);
}
return true;
}
return false;
}
void CInfoViewer::loop(bool show_dot)
{
bool hideIt = true;
@@ -939,9 +1006,14 @@ void CInfoViewer::loop(bool show_dot)
if (isVolscale)
CVolume::getInstance()->showVolscale();
_livestreamInfo1.clear();
_livestreamInfo2.clear();
while (!(res & (messages_return::cancel_info | messages_return::cancel_all))) {
g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd);
showLivestreamInfo();
#ifdef ENABLE_PIP
if ((msg == (neutrino_msg_t) g_settings.key_pip_close) ||
(msg == (neutrino_msg_t) g_settings.key_pip_setup) ||
@@ -1418,6 +1490,7 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data)
if ((*(t_channel_id *) data) == current_channel_id) {
if (is_visible && showButtonBar) {
infoViewerBB->showIcon_DD();
showLivestreamInfo();
infoViewerBB->showBBButtons(true /*paintFooter*/); // in case button text has changed
}
if (g_settings.radiotext_enable && g_Radiotext && !g_RemoteControl->current_PIDs.APIDs.empty() && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio))

View File

@@ -112,6 +112,8 @@ class CInfoViewer
bool channellogoChange;
uint32_t lcdUpdateTimer;
int zap_mode;
std::string _livestreamInfo1;
std::string _livestreamInfo2;
void paintBackground(int col_Numbox);
void paintHead();
@@ -146,6 +148,8 @@ class CInfoViewer
void reset_allScala();
void check_channellogo_ca_SettingsChange();
void sendNoEpg(const t_channel_id channel_id);
bool showLivestreamInfo();
public:
bool chanready;
bool is_visible;

View File

@@ -203,6 +203,8 @@ void CMoviePlayerGui::Init(void)
m_screensaver = false;
m_idletime = time(NULL);
liveStreamList.clear();
livestreamInfo1.clear();
livestreamInfo2.clear();
}
void CMoviePlayerGui::cutNeutrino()
@@ -888,9 +890,8 @@ 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;
std::string _pretty_name = name;
livestream_info_t info;
if (!_script.empty()) {
if (_script.find("/") == std::string::npos)
@@ -900,25 +901,49 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
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))
if (!luaGetUrl(_script, file, liveStreamList)) {
liveStreamList.clear();
printf(">>>>> [%s:%s:%d] lua script error\n", __file__, __func__, __LINE__);
return false;
}
oldChan = chan;
}
if (!selectLivestream(liveStreamList, g_settings.livestreamResolution, &info))
if (!selectLivestream(liveStreamList, g_settings.livestreamResolution, &info)) {
liveStreamList.clear();
printf(">>>>> [%s:%s:%d] error selectLivestream\n", __file__, __func__, __LINE__);
return false;
}
realUrl = info.url;
if (!info.name.empty()) {
livestreamInfo1 = info.name;
_pretty_name = info.name;
_epgTitle = info.name;
}
#if 0
if (!info.resolution.empty())
_epgTitle += (std::string)" (" + info.resolution + ")";
livestreamInfo2 = info.resolution;
if (info.bandwidth > 0) {
char buf[32];
memset(buf, '\0', sizeof(buf));
snprintf(buf, sizeof(buf), "%.02f kbps", (float)((float)info.bandwidth/(float)1000));
livestreamInfo2 += (std::string)", " + (std::string)buf;
}
else
#else
if (info.bandwidth > 0) {
char buf[32];
memset(buf, '\0', sizeof(buf));
snprintf(buf, sizeof(buf), "%.02f kbps", (float)((float)info.bandwidth/(float)1000));
livestreamInfo2 = (std::string)buf;
}
#endif
}
else {
liveStreamList.clear();
printf(">>>>> [%s:%s:%d] script error\n", __file__, __func__, __LINE__);
return false;
}
}
OpenThreads::ScopedLock<OpenThreads::Mutex> m_lock(mutex);
@@ -932,7 +957,7 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st
instance_bg->file_name = realUrl;
instance_bg->pretty_name = _pretty_name;
instance_bg->movie_info.epgTitle = _epgTitle;
instance_bg->movie_info.epgTitle = name;
instance_bg->movie_info.epgChannel = realUrl;
instance_bg->movie_info.epgId = chan;
instance_bg->p_movie_info = &movie_info;
@@ -959,6 +984,8 @@ void CMoviePlayerGui::stopPlayBack(void)
pthread_join(bgThread, NULL);
bgThread = 0;
}
livestreamInfo1.clear();
livestreamInfo2.clear();
printf("%s: stopped\n", __func__);
}

View File

@@ -94,6 +94,9 @@ class CMoviePlayerGui : public CMenuTarget
int bandwidth;
} livestream_info_struct_t;
std::string livestreamInfo1;
std::string livestreamInfo2;
CFrameBuffer * frameBuffer;
int m_LastMode;
@@ -257,6 +260,7 @@ class CMoviePlayerGui : public CMenuTarget
void setBlockedFromPlugin(bool b) { blockedFromPlugin = b; };
bool getBlockedFromPlugin() { return blockedFromPlugin; };
void setLuaInfoFunc(lua_State* L, bool func) { luaState = L; haveLuaInfoFunc = func; };
void getLivestreamInfo(std::string *i1, std::string *i2) { *i1=livestreamInfo1; *i2=livestreamInfo2; };
};
#endif