From 3f2a0b299cfcb2229717d5e0190eebcfb6f1d2c1 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 29 Sep 2016 18:06:58 +0200 Subject: [PATCH 1/4] movieplayer: fix -Wformat warning; Vol. 2 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/49b0ec3319985caeeaded168717affbb0a6a78d2 Author: vanhofen Date: 2016-09-29 (Thu, 29 Sep 2016) Origin message was: ------------------ - movieplayer: fix -Wformat warning; Vol. 2 --- src/gui/movieplayer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 800ce266b..db641841e 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1380,7 +1380,7 @@ void CMoviePlayerGui::PlayFileLoop(void) } else if (msg == (neutrino_msg_t) g_settings.key_quickzap_up || msg == (neutrino_msg_t) g_settings.key_quickzap_down) { quickZap(msg); } else if (fromInfoviewer && msg == CRCInput::RC_ok && !filelist.empty()) { - printf("CMoviePlayerGui::%s: start playlist movie #%ld\n", __func__, vzap_it - filelist.begin()); + printf("CMoviePlayerGui::%s: start playlist movie #%d\n", __func__, (int)(vzap_it - filelist.begin())); fromInfoviewer = false; playstate = CMoviePlayerGui::STOPPED; filelist_it = vzap_it; @@ -1657,7 +1657,7 @@ void CMoviePlayerGui::PlayFileEnd(bool restore) void CMoviePlayerGui::set_vzap_it(bool up) { - //printf("CMoviePlayerGui::%s: vzap_it: %d count %s\n", __func__, vzap_it - filelist.begin(), up ? "up" : "down"); + //printf("CMoviePlayerGui::%s: vzap_it: %d count %s\n", __func__, (int)(vzap_it - filelist.begin()), up ? "up" : "down"); if (up) { if (vzap_it < (filelist.end() - 1)) @@ -1668,7 +1668,7 @@ void CMoviePlayerGui::set_vzap_it(bool up) if (vzap_it > filelist.begin()) --vzap_it; } - //printf("CMoviePlayerGui::%s: vzap_it: %d\n", __func__, vzap_it - filelist.begin()); + //printf("CMoviePlayerGui::%s: vzap_it: %d\n", __func__, (int)(vzap_it - filelist.begin())); } void CMoviePlayerGui::callInfoViewer(bool init_vzap_it) From 7f1e2312a638dded80a2c373f2cfa128dee23b52 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 29 Sep 2016 23:53:26 +0200 Subject: [PATCH 2/4] imageinfo_ni: allow fade in/out Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ba563ea939f7dcba603eec015f6ddb95be7788f6 Author: vanhofen Date: 2016-09-29 (Thu, 29 Sep 2016) Origin message was: ------------------ - imageinfo_ni: allow fade in/out --- src/gui/imageinfo_ni.cpp | 63 +++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 14 deletions(-) diff --git a/src/gui/imageinfo_ni.cpp b/src/gui/imageinfo_ni.cpp index a5c22102b..14c1f25a3 100644 --- a/src/gui/imageinfo_ni.cpp +++ b/src/gui/imageinfo_ni.cpp @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -143,45 +144,72 @@ int CImageInfoNI::exec(CMenuTarget* parent, const std::string &) parent->hide(); neutrino_msg_t msg; - _stat cpu; + neutrino_msg_t postmsg = 0; + _stat cpu; cpu.usr = 0; cpu.nice = 0; cpu.system = 0; cpu.idle = 0; + sigBox_pos = 0; + COSDFader fader(g_settings.theme.menu_Content_alpha); + fader.StartFadeIn(); + bool fadeout = false; paint(); - paint_pig (xcpu, y + 10, width/3, height/3); + paint_pig(xcpu, y + 10, width/3, height/3); StartInfoThread(); while (1) { neutrino_msg_data_t data; uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS(100); - g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); + g_RCInput->getMsgAbsoluteTimeout(&msg, &data, &timeoutEnd); - if(msg == CRCInput::RC_setup) { - res = menu_return::RETURN_EXIT_ALL; - break; + if ((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) + { + if (fader.FadeDone()) + { + break; + } } - else if (CNeutrinoApp::getInstance()->listModeKey(msg)) { - g_RCInput->postMsg (msg, 0); + else if (msg == CRCInput::RC_setup) + { res = menu_return::RETURN_EXIT_ALL; - break; + fadeout = true; } - else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { - CNeutrinoApp::getInstance ()->handleMsg (msg, data); + else if (CNeutrinoApp::getInstance()->listModeKey(msg)) + { + postmsg = msg; + res = menu_return::RETURN_EXIT_ALL; + fadeout = true; + } + else if (msg == (neutrino_msg_t) g_settings.key_screenshot) + { + CNeutrinoApp::getInstance()->handleMsg(msg, data); continue; } else if (msg <= CRCInput::RC_MaxRC) { - break; + fadeout = true; } - if ( msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) + if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) { - CNeutrinoApp::getInstance()->handleMsg( msg, data ); + CNeutrinoApp::getInstance()->handleMsg(msg, data); + } + + if (fadeout && msg == CRCInput::RC_timeout) + { + if (fader.StartFadeOut()) + { + msg = 0; + } + else + { + break; + } } Stat_Info(&cpu); @@ -189,7 +217,14 @@ int CImageInfoNI::exec(CMenuTarget* parent, const std::string &) } StopInfoThread(); + hide(); + fader.StopFade(); + + if (postmsg) + { + g_RCInput->postMsg(postmsg, 0); + } return res; } From 1734d4e3ef386c5ce2d5a67ada298c2fe5a89f5f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 29 Sep 2016 23:58:18 +0200 Subject: [PATCH 3/4] fade: fix flickering on HD2 hardware; ported from TangoCash's repo Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/934ad685202e7b4aaa05f547d0c059d8ca8a543e Author: vanhofen Date: 2016-09-29 (Thu, 29 Sep 2016) Origin message was: ------------------ - fade: fix flickering on HD2 hardware; ported from TangoCash's repo --- src/driver/fade.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/driver/fade.cpp b/src/driver/fade.cpp index 92a5fbe40..ae0fffd58 100644 --- a/src/driver/fade.cpp +++ b/src/driver/fade.cpp @@ -28,7 +28,7 @@ #include #include -#ifdef HAVE_COOL_HARDWARE +#if HAVE_COOL_HARDWARE #include #endif @@ -61,6 +61,9 @@ void COSDFader::StartFadeIn() #endif frameBuffer->setBlendLevel(fadeValue); +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) + usleep(60000); +#endif fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); } @@ -90,10 +93,12 @@ void COSDFader::StopFade() if ( fadeIn || fadeOut ) { g_RCInput->killTimer(fadeTimer); #ifdef BOXMODEL_APOLLO - usleep(40000); frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) + usleep(60000); +#endif #endif fadeIn = fadeOut = false; } @@ -122,6 +127,9 @@ bool COSDFader::FadeDone() frameBuffer->setBlendMode(CNXTFB_BLEND_MODE_PER_PIXEL); // Global alpha multiplied with pixel alpha #else frameBuffer->setBlendMode(1); // Global alpha multiplied with pixel alpha +#if HAVE_SPARK_HARDWARE || HAVE_DUCKBOX_HARDWARE || (HAVE_COOL_HARDWARE && defined(BOXMODEL_APOLLO)) + usleep(60000); +#endif #endif } else frameBuffer->setBlendLevel(fadeValue); From 51e872dab98fca3c7d811210519719298f039c02 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Fri, 30 Sep 2016 00:02:01 +0200 Subject: [PATCH 4/4] streaminfo2: allow fade in/out Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6cff0d23ce26e62c4c215d61cbc0399066d0ce56 Author: vanhofen Date: 2016-09-30 (Fri, 30 Sep 2016) Origin message was: ------------------ - streaminfo2: allow fade in/out --- src/gui/streaminfo2.cpp | 42 ++++++++++++++++++++++++++++++++++++----- src/gui/streaminfo2.h | 2 ++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 586fdcfd5..dacb6fdd1 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -55,7 +56,7 @@ extern cAudio * audioDecoder; extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ -CStreamInfo2::CStreamInfo2 () +CStreamInfo2::CStreamInfo2() : fader(g_settings.theme.menu_Content_alpha) { frameBuffer = CFrameBuffer::getInstance (); pip = NULL; @@ -121,9 +122,11 @@ int CStreamInfo2::exec (CMenuTarget * parent, const std::string &) frontend = CFEManager::getInstance()->getLiveFE(); + fader.StartFadeIn(); paint (paint_mode); int res = doSignalStrengthLoop (); hide (); + fader.StopFade(); return res; } @@ -133,7 +136,9 @@ int CStreamInfo2::doSignalStrengthLoop () #define BAR_HEIGHT 12 int res = menu_return::RETURN_REPAINT; + bool fadeout = false; neutrino_msg_t msg; + neutrino_msg_t postmsg = 0; uint64_t maxb, minb, lastb, tmp_rate; unsigned int current_pmt_version= pmt_version; int cnt = 0; @@ -150,6 +155,27 @@ int CStreamInfo2::doSignalStrengthLoop () uint64_t timeoutEnd = CRCInput::calcTimeoutEnd_MS (100); g_RCInput->getMsgAbsoluteTimeout (&msg, &data, &timeoutEnd); + if ((msg == NeutrinoMessages::EVT_TIMER) && (data == fader.GetFadeTimer())) + { + if (fader.FadeDone()) + { + break; + } + continue; + } + if (fadeout && msg == CRCInput::RC_timeout) + { + if (fader.StartFadeOut()) + { + msg = 0; + continue; + } + else + { + break; + } + } + if (!mp) { signal.sig = frontend->getSignalStrength() & 0xFFFF; signal.snr = frontend->getSignalNoiseRatio() & 0xFFFF; @@ -236,12 +262,12 @@ int CStreamInfo2::doSignalStrengthLoop () } else if(msg == CRCInput::RC_setup) { res = menu_return::RETURN_EXIT_ALL; - break; + fadeout = true; } else if(CNeutrinoApp::getInstance()->listModeKey(msg)) { - g_RCInput->postMsg (msg, 0); + postmsg = msg; res = menu_return::RETURN_EXIT_ALL; - break; + fadeout = true; } else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { CNeutrinoApp::getInstance ()->handleMsg (msg, data); @@ -250,7 +276,7 @@ int CStreamInfo2::doSignalStrengthLoop () // -- any key --> abort if (msg <= CRCInput::RC_MaxRC) - break; + fadeout = true; // -- push other events if (msg > CRCInput::RC_MaxRC && msg != CRCInput::RC_timeout) @@ -259,6 +285,12 @@ int CStreamInfo2::doSignalStrengthLoop () delete signalbox; signalbox = NULL; ts_close (); + + if (postmsg) + { + g_RCInput->postMsg(postmsg, 0); + } + return res; } diff --git a/src/gui/streaminfo2.h b/src/gui/streaminfo2.h index f0808e9d1..ca7019659 100644 --- a/src/gui/streaminfo2.h +++ b/src/gui/streaminfo2.h @@ -31,6 +31,7 @@ #include +class COSDFader; class CStreamInfo2 : public CMenuTarget { private: @@ -39,6 +40,7 @@ class CStreamInfo2 : public CMenuTarget CFrontend *frontend; CComponentsPIP * pip; CMoviePlayerGui *mp; + COSDFader fader; int x; int y; int width;