diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 6caf75db8..4fec1c501 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -5524,7 +5524,7 @@ void CopyBB2FB() { fb_pixel_t *src, *dst, *topsrc; int fillcolor, i, screenwidth, swtmp; -#ifdef HAVE_SPARK_HARDWARE +#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) CFrameBuffer *f = CFrameBuffer::getInstance(); #endif @@ -5537,6 +5537,8 @@ void CopyBB2FB() { #ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, 0, true); +#elif defined BOXMODEL_CS_HD2 + f->fbCopyArea(var_screeninfo.xres, var_screeninfo.yres, 0, 0, 0, var_screeninfo.yres); #else memcpy(lfb, lbb, fix_screeninfo.line_length*var_screeninfo.yres); #endif @@ -5574,12 +5576,16 @@ void CopyBB2FB() if (screenmode == 1) { screenwidth = ( TV43STARTX ); -#ifdef HAVE_SPARK_HARDWARE +#if defined(HAVE_SPARK_HARDWARE) || defined(BOXMODEL_CS_HD2) int cx = var_screeninfo.xres - TV43STARTX; /* x start */ int cw = TV43STARTX; /* width */ int cy = StartY; int ch = 24*fontheight; +#endif +#ifdef HAVE_SPARK_HARDWARE f->blit2FB(lbb, cw, ch, cx, cy, cx, cy, true); +#elif defined BOXMODEL_CS_HD2 + f->fbCopyArea(cw, ch, cx, cy, cx, cy+var_screeninfo.yres); #else fb_pixel_t *topdst = dst; size_t width = (ex - screenwidth) * sizeof(fb_pixel_t); diff --git a/src/driver/fb_accel.h b/src/driver/fb_accel.h index f776908be..72bca8aa5 100644 --- a/src/driver/fb_accel.h +++ b/src/driver/fb_accel.h @@ -100,6 +100,7 @@ class CFbAccelCSHD1 inline void paintHLineRel(int x, int dx, int y, const fb_pixel_t col) { paintLine(x, y, x+dx, y, col); }; inline void paintVLineRel(int x, int y, int dy, const fb_pixel_t col) { paintLine(x, y, x, y+dy, col); }; 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 fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); 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); void waitForIdle(const char *func = NULL); @@ -123,6 +124,7 @@ class CFbAccelCSHD2 void paintHLineRel(int x, int dx, int y, const fb_pixel_t col); void paintVLineRel(int x, int y, int dy, const fb_pixel_t col); 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 fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); 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; diff --git a/src/driver/fb_accel_cs_hd1.cpp b/src/driver/fb_accel_cs_hd1.cpp index 9b20091cc..2672dfd58 100644 --- a/src/driver/fb_accel_cs_hd1.cpp +++ b/src/driver/fb_accel_cs_hd1.cpp @@ -262,6 +262,17 @@ void CFbAccelCSHD1::paintBoxRel(const int x, const int y, const int dx, const in checkFbArea(x, y, dx, dy, false); } +void CFbAccelCSHD1::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_; + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + //printf("\033[33m>>>>\033[0m [CFbAccelCSHD1::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + printf("\033[31m>>>>\033[0m [CFbAccelCSHD1::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); +} + void CFbAccelCSHD1::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; diff --git a/src/driver/fb_accel_cs_hd2.cpp b/src/driver/fb_accel_cs_hd2.cpp index 7e24aabf8..b801a37ff 100644 --- a/src/driver/fb_accel_cs_hd2.cpp +++ b/src/driver/fb_accel_cs_hd2.cpp @@ -141,6 +141,28 @@ void CFbAccelCSHD2::paintBoxRel(const int x, const int y, const int dx, const in checkFbArea(x, y, dx, dy, false); } +void CFbAccelCSHD2::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_; + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + if(!(w_%4)) { + fb_copyarea area; + area.dx = dst_x; + area.dy = dst_y; + area.width = w_; + area.height = h_; + area.sx = src_x; + area.sy = src_y; + ioctl(fd, FBIO_COPY_AREA, &area); + //printf("\033[33m>>>>\033[0m [CFbAccelCSHD2::%s:%d] fb_copyarea w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + return; + } + //printf("\033[31m>>>>\033[0m [CFbAccelCSHD2::%s:%d] sw blit w: %d, h: %d, dst_x: %d, dst_y: %d, src_x: %d, src_y: %d\n", __func__, __LINE__, w_, h_, dst_x, dst_y, src_x, src_y); + CFrameBuffer::fbCopyArea(width, height, dst_x, dst_y, src_x, src_y); +} + void CFbAccelCSHD2::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool transp) { int xc, yc; diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index 0e9ed448c..37b66ca00 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -1578,6 +1578,62 @@ void * CFrameBuffer::convertRGBA2FB(unsigned char *rgbbuff, unsigned long x, uns return int_convertRGB2FB(rgbbuff, x, y, 0, true); } +void CFrameBuffer::fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y) +{ + uint32_t w_, h_, i; + fb_pixel_t *fromBuf = NULL, *toBuf = NULL; + fb_pixel_t *dst_p, *src_p; + fb_pixel_t * fbp = getFrameBufferPointer(); + fb_pixel_t * bbp = getBackBufferPointer(); + w_ = (width > xRes) ? xRes : width; + h_ = (height > yRes) ? yRes : height; + + if ((src_y < yRes) && (dst_y < yRes)) { /* copy within framebuffer */ + fromBuf = fbp; + toBuf = fbp; + } + else if ((src_y >= yRes) && (dst_y >= yRes)) { /* copy within backbuffer */ + fromBuf = bbp; + toBuf = bbp; + dst_y -= yRes; + src_y -= yRes; + } + else if (src_y >= yRes) { /* copy backbuffer => framebuffer */ + fromBuf = bbp; + toBuf = fbp; + src_y -= yRes; + } + else if (dst_y >= yRes) { /* copy framebuffer => backbuffer */ + fromBuf = fbp; + toBuf = bbp; + dst_y -= yRes; + } + if ((fromBuf == NULL) || (toBuf == NULL)) { + //printf(">>>>> [%s:%d] buff = NULL\n", __func__, __LINE__); + return; + } + if ((src_x == dst_x) && (src_y == dst_y) && (fromBuf == toBuf)) { /* self copy? */ + //printf(">>>>> [%s:%d] self copy?\n", __func__, __LINE__); + return; + } + + dst_p = toBuf + dst_y*swidth; + src_p = fromBuf + src_y*swidth; + if ((w_ == xRes) && (swidth == xRes)) { /* copy full width */ + //printf(">>>>> [%s:%d] copy full width - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p); + memcpy(dst_p, src_p, w_*h_*sizeof(fb_pixel_t)); + } + else { /* copy all other */ + //printf(">>>>> [%s:%d] copy all other - dst_p: %p, src_p: %p\n", __func__, __LINE__, dst_p, src_p); + uint32_t wMem = w_*sizeof(fb_pixel_t); + for (i = 0; i < h_; i++) { + memcpy(dst_p+dst_x, src_p+src_x, wMem); + dst_p += swidth; + src_p += swidth; + } + } +} + void CFrameBuffer::blit2FB(void *fbbuff, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff, uint32_t xp, uint32_t yp, bool /*transp*/) { int xc, yc; diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index c1a2d14d2..b6dae5a3f 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -265,6 +265,7 @@ class CFrameBuffer : public sigc::trackable void* convertRGB2FB(unsigned char *rgbbuff, unsigned long x, unsigned long y, int transp = 0xFF); 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 fbCopyArea(uint32_t width, uint32_t height, uint32_t dst_x, uint32_t dst_y, uint32_t src_x, uint32_t src_y); 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); virtual void blitBox2FB(const fb_pixel_t* boxBuf, uint32_t width, uint32_t height, uint32_t xoff, uint32_t yoff); diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index d35c07701..7a5224115 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -177,6 +177,27 @@ bool CRCInput::checkdev() bool CRCInput::checkpath(in_dev id) { for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { +#ifdef BOXMODEL_CS_HD2 + if ((id.type == DT_LNK) || ((*it).type == DT_LNK)) { + std::string check1, check2; + if (id.type == DT_LNK) + check1 = readLink(id.path); + else + check1 = id.path; + + if ((*it).type == DT_LNK) + check2 = readLink((*it).path); + else + check2 = (*it).path; + + if ((!check1.empty()) && (!check2.empty()) && (check1 == check2)) { + printf("[rcinput:%s] skipping already opened %s => %s\n", __func__, id.path.c_str(), check1.c_str()); + return true; + } + else + return false; + } +#endif if ((*it).path == id.path) { printf("[rcinput:%s] skipping already opened %s\n", __func__, id.path.c_str()); return true; @@ -185,6 +206,25 @@ bool CRCInput::checkpath(in_dev id) return false; } +#ifdef BOXMODEL_CS_HD2 +bool CRCInput::checkLnkDev(std::string lnk) +{ + static struct stat info; + if (lstat(lnk.c_str(), &info) != -1) { + if (S_ISLNK(info.st_mode)) { + std::string tmp = readLink(lnk); + if (!tmp.empty()) { + if (lstat(tmp.c_str(), &info) != -1) { + if (S_ISCHR(info.st_mode)) + return true; + } + } + } + } + return false; +} +#endif + /* if recheck == true, only not already opened devices are opened, if not, close then (re)open all */ void CRCInput::open(bool recheck) { @@ -205,10 +245,22 @@ void CRCInput::open(bool recheck) while ((dentry = readdir(dir)) != NULL) { - if (dentry->d_type != DT_CHR) { + if ((dentry->d_type != DT_CHR) +#ifdef BOXMODEL_CS_HD2 + && (dentry->d_type != DT_LNK) +#endif + + ) { d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); continue; } +#ifdef BOXMODEL_CS_HD2 + if ((dentry->d_type == DT_LNK) && (!checkLnkDev("/dev/input/" + std::string(dentry->d_name)))) { + d_printf("[rcinput:%s] skipping '%s'\n", __func__, dentry->d_name); + continue; + } + id.type = dentry->d_type; +#endif d_printf("[rcinput:%s] considering '%s'\n", __func__, dentry->d_name); id.path = "/dev/input/" + std::string(dentry->d_name); if (checkpath(id)) @@ -1764,7 +1816,11 @@ void CRCInput::set_rc_hw(ir_protocol_t ir_protocol, unsigned int ir_address) } int fd = -1; for (std::vector::iterator it = indev.begin(); it != indev.end(); ++it) { - if ((*it).path == "/dev/input/nevis_ir") { + if (((*it).path == "/dev/input/nevis_ir") +#ifdef BOXMODEL_CS_HD2 + || ((*it).path == "/dev/input/input0") +#endif + ){ fd = (*it).fd; break; } diff --git a/src/driver/rcinput.h b/src/driver/rcinput.h index d2c29e50f..37cfd4b8a 100644 --- a/src/driver/rcinput.h +++ b/src/driver/rcinput.h @@ -145,6 +145,9 @@ class CRCInput { int fd; std::string path; +#ifdef BOXMODEL_CS_HD2 + int type; +#endif }; uint32_t timerid; @@ -167,6 +170,9 @@ class CRCInput void open(bool recheck = false); bool checkpath(in_dev id); bool checkdev(); +#ifdef BOXMODEL_CS_HD2 + bool checkLnkDev(std::string lnk); +#endif void close(); int translate(int code); void calculateMaxFd(void); diff --git a/src/driver/scanepg.cpp b/src/driver/scanepg.cpp index 2ea208d61..7367175d2 100644 --- a/src/driver/scanepg.cpp +++ b/src/driver/scanepg.cpp @@ -160,7 +160,7 @@ bool CEpgScan::AddSelected() void CEpgScan::AddTransponders() { - if(bouquetList->Bouquets.empty()) + if(!bouquetList || bouquetList->Bouquets.empty()) return; if (current_mode != g_settings.epg_scan) { diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 31601f30a..c7e7e509d 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -125,17 +125,24 @@ CMoviePlayerGui::CMoviePlayerGui() CMoviePlayerGui::~CMoviePlayerGui() { - //playback->Close(); if (this == instance_mp) stopPlayBack(); - delete moviebrowser; - moviebrowser = NULL; - delete filebrowser; - filebrowser = NULL; - delete bookmarkmanager; - bookmarkmanager = NULL; - delete playback; - playback = NULL; + if(moviebrowser){ + delete moviebrowser; + moviebrowser = NULL; + } + if(filebrowser){ + delete filebrowser; + filebrowser = NULL; + } + if(bookmarkmanager){ + delete bookmarkmanager; + bookmarkmanager = NULL; + } + if(playback){ + delete playback; + playback = NULL; + } if (this == instance_mp) { delete instance_bg; instance_bg = NULL; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index c1e429075..6a4c3bec5 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2466,7 +2466,7 @@ void CNeutrinoApp::RealRun() m_idletime = time(NULL); if (m_screensaver) { - printf("[neutrino] CSreenSaver stop; msg: %lX\n", msg); + printf("[neutrino] CScreenSaver stop; msg: %lX\n", msg); screensaver(false); frameBuffer->stopFrame(); diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 35532da03..ab5d3b840 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -1233,3 +1233,13 @@ std::string Lang2ISO639_1(std::string& lang) return ret; } + +string readLink(string lnk) +{ + char buf[PATH_MAX]; + memset(buf, 0, sizeof(buf)-1); + if (readlink(lnk.c_str(), buf, sizeof(buf)-1) != -1) + return (string)buf; + + return ""; +} diff --git a/src/system/helpers.h b/src/system/helpers.h index 0c99d6366..b758ce21d 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -147,5 +147,6 @@ bool split_config_string(const std::string &str, std::map