From 70c0b2ae5e63eebdcdca30f868d8421957297dd1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 24 Jan 2017 14:41:30 +0100 Subject: [PATCH 1/3] CTextBox::refreshText: Fix flags for RenderString() v2.0; thx to DboxOldie Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4cfff44e29fc275fea32e3cb0df3f820df4755fa Author: vanhofen Date: 2017-01-24 (Tue, 24 Jan 2017) --- src/gui/widget/textbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 4750de544..cb8bbb1e0 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -713,7 +713,7 @@ void CTextBox::refreshText(void) frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); #endif //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); - m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0)); + m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, (m_renderMode | m_utf8_encoded) ? Font::IS_UTF8 : 0); m_old_cText = m_cText; y += m_nFontTextHeight; } From a05d03b02ccb82fe52fc0359974158a4a03e64b9 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Thu, 26 Jan 2017 11:55:06 +0100 Subject: [PATCH 2/3] movieplayer dont chache last realurl for lua script Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e111bf74187d1c08c4d0ab42a7c70f3ed90af48c Author: Jacek Jendrzej Date: 2017-01-26 (Thu, 26 Jan 2017) --- src/driver/record.cpp | 2 +- src/driver/streamts.cpp | 2 +- src/gui/movieplayer.cpp | 20 ++++++-------------- src/gui/movieplayer.h | 2 +- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index b9ee29bca..f76cecf3b 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -2095,7 +2095,7 @@ bool CStreamRec::Open(CZapitChannel * channel) return false; std::string pretty_name,headers; - if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getChannelID(), channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers)) { + if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, recMovieInfo->epgInfo1, recMovieInfo->epgInfo2,headers)) { printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str()); return false; } diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index e60f4b88c..7efd37d77 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -773,7 +773,7 @@ bool CStreamStream::Open() return false; std::string pretty_name, livestreamInfo1, livestreamInfo2, headers; - if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getChannelID(), channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers)) { + if (!CMoviePlayerGui::getInstance(true).getLiveUrl(channel->getUrl(), channel->getScriptName(), url, pretty_name, livestreamInfo1, livestreamInfo2,headers)) { printf("%s: getLiveUrl() [%s] failed!\n", __FUNCTION__, url.c_str()); return false; } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 95fde689d..c4223a1fe 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -933,10 +933,9 @@ bool CMoviePlayerGui::selectLivestream(std::vector &streamLis return false; } -bool CMoviePlayerGui::getLiveUrl(const t_channel_id chan, const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header) +bool CMoviePlayerGui::getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header) { - static t_channel_id oldChan = 0; - static std::vector liveStreamList; + std::vector liveStreamList; livestream_info_t info; if (script.empty()) { @@ -950,22 +949,15 @@ bool CMoviePlayerGui::getLiveUrl(const t_channel_id chan, const std::string &url size_t pos = _script.find(".lua"); if (!file_exists(_script.c_str()) || (pos == std::string::npos) || (_script.length()-pos != 4)) { - liveStreamList.clear(); printf(">>>>> [%s:%s:%d] script error\n", __file__, __func__, __LINE__); return false; } - if ((oldChan != chan) || liveStreamList.empty()) { - liveStreamList.clear(); - if (!luaGetUrl(_script, url, liveStreamList)) { - liveStreamList.clear(); - printf(">>>>> [%s:%s:%d] lua script error\n", __file__, __func__, __LINE__); - return false; - } - oldChan = chan; + if (!luaGetUrl(_script, url, liveStreamList)) { + printf(">>>>> [%s:%s:%d] lua script error\n", __file__, __func__, __LINE__); + return false; } if (!selectLivestream(liveStreamList, g_settings.livestreamResolution, &info)) { - liveStreamList.clear(); printf(">>>>> [%s:%s:%d] error selectLivestream\n", __file__, __func__, __LINE__); return false; } @@ -1034,7 +1026,7 @@ bool CMoviePlayerGui::PlayBackgroundStart(const std::string &file, const std::st std::string realUrl; std::string _pretty_name = name; cookie_header.clear(); - if (!getLiveUrl(chan, file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header)) { + if (!getLiveUrl(file, script, realUrl, _pretty_name, livestreamInfo1, livestreamInfo2, cookie_header)) { return false; } diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index c87a71d18..b0da2d4c2 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -269,7 +269,7 @@ class CMoviePlayerGui : public CMenuTarget 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; }; - bool getLiveUrl(const t_channel_id chan, const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header); + bool getLiveUrl(const std::string &url, const std::string &script, std::string &realUrl, std::string &_pretty_name, std::string &info1, std::string &info2, std::string &header); }; #endif From 6da7f8645f306c155e03588e526fb9ee22338f65 Mon Sep 17 00:00:00 2001 From: max_10 Date: Sun, 22 Jan 2017 16:25:58 +0100 Subject: [PATCH 3/3] edvbstring: fix utf8 encoding, thx DboxOldie Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/2f1ceb07e224ad1da7921a442b1a9af4e8027a8e Author: max_10 Date: 2017-01-22 (Sun, 22 Jan 2017) Origin message was: ------------------ - edvbstring: fix utf8 encoding, thx DboxOldie --- src/eitd/edvbstring.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/eitd/edvbstring.cpp b/src/eitd/edvbstring.cpp index cb495b1cc..9267630da 100644 --- a/src/eitd/edvbstring.cpp +++ b/src/eitd/edvbstring.cpp @@ -2305,28 +2305,31 @@ const std::string convertLatin1UTF8(const std::string &string) int isUTF8(const std::string &string) { unsigned int len=string.size(); + unsigned char c; for (unsigned int i=0; i < len;) { int trailing = 0; - if (string[i] >> 7 == 0) // 0xxxxxxx + c = string[i] & 0xFF; + + if (c >> 7 == 0) // 0xxxxxxx { i++; continue; } - if (string[i] >> 5 == 6) // 110xxxxx 10xxxxxx + if (c >> 5 == 6) // 110xxxxx 10xxxxxx { if (++i >= len) return 0; trailing = 1; } - else if (string[i] >> 4 == 14) // 1110xxxx 10xxxxxx 10xxxxxx + else if (c >> 4 == 14) // 1110xxxx 10xxxxxx 10xxxxxx { if (++i >= len) return 0; trailing = 2; } - else if ((string[i] >> 3) == 30) // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + else if (c >> 3 == 30) // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx { if (++i >= len) return 0; @@ -2335,7 +2338,7 @@ int isUTF8(const std::string &string) return 0; while (trailing) { - if (i >= len || string[i] >> 6 != 2) + if (i >= len || (string[i] & 0xFF) >> 6 != 2) return 0; trailing--; i++;