From ed047027d1d5b31409a023e636ebcef8ac77cde5 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sun, 12 Feb 2017 17:29:30 +0100 Subject: [PATCH 01/36] configure.ac: bump revision to 3.4.2 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/73e710a9172159ebcfdcc2cb1d07fa6c886b45db Author: Michael Liebmann Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 55b5103db..6da3d63c6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(Tuxbox-Neutrino,3.4.1) +AC_INIT(Tuxbox-Neutrino,3.4.2) AM_INIT_AUTOMAKE([1.0.1 nostdinc]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) From 8fad420914ac67e28b635d320635273742c85671 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 11:25:24 +0100 Subject: [PATCH 02/36] remove udpstreampes from build, it's unlikely to work anyway Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2f36a0900c30ee95555f84c0e5eda706845e3fcb Author: Stefan Seyfried Date: 2017-02-11 (Sat, 11 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/zapit/src/Makefile.am | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/zapit/src/Makefile.am b/src/zapit/src/Makefile.am index 0130f3a8a..96e700284 100644 --- a/src/zapit/src/Makefile.am +++ b/src/zapit/src/Makefile.am @@ -34,7 +34,6 @@ libzapit_a_SOURCES = \ zapit.cpp bin_PROGRAMS = pzapit -sbin_PROGRAMS = udpstreampes pzapit_SOURCES = \ pzapit.cpp @@ -44,12 +43,3 @@ pzapit_LDADD = \ $(top_builddir)/lib/connection/libtuxbox-connection.a \ -lOpenThreads \ -lpthread - -udpstreampes_SOURCES = \ - udpstreampes.cpp - -udpstreampes_LDADD = \ - $(top_builddir)/src/zapit/lib/libzapitclient.a \ - $(top_builddir)/lib/connection/libtuxbox-connection.a \ - -lOpenThreads \ - -lpthread From fc5d95a4d01ddcb2608deb5cf128b2f8cd77fc2c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 14:42:15 +0100 Subject: [PATCH 03/36] remove unnecessary sectionsdclient.h includes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c14c15ea24a1776c374ba0967bb41df6199ddf2b Author: Stefan Seyfried Date: 2017-02-11 (Sat, 11 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/epgview.h | 2 -- src/gui/eventlist.h | 1 - src/gui/infoviewer_bb.h | 2 -- src/nhttpd/tuxboxapi/neutrinoapi.h | 1 - 4 files changed, 6 deletions(-) diff --git a/src/gui/epgview.h b/src/gui/epgview.h index 4fe60f9de..b66360d44 100644 --- a/src/gui/epgview.h +++ b/src/gui/epgview.h @@ -39,8 +39,6 @@ #include #include "widget/menue.h" -#include - #include #include diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index c0c15af52..90542ba26 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -28,7 +28,6 @@ #define __EVENTLIST_HPP__ #include -#include #include #include diff --git a/src/gui/infoviewer_bb.h b/src/gui/infoviewer_bb.h index e664e516d..753e32a2e 100644 --- a/src/gui/infoviewer_bb.h +++ b/src/gui/infoviewer_bb.h @@ -33,8 +33,6 @@ #ifndef __infoview_bb__ #define __infoview_bb__ -#include - #include #include #include diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.h b/src/nhttpd/tuxboxapi/neutrinoapi.h index 82c9abbf3..5936e194b 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/neutrinoapi.h @@ -7,7 +7,6 @@ // tuxbox #include -#include #include #include From c5cd92dd8c4f401411bb6d63e841bad794f5ff60 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 14:45:37 +0100 Subject: [PATCH 04/36] sectionsdclient: remove unused scanMode variable Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/96f86f974e188cbc6ac247476f7af93e7273987f Author: Stefan Seyfried Date: 2017-02-11 (Sat, 11 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/sectionsdclient/sectionsdMsg.h | 2 -- lib/sectionsdclient/sectionsdclient.cpp | 1 - lib/sectionsdclient/sectionsdclient.h | 1 - 3 files changed, 4 deletions(-) diff --git a/lib/sectionsdclient/sectionsdMsg.h b/lib/sectionsdclient/sectionsdMsg.h index 440feabae..fb71f8322 100644 --- a/lib/sectionsdclient/sectionsdMsg.h +++ b/lib/sectionsdclient/sectionsdMsg.h @@ -92,7 +92,6 @@ struct sectionsd struct commandSetConfig { - int scanMode; int epg_cache; int epg_old_events; unsigned int epg_max_events; @@ -327,7 +326,6 @@ struct sectionsd // // setConfig // data of request: -// int scanMode; -> updating of services and bouquets -> saved in auto_scanning // int epg_cache; -> in days -> saved in secondsToCache // int epg_old_events; -> in hours -> saved in oldEventsAre // unsigned int epg_max_events; -> #of saved events -> saved in max_events diff --git a/lib/sectionsdclient/sectionsdclient.cpp b/lib/sectionsdclient/sectionsdclient.cpp index c6be1fac2..a8a3c4648 100644 --- a/lib/sectionsdclient/sectionsdclient.cpp +++ b/lib/sectionsdclient/sectionsdclient.cpp @@ -199,7 +199,6 @@ void CSectionsdClient::setConfig(const epg_config config) char* pData = new char[sizeof(sectionsd::commandSetConfig) + config.network_ntpserver.length() + 1 + config.epg_dir.length() + 1]; msg = (sectionsd::commandSetConfig *)pData; - msg->scanMode = config.scanMode; msg->epg_cache = config.epg_cache; msg->epg_old_events = config.epg_old_events; msg->epg_max_events = config.epg_max_events; diff --git a/lib/sectionsdclient/sectionsdclient.h b/lib/sectionsdclient/sectionsdclient.h index c827d83b5..8ba8dfab0 100644 --- a/lib/sectionsdclient/sectionsdclient.h +++ b/lib/sectionsdclient/sectionsdclient.h @@ -154,7 +154,6 @@ class CSectionsdClient : private CBasicClient typedef struct { - int scanMode; int epg_cache; int epg_old_events; int epg_max_events; From 54ca471493163512c98e6553f63782d7e3b81eb9 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 18:52:39 +0100 Subject: [PATCH 05/36] fb_accel_td: implement setBlendMode/Level Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/67387a13c6a543db87138d0c8a216e6a94ef63b3 Author: Stefan Seyfried Date: 2017-02-11 (Sat, 11 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 2 ++ src/driver/fb_accel_td.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index d67dc75d0..54736d331 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -169,6 +169,8 @@ class CFbAccelTD void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp); void waitForIdle(const char *func = NULL); + void setBlendMode(uint8_t); + void setBlendLevel(int); }; #endif diff --git a/src/driver/fb_accel_td.cpp b/src/driver/fb_accel_td.cpp index 7cddcfa3c..af3bf8f60 100644 --- a/src/driver/fb_accel_td.cpp +++ b/src/driver/fb_accel_td.cpp @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -143,6 +144,7 @@ void CFbAccelTD::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t void CFbAccelTD::init(const char *) { CFrameBuffer::init(); + fcntl(fd, F_SETFD, FD_CLOEXEC); if (lfb == NULL) { printf(LOGTAG "CFrameBuffer::init() failed.\n"); return; /* too bad... */ @@ -174,3 +176,29 @@ int CFbAccelTD::setMode(unsigned int, unsigned int, unsigned int) backbuffer = lfb; /* will not work well, but avoid crashes */ return 0; } + +void CFbAccelTD::setBlendMode(uint8_t mode) +{ + Stb04GFXOsdControl g; + ioctl(gfxfd, STB04GFX_OSD_GETCONTROL, &g); + g.use_global_alpha = (mode == 2); /* 1 == pixel alpha, 2 == global alpha */ + ioctl(gfxfd, STB04GFX_OSD_SETCONTROL, &g); +} + +void CFbAccelTD::setBlendLevel(int level) +{ + /* this is bypassing directfb, but faster and easier */ + Stb04GFXOsdControl g; + ioctl(gfxfd, STB04GFX_OSD_GETCONTROL, &g); + if (g.use_global_alpha == 0) + return; + + if (level < 0 || level > 100) + return; + + /* this is the same as convertSetupAlpha2Alpha(), but non-float */ + g.global_alpha = 255 - (255 * level / 100); + ioctl(gfxfd, STB04GFX_OSD_SETCONTROL, &g); + if (level == 100) // sucks + usleep(20000); +} From 5dbbb152cb79532ccb3800ad7e4ace1771af7512 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sat, 11 Feb 2017 18:54:50 +0100 Subject: [PATCH 06/36] fb_generic: initialization and deinitialization fixes * initialize variables locked and cache_size in constructor * set lfb pointer to NULL after munmap(), fd to -1 after close * remove unused tty fd close() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1dd47e00c0f7ba34d8b76888136b4ffd301b2bb0 Author: Stefan Seyfried Date: 2017-02-11 (Sat, 11 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 0c7df12e4..ddce37dfd 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -82,6 +82,7 @@ CFrameBuffer::CFrameBuffer() fb_name = "generic framebuffer"; iconBasePath = ""; available = 0; + cache_size = 0; cmap.start = 0; cmap.len = 256; cmap.red = red; @@ -93,6 +94,7 @@ CFrameBuffer::CFrameBuffer() background = NULL; backupBackground = NULL; backgroundFilename = ""; + locked = false; fd = 0; tty = 0; m_transparent_default = CFrameBuffer::TM_BLACK; // TM_BLACK: Transparency when black content ('pseudo' transparency) @@ -173,8 +175,6 @@ void CFrameBuffer::init(const char * const fbDevice) goto nolfb; } - cache_size = 0; - /* Windows Colors */ paletteSetColor(0x1, 0x010101, tr); paletteSetColor(0x2, 0x800000, tr); @@ -235,13 +235,14 @@ CFrameBuffer::~CFrameBuffer() if (lfb) munmap(lfb, available); + lfb = NULL; if (virtual_fb){ delete[] virtual_fb; virtual_fb = NULL; } close(fd); - close(tty); + fd = -1; v_fbarea.clear(); } From 7c36e9c08037a911c52541ba78395497782c271f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 11:48:01 +0100 Subject: [PATCH 07/36] zapit: speed up scan by skipping unsupported delivery systems Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e810bfe30b02fde1be7ac87d6073b66295cf6af8 Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/zapit/src/scan.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/zapit/src/scan.cpp b/src/zapit/src/scan.cpp index 150bf5b08..29d59eea8 100644 --- a/src/zapit/src/scan.cpp +++ b/src/zapit/src/scan.cpp @@ -137,6 +137,11 @@ void CServiceScan::CleanAllMaps() bool CServiceScan::tuneFrequency(FrontendParameters *feparams, t_satellite_position satellitePosition) { + if (! frontend->supportsDelivery(feparams->delsys)) { + printf("[scan] [fe%d] does not support delivery system %d, skipping\n", + frontend->getNumber(), feparams->delsys); + return false; + } frontend->setInput(satellitePosition, feparams->frequency, feparams->polarization); int ret = frontend->driveToSatellitePosition(satellitePosition, false); //true); if(ret > 0) { From 001c4e7d05b53bdc6719970f6ec15a5bade24427 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 12:05:03 +0100 Subject: [PATCH 08/36] getservices: don't update channels if only scrambling changed Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5ca3ccaa5d57dad1d81228f13cbcb87da15e432b Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/zapit/src/getservices.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index 96ad485af..5bb5d24aa 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -1103,7 +1103,11 @@ bool CServiceManager::CopyCurrentServices(transponder_id_t tpid) updated = true; printf("CServiceManager::CopyCurrentServices: [%s] add\n", cI->second.getName().c_str()); } else { - if(cI->second.scrambled != aI->second.scrambled || cI->second.getName() != aI->second.getName()) { + if (cI->second.getName() != aI->second.getName() +#ifdef UPDATE_CHANNELS_ON_SCRAMBLED_CHANGE + || cI->second.scrambled != aI->second.scrambled +#endif + ) { aI->second.setName(cI->second.getName()); aI->second.scrambled = cI->second.scrambled; aI->second.flags = CZapitChannel::UPDATED; @@ -1211,7 +1215,11 @@ bool CServiceManager::SaveCurrentServices(transponder_id_t tpid) if(ccI == allchans.end()) { WriteCurrentService(fd, satfound, tpdone, updated, satstr, tI->second, cI->second, "add"); } else { - if(strcmp(cI->second.getRealname().c_str(), ccI->second.getRealname().c_str()) || cI->second.scrambled != ccI->second.scrambled) { + if (strcmp(cI->second.getRealname().c_str(), ccI->second.getRealname().c_str()) +#ifdef UPDATE_CHANNELS_ON_SCRAMBLED_CHANGE + || cI->second.scrambled != ccI->second.scrambled +#endif + ) { cI->second.number = ccI->second.number; WriteCurrentService(fd, satfound, tpdone, updated, satstr, tI->second, cI->second, "replace"); } From 5cc48eb30a87904931cfcbe0eee942bb1a45799c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 14:09:40 +0100 Subject: [PATCH 09/36] cc: reduce impact of cc_draw header from 161 to 4 files Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/58c6dbf4694fd3e8fa8c1d03c052a4207491ba51 Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.cpp | 3 ++- src/gui/components/cc_draw.h | 2 +- src/gui/components/cc_frm_clock.cpp | 1 + src/gui/components/cc_frm_clock.h | 2 +- src/gui/widget/hintbox.cpp | 1 + 5 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index b9035e8db..cedebc332 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -25,6 +25,7 @@ #include #include #include "cc_draw.h" +#include "cc_timer.h" #include #include @@ -794,4 +795,4 @@ bool CCDraw::cancelBlink(bool keep_on_screen) return res; -} \ No newline at end of file +} diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index a144433ec..50be8a71d 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -27,7 +27,6 @@ #include "cc_types.h" #include "cc_signals.h" -#include "cc_timer.h" #include #include #include @@ -38,6 +37,7 @@ Basic paint attributes and member functions for component classes */ +class CComponentsTimer; class CCDraw : public COSDFader, public CComponentsSignals { protected: diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index b52180456..531c1af89 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -29,6 +29,7 @@ #include #include "cc_frm_clock.h" +#include "cc_timer.h" #include #include diff --git a/src/gui/components/cc_frm_clock.h b/src/gui/components/cc_frm_clock.h index 22da0af26..23eb726ce 100644 --- a/src/gui/components/cc_frm_clock.h +++ b/src/gui/components/cc_frm_clock.h @@ -34,13 +34,13 @@ #include #include "cc_base.h" #include "cc_frm.h" -#include "cc_timer.h" #include "cc_text_screen.h" //! Sub class of CComponents. Show clock with digits on screen. /*! Usable as simple fixed display or as ticking clock. */ +class CComponentsTimer; class CComponentsFrmClock : public CComponentsForm, public CCTextScreen { private: diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 9e367f4d2..4b61201ce 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -34,6 +34,7 @@ #include #include #include "hintbox.h" +#include #include #include From e71631fd8b6e022701b4a3a5ba6ffe7f2dc14ab5 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 14:46:42 +0100 Subject: [PATCH 10/36] CComponentsTimer: allow to set a thread name Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/6fdd920e4289ad926c2609049da549b97ee5965f Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_timer.cpp | 5 ++++- src/gui/components/cc_timer.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_timer.cpp b/src/gui/components/cc_timer.cpp index 11ae9b35e..a7b7e13ca 100644 --- a/src/gui/components/cc_timer.cpp +++ b/src/gui/components/cc_timer.cpp @@ -33,11 +33,13 @@ #include #include #include +#include using namespace std; CComponentsTimer::CComponentsTimer(const int& interval, bool is_nano) { + name = "unnamed"; tm_thread = 0; tm_interval = interval; tm_enable_nano = is_nano; @@ -56,7 +58,8 @@ CComponentsTimer::~CComponentsTimer() void CComponentsTimer::runSharedTimerAction() { //start loop - + string tn = "cc:"+name; + set_threadname(tn.c_str()); while(tm_enable && tm_interval > 0) { tm_mutex.lock(); OnTimer(); diff --git a/src/gui/components/cc_timer.h b/src/gui/components/cc_timer.h index 530224f40..c7e2d21cd 100644 --- a/src/gui/components/cc_timer.h +++ b/src/gui/components/cc_timer.h @@ -63,6 +63,9 @@ class CComponentsTimer : public sigc::trackable ///flag to control thread state bool tm_enable; + ///name for the thread + std::string name; + ///mutex for timer OpenThreads::Mutex tm_mutex; ///slot for restart signals @@ -120,6 +123,13 @@ class CComponentsTimer : public sigc::trackable */ void setTimerInterval(const int& interval, bool is_nano = false); + /**set thread name + * @param[in] thread name + * @return + * void + */ + void setThreadName(const std::string& n) { name = n; }; + /**Provides a signal handler to receive any function or methode. * Use this in your class where ever you need time controled actions. * From 184f520208023c92f26d4b4bba8b7a494c271fe6 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 15:17:32 +0100 Subject: [PATCH 11/36] set useful thread names for all spawned threads Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5188f721c4ecd77dbaeb337a23f05aa49cb9ca16 Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libdvbsub/dvbsub.cpp | 4 +++- lib/libtuxtxt/tuxtxt.cpp | 2 ++ lib/libtuxtxt/tuxtxt_common.h | 2 ++ src/driver/audioplay.cpp | 2 ++ src/driver/lcdd.cpp | 2 ++ src/driver/netfile.cpp | 2 ++ src/driver/shutdown_count.cpp | 2 ++ src/eitd/sectionsd.cpp | 1 + src/gui/components/cc_draw.cpp | 1 + src/gui/components/cc_frm_clock.cpp | 1 + src/gui/widget/hintbox.cpp | 5 +++-- src/nhttpd/yhttpd_core/ywebserver.cpp | 2 +- src/timerd/timerd.cpp | 3 ++- src/timerd/timermanager.cpp | 3 ++- 14 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/libdvbsub/dvbsub.cpp b/lib/libdvbsub/dvbsub.cpp index a0f061202..828f09849 100644 --- a/lib/libdvbsub/dvbsub.cpp +++ b/lib/libdvbsub/dvbsub.cpp @@ -15,6 +15,7 @@ #include "PacketQueue.hpp" #include "helpers.hpp" #include "dvbsubtitle.h" +#include #define Log2File printf #define RECVBUFFER_STEPSIZE 1024 @@ -243,6 +244,7 @@ static void* reader_thread(void * /*arg*/) int len; uint16_t packlen; uint8_t* buf; + set_threadname("dvbsub:reader"); dmx = new cDemux(0); dmx->Open(DMX_PES_CHANNEL, NULL, 64*1024); @@ -339,7 +341,7 @@ static void* dvbsub_thread(void* /*arg*/) { struct timespec restartWait; struct timeval now; - + set_threadname("dvbsub:main"); sub_debug.print(Debug::VERBOSE, "%s started\n", __FUNCTION__); if (!dvbSubtitleConverter) dvbSubtitleConverter = new cDvbSubtitleConverter; diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 91722ee88..e2a5bd5fd 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -19,6 +19,7 @@ #include #include #include +#include /* same as in rcinput.h... */ #define KEY_TTTV KEY_FN_1 @@ -1510,6 +1511,7 @@ static void cleanup_fb_pan() static void* reader_thread(void * /*arg*/) { printf("TuxTxt subtitle thread started\n"); + set_threadname("tuxtxt:reader"); reader_running = 1; //ttx_paused = 0; while(reader_running) { diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h index 7f95dbc41..8a99bd2b5 100644 --- a/lib/libtuxtxt/tuxtxt_common.h +++ b/lib/libtuxtxt/tuxtxt_common.h @@ -12,6 +12,7 @@ #endif #include +#include tuxtxt_cache_struct tuxtxt_cache; static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER; @@ -587,6 +588,7 @@ void *tuxtxt_CacheThread(void * /*arg*/) unsigned char pagedata[9][23*40]; tstPageinfo *pageinfo_thread; + set_threadname("tuxtxt:cache"); printf("TuxTxt running thread...(%04x)\n",tuxtxt_cache.vtxtpid); tuxtxt_cache.receiving = 1; nice(3); diff --git a/src/driver/audioplay.cpp b/src/driver/audioplay.cpp index 4359956ba..956319297 100644 --- a/src/driver/audioplay.cpp +++ b/src/driver/audioplay.cpp @@ -43,6 +43,7 @@ #include #include #include // UTF8 +#include void CAudioPlayer::stop() { @@ -88,6 +89,7 @@ CAudioPlayer* CAudioPlayer::getInstance() void* CAudioPlayer::PlayThread( void* /*dummy*/ ) { int soundfd = -1; + set_threadname("audio:play"); g_RCInput->close_click(); /* Decode stdin to stdout. */ CBaseDec::RetCode Status = diff --git a/src/driver/lcdd.cpp b/src/driver/lcdd.cpp index 74193ed4b..3ff7e111c 100644 --- a/src/driver/lcdd.cpp +++ b/src/driver/lcdd.cpp @@ -47,6 +47,7 @@ #include #include +#include #include extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */ @@ -139,6 +140,7 @@ void CLCD::wake_up() { #ifndef BOXMODEL_DM500 void* CLCD::TimeThread(void *) { + set_threadname("lcd:time"); while(1) { sleep(1); diff --git a/src/driver/netfile.cpp b/src/driver/netfile.cpp index f7ac9658e..12270fb93 100644 --- a/src/driver/netfile.cpp +++ b/src/driver/netfile.cpp @@ -108,6 +108,7 @@ #include #include #include +#include /* TODO: - ICECAST support @@ -1603,6 +1604,7 @@ void CacheFillThread(void *c) if(scache->closed) return; + set_threadname("netfile:cache"); dprintf(stderr, "CacheFillThread: thread started, using stream %p\n", scache->fd); buf = (char*)malloc(CACHEBTRANS); diff --git a/src/driver/shutdown_count.cpp b/src/driver/shutdown_count.cpp index 0bd113656..9bba124cf 100644 --- a/src/driver/shutdown_count.cpp +++ b/src/driver/shutdown_count.cpp @@ -35,6 +35,7 @@ #include #include #include +#include SHTDCNT::SHTDCNT() @@ -55,6 +56,7 @@ SHTDCNT* SHTDCNT::getInstance() void* SHTDCNT::TimeThread(void *) { + set_threadname("n:shtdcnt"); while(1) { sleep(1); diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 38b9300e1..7095a6b03 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -2067,6 +2067,7 @@ static void print_meminfo(void) static void *houseKeepingThread(void *) { int count = 0, scount = 0, ecount = 0; + set_threadname("sd:housekeeping"); dprintf("housekeeping-thread started.\n"); pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0); diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index cedebc332..9ca52c03c 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -775,6 +775,7 @@ bool CCDraw::paintBlink(const int& interval, bool is_nano) { if (cc_draw_timer == NULL) cc_draw_timer = new CComponentsTimer(interval, is_nano); + cc_draw_timer->setThreadName(__func__); return paintBlink(cc_draw_timer); } diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 531c1af89..0f4329ea3 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -321,6 +321,7 @@ bool CComponentsFrmClock::startClock() if (cl_timer == NULL){ cl_timer = new CComponentsTimer(0); + cl_timer->setThreadName("frmClock"); if (cl_timer->OnTimer.empty()){ dprintf(DEBUG_INFO,"\033[33m[CComponentsFrmClock]\t[%s] init slot...\033[0m\n", __func__); cl_timer->OnTimer.connect(cl_sl_show); diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 4b61201ce..45ef2b6ed 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -188,8 +188,10 @@ void CHintBox::enableTimeOutBar(bool enable) timeout_pb = new CProgressBar(); timeout_pb->setDimensionsAll(ccw_body->getRealXPos(), ccw_body->getRealYPos(), ccw_body->getWidth(), TIMEOUT_BAR_HEIGHT); timeout_pb->setValues(0, 100*timeout); - if (!timeout_pb_timer) + if (!timeout_pb_timer) { timeout_pb_timer = new CComponentsTimer(1, true); + timeout_pb_timer->setThreadName("hb:tmoutbar"); + } timeout_pb_timer->OnTimer.connect(sigc::mem_fun0(this, &CHintBox::showTimeOutBar)); timeout_pb_timer->startTimer(); } @@ -200,7 +202,6 @@ int CHintBox::exec() neutrino_msg_t msg; neutrino_msg_data_t data; int res = messages_return::none; - if (timeout == NO_TIMEOUT || timeout == DEFAULT_TIMEOUT) timeout = HINTBOX_DEFAULT_TIMEOUT; diff --git a/src/nhttpd/yhttpd_core/ywebserver.cpp b/src/nhttpd/yhttpd_core/ywebserver.cpp index 0a8b4d77a..e1a5f149d 100644 --- a/src/nhttpd/yhttpd_core/ywebserver.cpp +++ b/src/nhttpd/yhttpd_core/ywebserver.cpp @@ -118,7 +118,7 @@ CWebserver::~CWebserver() { #define MAX_TIMEOUTS_TO_CLOSE 10 #define MAX_TIMEOUTS_TO_TEST 100 bool CWebserver::run(void) { - set_threadname(__func__); + set_threadname("ywebsrv::run"); if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) { if (port != 80) { fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port); diff --git a/src/timerd/timerd.cpp b/src/timerd/timerd.cpp index 6589e62c0..385afac85 100644 --- a/src/timerd/timerd.cpp +++ b/src/timerd/timerd.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include "debug.h" #include "timermanager.h" @@ -480,7 +481,7 @@ bool timerd_parse_command(CBasicMessage::Header &rmsg, int connfd) int timerd_main_thread(void *data) { pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, 0); - + set_threadname("n:timerd"); printf("timerd startup, tid %ld\n", syscall(__NR_gettid)); CBasicServer timerd_server; diff --git a/src/timerd/timermanager.cpp b/src/timerd/timermanager.cpp index fec447b79..8998ea2d2 100644 --- a/src/timerd/timermanager.cpp +++ b/src/timerd/timermanager.cpp @@ -42,7 +42,7 @@ #include "debug.h" #include "timermanager.h" - +#include extern bool timeset; time_t timer_minutes; @@ -89,6 +89,7 @@ void* CTimerManager::timerThread(void *arg) pthread_mutex_t dummy_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t dummy_cond = PTHREAD_COND_INITIALIZER; struct timespec wait; + set_threadname("n:timermanager"); CTimerManager *timerManager = (CTimerManager*) arg; From f64fb649b2a022b08a28bcdbdcbc347ea7094970 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 15:18:35 +0100 Subject: [PATCH 12/36] remove spurious newlines from debug output Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/66041784854ea92fe27eee6a07c7329351927dcd Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/scanepg.cpp | 2 +- src/zapit/src/femanager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index 24c6e3d33..bd903b162 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -91,7 +91,7 @@ void CEpgScan::ConfigureEIT() count++; } } - INFO("added %d channels to EIT white list\n", count); + INFO("added %d channels to EIT white list", count); } void CEpgScan::Clear() diff --git a/src/zapit/src/femanager.cpp b/src/zapit/src/femanager.cpp index c79f34153..2cf50a6a4 100644 --- a/src/zapit/src/femanager.cpp +++ b/src/zapit/src/femanager.cpp @@ -115,7 +115,7 @@ bool CFEManager::Init() for (unsigned i = 0; i < MAX_DMX_UNITS; i++) dmap.push_back(CFeDmx(i)); - INFO("found %d frontends, %d demuxes\n", (int)femap.size(), (int)dmap.size()); + INFO("found %d frontends, %d demuxes", (int)femap.size(), (int)dmap.size()); if (femap.empty()) return false; @@ -463,7 +463,7 @@ void CFEManager::linkFrontends(bool init) for(unsigned i = 0; i < MAX_DMX_UNITS; i++) { if (demuxes[i] == 0) { unused_demux = i; - INFO("pip demux: %d\n", unused_demux); + INFO("pip demux: %d", unused_demux); break; } } From 500c6d7032caee70fe512a0b1a904a0e52553503 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 15:19:51 +0100 Subject: [PATCH 13/36] neutrino: move start of standby epgscan forward this avoids that cpufreq is set to standby value before epgscan is started, resulting in poor performance Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7384e2155ec40069a0aadb71cec735eb3c2a23c4 Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ This commit was generated by Migit --- src/neutrino.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 6ad2c2c84..8ab84bd88 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3849,6 +3849,7 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) puts("[neutrino.cpp] executing " NEUTRINO_ENTER_STANDBY_SCRIPT "."); if (my_system(NEUTRINO_ENTER_STANDBY_SCRIPT) != 0) perror(NEUTRINO_ENTER_STANDBY_SCRIPT " failed"); + CEpgScan::getInstance()->Start(true); bool alive = recordingstatus || CEpgScan::getInstance()->Running() || CStreamManager::getInstance()->StreamStatus(); if(!alive) @@ -3861,7 +3862,6 @@ void CNeutrinoApp::standbyMode( bool bOnOff, bool fromDeepStandby ) frameBuffer->setActive(false); // Active standby on powerManager->SetStandby(false, false); - CEpgScan::getInstance()->Start(true); if (scansettings.fst_update) fst_timer = g_RCInput->addTimer(30*1000*1000, true); } else { From 6f1ae25be59f032740e523f51b660afe74cd0558 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 16:56:10 +0100 Subject: [PATCH 14/36] streamts: don't overflow receive buffer, better diag message Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ff0d98bcc30dba2fa09bd6d5823d2a77a12a568f Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/streamts.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index 7efd37d77..f0144806c 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -369,9 +369,11 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFro bp = &cbuf[0]; /* read one line */ - while (bp - &cbuf[0] < (int) sizeof(cbuf)) { + while (bp - &cbuf[0] < (int) sizeof(cbuf) - 1) { unsigned char c; int res = read(fd, &c, 1); + if (res == 0) + break; if (res < 0) { perror("read"); return false; @@ -379,12 +381,11 @@ bool CStreamManager::Parse(int fd, stream_pids_t &pids, t_channel_id &chid, CFro if ((*bp++ = c) == '\n') break; } + *bp = 0; - *bp++ = 0; + printf("CStreamManager::Parse: got %d bytes '%s'", (int)(bp-&cbuf[0]), cbuf); bp = &cbuf[0]; - printf("CStreamManager::Parse: got %s\n", cbuf); - /* send response to http client */ if (!strncmp(cbuf, "GET /", 5)) { fprintf(fp, "HTTP/1.1 200 OK\r\nServer: streamts (%s)\r\n\r\n", "ts" /*&argv[1][1]*/); From c7bf13abb75236d4e4f1d7cf2f8d557eee336f51 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 12 Feb 2017 18:10:11 +0100 Subject: [PATCH 15/36] fb_generic: add sanity check and missing mark() to painIcon8 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ec40cf7986dd6640502eb6acee8293dc8e56ba5e Author: Stefan Seyfried Date: 2017-02-12 (Sun, 12 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index ddce37dfd..9377d77da 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -744,6 +744,12 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i width = (header.width_hi << 8) | header.width_lo; height = (header.height_hi << 8) | header.height_lo; + if (width > 768) { + /* this is not going to happen, but check anyway */ + printf("%s: icon %s too wide (%d)\n", __func__, filename.c_str(), (int)width); + close(lfd); + return false; + } unsigned char pixbuf[768]; uint8_t * d = ((uint8_t *)getFrameBufferPointer()) + x * sizeof(fb_pixel_t) + stride * y; @@ -764,6 +770,7 @@ bool CFrameBuffer::paintIcon8(const std::string & filename, const int x, const i d += stride; } close(lfd); + mark(x, y, x + width, y + height); return true; } From 513cf81b72d85ce30d36a871a94454a86191fd8c Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 12 Feb 2017 23:27:18 +0100 Subject: [PATCH 16/36] test_menu: add missing include of gui/components/cc_timer.h Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ba4b67436ca012dca27329861938acb6be73e973 Author: vanhofen Date: 2017-02-12 (Sun, 12 Feb 2017) Origin message was: ------------------ - test_menu: add missing include of gui/components/cc_timer.h ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/test_menu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 7e0098b96..060e7858b 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -59,6 +59,7 @@ #include #include #include +#include extern int cs_test_card(int unit, char * str); From 05c3dd2dcc77b1ce680cd2c3dcbe80ca998a5a90 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 12 Feb 2017 23:29:32 +0100 Subject: [PATCH 17/36] sectionsd: add missing include of system/set_threadname.h Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4d6831844735d127aaa0d43cf54438661f3e8d9b Author: vanhofen Date: 2017-02-12 (Sun, 12 Feb 2017) Origin message was: ------------------ - sectionsd: add missing include of system/set_threadname.h ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/sectionsd.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 7095a6b03..4b79b389b 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include "eitd.h" From 587eb783bce162cbeba679178a0026ff9e6cdce5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 10 Feb 2017 01:32:51 +0100 Subject: [PATCH 18/36] CProgressWindow: allow variable max value, allow define dimensions Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/547238bfdd9457311f49fac7692ccc88f4be8ca5 Author: Thilo Graf Date: 2017-02-10 (Fri, 10 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/progresswindow.cpp | 20 ++++++++++---------- src/gui/widget/progresswindow.h | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index f7c84e024..b077cf2f0 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -33,8 +33,8 @@ #include #include -CProgressWindow::CProgressWindow(CComponentsForm *parent) -: CComponentsWindow(0, 0, 700, 200, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) +CProgressWindow::CProgressWindow(CComponentsForm *parent, const int &dx, const int &dy) +: CComponentsWindow(0, 0, dx, dy, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) { Init(); } @@ -48,7 +48,7 @@ void CProgressWindow::Init() int x_item = 10; int y_item = 10; - setWidthP(75); + int w_item = width-2*x_item; int h_item = 14; int h_pbar = 20; @@ -86,7 +86,7 @@ void CProgressWindow::Init() y_item += 2*h_pbar; h_height = ccw_head->getHeight(); - height = y_item + h_height; + height = max(height, y_item + h_height); setCenterPos(); } @@ -121,7 +121,7 @@ void CProgressWindow::fitItems() } } -void CProgressWindow::showStatus(const unsigned int prog) +void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max) { if (global_progress == prog) return; @@ -132,17 +132,17 @@ void CProgressWindow::showStatus(const unsigned int prog) global_bar->setHeight(g_height + g_height/2); } - showGlobalStatus(prog); + showGlobalStatus(prog, max); } -void CProgressWindow::showGlobalStatus(const unsigned int prog) +void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max) { if (global_progress == prog) return; global_bar->allowPaint(true); global_progress = prog; - global_bar->setValues(prog, 100); + global_bar->setValues(prog, (int)max); global_bar->paint(false); #ifdef VFD_UPDATE @@ -150,14 +150,14 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog) #endif // VFD_UPDATE } -void CProgressWindow::showLocalStatus(const unsigned int prog) +void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max) { if (local_progress == prog) return; local_bar->allowPaint(true); local_progress = prog; - local_bar->setValues(prog, 100); + local_bar->setValues(prog, (int)max); local_bar->paint(false); #ifdef VFD_UPDATE diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 6b8ff9e72..eaa8f8c63 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -43,16 +43,16 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget public: - CProgressWindow(CComponentsForm *parent = NULL); + CProgressWindow(CComponentsForm *parent = NULL, const int &dx = 700, const int &dy = 200); void setTitle(const neutrino_locale_t title); virtual void hide(); virtual int exec( CMenuTarget* parent, const std::string & actionKey ); - void showStatus(const unsigned int prog); - void showGlobalStatus(const unsigned int prog); + void showStatus(const unsigned int prog, const unsigned int max = 100); + void showGlobalStatus(const unsigned int prog, const unsigned int max = 100); unsigned int getGlobalStatus(void); - void showLocalStatus(const unsigned int prog); + void showLocalStatus(const unsigned int prog, const unsigned int max = 100); void showStatusMessageUTF(const std::string & text); // UTF-8 void paint(bool do_save_bg = true); void setTitle(const std::string & title); From 136e9c10ffd82984a9e1b47bbb9b07a7c4605b03 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 10 Feb 2017 10:04:40 +0100 Subject: [PATCH 19/36] CProgressWindow: add possibility to show progress via signal Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/842c8e79bbd3bda05919093b5c95a76eb3313f14 Author: Thilo Graf Date: 2017-02-10 (Fri, 10 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/progresswindow.cpp | 46 +++++++++++++++++++++++++------ src/gui/widget/progresswindow.h | 25 +++++++++++++---- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index b077cf2f0..1d2c5f0d5 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -33,14 +33,39 @@ #include #include -CProgressWindow::CProgressWindow(CComponentsForm *parent, const int &dx, const int &dy) -: CComponentsWindow(0, 0, dx, dy, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) +CProgressWindow::CProgressWindow(CComponentsForm *parent, + const int &dx, + const int &dy, + sigc::signal *statusSignal, + sigc::signal *localSignal, + sigc::signal *globalSignal) + : CComponentsWindow(0, 0, dx, dy, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) { - Init(); + Init(statusSignal, localSignal, globalSignal); } -void CProgressWindow::Init() +CProgressWindow::CProgressWindow(const neutrino_locale_t title, + const int &dx, + const int &dy, + sigc::signal *statusSignal, + sigc::signal *localSignal, + sigc::signal *globalSignal) + : CComponentsWindow(0, 0, dx, dy, g_Locale->getText(title), NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON) { + Init(statusSignal, localSignal, globalSignal); +} + +void CProgressWindow::Init( sigc::signal *statusSignal, + sigc::signal *localSignal, + sigc::signal *globalSignal) +{ + if (statusSignal) + *statusSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showStatus)); + if (localSignal) + *localSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showLocalStatus)); + if (globalSignal) + *globalSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showGlobalStatus)); + global_progress = local_progress = 100; showFooter(false); @@ -60,6 +85,7 @@ void CProgressWindow::Init() status_txt->setDimensionsAll(x_item, y_item, w_item, h_txt); status_txt->setColorBody(col_body); status_txt->doPaintTextBoxBg(true); + status_txt->doPaintBg(false); addWindowItem(status_txt); y_item += h_txt + 10; @@ -121,7 +147,7 @@ void CProgressWindow::fitItems() } } -void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max) +void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) { if (global_progress == prog) return; @@ -132,10 +158,10 @@ void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max global_bar->setHeight(g_height + g_height/2); } - showGlobalStatus(prog, max); + showGlobalStatus(prog, max, statusText); } -void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max) +void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) { if (global_progress == prog) return; @@ -143,6 +169,8 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i global_bar->allowPaint(true); global_progress = prog; global_bar->setValues(prog, (int)max); + if (!statusText.empty()) + showStatusMessageUTF(statusText); global_bar->paint(false); #ifdef VFD_UPDATE @@ -150,7 +178,7 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i #endif // VFD_UPDATE } -void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max) +void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) { if (local_progress == prog) return; @@ -158,6 +186,8 @@ void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned in local_bar->allowPaint(true); local_progress = prog; local_bar->setValues(prog, (int)max); + if (!statusText.empty()) + showStatusMessageUTF(statusText); local_bar->paint(false); #ifdef VFD_UPDATE diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index eaa8f8c63..18d4c9273 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -38,21 +38,36 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget unsigned int local_progress; int w_bar_frame; int h_height; - void Init(); + void Init( sigc::signal *statusSignal, + sigc::signal *localSignal, + sigc::signal *globalSignal); void fitItems(); public: - CProgressWindow(CComponentsForm *parent = NULL, const int &dx = 700, const int &dy = 200); + CProgressWindow(CComponentsForm *parent = NULL, + const int &dx = 700, + const int &dy = 200, + sigc::signal *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *globalSignal = NULL); + + CProgressWindow(const neutrino_locale_t title, + const int &dx = 700, + const int &dy = 200, + sigc::signal *status_Signal = NULL, + sigc::signal *localSignal = NULL, + sigc::signal *globalSignal = NULL); + void setTitle(const neutrino_locale_t title); virtual void hide(); virtual int exec( CMenuTarget* parent, const std::string & actionKey ); - void showStatus(const unsigned int prog, const unsigned int max = 100); - void showGlobalStatus(const unsigned int prog, const unsigned int max = 100); + void showStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); + void showLocalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); + void showGlobalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); unsigned int getGlobalStatus(void); - void showLocalStatus(const unsigned int prog, const unsigned int max = 100); void showStatusMessageUTF(const std::string & text); // UTF-8 void paint(bool do_save_bg = true); void setTitle(const std::string & title); From d79b387f7e1fb20f24671d412e3e4c7fa788c8fb Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 10 Feb 2017 13:00:41 +0100 Subject: [PATCH 20/36] CProgressWindow: use using namespace for std and sigc Makes more clearly Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a3c93f423690812d5996f3ffdce169c7cbddf320 Author: Thilo Graf Date: 2017-02-10 (Fri, 10 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/widget/progresswindow.cpp | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 1d2c5f0d5..564df2204 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -32,13 +32,15 @@ #include #include +using namespace sigc; +using namespace std; CProgressWindow::CProgressWindow(CComponentsForm *parent, const int &dx, const int &dy, - sigc::signal *statusSignal, - sigc::signal *localSignal, - sigc::signal *globalSignal) + signal *statusSignal, + signal *localSignal, + signal *globalSignal) : CComponentsWindow(0, 0, dx, dy, string(), NEUTRINO_ICON_INFO, parent, CC_SHADOW_ON) { Init(statusSignal, localSignal, globalSignal); @@ -47,24 +49,24 @@ CProgressWindow::CProgressWindow(CComponentsForm *parent, CProgressWindow::CProgressWindow(const neutrino_locale_t title, const int &dx, const int &dy, - sigc::signal *statusSignal, - sigc::signal *localSignal, - sigc::signal *globalSignal) + signal *statusSignal, + signal *localSignal, + signal *globalSignal) : CComponentsWindow(0, 0, dx, dy, g_Locale->getText(title), NEUTRINO_ICON_INFO, NULL, CC_SHADOW_ON) { Init(statusSignal, localSignal, globalSignal); } -void CProgressWindow::Init( sigc::signal *statusSignal, - sigc::signal *localSignal, - sigc::signal *globalSignal) +void CProgressWindow::Init( signal *statusSignal, + signal *localSignal, + signal *globalSignal) { if (statusSignal) - *statusSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showStatus)); + *statusSignal->connect(mem_fun(*this, &CProgressWindow::showStatus)); if (localSignal) - *localSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showLocalStatus)); + *localSignal->connect(mem_fun(*this, &CProgressWindow::showLocalStatus)); if (globalSignal) - *globalSignal->connect(sigc::mem_fun(*this, &CProgressWindow::showGlobalStatus)); + *globalSignal->connect(mem_fun(*this, &CProgressWindow::showGlobalStatus)); global_progress = local_progress = 100; @@ -126,7 +128,7 @@ void CProgressWindow::setTitle(const neutrino_locale_t title) #endif // VFD_UPDATE } -void CProgressWindow::setTitle(const std::string & title) +void CProgressWindow::setTitle(const string & title) { setWindowCaption(title); @@ -147,7 +149,7 @@ void CProgressWindow::fitItems() } } -void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) +void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max, const string &statusText) { if (global_progress == prog) return; @@ -161,7 +163,7 @@ void CProgressWindow::showStatus(const unsigned int prog, const unsigned int max showGlobalStatus(prog, max, statusText); } -void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) +void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { if (global_progress == prog) return; @@ -178,7 +180,7 @@ void CProgressWindow::showGlobalStatus(const unsigned int prog, const unsigned i #endif // VFD_UPDATE } -void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const std::string &statusText) +void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned int max, const string &statusText) { if (local_progress == prog) return; @@ -197,7 +199,7 @@ void CProgressWindow::showLocalStatus(const unsigned int prog, const unsigned in #endif // VFD_UPDATE } -void CProgressWindow::showStatusMessageUTF(const std::string & text) +void CProgressWindow::showStatusMessageUTF(const string & text) { string txt = text; int w_txt = status_txt->getWidth(); @@ -222,7 +224,7 @@ void CProgressWindow::hide() CComponentsWindow::hide(); } -int CProgressWindow::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +int CProgressWindow::exec(CMenuTarget* parent, const string & /*actionKey*/) { if(parent) { From ad3e80877ed7274dd61f84864a0fb0b584392af5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 10 Feb 2017 19:10:15 +0100 Subject: [PATCH 21/36] CProgressWindow: add documentation for Doxygen Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/45e77707f0fe880b2036c5e269619c17d200e3f8 Author: Thilo Graf Date: 2017-02-10 (Fri, 10 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/widget/progresswindow.cpp | 2 +- src/gui/widget/progresswindow.h | 156 +++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 4 deletions(-) diff --git a/src/gui/widget/progresswindow.cpp b/src/gui/widget/progresswindow.cpp index 564df2204..84c74e15d 100644 --- a/src/gui/widget/progresswindow.cpp +++ b/src/gui/widget/progresswindow.cpp @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Implementation of CComponent Window class. - Copyright (C) 2014 Thilo Graf 'dbt' + Copyright (C) 2014-2017 Thilo Graf 'dbt' License: GPL diff --git a/src/gui/widget/progresswindow.h b/src/gui/widget/progresswindow.h index 18d4c9273..811b5714a 100644 --- a/src/gui/widget/progresswindow.h +++ b/src/gui/widget/progresswindow.h @@ -3,7 +3,7 @@ Copyright (C) 2001 by Steffen Hehn 'McClean' Implementation of CComponent Window class. - Copyright (C) 2014 Thilo Graf 'dbt' + Copyright (C) 2014-2017 Thilo Graf 'dbt' License: GPL @@ -44,7 +44,92 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget void fitItems(); public: - + /**CProgressWindow Constructor + * @param[in] parent + * @li optional: expects type CComponentsForm * as possible parent object, default = NULL + * @param[in] dx + * @li optional: expects type const &int, width of window, default = 0, auto size with declared default values + * @param[in] dy + * @li optional: expects type const &int, height of window, default = 0, auto size with declared default values + * @param[in] status_Signal + * @li optional: expects type sigc::signal, defines an optional signal container for + * current changing values. + * @param[in] localSignal + * @li optional: expects type sigc::signal, defines an optional signal container for + * current changing local values. + * @param[in] globalSignal + * @li optional: expects type sigc::signal, defines an optional signal container for + * current changing global values. + * + * @example + * void CFooClass::DoCount{ + * //Usage with classic init inside method: + * + * //Create a CProgressWindow object + * CProgressWindow progress; + * + * //set possible properties, eg. like here we dont't need a header + * status.showHeader(false); + * + * //paint window + * status.paint(); + * + * //set possible properties, like current status text + * status.showStatusMessageUTF("test progress"); + * + * //set current progress, call functions, methods or use a while, next loop or what ever + * status.showStatus(25) + * + * //finally remove window from screen + * status.hide(); + * } + * + * //That's it. Until now these steps are a classical way inside neutrino, but you can use proress window with signals too. + * //Working with signals have the advantage that the implementation could be more compactly, because + * //complex constructions within the classes are usually unnecessary, + * //beacuse of the signals can be installed where they directly take the required values. See next example: + * + * class CFooClass + * { + * //Usage with signals: + * //declare a signal eg. in header file + * private: + * //other members... + * sigc::signal OnProgress; + * //other members... + * public: + * //other members... + * void DoAnything(); + * //other members... + * }; + * + * //add the OnProgress signal into a counter methode + * void CFooClass::DoCount{ + * size_t max = 10 + * for (size_t i = 0; i < max; i++){ + * OnProgress(i, max, "Test"); + * } + * } + * + * void CFooClass::DoAnything{ + * //inside of methode which calls the progress define a CProgressWindow object and the counter method: + * //...any code + * CProgressWindow progress(NULL, 500, 150, &OnProgress); + * //paint window + * progress.paint(); // paint() + * + * //... + * + * DoCount(); + * + * //... + * + * //finally remove window from screen + * progress.hide(); + * } + * @note + * Don't use status_Signal at same time with localSignal and globalSignal. In This case please set status_Signal = NULL + */ CProgressWindow(CComponentsForm *parent = NULL, const int &dx = 700, const int &dy = 200, @@ -52,6 +137,12 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); + /**CProgressWindow Constructor + * @param[in] title + * @li expects type neutrino_locale_t as window title + * + * @see For other arguments and examples, see related constructor(s) + */ CProgressWindow(const neutrino_locale_t title, const int &dx = 700, const int &dy = 200, @@ -59,18 +150,77 @@ class CProgressWindow : public CComponentsWindow, public CMenuTarget sigc::signal *localSignal = NULL, sigc::signal *globalSignal = NULL); + /**Sets titel of window + * @param[in] title + * @li expects type neutrino_locale_t as window title + */ void setTitle(const neutrino_locale_t title); + + /**Sets titel of window + * @param[in] title + * @li expects type std::string as window title + */ + void setTitle(const std::string & title); + + /** + * Remove window from screen, restores background. + */ virtual void hide(); + /** + * Executes the exec contents. In this case it will paint the window and remove possible parents from screen + * @param[in] parent + * @li optional: expects type CMenuTarget* + * @param[in] actionKey + * @li optional: without effect + * @return int = menu_return::RETURN_REPAINT + */ virtual int exec( CMenuTarget* parent, const std::string & actionKey ); + /** + * Sets current progress value and show progress in window. + * @param[in] prog + * @li expects type unsigned int, describes current progress value + * @param[in] max + * @li optional: expects type unsigned int, describes maximal progress value, default = 100 + * @param[in] statusText + * @li optional: expects type std::string, describes current status text, default = empty + */ void showStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); + + /** + * Sets current local progressbar value and show progress in window. + * @note For other arguments take a look to related method showStatus() + * @see showStatus() + */ void showLocalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); + + /** + * Sets current global progressbar value and show progress in window. + * @note For other arguments take a look to related method showStatus() + * @see showStatus() + */ void showGlobalStatus(const unsigned int prog, const unsigned int max = 100, const std::string &statusText = std::string()); + + /** + * Gets current progress value + * @return unsigned int + */ unsigned int getGlobalStatus(void); + + /** + * Sets current progress value and show progress in window. + * @param[in] text + * @li expects type std::string, describes current status text + */ void showStatusMessageUTF(const std::string & text); // UTF-8 + + /** + * Paint window + * @param[in] do_save_bg + * @li optional: expects type bool, sets background save mode + */ void paint(bool do_save_bg = true); - void setTitle(const std::string & title); }; From bf3a0863de0d40ed0845c0d6b72038da965df287 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 10 Feb 2017 19:12:10 +0100 Subject: [PATCH 22/36] CMovieBrowser: visualize progress during load movies TODO: youtube load Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a907afdc7c19f8b5c80254ac7b2489cf9f8f2c97 Author: Thilo Graf Date: 2017-02-10 (Fri, 10 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 6 ++++-- src/gui/moviebrowser/mb.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 9e08c01c5..fb80bebd7 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2874,7 +2874,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) CFileList flist; if (readDir(dirname, &flist) == true) { - for (unsigned int i = 0; i < flist.size(); i++) + for (size_t i = 0; i < flist.size(); i++) { if (S_ISDIR(flist[i].Mode)) { if (m_settings.ts_only || !CFileBrowser::checkBD(flist[i])) { @@ -2885,6 +2885,7 @@ bool CMovieBrowser::loadTsFileNamesFromDir(const std::string & dirname) } else { result |= addFile(flist[i], dirItNr); } + OnLoadFile(i, flist.size(), g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); } //result = true; } @@ -3123,7 +3124,8 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CHintBox loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, &OnLoadFile); + loadBox.enableShadow(); loadBox.paint(); if (show_mode == MB_SHOW_YT) { diff --git a/src/gui/moviebrowser/mb.h b/src/gui/moviebrowser/mb.h index 9dee3dbee..3f29afdea 100644 --- a/src/gui/moviebrowser/mb.h +++ b/src/gui/moviebrowser/mb.h @@ -362,6 +362,7 @@ class CMovieBrowser : public CMenuTarget void clearSelection(); bool supportedExtension(CFile &file); bool addFile(CFile &file, int dirItNr); + sigc::signal OnLoadFile; }; // I tried a lot to use the menu.cpp as ListBox selection, and I got three solution which are all garbage. From 0bd84a7f0437dc3453503d6f03801ac81ef3f12d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 13 Feb 2017 08:47:55 +0100 Subject: [PATCH 23/36] CImageInfo: fix y position of infotext Minitv was not considered. When font size very small, infotext could be overlapping with minitv window. This should fix this. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2727e3f7f0532aed803f4e01662ee269a022007e Author: Thilo Graf Date: 2017-02-13 (Mon, 13 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/imageinfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/imageinfo.cpp b/src/gui/imageinfo.cpp index 99a3cace5..15dd92544 100644 --- a/src/gui/imageinfo.cpp +++ b/src/gui/imageinfo.cpp @@ -414,6 +414,7 @@ void CImageInfo::InitInfoText(const std::string& text) //add a caption for info contents Font * caption_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]; int caption_height = caption_font->getHeight(); + y_tmp = max(y_tmp, cc_tv->getYPos()+cc_tv->getHeight()); if (cc_sub_caption == NULL) cc_sub_caption = new CComponentsLabel(cc_info->getXPos(), y_tmp, cc_info->getWidth(), caption_height, g_Locale->getText(LOCALE_IMAGEINFO_LICENSE), CTextBox::AUTO_WIDTH, item_font); From 50900d8621162f8c1130cf534d6ba75d62181b6e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 13 Feb 2017 10:03:38 +0100 Subject: [PATCH 24/36] cYTFeedParser: add signal OnLoadVideoInfo Required for visualized progress display. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0aa261d911dcf499dd44755fe5393ff07e6f70af Author: Thilo Graf Date: 2017-02-13 (Mon, 13 Feb 2017) ------------------ This commit was generated by Migit --- src/system/ytparser.cpp | 1 + src/system/ytparser.h | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 928df3afe..3c558ee1b 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -323,6 +323,7 @@ bool cYTFeedParser::parseFeedJSON(std::string &answer) Json::Value elements = root["items"]; for(unsigned int i=0; igetText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES)); #ifdef DEBUG_PARSER printf("=========================================================\n"); printf("Element %d in elements\n", i); diff --git a/src/system/ytparser.h b/src/system/ytparser.h index adb30ba67..c54c2239b 100644 --- a/src/system/ytparser.h +++ b/src/system/ytparser.h @@ -27,7 +27,7 @@ #include #include #include - +#include #include #include @@ -155,6 +155,8 @@ class cYTFeedParser void SetMaxResults(int count) { max_results = count; } void SetConcurrentDownloads(int count) { concurrent_downloads = count; } void SetThumbnailDir(std::string &_thumbnail_dir); + + sigc::signal OnLoadVideoInfo; }; #endif From e22dc3d33d6c0f7c40210fee89833374357526a5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 13 Feb 2017 10:05:34 +0100 Subject: [PATCH 25/36] CMovieBrowser: vizualize progress for loading of youtube vidoes Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/690ac7c428e67e5f28dd908266ed524153148948 Author: Thilo Graf Date: 2017-02-13 (Mon, 13 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/moviebrowser/mb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index fb80bebd7..b6d49b888 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -3124,7 +3124,7 @@ void CMovieBrowser::loadMovies(bool doRefresh) { TRACE("[mb] loadMovies: \n"); - CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, &OnLoadFile); + CProgressWindow loadBox((show_mode == MB_SHOW_YT) ? LOCALE_MOVIEPLAYER_YTPLAYBACK : LOCALE_MOVIEBROWSER_HEAD, 500, 150, show_mode == MB_SHOW_YT ? &ytparser.OnLoadVideoInfo : &OnLoadFile); loadBox.enableShadow(); loadBox.paint(); From 32120b3599fddf1fe8b7f2c655e51dad8f011102 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Mon, 13 Feb 2017 00:03:58 +0100 Subject: [PATCH 26/36] acinclude: only set default model to hd1 if boxtype=coolstream Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/62ee5185b5f9b191d0548517d5c8d4b4b4749c1d Author: Stefan Seyfried Date: 2017-02-13 (Mon, 13 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- acinclude.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 3eadaaff4..f5b22cab2 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -511,7 +511,7 @@ AC_ARG_WITH(boxmodel, *) AC_MSG_ERROR([unsupported value $withval for --with-boxmodel]) ;; - esac], [BOXMODEL="hd1"] + esac], [test "$BOXTYPE" = "coolstream" && BOXMODEL="hd1" || true] [if test "$BOXTYPE" = "dreambox" -o "$BOXTYPE" = "ipbox" && test -z "$BOXMODEL"; then AC_MSG_ERROR([Dreambox/IPBox needs --with-boxmodel]) fi]) From 248fd86b6afec89e1d6c1591035549534662943f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:06:47 +0100 Subject: [PATCH 27/36] fb_generic: remove hardware specific #ifdef Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7fdc4c7178f44eafdc73235a52c196c1d4708aa4 Author: Stefan Seyfried Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 5b2a24402..e863528ab 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -184,10 +184,7 @@ class CFrameBuffer : public sigc::trackable bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? -#ifdef BOXMODEL_CS_HD1 - virtual void setupGXA() {}; - virtual void add_gxa_sync_marker() {}; -#endif + virtual void setupGXA() { return; }; // reinitialize stuff void setTransparency( int tr = 0 ); virtual void setBlendMode(uint8_t mode = 1); From ddb457bc9070885d0e5091a80ea61fb2131fa1c8 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:09:33 +0100 Subject: [PATCH 28/36] implement getWidth4FB_HW_ACC in fb_accel class This helper to determine alignment for hardware blitting is now in system/helpers.h, where it does not really belong. Put it into the framebuffer class instead. Framebuffers that don't need it will just get a dummy function, the cs_hd2 framebuffer gets the real thing. Also add a bool function that indicates the need for alignment. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b6909fb815c9e54a7a4626f1c13139402918fe63 Author: Stefan Seyfried Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 2 ++ src/driver/fb_accel_cs_hd2.cpp | 17 +++++++++++++++++ src/driver/fb_generic.cpp | 8 ++++++-- src/driver/fb_generic.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 54736d331..e3eceaab5 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -127,6 +127,8 @@ class CFbAccelCSHD2 void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); void setBlendMode(uint8_t); void setBlendLevel(int); + uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); + bool needAlign4Blit() { return true; }; }; class CFbAccelGLFB diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 393e6396c..256a9c729 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -228,3 +228,20 @@ void CFbAccelCSHD2::setBlendLevel(int level) if (level == 100) // TODO: sucks. usleep(20000); } + +/* align for hw blit */ +uint32_t CFbAccelCSHD2::getWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max) +{ + uint32_t ret = _w; + if ((_x + ret) >= xRes) + ret = xRes-_x-1; + if (ret%4 == 0) + return ret; + + int add = (max) ? 3 : 0; + ret = ((ret + add) / 4) * 4; + if ((_x + ret) >= xRes) + ret -= 4; + + return ret; +} diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 9377d77da..1160b9c44 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include @@ -514,7 +513,7 @@ fb_pixel_t* CFrameBuffer::paintBoxRel(const int x, const int y, const int dx, co #ifdef BOXMODEL_CS_HD2 if (_dx%4 != 0) { - w_align = GetWidth4FB_HW_ACC(x, _dx, true); + w_align = getWidth4FB_HW_ACC(x, _dx, true); if (w_align < _dx) _dx = w_align; offs_align = w_align - _dx; @@ -1770,3 +1769,8 @@ bool CFrameBuffer::_checkFbArea(int _x, int _y, int _dx, int _dy, bool prev) void CFrameBuffer::mark(int , int , int , int ) { } + +uint32_t CFrameBuffer::getWidth4FB_HW_ACC(const uint32_t /*x*/, const uint32_t w, const bool /*max*/) +{ + return w; +} diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index e863528ab..fdd9cc8d5 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -185,6 +185,8 @@ class CFrameBuffer : public sigc::trackable bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? virtual void setupGXA() { return; }; // reinitialize stuff + virtual bool needAlign4Blit() { return false; }; + virtual uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); void setTransparency( int tr = 0 ); virtual void setBlendMode(uint8_t mode = 1); From 0e3ab5bce1aa955910e9cfa79c90db387d67d52a Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:14:30 +0100 Subject: [PATCH 29/36] remove hardware specific code from gui Use the framebuffer's getWidth4FB_HW_ACC() instead of system/helpers. The use in cc_item_picture was guarded by a hardware #ifdef, use needAlign4Blit() instead. This needs testing on the affected hardware, which I do not have :-) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c9e1072b94e3327c5ded71eada4533489572899a Author: Stefan Seyfried Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_item_picture.cpp | 8 +++----- src/gui/movieplayer.cpp | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index bcaccf6c7..1870092af 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -33,7 +33,6 @@ #include "cc_item_picture.h" #include #include -#include #include extern CPictureViewer * g_PicViewer; @@ -222,10 +221,9 @@ void CComponentsPicture::initCCItem() { float h_ratio = float(height)*100/(float)dy; width = int(h_ratio*(float)dx/100); -#ifdef BOXMODEL_CS_HD2 - if (do_scale && (width > 10 || height > 10)) - width = GetWidth4FB_HW_ACC(x+fr_thickness, width-2*fr_thickness)+2*fr_thickness; -#endif + if (frameBuffer->needAlign4Blit() && + do_scale && (width > 10 || height > 10)) + width = frameBuffer->getWidth4FB_HW_ACC(x+fr_thickness, width-2*fr_thickness)+2*fr_thickness; keep_dx_aspect = false; } if (keep_dy_aspect && dx) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index ec9379fc9..0fda64768 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -2448,7 +2448,7 @@ void CMoviePlayerGui::showSubtitle(neutrino_msg_data_t data) int xoff = (double) sub->rects[i]->x * xc; int yoff = (double) sub->rects[i]->y * yc; - int nw = GetWidth4FB_HW_ACC(xoff, (double) sub->rects[i]->w * xc); + int nw = frameBuffer->getWidth4FB_HW_ACC(xoff, (double) sub->rects[i]->w * xc); int nh = (double) sub->rects[i]->h * yc; printf("Draw: #%d at %d,%d size %dx%d colors %d (x=%d y=%d w=%d h=%d) \n", i+1, From 5f0e41af6adc6869de255ee98a6fd1289afcc731 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Tue, 14 Feb 2017 00:15:11 +0100 Subject: [PATCH 30/36] system/helpers: disable GetWidth4FB_HW_ACC() ...will be removed later Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e1e2052edb2f3c5890206da5f58bb43a5b57bf85 Author: Stefan Seyfried Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ This commit was generated by Migit --- src/system/helpers.cpp | 4 +++- src/system/helpers.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 46ae17fa0..e6e4a1e2e 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -47,7 +47,7 @@ #include "debug.h" #include #include -#include +//#include #include #include using namespace std; @@ -1113,6 +1113,7 @@ bool split_config_string(const std::string &str, std::map split(const std::string &s, char delim) { diff --git a/src/system/helpers.h b/src/system/helpers.h index dd23280a3..e117e011e 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -116,7 +116,9 @@ class CFileHelpers static uint64_t getDirSize(const std::string& dir){return getDirSize(dir.c_str());}; }; +#if 0 uint32_t GetWidth4FB_HW_ACC(const uint32_t _x, const uint32_t _w, const bool max=true); +#endif #if __cplusplus < 201103L std::string to_string(int); From e618203c09fb1a26eb58b19c5f022fbc334c4603 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 14 Feb 2017 16:30:20 +0100 Subject: [PATCH 31/36] fb_generic.h: Add missing function add_gxa_sync_marker() - is required for cs hd1 Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/de80748cac920d7bea98ed739ff5d32d7a1ad53c Author: Michael Liebmann Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_generic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index fdd9cc8d5..9ef472740 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -185,6 +185,7 @@ class CFrameBuffer : public sigc::trackable bool getActive() const; // is framebuffer active? void setActive(bool enable); // is framebuffer active? virtual void setupGXA() { return; }; // reinitialize stuff + virtual void add_gxa_sync_marker() { return; }; virtual bool needAlign4Blit() { return false; }; virtual uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); From c94080113608c77d1bd8835feb3ab091c349f51e Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Tue, 14 Feb 2017 19:57:28 +0100 Subject: [PATCH 32/36] fb_generic: make blitBox2FB virtual Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/e8ec4540ca3ed77c4ce59c145609d13dbf7b1ca6 Author: Michael Liebmann Date: 2017-02-14 (Tue, 14 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index 9ef472740..412a3df29 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -267,7 +267,7 @@ class CFrameBuffer : public sigc::trackable void* convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y); void displayRGB(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs, bool clearfb = true, int transp = 0xFF); virtual void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); - void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); + virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); virtual void mark(int x, int y, int dx, int dy); From 22d123dd4027760336f74ac21490140315a98ca9 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 15 Feb 2017 00:10:59 +0100 Subject: [PATCH 33/36] fb_accel_td: add missing getBackBufferPointer() this fixes tuxtxt rendering problems Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/20a85c3874eac682191dd2c15c711876e9b3bfed Author: Stefan Seyfried Date: 2017-02-15 (Wed, 15 Feb 2017) ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 1 + src/driver/fb_accel_td.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index e3eceaab5..090ef4cc4 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -171,6 +171,7 @@ class CFbAccelTD void paintLine(int xa, int ya, int xb, int yb, const fb_pixel_t col); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp); void waitForIdle(const char *func = NULL); + fb_pixel_t * getBackBufferPointer() const; void setBlendMode(uint8_t); void setBlendLevel(int); }; diff --git a/src/driver/fb_accel_td.cpp b/src/driver/fb_accel_td.cpp index af3bf8f60..7033ed0bc 100644 --- a/src/driver/fb_accel_td.cpp +++ b/src/driver/fb_accel_td.cpp @@ -202,3 +202,8 @@ void CFbAccelTD::setBlendLevel(int level) if (level == 100) // sucks usleep(20000); } + +fb_pixel_t *CFbAccelTD::getBackBufferPointer() const +{ + return backbuffer; +} From aaef3934cb37f8027e1fe9f0c944f6ebc6935736 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 15 Feb 2017 18:32:35 +0100 Subject: [PATCH 34/36] libtuxtxt: Transfer from neutrino-mp for better compatibility Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5612baaff71f28b35844bd55cba31c132a108b3a Author: Michael Liebmann Date: 2017-02-15 (Wed, 15 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- lib/libtuxtxt/Makefile.am | 2 + lib/libtuxtxt/libtuxtxt.cpp | 2 + lib/libtuxtxt/tuxtxt.cpp | 243 ++++++++++++++++++++++++---------- lib/libtuxtxt/tuxtxt.h | 129 ++++++++++++------ lib/libtuxtxt/tuxtxt_common.h | 16 ++- 5 files changed, 279 insertions(+), 113 deletions(-) diff --git a/lib/libtuxtxt/Makefile.am b/lib/libtuxtxt/Makefile.am index 5d24e483e..f3dc7d972 100644 --- a/lib/libtuxtxt/Makefile.am +++ b/lib/libtuxtxt/Makefile.am @@ -1,6 +1,8 @@ AM_CPPFLAGS = \ -I$(top_builddir) \ -I$(top_srcdir) \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/lib/libconfigfile \ -I$(top_srcdir)/src \ -I$(top_srcdir)/src/zapit/include \ $(FREETYPE_CFLAGS) \ diff --git a/lib/libtuxtxt/libtuxtxt.cpp b/lib/libtuxtxt/libtuxtxt.cpp index 27111f618..40af36282 100644 --- a/lib/libtuxtxt/libtuxtxt.cpp +++ b/lib/libtuxtxt/libtuxtxt.cpp @@ -37,6 +37,8 @@ int tuxtxt_init() tuxtxt_cache.vtxtpid = -1; tuxtxt_cache.thread_id = 0; tuxtxt_cache.dmx = -1; + /* not sure if this is correct here... */ + tuxtxt_cache.page = 0x100; return 1;//tuxtxt_init_demuxer(); } diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index e2a5bd5fd..c6f5f4ce9 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -11,6 +11,8 @@ * * * ported 2009 to HD1 by Coolstream LTD * * * + * TD, SPARK and AZbox port (C) 2010-2013 Stefan Seyfried * + * * ******************************************************************************/ #include "teletext.h" @@ -19,6 +21,7 @@ #include #include #include +#include #include /* same as in rcinput.h... */ @@ -26,6 +29,12 @@ #define KEY_TTZOOM KEY_FN_2 #define KEY_REVEAL KEY_FN_D +#ifdef HAVE_SPARK_HARDWARE +#define MARK_FB(a, b, c, d) if (p == lfb) CFrameBuffer::getInstance()->mark(a, b, (a) + (c), (b) + (d)) +#else +#define MARK_FB(a, b, c, d) +#endif + extern cVideo * videoDecoder; static pthread_t ttx_sub_thread; @@ -36,11 +45,24 @@ static int sub_pid, sub_page; static bool use_gui; static int cfg_national_subset; +static int screen_x, screen_y, screen_w, screen_h; + //#define USE_FBPAN // FBIOPAN_DISPLAY seems to be working in current driver +unsigned char *getFBp(int *y) +{ + if (*y < (int)var_screeninfo.yres) + return lfb; + + *y -= var_screeninfo.yres; + return lbb; +} + void FillRect(int x, int y, int w, int h, int color) { - unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; + unsigned char *p = getFBp(&y); + MARK_FB(x, y, w, h); + p += x*4 + y * fix_screeninfo.line_length; #if !HAVE_TRIPLEDRAGON unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0]; #else @@ -55,6 +77,7 @@ void FillRect(int x, int y, int w, int h, int color) } } + void FillBorder(int color) { int ys = (var_screeninfo.yres-var_screeninfo.yoffset); @@ -180,6 +203,9 @@ int toptext_getnext(int startpage, int up, int findgroup) nextgrp = nextblk = 0; current = startpage; + if (startpage == 0) + return 0; + do { if (up) tuxtxt_next_dec(¤t); @@ -220,6 +246,13 @@ void RenderClearMenuLineBB(char *p, tstPageAttr *attrcol, tstPageAttr *attr) #if 0 RenderCharBB(' ', attr); /* separator */ #endif + /* the fontwidth_topmenusmall is not correctly calculated: the navigation + * indicator ' ' is not considered and thus the font is slightly too wide. + * Shift the topmenu to the left instead of using a smaller font, since + * the worst that can happen is that the indicator is partly obscured and + * that looks better than empty space on the right of the topmenu. + */ + PosX = screen_x + screen_w - TOPMENUCHARS * fontwidth_topmenusmall; for(col = 0; col < TOPMENUCHARS; col++) { RenderCharBB(*p++, attr); @@ -242,7 +275,8 @@ void ClearFB(int /*color*/) //never used void ClearB(int color) { - FillRect(0,0,var_screeninfo.xres,var_screeninfo.yres*2,color); + FillRect(0, 0, var_screeninfo.xres, var_screeninfo.yres, color); /* framebuffer */ + FillRect(0, var_screeninfo.yres, var_screeninfo.xres, var_screeninfo.yres, color); /* backbuffer */ } #endif int GetCurFontWidth() @@ -250,6 +284,7 @@ int GetCurFontWidth() int mx = (displaywidth)%(40-nofirst); // # of unused pixels int abx = (mx == 0 ? displaywidth+1 : (displaywidth)/(mx+1));// distance between 'inserted' pixels int nx= abx+1-((PosX-sx) % (abx+1)); // # of pixels to next insert + return fontwidth+(((PosX+fontwidth+1-sx) <= displaywidth && nx <= fontwidth+1) ? 1 : 0); } @@ -1535,7 +1570,7 @@ static void* reader_thread(void * /*arg*/) void tuxtx_pause_subtitle(bool pause) { if(!pause) { - printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page); + //printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page); ttx_paused = 0; if(!reader_running && sub_pid && sub_page) tuxtx_main(0, sub_pid, sub_page); @@ -1572,8 +1607,8 @@ void tuxtx_set_pid(int pid, int page, const char * cc) sub_page = page; cfg_national_subset = GetNationalSubset(cc); - printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset); #if 0 + printf("TuxTxt subtitle set pid %d page %d lang %s (%d)\n", sub_pid, sub_page, cc, cfg_national_subset); ttx_paused = 1; if(sub_pid && sub_page) tuxtx_main(0, sub_pid, sub_page); @@ -1597,7 +1632,7 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running) return ret; } -int tuxtx_main(int _rc, int pid, int page, int source) +int tuxtx_main(int /*_rc*/, int pid, int page, int source) { char cvs_revision[] = "$Revision: 1.95 $"; @@ -1621,14 +1656,18 @@ int tuxtx_main(int _rc, int pid, int page, int source) printf("TuxTxt %s\n", versioninfo); printf("for 32bpp framebuffer\n"); + fb = -1; +#ifdef USE_FBPAN if ((fb=open("/dev/fb/0", O_RDWR)) == -1) { perror("TuxTxt "); return 0; } +#endif - rc = _rc; - lfb = (unsigned char *) CFrameBuffer::getInstance()->getFrameBufferPointer(); + CFrameBuffer *fbp = CFrameBuffer::getInstance(); + lfb = (unsigned char *)fbp->getFrameBufferPointer(); + lbb = (unsigned char *)fbp->getBackBufferPointer(); tuxtxt_cache.vtxtpid = pid; @@ -1637,8 +1676,7 @@ int tuxtx_main(int _rc, int pid, int page, int source) else printf("[tuxtxt] using PID %x page %d\n", tuxtxt_cache.vtxtpid, tuxtxt_cache.page); - fcntl(rc, F_SETFL, fcntl(rc, F_GETFL) | O_EXCL | O_NONBLOCK); - +#if 0 /* just get it from the framebuffer class */ /* get fixed screeninfo */ if (ioctl(fb, FBIOGET_FSCREENINFO, &fix_screeninfo) == -1) { @@ -1652,7 +1690,12 @@ int tuxtx_main(int _rc, int pid, int page, int source) perror("TuxTxt "); return 0; } - +#else + struct fb_var_screeninfo *var; + var = fbp->getScreenInfo(); + memcpy(&var_screeninfo, var, sizeof(struct fb_var_screeninfo)); + fix_screeninfo.line_length = var_screeninfo.xres * sizeof(fb_pixel_t); +#endif /* set variable screeninfo for double buffering */ var_screeninfo.yoffset = 0; #if 0 @@ -1661,10 +1704,15 @@ int tuxtx_main(int _rc, int pid, int page, int source) ex = x + w - 10; ey = y + h - 10; #endif - int x = CFrameBuffer::getInstance()->getScreenX(); - int y = CFrameBuffer::getInstance()->getScreenY(); - int w = CFrameBuffer::getInstance()->getScreenWidth(); - int h = CFrameBuffer::getInstance()->getScreenHeight(); + screen_x = fbp->getScreenX(); + screen_y = fbp->getScreenY(); + screen_w = fbp->getScreenWidth(); + screen_h = fbp->getScreenHeight(); + + int x = screen_x; + int y = screen_y; + int w = screen_w; + int h = screen_h; int tx = 0; if (!screen_mode1) @@ -1725,6 +1773,7 @@ int tuxtx_main(int _rc, int pid, int page, int source) SwitchTranspMode(); break; /* and evaluate key */ + case RC_TTTV: case RC_MUTE: /* regular toggle to transparent */ case RC_TEXT: break; @@ -1797,20 +1846,25 @@ int tuxtx_main(int _rc, int pid, int page, int source) case RC_7: case RC_8: case RC_9: - PageInput(RCCode - RC_0); + PageInput(CRCInput::getNumericValue(RCCode)); break; case RC_RED: ColorKey(prev_100); break; case RC_GREEN: ColorKey(prev_10); break; case RC_YELLOW: ColorKey(next_10); break; case RC_BLUE: ColorKey(next_100); break; + case RC_TTZOOM: case RC_PLUS: SwitchZoomMode(); break; + case RC_SPLIT: case RC_MINUS: SwitchScreenMode(-1);prevscreenmode = screenmode; break; + case RC_TTTV: case RC_MUTE: SwitchTranspMode(); break; case RC_TEXT: if(transpmode == 1) RCCode = RC_HOME; SwitchTranspMode(); break; + case RC_TTREVEAL: + case RC_INFO: case RC_HELP: SwitchHintMode(); break; case RC_DBOX: ConfigMenu(0); break; case RC_HOME: @@ -1827,7 +1881,8 @@ int tuxtx_main(int _rc, int pid, int page, int source) /* exit */ CleanUp(); - close(fb); + if (fb >= 0) + close(fb); #if 1 if ( initialized ) @@ -1863,10 +1918,10 @@ FT_Error MyFaceRequester(FTC_FaceID face_id, FT_Library plibrary, FT_Pointer /*r ******************************************************************************/ extern std::string ttx_font_file; static bool ft_init_done = false; +static int oldfontheight = 0; int Init(int source) { int error, i; - unsigned char magazine; static std::string font_file; /* init data */ @@ -1874,12 +1929,13 @@ int Init(int source) //page_atrb[32] = transp<<4 | transp; inputcounter = 2; +#if TUXTXT_CFG_STANDALONE + unsigned char magazine; for (magazine = 1; magazine < 9; magazine++) { tuxtxt_cache.current_page [magazine] = -1; tuxtxt_cache.current_subpage [magazine] = -1; } -#if TUXTXT_CFG_STANDALONE /* init data */ memset(&tuxtxt_cache.astCachetable, 0, sizeof(tuxtxt_cache.astCachetable)); memset(&tuxtxt_cache.subpagetable, 0xFF, sizeof(tuxtxt_cache.subpagetable)); @@ -2029,7 +2085,7 @@ int Init(int source) fontwidth_topmenumain = (TV43STARTX-sx) / 40; fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; //fontwidth_small = (TV169FULLSTARTX-sx) / 40; - fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / 40; + fontwidth_small = (screen_w / 2) / 40; ymosaic[0] = 0; /* y-offsets for 2*3 mosaic */ ymosaic[1] = (fontheight + 1) / 3; ymosaic[2] = (fontheight * 2 + 1) / 3; @@ -2071,7 +2127,7 @@ int Init(int source) } } #endif - if(!ft_init_done || font_file != ttx_font_file) { + if(!ft_init_done || font_file != ttx_font_file || fontheight != oldfontheight) { printf("TuxTxt: init fontlibrary\n"); if(ft_init_done) { FTC_Manager_Done(manager); @@ -2121,6 +2177,7 @@ int Init(int source) } font_file = ttx_font_file; ft_init_done = true; + oldfontheight = fontheight; ascender = (usettf ? fontheight * face->ascender / face->units_per_EM : 16); } @@ -2193,7 +2250,6 @@ int Init(int source) #else tuxtxt_start(tuxtxt_cache.vtxtpid, source); #endif - fcntl(rc, F_SETFL, O_NONBLOCK); gethotlist(); if(use_gui) @@ -2787,7 +2843,7 @@ void Menu_Init(char *menu, int current_pid, int menuitem, int hotindex) void ConfigMenu(int Init) { - int val, menuitem = M_Start; + int menuitem = M_Start; int current_pid = 0; int hotindex; int oldscreenmode, oldtrans = 0; @@ -2841,23 +2897,18 @@ void ConfigMenu(int Init) clearbbcolor = black; Menu_Init(menu, current_pid, menuitem, hotindex); - /* set blocking mode */ - val = fcntl(rc, F_GETFL); - fcntl(rc, F_SETFL, val &~ O_NONBLOCK); - /* loop */ do { if (GetRCCode() == 1) { + int rc_num = -1; - if ( -#if (RC_1 > 0) - RCCode >= RC_1 && /* generates a warning... */ -#endif - RCCode <= RC_1+M_MaxDirect) /* direct access */ + if (CRCInput::isNumeric(RCCode)) + rc_num = CRCInput::getNumericValue(RCCode) -1; /* valid: 1 to M_MaxDirect */ + if (rc_num >= 0 && rc_num <= M_MaxDirect) /* direct access */ { Menu_HighlightLine(menu, MenuLine[menuitem], 0); - menuitem = RCCode-RC_1; + menuitem = rc_num; Menu_HighlightLine(menu, MenuLine[menuitem], 1); if (menuitem != M_PID) /* just select */ @@ -3318,7 +3369,6 @@ void ConfigMenu(int Init) current_service = current_pid; // RenderMessage(ShowServiceName); - fcntl(rc, F_SETFL, O_NONBLOCK); RCCode = -1; if (oldscreenmode) SwitchScreenMode(oldscreenmode); /* restore divided screen */ @@ -3379,8 +3429,6 @@ void ConfigMenu(int Init) ClearBB(transp); CopyBB2FB(); - /* reset to nonblocking mode */ - fcntl(rc, F_SETFL, O_NONBLOCK); tuxtxt_cache.pageupdate = 1; RCCode = -1; if (oldscreenmode) @@ -3595,7 +3643,7 @@ void ColorKey(int target) void PageCatching() { - int val, byte; + int byte; int oldzoommode = zoommode; pagecatching = 1; @@ -3625,10 +3673,6 @@ void PageCatching() return; } - /* set blocking mode */ - val = fcntl(rc, F_GETFL); - fcntl(rc, F_SETFL, val &~ O_NONBLOCK); - /* loop */ do { GetRCCode(); @@ -3667,7 +3711,6 @@ void PageCatching() case RC_HOME: case RC_HELP: case RC_MUTE: - fcntl(rc, F_SETFL, O_NONBLOCK); tuxtxt_cache.pageupdate = 1; pagecatching = 0; RCCode = -1; @@ -3691,9 +3734,6 @@ void PageCatching() tuxtxt_cache.subpage = subp; else tuxtxt_cache.subpage = 0; - - /* reset to nonblocking mode */ - fcntl(rc, F_SETFL, O_NONBLOCK); } /****************************************************************************** @@ -3925,9 +3965,9 @@ void SwitchScreenMode(int newscreenmode) if (screenmode==1) /* split with topmenu */ { - int x = CFrameBuffer::getInstance()->getScreenX(); - int w = CFrameBuffer::getInstance()->getScreenWidth(); - int h = CFrameBuffer::getInstance()->getScreenHeight(); + int x = screen_x; + int w = screen_w; + int h = screen_h; fw = fontwidth_topmenumain; tx = 0; /* split means we start at the left edge */ @@ -3954,18 +3994,20 @@ void SwitchScreenMode(int newscreenmode) } else /* 2: split with full height tv picture */ { - StartX = CFrameBuffer::getInstance()->getScreenX(); + StartX = screen_x; fw = fontwidth_small; tx = TV169FULLSTARTX; ty = TV169FULLSTARTY; tw = TV169FULLWIDTH; th = TV169FULLHEIGHT; - displaywidth = CFrameBuffer::getInstance()->getScreenWidth()/2; + displaywidth = screen_w / 2; } setfontwidth(fw); - videoDecoder->Pig(tx, ty, tw, th, CFrameBuffer::getInstance()->getScreenWidth(true), CFrameBuffer::getInstance()->getScreenHeight(true)); + CFrameBuffer *f = CFrameBuffer::getInstance(); + videoDecoder->Pig(tx, ty, tw, th, + f->getScreenWidth(true), f->getScreenHeight(true)); #if 0 int sm = 0; ioctl(pig, VIDIOC_OVERLAY, &sm); @@ -3987,8 +4029,8 @@ void SwitchScreenMode(int newscreenmode) #endif videoDecoder->Pig(-1, -1, -1, -1); - int x = CFrameBuffer::getInstance()->getScreenX(); - int w = CFrameBuffer::getInstance()->getScreenWidth(); + int x = screen_x; + int w = screen_w; //int h = CFrameBuffer::getInstance()->getScreenHeight(); int tx = 0; /* see comment above on the TTX window dimensions */ @@ -4131,7 +4173,9 @@ void RenderDRCS( //FIX ME void DrawVLine(int x, int y, int l, int color) { - unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; + unsigned char *p = getFBp(&y); + MARK_FB(x, y, 0, l); + p += x*4 + y * fix_screeninfo.line_length; for ( ; l > 0 ; l--) { @@ -4143,11 +4187,13 @@ void DrawVLine(int x, int y, int l, int color) void DrawHLine(int x, int y, int l, int color) { int ltmp; + unsigned char *p = getFBp(&y); + MARK_FB(x, y, l, 0); if (l > 0) { for (ltmp=0; ltmp <= l; ltmp++) { - memmove(lfb + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4); + memmove(p + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4); } } } @@ -4163,7 +4209,10 @@ void FillRectMosaicSeparated(int x, int y, int w, int h, int fgcolor, int bgcolo void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) { - unsigned char *p = lfb + x0*4 + y0 * fix_screeninfo.line_length; + unsigned char *p = getFBp(&y0); + MARK_FB(x0, y0, l0, h); + p += x0 * 4 + y0 * fix_screeninfo.line_length; + int xoffset, l; int yoffset; int ltmp; @@ -4185,7 +4234,10 @@ void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) void FlipHorz(int x, int y, int w, int h) { unsigned char *buf= new unsigned char[w*4]; - unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; + unsigned char *p = getFBp(&y); + MARK_FB(x, y, w, h); + p += x * 4 + y * fix_screeninfo.line_length; + int w1,h1; if(buf != NULL){ for (h1 = 0 ; h1 < h ; h1++) @@ -4203,7 +4255,11 @@ void FlipHorz(int x, int y, int w, int h) void FlipVert(int x, int y, int w, int h) { unsigned char *buf= new unsigned char[w*4]; - unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length, *p1, *p2; + unsigned char *p1, *p2; + unsigned char *p = getFBp(&y); + MARK_FB(x, y, w, h); + p += x*4 + y * fix_screeninfo.line_length; + int h1; if(buf != NULL){ for (h1 = 0 ; h1 < h/2 ; h1++) @@ -4464,7 +4520,11 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset) else if (*aShapes[Char - 0x20] == S_ADT) { int x,y,f,c; - unsigned char* p = lfb + PosX*4 + (PosY+yoffset)* fix_screeninfo.line_length; + y = yoffset; + unsigned char *p = getFBp(&y); + MARK_FB(PosX, PosY, curfontwidth, fontheight); + p += PosX * 4 + PosY * fix_screeninfo.line_length; + for (y=0; ytop + TTFShiftY + sbit->height > fontheight) sbit->height = fontheight - ascender + sbit->top - TTFShiftY; /* limit char height to defined/calculated fontheight */ + int y = yoffset; + p = getFBp(&y); + p += PosX * 4 + (PosY + Row) * fix_screeninfo.line_length; /* running pointer into framebuffer */ - p = lfb + PosX*4 + (yoffset + PosY + Row) * fix_screeninfo.line_length; /* running pointer into framebuffer */ for (Row = sbit->height; Row; Row--) /* row counts up, but down may be a little faster :) */ { int pixtodo = (usettf ? sbit->width : curfontwidth); @@ -5117,8 +5181,8 @@ void DoFlashing(int startrow) } PosY += fontheight*factor; } - } + void RenderPage() { int row, col, byte, startrow = 0;; @@ -5189,7 +5253,7 @@ void RenderPage() fontwidth_topmenumain = (TV43STARTX-sx) / (40-nofirst); fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; //fontwidth_small = (TV169FULLSTARTX-sx) / (40-nofirst); - fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / (40-nofirst); + fontwidth_small = (screen_w / 2) / (40 - nofirst); switch(screenmode) { case 0: @@ -5197,7 +5261,7 @@ void RenderPage() displaywidth = ex - sx; break; case 2: setfontwidth(fontwidth_small); - displaywidth = CFrameBuffer::getInstance()->getScreenWidth() / 2; + displaywidth = screen_w / 2; break; } if (transpmode || (boxed && !screenmode)) @@ -5440,7 +5504,7 @@ void CreateLine25() showlink(3, next_100); } - if (//tuxtxt_cache.bttok && + if (tuxtxt_cache.bttok && screenmode == 1) /* TOP-Info present, divided screen -> create TOP overview */ { char line[TOPMENUCHARS]; @@ -5550,6 +5614,9 @@ void CopyBB2FB() { unsigned char *src, *dst, *topsrc; int fillcolor, i, screenwidth, swtmp; +#ifdef HAVE_SPARK_HARDWARE + CFrameBuffer *f = CFrameBuffer::getInstance(); +#endif /* line 25 */ if (!pagecatching && use_gui) @@ -5570,12 +5637,16 @@ void CopyBB2FB() if (ioctl(fb, FBIOPAN_DISPLAY, &var_screeninfo) == -1) perror("TuxTxt "); #else - memmove(lfb, lfb+fix_screeninfo.line_length * var_screeninfo.yres, fix_screeninfo.line_length*var_screeninfo.yres); +#ifdef HAVE_SPARK_HARDWARE + f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true); +#else + memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); +#endif #endif /* adapt background of backbuffer if changed */ - if (StartX > 0 && *lfb != *(lfb + fix_screeninfo.line_length * var_screeninfo.yres)) { - FillBorder(*(lfb + fix_screeninfo.line_length * var_screeninfo.yoffset)); + if (StartX > 0 && *lfb != *lbb) { + FillBorder(*lbb); // ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset)); } @@ -5587,8 +5658,11 @@ void CopyBB2FB() return; } - src = dst = topsrc = lfb + StartY*fix_screeninfo.line_length; + src = topsrc = lbb + StartY * fix_screeninfo.line_length; + dst = lfb + StartY * fix_screeninfo.line_length; +#ifdef USE_FBPAN + #error USE_FBPAN code is not working right now. if (var_screeninfo.yoffset) dst += fix_screeninfo.line_length * var_screeninfo.yres; else @@ -5596,6 +5670,7 @@ void CopyBB2FB() src += fix_screeninfo.line_length * var_screeninfo.yres; topsrc += fix_screeninfo.line_length * var_screeninfo.yres; } +#endif /* copy line25 in normal height */ if (!pagecatching ) memmove(dst+(24*fontheight)*fix_screeninfo.line_length, src + (24*fontheight)*fix_screeninfo.line_length, fix_screeninfo.line_length*fontheight); @@ -5611,9 +5686,15 @@ void CopyBB2FB() /* copy topmenu in normal height (since PIG also keeps dimensions) */ if (screenmode == 1) { - unsigned char *topdst = dst; - screenwidth = ( TV43STARTX ) * 4; +#ifdef HAVE_SPARK_HARDWARE + int cx = var_screeninfo.xres - TV43STARTX; /* x start */ + int cw = TV43STARTX; /* width */ + int cy = StartY; + int ch = 24*fontheight; + f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true); +#else + unsigned char *topdst = dst; size_t width = ex * sizeof(fb_pixel_t) - screenwidth; topsrc += screenwidth; @@ -5624,6 +5705,7 @@ void CopyBB2FB() topdst += fix_screeninfo.line_length; topsrc += fix_screeninfo.line_length; } +#endif } else if (screenmode == 2) screenwidth = ( TV169FULLSTARTX ) * 4; @@ -5654,6 +5736,9 @@ void CopyBB2FB() memmove(dst + fix_screeninfo.line_length*(fontheight+i)+swtmp*4, bgra[fillcolor], 4); } } +#ifdef HAVE_SPARK_HARDWARE + f->mark(0, 0, var_screeninfo.xres, var_screeninfo.yres); +#endif } /****************************************************************************** @@ -6343,6 +6428,21 @@ void DecodePage() /****************************************************************************** * GetRCCode * ******************************************************************************/ +int GetRCCode() +{ + neutrino_msg_t msg; + neutrino_msg_data_t data; + g_RCInput->getMsg_ms(&msg, &data, 40); + RCCode = -1; + + if (msg <= CRCInput::RC_MaxRC) { + RCCode = msg; + return 1; + } + return 0; +} + +#if 0 #if 1 int GetRCCode() { @@ -6416,7 +6516,7 @@ printf("[tuxtxt] new key, code %X\n", RCCode); } RCCode = -1; - usleep(1000000/100); + usleep(1000000/25); return 0; } @@ -6481,6 +6581,7 @@ int GetRCCode() return 1; } #endif +#endif /* Local Variables: */ /* indent-tabs-mode:t */ /* tab-width:3 */ diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 9fcaed9e2..1a6974c86 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -12,6 +12,8 @@ * ported 2006 to Dreambox 7025 / 32Bit framebuffer * * by Seddi * * * + * * + * ported to Tripledragon, SPARK and AZbox 2010-2013 Stefan Seyfried * ******************************************************************************/ #define TUXTXT_CFG_STANDALONE 0 // 1:plugin only 0:use library @@ -42,6 +44,8 @@ #include FT_CACHE_H #include FT_CACHE_SMALL_BITMAPS_H +#include + /* devices */ #if TUXTXT_CFG_STANDALONE @@ -82,20 +86,19 @@ int tv_pip_y; #define fontwidth_small_lcd 8 #define TV43STARTX (ex) -#define TVENDX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()) //ex +#define TVENDX (screen_x + screen_w) //ex // #define TVENDY (StartY + 25*fontheight) // #define TV43WIDTH (TVENDX - TV43STARTX) // #define TV43HEIGHT (TV43WIDTH *9/16) // #define TV43STARTY (TVENDY - TV43HEIGHT) //#define TV169FULLSTARTX (sx+ 8*40) //(sx +(ex +1 - sx)/2) -#define TV169FULLSTARTX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()/2) +#define TV169FULLSTARTX (screen_x + screen_w / 2) #define TV169FULLSTARTY sy //#define TV169FULLWIDTH (ex - sx)/2 -#define TV169FULLWIDTH (CFrameBuffer::getInstance()->getScreenWidth()/2) +#define TV169FULLWIDTH (screen_w / 2) #define TV169FULLHEIGHT (ey - sy) - -#define TOPMENUSTARTX TV43STARTX+2 +#define TOPMENUSTARTX (TV43STARTX+2) //#define TOPMENUENDX TVENDX #define TOPMENUSTARTY StartY #define TOPMENUENDY TV43STARTY @@ -105,7 +108,7 @@ int tv_pip_y; #define TOPMENUINDENTGRP 1 #define TOPMENUINDENTDEF 2 #define TOPMENUSPC 0 -#define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+4) +#define TOPMENUCHARS (TOPMENUINDENTDEF+12+TOPMENUSPC+3) #define FLOFSIZE 4 @@ -143,6 +146,7 @@ int tv_pip_y; #define hold_mosaic 0x1E #define release_mosaic 0x1F +#if 0 /* rc codes */ #define RC_0 0x00 #define RC_1 0x01 @@ -171,6 +175,48 @@ int tv_pip_y; #define RC_DBOX 0x18 #define RC_TEXT 0x19 #define RC_HOME 0x1F +#else +#define RC_0 CRCInput::RC_0 +#define RC_1 CRCInput::RC_1 +#define RC_2 CRCInput::RC_2 +#define RC_3 CRCInput::RC_3 +#define RC_4 CRCInput::RC_4 +#define RC_5 CRCInput::RC_5 +#define RC_6 CRCInput::RC_6 +#define RC_7 CRCInput::RC_7 +#define RC_8 CRCInput::RC_8 +#define RC_9 CRCInput::RC_9 +#define RC_RIGHT CRCInput::RC_right +#define RC_LEFT CRCInput::RC_left +#define RC_UP CRCInput::RC_up +#define RC_DOWN CRCInput::RC_down +#define RC_OK CRCInput::RC_ok +#define RC_MUTE CRCInput::RC_spkr +#define RC_STANDBY CRCInput::RC_standby +#define RC_GREEN CRCInput::RC_green +#define RC_YELLOW CRCInput::RC_yellow +#define RC_RED CRCInput::RC_red +#define RC_BLUE CRCInput::RC_blue +#define RC_PLUS CRCInput::RC_plus +#define RC_MINUS CRCInput::RC_minus +#define RC_HELP CRCInput::RC_help +#define RC_INFO CRCInput::RC_info +#define RC_DBOX CRCInput::RC_setup +#define RC_HOME CRCInput::RC_home +#define RC_TTTV CRCInput::RC_tttv +#define RC_TTZOOM CRCInput::RC_ttzoom +#define RC_TTREVEAL CRCInput::RC_ttreveal +#if HAVE_TRIPLEDRAGON +/* td has more keys so use ttx key for switching split mode... */ +#define RC_SPLIT CRCInput::RC_text +/* rc_text is now unused */ +#define RC_TEXT (CRCInput::RC_MaxRC + 1) +#else +/* ...while other receivers use the vol- key for that, so rc_split is unused */ +#define RC_SPLIT (CRCInput::RC_MaxRC + 1) +#define RC_TEXT CRCInput::RC_text +#endif +#endif typedef enum /* object type */ { @@ -202,6 +248,7 @@ const char *ObjectType[] = /* framebuffer stuff */ static unsigned char *lfb = 0; +static unsigned char *lbb = 0; struct fb_var_screeninfo var_screeninfo; struct fb_fix_screeninfo fix_screeninfo; @@ -545,7 +592,7 @@ char versioninfo[16]; int hotlist[10]; int maxhotlist; -int pig, rc, fb, lcd; +int pig, fb, lcd; int sx, ex, sy, ey; int PosX, PosY, StartX, StartY; int lastpage; @@ -577,7 +624,7 @@ int subtitledelay, delaystarted; FILE *conf; -unsigned short RCCode; +neutrino_msg_t RCCode; struct _pid_table { @@ -702,11 +749,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Bildschirmformat äé" "ã3 Standard-Modus 16:9 äé" "ã äé" - "ã5 Helligkeit äé" + "ã4 Helligkeit äé" "ãí îäé" - "ã6 Transparenz äé" + "ã5 Transparenz äé" "ãí îäé" - "ã7 nationaler Zeichensatz äé" + "ã6 nationaler Zeichensatz äé" "ãautomatische Erkennung äé" "ãí îäé" "ãí Sprache/Language deutsch îäé" @@ -729,11 +776,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Screen format äé" "ã3 Standard mode 16:9 äé" "ã äé" - "ã5 Brightness äé" + "ã4 Brightness äé" "ãí îäé" - "ã6 Transparency äé" + "ã5 Transparency äé" "ãí îäé" - "ã7 national characterset äé" + "ã6 national characterset äé" "ã automatic recognition äé" "ãí îäé" "ãí Sprache/language english îäé" @@ -756,11 +803,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Format de l'#cran äé" "ã3 Mode standard 16:9 äé" "ã äé" - "ã5 Clarte äé" + "ã4 Clarte äé" "ãí îäé" - "ã6 Transparence äé" + "ã5 Transparence äé" "ãí îäé" - "ã7 police nationale äé" + "ã6 police nationale äé" "ãreconn. automatique äé" "ãí îäé" "ãí Sprache/language francaisîäé" @@ -783,11 +830,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Beeldschermformaat äé" "ã3 Standaardmode 16:9 äé" "ã äé" - "ã5 Helderheid äé" + "ã4 Helderheid äé" "ãí îäé" - "ã6 Transparantie äé" + "ã5 Transparantie äé" "ãí îäé" - "ã7 nationale tekenset äé" + "ã6 nationale tekenset äé" "ãautomatische herkenning äé" "ãí îäé" "ãí Sprache/Language nederl. îäé" @@ -810,11 +857,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Loqv^ oh|mgr äé" "ã3 Tq|por pq|tupor 16:9 äé" "ã äé" - "ã5 Kalpq|tgta äé" + "ã4 Kalpq|tgta äé" "ãí îäé" - "ã6 Diav\\meia äé" + "ã5 Diav\\meia äé" "ãí îäé" - "ã7 Ehmij^ tuposeiq\\ äé" + "ã6 Ehmij^ tuposeiq\\ äé" "ãaut|latg amacm~qisg äé" "ãí îäé" "ãí Ck~ssa/Language ekkgmij\\ îäé" @@ -837,11 +884,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Formato schermo äé" "ã3 Modo standard 16:9 äé" "ã äé" - "ã5 Luminosit{ äé" + "ã4 Luminosit{ äé" "ãí îäé" - "ã6 Trasparenza äé" + "ã5 Trasparenza äé" "ãí îäé" - "ã7 nazionalita'caratteri äé" + "ã6 nazionalita'caratteri äé" "ã riconoscimento automatico äé" "ãí îäé" "ãí Lingua/Language Italiana îäé" @@ -864,11 +911,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Format obrazu äé" "ã3 Tryb standard 16:9 äé" "ã äé" - "ã5 Jasno|^ äé" + "ã4 Jasno|^ äé" "ãí îäé" - "ã6 Prze~roczysto|^ äé" + "ã5 Prze~roczysto|^ äé" "ãí îäé" - "ã7 Znaki charakterystyczne äé" + "ã6 Znaki charakterystyczne äé" "ã automatyczne rozpozn. äé" "ãí îäé" "ãí J`zyk/Language polski îäé" @@ -891,11 +938,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã TV- format äé" "ã3 Standard l{ge 16:9 äé" "ã äé" - "ã5 Ljusstyrka äé" + "ã4 Ljusstyrka äé" "ãí îäé" - "ã6 Genomskinlighet äé" + "ã5 Genomskinlighet äé" "ãí îäé" - "ã7nationell teckenupps{ttningäé" + "ã6nationell teckenupps{ttningäé" "ã automatisk igenk{nning äé" "ãí îäé" "ãí Sprache/language svenska îäé" @@ -918,11 +965,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã N{ytt|tila äé" "ã3 Vakiotila 16:9 äé" "ã äé" - "ã5 Kirkkaus äé" + "ã4 Kirkkaus äé" "ãí îäé" - "ã6 L{pin{kyvyys äé" + "ã5 L{pin{kyvyys äé" "ãí îäé" - "ã7 kansallinen merkist| äé" + "ã6 kansallinen merkist| äé" "ã automaattinen tunnistus äé" "ãí îäé" "ãí Kieli suomi îäé" @@ -945,11 +992,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã formato ecran äé" "ã3 Standard mode 16:9 äé" "ã äé" - "ã5 Brilho äé" + "ã4 Brilho äé" "ãí îäé" - "ã6 Transparencia äé" + "ã5 Transparencia äé" "ãí îäé" - "ã7 Caracteres nacionaist äé" + "ã6 Caracteres nacionaist äé" "ãreconhecimento utomatico äé" "ãí îäé" "ãí Lingua Portuguesa îäé" @@ -972,11 +1019,11 @@ const char configmenu[][Menu_Height*(Menu_Width+1)] = "ã Format kartinki äé" "ã3 Stand. revim 16:9 äé" "ã äé" - "ã5 Qrkostx äé" + "ã4 Qrkostx äé" "ãí îäé" - "ã6 Prozra~nostx äé" + "ã5 Prozra~nostx äé" "ãí îäé" - "ã7 Ispolxzuem&j alfawit äé" + "ã6 Ispolxzuem&j alfawit äé" "ã awtoopredelenie äé" "ãí îäé" "ãí Qz&k: Russkij îäé" diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h index 8a99bd2b5..0abbf87c1 100644 --- a/lib/libtuxtxt/tuxtxt_common.h +++ b/lib/libtuxtxt/tuxtxt_common.h @@ -1,4 +1,6 @@ - +/* tuxtxt_common.h + * for license info see the other tuxtxt files + */ #include #include #include @@ -16,6 +18,7 @@ tuxtxt_cache_struct tuxtxt_cache; static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t tuxtxt_cache_biglock = PTHREAD_MUTEX_INITIALIZER; int tuxtxt_get_zipsize(int p,int sp) { tstCachedPage* pg = tuxtxt_cache.astCachetable[p][sp]; @@ -351,6 +354,7 @@ int tuxtxt_GetSubPage(int page, int subpage, int offset) void tuxtxt_clear_cache(void) { + pthread_mutex_lock(&tuxtxt_cache_biglock); pthread_mutex_lock(&tuxtxt_cache_lock); int clear_page, clear_subpage, d26; tuxtxt_cache.maxadippg = -1; @@ -414,6 +418,7 @@ void tuxtxt_clear_cache(void) printf("TuxTxt cache cleared\n"); #endif pthread_mutex_unlock(&tuxtxt_cache_lock); + pthread_mutex_unlock(&tuxtxt_cache_biglock); } /****************************************************************************** * init_demuxer * @@ -541,6 +546,7 @@ void tuxtxt_allocate_cache(int magazine) // Lock here as we have a possible race here with // tuxtxt_clear_cache(). We should not be allocating and // freeing at the same time. + // *** this is probably worked around by tuxtxt_cacehe_biglock now *** --seife pthread_mutex_lock(&tuxtxt_cache_lock); /* check cachetable and allocate memory if needed */ @@ -614,6 +620,13 @@ void *tuxtxt_CacheThread(void * /*arg*/) continue; } + /* this "big hammer lock" is a hack: it avoids a crash if + * tuxtxt_clear_cache() is called while the cache thread is in the + * middle of the following loop, leading to tuxtxt_cache.current_page[] + * etc. being set to -1 and tuxtxt_cache.astCachetable[] etc. being set + * to NULL + * it probably also avoids the possible race in tuxtxt_allocate_cache() */ + pthread_mutex_lock(&tuxtxt_cache_biglock); /* analyze it */ for (line = 0; line < readcnt/0x2e /*4*/; line++) { @@ -1055,6 +1068,7 @@ void *tuxtxt_CacheThread(void * /*arg*/) printf("line %d row %X %X, continue\n", line, vtx_rowbyte[0], vtx_rowbyte[1]); #endif } + pthread_mutex_unlock(&tuxtxt_cache_biglock); } pthread_exit(NULL); From af247d098a2d26eee48a9f61b043a126fcac5f74 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 15 Feb 2017 00:31:26 +0100 Subject: [PATCH 35/36] tuxtxt: convert to int-pointer arithmetic, work with all framebuffers This converts the drawing code from byte-pointer to fb_pixel_t-pointer arithmetic, making the calculations more obvious and probably more efficient. Additionally, the color tables are now generated in a way that it should work regardless of the frame buffer color format. Allows to remove a few hardware specific #ifdefs. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c977c98217efa7211444b22f8afa2abc69f102be Author: Stefan Seyfried Date: 2017-02-15 (Wed, 15 Feb 2017) ------------------ This commit was generated by Migit --- lib/libtuxtxt/tuxtxt.cpp | 199 +++++++++++++++++---------------------- lib/libtuxtxt/tuxtxt.h | 34 +------ 2 files changed, 93 insertions(+), 140 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index c6f5f4ce9..dc7d5a7c5 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -49,7 +49,7 @@ static int screen_x, screen_y, screen_w, screen_h; //#define USE_FBPAN // FBIOPAN_DISPLAY seems to be working in current driver -unsigned char *getFBp(int *y) +fb_pixel_t *getFBp(int *y) { if (*y < (int)var_screeninfo.yres) return lfb; @@ -60,20 +60,15 @@ unsigned char *getFBp(int *y) void FillRect(int x, int y, int w, int h, int color) { - unsigned char *p = getFBp(&y); + fb_pixel_t *p = getFBp(&y); MARK_FB(x, y, w, h); - p += x*4 + y * fix_screeninfo.line_length; -#if !HAVE_TRIPLEDRAGON - unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0]; -#else - unsigned int col = *((unsigned int*)bgra[color]); -#endif + p += x + y * stride; if (w > 0) for (int count = 0; count < h; count++) { - unsigned int * dest0 = (unsigned int *)p; + fb_pixel_t *dest0 = p; for (int i = 0; i < w; i++) - *(dest0++) = col; - p += fix_screeninfo.line_length; + *(dest0++) = bgra[color]; + p += stride; } } @@ -319,25 +314,14 @@ void setfontwidth(int newwidth) } } -#if HAVE_TRIPLEDRAGON -#define _A 0 -#define _R 1 -#define _G 2 -#define _B 3 -#else -#define _A 3 -#define _R 2 -#define _G 1 -#define _B 0 -#endif void setcolors(unsigned short *pcolormap, int offset, int number) { - int i,trans_tmp; + int i,trans_tmp,tr; int j = offset; /* index in global color table */ - - trans_tmp=25-trans_mode; - - bgra[transp2][_A]=((trans_tmp+7)<<11 | 0x7FF)>>8; + int R = var_screeninfo.red.offset; + int G = var_screeninfo.green.offset; + int B = var_screeninfo.blue.offset; + int A = var_screeninfo.transp.offset; for (i = 0; i < number; i++) { @@ -348,13 +332,17 @@ void setcolors(unsigned short *pcolormap, int offset, int number) r = (r * (0x3f+(color_mode<<3))) >> 8; g = (g * (0x3f+(color_mode<<3))) >> 8; b = (b * (0x3f+(color_mode<<3))) >> 8; - - bgra[j][_R]=r; - bgra[j][_G]=g; - bgra[j][_B]=b; - + bgra[j] = (r << R) | (g << G) | (b << B) | (0xff << A); j++; } + trans_tmp=25-trans_mode; + tr = ((trans_tmp+7)<<11 | 0x7FF)>>8; + bgra[transp2] &= ~(0xff << A); /* clear alpha */ + bgra[transp2] |= tr << A; + bgra[menu3] &= ~(0xff << A); + bgra[menu3] |= 0xc0 << A; + bgra[transp] &= ~(0xff << A); + bgra[transp] |= 0; } /* hexdump of page contents to stdout for debugging */ @@ -1666,8 +1654,8 @@ int tuxtx_main(int /*_rc*/, int pid, int page, int source) #endif CFrameBuffer *fbp = CFrameBuffer::getInstance(); - lfb = (unsigned char *)fbp->getFrameBufferPointer(); - lbb = (unsigned char *)fbp->getBackBufferPointer(); + lfb = fbp->getFrameBufferPointer(); + lbb = fbp->getBackBufferPointer(); tuxtxt_cache.vtxtpid = pid; @@ -1693,6 +1681,8 @@ int tuxtx_main(int /*_rc*/, int pid, int page, int source) #else struct fb_var_screeninfo *var; var = fbp->getScreenInfo(); + /* this is actually the length of the screen in pixels */ + stride = fbp->getStride() / sizeof(fb_pixel_t); memcpy(&var_screeninfo, var, sizeof(struct fb_var_screeninfo)); fix_screeninfo.line_length = var_screeninfo.xres * sizeof(fb_pixel_t); #endif @@ -4117,7 +4107,7 @@ void SwitchHintMode() void RenderDRCS( //FIX ME unsigned char *s, /* pointer to char data, parity undecoded */ - unsigned char *d, /* pointer to frame buffer of top left pixel */ + fb_pixel_t *d, /* pointer to frame buffer of top left pixel */ unsigned char *ax, /* array[0..12] of x-offsets, array[0..10] of y-offsets for each pixel */ unsigned char fgcolor, unsigned char bgcolor) { @@ -4149,52 +4139,45 @@ void RenderDRCS( //FIX ME { // memset(d + ax[x], f1, ax[x+1] - ax[x]); for (ltmp=0 ; ltmp <= (ax[x+1]-ax[x]); ltmp++) - { - memmove(d + ax[x]*4 +ltmp*4,bgra[f1],4); - } + *(d + ax[x] + ltmp) = bgra[f1]; } if (ax[x+7] > ax[x+6]) { // memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */ for (ltmp=0 ; ltmp <= (ax[x+7]-ax[x+6]); ltmp++) - { - memmove(d + ax[x+6]*4 +ltmp*4,bgra[f2],4); - } - + *(d + ax[x+6] + ltmp) = bgra[f2]; } - d += fix_screeninfo.line_length; + d += stride; } - d -= h * fix_screeninfo.line_length; + d -= h * stride; } - d += h * fix_screeninfo.line_length; + d += h * stride; } } void DrawVLine(int x, int y, int l, int color) { - unsigned char *p = getFBp(&y); + fb_pixel_t *p = getFBp(&y); MARK_FB(x, y, 0, l); - p += x*4 + y * fix_screeninfo.line_length; + p += x + y * stride; for ( ; l > 0 ; l--) { - memmove(p,bgra[color],4); - p += fix_screeninfo.line_length; + *p = bgra[color]; + p += stride; } } void DrawHLine(int x, int y, int l, int color) { int ltmp; - unsigned char *p = getFBp(&y); + fb_pixel_t *p = getFBp(&y); MARK_FB(x, y, l, 0); if (l > 0) { for (ltmp=0; ltmp <= l; ltmp++) - { - memmove(p + x*4 + ltmp*4 + y * fix_screeninfo.line_length, bgra[color], 4); - } + *(p + x + ltmp + y * stride) = bgra[color]; } } @@ -4209,9 +4192,9 @@ void FillRectMosaicSeparated(int x, int y, int w, int h, int fgcolor, int bgcolo void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) { - unsigned char *p = getFBp(&y0); + fb_pixel_t *p = getFBp(&y0); MARK_FB(x0, y0, l0, h); - p += x0 * 4 + y0 * fix_screeninfo.line_length; + p += x0 + y0 * stride; int xoffset, l; int yoffset; @@ -4224,19 +4207,17 @@ void FillTrapez(int x0, int y0, int l0, int xoffset1, int h, int l1, int color) if (l > 0) { for (ltmp=0; ltmp <= l; ltmp++) - { - memmove(p + xoffset*4 +ltmp*4, bgra[color], 4); - } + *(p + xoffset + ltmp) = bgra[color]; } - p += fix_screeninfo.line_length; + p += stride; } } void FlipHorz(int x, int y, int w, int h) { unsigned char *buf= new unsigned char[w*4]; - unsigned char *p = getFBp(&y); + fb_pixel_t *p = getFBp(&y); MARK_FB(x, y, w, h); - p += x * 4 + y * fix_screeninfo.line_length; + p += x + y * stride; int w1,h1; if(buf != NULL){ @@ -4245,9 +4226,9 @@ void FlipHorz(int x, int y, int w, int h) memmove(buf,p,w*4); for (w1 = 0 ; w1 < w ; w1++) { - memmove(p+w1*4,buf+((w-w1)*4)-4,4); + memmove(p + w1,buf+((w-w1)*4)-4,4); } - p += fix_screeninfo.line_length; + p += stride; } delete [] buf; } @@ -4255,17 +4236,17 @@ void FlipHorz(int x, int y, int w, int h) void FlipVert(int x, int y, int w, int h) { unsigned char *buf= new unsigned char[w*4]; - unsigned char *p1, *p2; - unsigned char *p = getFBp(&y); + fb_pixel_t *p1, *p2; + fb_pixel_t *p = getFBp(&y); MARK_FB(x, y, w, h); - p += x*4 + y * fix_screeninfo.line_length; + p += x + y * stride; int h1; if(buf != NULL){ for (h1 = 0 ; h1 < h/2 ; h1++) { - p1 = (p+(h1*fix_screeninfo.line_length)); - p2 = (p+(h-(h1+1))*fix_screeninfo.line_length); + p1 = (p + (h1 * stride)); + p2 = (p + (h - (h1 + 1)) * stride); memmove(buf,p1,w*4); memmove(p1,p2,w*4); memmove(p2,buf,w*4); @@ -4521,9 +4502,9 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset) { int x,y,f,c; y = yoffset; - unsigned char *p = getFBp(&y); + fb_pixel_t *p = getFBp(&y); MARK_FB(PosX, PosY, curfontwidth, fontheight); - p += PosX * 4 + PosY * fix_screeninfo.line_length; + p += PosX + PosY * stride; for (y=0; ytop + TTFShiftY); @@ -4848,18 +4829,18 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset) int y = yoffset; p = getFBp(&y); - p += PosX * 4 + (PosY + Row) * fix_screeninfo.line_length; /* running pointer into framebuffer */ + p += PosX + (PosY + Row) * stride; /* running pointer into framebuffer */ for (Row = sbit->height; Row; Row--) /* row counts up, but down may be a little faster :) */ { int pixtodo = (usettf ? sbit->width : curfontwidth); - char *pstart = (char*) p; + fb_pixel_t *pstart = p; for (Bit = xfactor * (sbit->left + TTFShiftX); Bit > 0; Bit--) /* fill left margin */ { for (f = factor-1; f >= 0; f--) - memmove((p + f*fix_screeninfo.line_length),bgra[bgcolor],4);/*bgcolor*/ - p+=4; + *(p + f * stride) = bgra[bgcolor]; + p++; if (!usettf) pixtodo--; } @@ -4879,14 +4860,14 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset) color = bgcolor; for (f = factor-1; f >= 0; f--) - memmove((p + f*fix_screeninfo.line_length),bgra[color],4); - p+=4; + *(p + f * stride) = bgra[color]; + p++; if (xfactor > 1) /* double width */ { for (f = factor-1; f >= 0; f--) - memmove((p + f*fix_screeninfo.line_length),bgra[color],4); - p+=4; + *(p + f * stride) = bgra[color]; + p++; if (!usettf) pixtodo--; @@ -4898,11 +4879,11 @@ void RenderChar(int Char, tstPageAttr *Attribute, int zoom, int yoffset) Bit > 0; Bit--) /* fill rest of char width */ { for (f = factor-1; f >= 0; f--) - memmove((p + f*fix_screeninfo.line_length),bgra[bgcolor],4); - p+=4; + *(p + f * stride) = bgra[bgcolor]; + p++; } - p = (unsigned char*) pstart + factor*fix_screeninfo.line_length; + p = pstart + factor * stride; } Row = ascender - sbit->top + sbit->height + TTFShiftY; @@ -5612,7 +5593,7 @@ void CreateLine25() void CopyBB2FB() { - unsigned char *src, *dst, *topsrc; + fb_pixel_t *src, *dst, *topsrc; int fillcolor, i, screenwidth, swtmp; #ifdef HAVE_SPARK_HARDWARE CFrameBuffer *f = CFrameBuffer::getInstance(); @@ -5658,8 +5639,8 @@ void CopyBB2FB() return; } - src = topsrc = lbb + StartY * fix_screeninfo.line_length; - dst = lfb + StartY * fix_screeninfo.line_length; + src = topsrc = lbb + StartY * stride; + dst = lfb + StartY * stride; #ifdef USE_FBPAN #error USE_FBPAN code is not working right now. @@ -5673,7 +5654,7 @@ void CopyBB2FB() #endif /* copy line25 in normal height */ if (!pagecatching ) - memmove(dst+(24*fontheight)*fix_screeninfo.line_length, src + (24*fontheight)*fix_screeninfo.line_length, fix_screeninfo.line_length*fontheight); + memmove(dst + (24 * fontheight) * stride, src + (24 * fontheight) * stride, stride * fontheight); if (transpmode) fillcolor = transp; @@ -5681,12 +5662,12 @@ void CopyBB2FB() fillcolor = FullScrColor; if (zoommode == 2) - src += 12*fontheight*fix_screeninfo.line_length; + src += 12 * fontheight * stride; /* copy topmenu in normal height (since PIG also keeps dimensions) */ if (screenmode == 1) { - screenwidth = ( TV43STARTX ) * 4; + screenwidth = ( TV43STARTX ); #ifdef HAVE_SPARK_HARDWARE int cx = var_screeninfo.xres - TV43STARTX; /* x start */ int cw = TV43STARTX; /* width */ @@ -5694,47 +5675,43 @@ void CopyBB2FB() int ch = 24*fontheight; f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true); #else - unsigned char *topdst = dst; - size_t width = ex * sizeof(fb_pixel_t) - screenwidth; + fb_pixel_t *topdst = dst; + size_t width = (ex - screenwidth) * sizeof(fb_pixel_t); topsrc += screenwidth; topdst += screenwidth; for (i=0; i < 24*fontheight; i++) { memmove(topdst, topsrc, width); - topdst += fix_screeninfo.line_length; - topsrc += fix_screeninfo.line_length; + topdst += stride; + topsrc += stride; } #endif } else if (screenmode == 2) - screenwidth = ( TV169FULLSTARTX ) * 4; + screenwidth = ( TV169FULLSTARTX ); else - screenwidth = fix_screeninfo.line_length;//var_screeninfo.xres; + screenwidth = stride; for (i = StartY; i>0;i--) { for (swtmp=0; swtmp<=screenwidth; swtmp++) - { - memmove(dst - i*fix_screeninfo.line_length+swtmp*4, bgra[fillcolor], 4); - } + *(dst - i * stride + swtmp) = bgra[fillcolor]; } for (i = 12*fontheight; i; i--) { - memmove(dst, src, screenwidth); - dst += fix_screeninfo.line_length; - memmove(dst, src, screenwidth); - dst += fix_screeninfo.line_length; - src += fix_screeninfo.line_length; + memmove(dst, src, screenwidth * sizeof(fb_pixel_t)); + dst += stride; + memmove(dst, src, screenwidth * sizeof(fb_pixel_t)); + dst += stride; + src += stride; } for (i = var_screeninfo.yres - StartY - 25*fontheight; i >= 0;i--) { for (swtmp=0; swtmp<= screenwidth;swtmp++) - { - memmove(dst + fix_screeninfo.line_length*(fontheight+i)+swtmp*4, bgra[fillcolor], 4); - } + *(dst + stride * (fontheight + i) + swtmp) = bgra[fillcolor]; } #ifdef HAVE_SPARK_HARDWARE f->mark(0, 0, var_screeninfo.xres, var_screeninfo.yres); @@ -6056,8 +6033,8 @@ void DecodePage() RenderDRCS( page_char + 20 * (DRCSCOLS * row + col + 2), lfb - + (StartY + fontheight + DRCSYSPC * row + var_screeninfo.yres - var_screeninfo.yoffset) * fix_screeninfo.line_length - + (StartX + DRCSXSPC * col)*4, + + (StartY + fontheight + DRCSYSPC * row + var_screeninfo.yres - var_screeninfo.yoffset) * stride + + (StartX + DRCSXSPC * col), ax, white, black); memset(page_char + 40, 0xff, 24*40); /* don't render any char below row 0 */ diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 1a6974c86..b347d6420 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -247,10 +247,11 @@ const char *ObjectType[] = #define NoServicesFound 3 /* framebuffer stuff */ -static unsigned char *lfb = 0; -static unsigned char *lbb = 0; +static fb_pixel_t *lfb = 0; +static fb_pixel_t *lbb = 0; struct fb_var_screeninfo var_screeninfo; struct fb_fix_screeninfo fix_screeninfo; +int stride; /* freetype stuff */ FT_Library library; @@ -1248,33 +1249,8 @@ const unsigned short defaultcolors[] = /* 0x0bgr */ 0x420, 0x210, 0x420, 0x000, 0x000 }; -#if !HAVE_TRIPLEDRAGON -/* 32bit colortable */ -unsigned char bgra[][5] = { -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", -"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00", -"\0\0\0\x33" }; -#else -/* actually "ARGB" */ -unsigned char bgra[][5] = { -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", -"\xFF\0\0\0", "\xFF\0\0\0", "\xC0\0\0\0", "\x00\0\0\0", -"\x33\0\0\0" }; -#endif +/* filled in setcolors() */ +fb_pixel_t bgra[SIZECOLTABLE]; /* old 8bit color table */ unsigned short rd0[] = {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0x00<<8, 0x00<<8, 0x00<<8, 0, 0 }; From 04ab274e2a863515cff3d710d694eb2e100f6588 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Wed, 15 Feb 2017 18:39:02 +0100 Subject: [PATCH 36/36] fb_accel_cs_hd2: add missing getBackBufferPointer() Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/84edb25f3f1a60230ee8340c97650609fbb6d08a Author: Michael Liebmann Date: 2017-02-15 (Wed, 15 Feb 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/fb_accel.h | 1 + src/driver/fb_accel_cs_hd2.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index 090ef4cc4..f776908be 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -125,6 +125,7 @@ class CFbAccelCSHD2 void paintBoxRel(const int x, const int y, const int dx, const int dy, const fb_pixel_t col, int radius = 0, int type = CORNER_ALL); void blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp = 0, uint32_t yp = 0, bool transp = false); void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); + fb_pixel_t * getBackBufferPointer() const; void setBlendMode(uint8_t); void setBlendLevel(int); uint32_t getWidth4FB_HW_ACC(const uint32_t x, const uint32_t w, const bool max=true); diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 256a9c729..bc2983560 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -211,6 +211,11 @@ int CFbAccelCSHD2::setMode(unsigned int, unsigned int, unsigned int) return 0; /* dont fail because of this */ } +fb_pixel_t * CFbAccelCSHD2::getBackBufferPointer() const +{ + return backbuffer; +} + void CFbAccelCSHD2::setBlendMode(uint8_t mode) { if (ioctl(fd, FBIO_SETBLENDMODE, mode))