From 46108978fb72b40c7feeb52c2a7abbd437f8751d Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 17 Feb 2009 00:35:44 +0100 Subject: move replace_all function to base/string.h --- lib/base/estring.cpp | 9 +++++++++ lib/base/estring.h | 1 + 2 files changed, 10 insertions(+) (limited to 'lib/base') diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index 5d15ddce..f1d50ccc 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -633,3 +633,12 @@ void makeUpper(std::string &s) { std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper); } + +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol) +{ + std::string out = in; + std::string::size_type loc = 0; + while (( loc = out.find(entity, loc)) != std::string::npos ) + out.replace(loc, entity.length(), symbol); + return out; +} diff --git a/lib/base/estring.h b/lib/base/estring.h index 68e0970f..d61489eb 100644 --- a/lib/base/estring.h +++ b/lib/base/estring.h @@ -18,6 +18,7 @@ int isUTF8(const std::string &string); std::string removeDVBChars(const std::string &s); void makeUpper(std::string &s); +std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol); inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1 { -- cgit v1.2.3 From 5a6bde9419249a78c957093e0cc438d7c6eeb46c Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Mon, 23 Feb 2009 19:16:53 +0100 Subject: fixed compile errors with g++ 4.3 and replaced some c headers by their c++ counterparts --- lib/base/buffer.cpp | 5 +++-- lib/base/eerror.cpp | 7 ++++--- lib/base/encoding.cpp | 1 + lib/base/estring.cpp | 5 +++-- lib/driver/misc_options.cpp | 1 + lib/dvb/db.h | 4 ++-- lib/dvb/idvb.h | 4 ++-- lib/gdi/accel.cpp | 1 + lib/gdi/gpixmap.cpp | 2 ++ lib/gui/elistboxcontent.h | 2 +- 10 files changed, 20 insertions(+), 12 deletions(-) (limited to 'lib/base') diff --git a/lib/base/buffer.cpp b/lib/base/buffer.cpp index 3a0a6a3d..5dfdfad5 100644 --- a/lib/base/buffer.cpp +++ b/lib/base/buffer.cpp @@ -1,8 +1,9 @@ #include #include -#include +#include +#include +#include #include -#include void eIOBuffer::removeblock() { diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp index 4c4d6551..35e46e05 100644 --- a/lib/base/eerror.cpp +++ b/lib/base/eerror.cpp @@ -1,8 +1,9 @@ #include #include -#include -#include -#include +#include +#include +#include +#include #include #include diff --git a/lib/base/encoding.cpp b/lib/base/encoding.cpp index 5d6617d9..45fea102 100644 --- a/lib/base/encoding.cpp +++ b/lib/base/encoding.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp index f1d50ccc..dcba7705 100644 --- a/lib/base/estring.cpp +++ b/lib/base/estring.cpp @@ -1,6 +1,7 @@ +#include +#include +#include #include -#include -#include #include #include #include diff --git a/lib/driver/misc_options.cpp b/lib/driver/misc_options.cpp index c567878c..43e6dad3 100644 --- a/lib/driver/misc_options.cpp +++ b/lib/driver/misc_options.cpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/lib/dvb/db.h b/lib/dvb/db.h index 55e008fb..11fb1ab1 100644 --- a/lib/dvb/db.h +++ b/lib/dvb/db.h @@ -51,11 +51,11 @@ public: RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr &parm); - RESULT addService(const eServiceReferenceDVB &service, eDVBService *service); + RESULT addService(const eServiceReferenceDVB &referenc, eDVBService *service); RESULT getService(const eServiceReferenceDVB &reference, ePtr &service); RESULT flush(); - RESULT startQuery(ePtr &query, eDVBChannelQuery *query, const eServiceReference &source); + RESULT startQuery(ePtr &query, eDVBChannelQuery *q, const eServiceReference &source); RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet); ////// diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index ec016d69..6dd0f903 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -385,13 +385,13 @@ public: virtual RESULT getChannelFrontendData(const eDVBChannelID &id, ePtr &parm)=0; - virtual RESULT addService(const eServiceReferenceDVB &service, eDVBService *service)=0; + virtual RESULT addService(const eServiceReferenceDVB &reference, eDVBService *service)=0; virtual RESULT getService(const eServiceReferenceDVB &reference, ePtr &service)=0; virtual RESULT flush()=0; virtual RESULT getBouquet(const eServiceReference &ref, eBouquet* &bouquet)=0; - virtual RESULT startQuery(ePtr &query, eDVBChannelQuery *query, const eServiceReference &source)=0; + virtual RESULT startQuery(ePtr &query, eDVBChannelQuery *q, const eServiceReference &source)=0; }; #endif // SWIG diff --git a/lib/gdi/accel.cpp b/lib/gdi/accel.cpp index 27b4abcc..d9c80e2e 100644 --- a/lib/gdi/accel.cpp +++ b/lib/gdi/accel.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/lib/gdi/gpixmap.cpp b/lib/gdi/gpixmap.cpp index 315c18d1..e01e5e43 100644 --- a/lib/gdi/gpixmap.cpp +++ b/lib/gdi/gpixmap.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include #include diff --git a/lib/gui/elistboxcontent.h b/lib/gui/elistboxcontent.h index 64699013..6bb45590 100644 --- a/lib/gui/elistboxcontent.h +++ b/lib/gui/elistboxcontent.h @@ -73,7 +73,7 @@ public: void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected); int currentCursorSelectable(); void setList(SWIG_PYOBJECT(ePyObject) list); - void setFont(int fnt, gFont *fnt); + void setFont(int fnt, gFont *font); void setBuildFunc(SWIG_PYOBJECT(ePyObject) func); void setSelectableFunc(SWIG_PYOBJECT(ePyObject) func); void setItemHeight(int height); -- cgit v1.2.3 From e63586af0f2e8acf5a0972ae1993c039edcd901e Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Mon, 2 Mar 2009 17:17:06 +0100 Subject: replace EOF magic by a slightly more accurate PVR EOF. --- lib/base/filepush.cpp | 8 +++-- lib/python/Screens/InfoBarGenerics.py | 58 ++++------------------------------- 2 files changed, 12 insertions(+), 54 deletions(-) (limited to 'lib/base') diff --git a/lib/base/filepush.cpp b/lib/base/filepush.cpp index 1999707f..ed2a2185 100644 --- a/lib/base/filepush.cpp +++ b/lib/base/filepush.cpp @@ -189,9 +189,13 @@ void eFilePushThread::thread() if (m_send_pvr_commit && !already_empty) { eDebug("sending PVR commit"); + + struct pollfd pfd[1] = {m_fd_dest, POLLHUP}; + poll(pfd, 1, 10000); + sleep(5); /* HACK to allow ES buffer to drain */ already_empty = 1; - if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR) - continue; +// if (::ioctl(m_fd_dest, PVR_COMMIT) < 0 && errno == EINTR) +// continue; eDebug("commit done"); /* well check again */ continue; diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index e39e028d..71e08327 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -623,11 +623,6 @@ class InfoBarSeek: iPlayableService.evEOF: self.__evEOF, iPlayableService.evSOF: self.__evSOF, }) - self.eofState = 0 - self.eofTimer = eTimer() - self.eofTimer.timeout.get().append(self.doEof) - self.eofInhibitTimer = eTimer() - self.eofInhibitTimer.timeout.get().append(self.inhibitEof) self.minSpeedBackward = useSeekBackHack and 16 or 0 @@ -763,9 +758,6 @@ class InfoBarSeek: def __serviceStarted(self): self.seekstate = self.SEEK_STATE_PLAY self.__seekableStatusChanged() - if self.eofState != 0: - self.eofTimer.stop() - self.eofState = 0 def setSeekState(self, state): service = self.session.nav.getCurrentService() @@ -827,16 +819,6 @@ class InfoBarSeek: seekable = self.getSeek() if seekable is None: return - prevstate = self.seekstate - if self.eofState == 1: - self.eofState = 2 - self.inhibitEof() - if self.seekstate == self.SEEK_STATE_EOF: - if prevstate == self.SEEK_STATE_PAUSE: - self.setSeekState(self.SEEK_STATE_PAUSE) - else: - self.setSeekState(self.SEEK_STATE_PLAY) - self.eofInhibitTimer.start(200, True) seekable.seekTo(pts) def doSeekRelative(self, pts): @@ -844,15 +826,12 @@ class InfoBarSeek: if seekable is None: return prevstate = self.seekstate - if self.eofState == 1: - self.eofState = 2 - self.inhibitEof() + if self.seekstate == self.SEEK_STATE_EOF: if prevstate == self.SEEK_STATE_PAUSE: self.setSeekState(self.SEEK_STATE_PAUSE) else: self.setSeekState(self.SEEK_STATE_PLAY) - self.eofInhibitTimer.start(200, True) seekable.seekRelative(pts<0 and -1 or 1, abs(pts)) if abs(pts) > 100 and config.usage.show_infobar_on_skip.value: self.showAfterSeek() @@ -964,44 +943,19 @@ class InfoBarSeek: return False def __evEOF(self): - if self.eofState == 0 and self.seekstate != self.SEEK_STATE_EOF: - self.eofState = 1 - time = self.calcRemainingTime() - if not time: - time = 3000 # Failed to calc, use default - elif time == 0: - time = 300 # Passed end, shortest wait - elif time > 15000: - self.eofState = -2 # Too long, block eof - time = 15000 - else: - time += 1000 # Add margin - self.eofTimer.start(time, True) - - def inhibitEof(self): - if self.eofState >= 1: - self.eofState = -self.eofState - self.eofTimer.stop() - self.doEof() - - def doEof(self): if self.seekstate == self.SEEK_STATE_EOF: return - if self.eofState == -2 or self.isStateBackward(self.seekstate): - self.eofState = 0 - return - # if we are seeking, we try to end up ~1s before the end, and pause there. - eofstate = self.eofState + # if we are seeking forward, we try to end up ~1s before the end, and pause there. seekstate = self.seekstate - self.eofState = 0 - if not self.seekstate == self.SEEK_STATE_PAUSE: + if self.seekstate != self.SEEK_STATE_PAUSE: self.setSeekState(self.SEEK_STATE_EOF) - if eofstate == -1 or not seekstate in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): + + if seekstate not in (self.SEEK_STATE_PLAY, self.SEEK_STATE_PAUSE): # if we are seeking seekable = self.getSeek() if seekable is not None: seekable.seekTo(-1) - if eofstate == 1 and seekstate == self.SEEK_STATE_PLAY: + if seekstate == self.SEEK_STATE_PLAY: # regular EOF self.doEofInternal(True) else: self.doEofInternal(False) -- cgit v1.2.3