From 07df0b7d65164254613e77c93ff75e045be0955a Mon Sep 17 00:00:00 2001 From: andreas 'randy' weinberger Date: Tue, 23 Nov 2010 21:45:02 +0100 Subject: fixed vdr 1.6.0 combatibility --- display.c | 34 +++++++++++++++++++++++++++++++++- display.h | 5 +++++ state.c | 2 +- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/display.c b/display.c index af64461..37361f0 100644 --- a/display.c +++ b/display.c @@ -1344,15 +1344,30 @@ void cGraphLCDDisplay::DisplayProgramme() } } +#if VDRVERSNUM >= 10701 bool cGraphLCDDisplay::IndexIsGreaterAsOneHour(int Index, double framesPerSecond) const { return (((Index / framesPerSecond) / 3600) > 0); } +#else +bool cGraphLCDDisplay::IndexIsGreaterAsOneHour(int Index) const +{ + int h = (Index / FRAMESPERSEC) / 3600; + return h > 0; +} +#endif +#if VDRVERSNUM >= 10701 const char * cGraphLCDDisplay::IndexToMS(int Index, double framesPerSecond) const { static char buffer[16]; int s = (Index / framesPerSecond); +#else +const char * cGraphLCDDisplay::IndexToMS(int Index) const +{ + static char buffer[16]; + int s = (Index / FRAMESPERSEC); +#endif int m = s / 60; s %= 60; snprintf(buffer, sizeof(buffer), "%02d:%02d", m, s); @@ -1531,7 +1546,8 @@ void cGraphLCDDisplay::DisplayReplay(tReplayState & replay) } else { - if ((replay.total > 1 && IndexIsGreaterAsOneHour(replay.total, replay.framesPerSecond)) || +#if VDRVERSNUM >= 10701 + if ((replay.total > 1 && IndexIsGreaterAsOneHour(replay.total, replay.framesPerSecond)) || IndexIsGreaterAsOneHour(replay.current, replay.framesPerSecond)) // Check if any index bigger as one hour { szCurrent = (const char *) IndexToHMSF(replay.current, false, replay.framesPerSecond); @@ -1545,6 +1561,22 @@ void cGraphLCDDisplay::DisplayReplay(tReplayState & replay) if (replay.total > 1) // Don't draw totaltime for endless streams szTotal = (const char *) IndexToMS(replay.total, replay.framesPerSecond); } +#else + if ((replay.total > 1 && IndexIsGreaterAsOneHour(replay.total)) || + IndexIsGreaterAsOneHour(replay.current)) // Check if any index bigger as one hour + { + szCurrent = (const char *) IndexToHMSF(replay.current); + if (replay.total > 1) // Don't draw totaltime for endless streams + szTotal = (const char *) IndexToHMSF(replay.total); + } + else + { + // Show only minutes and seconds on short replays + szCurrent = (const char *) IndexToMS(replay.current); + if (replay.total > 1) // Don't draw totaltime for endless streams + szTotal = (const char *) IndexToMS(replay.total); + } +#endif } // Get width of drawable strings nWidthPreMsg = normalFont->Width(szPreMsg); diff --git a/display.h b/display.h index 09e297a..a9a1354 100644 --- a/display.h +++ b/display.h @@ -131,10 +131,15 @@ private: void UpdateIn(long usec); bool CheckAndUpdateSymbols(); +#if VDRVERSNUM >= 10701 /** Check if replay index bigger as one hour */ bool IndexIsGreaterAsOneHour(int Index, double framesPerSecond) const; /** Translate replay index to string with minute and second MM:SS */ const char *IndexToMS(int Index, double framesPerSecond) const; +#else + bool IndexIsGreaterAsOneHour(int Index) const; + const char *IndexToMS(int Index) const; +#endif /** Compare Scroller with new Textbuffer*/ bool IsScrollerTextChanged(const std::vector & scroller, const std::vector & lines) const; /** Returns true if Logo loaded and active*/ diff --git a/state.c b/state.c index 771e113..6f29e9d 100644 --- a/state.c +++ b/state.c @@ -45,7 +45,7 @@ cGraphLCDState::cGraphLCDState(cGraphLCDDisplay * Display) replay.framesPerSecond = DEFAULTFRAMESPERSECOND; #else replay.currentLast = FRAMESPERSEC; - replay.framesPerSecond = FRAMESPERSECOND; + replay.framesPerSecond = FRAMESPERSEC; #endif replay.total = 0; replay.totalLast = 1; -- cgit v1.2.3