From c97517dfd803ab7132412725e91241fcca36cbe0 Mon Sep 17 00:00:00 2001 From: andreas 'randy' weinberger Date: Sun, 14 Nov 2010 13:51:14 +0100 Subject: wrong recordinglength with vdr-1.7.x see http://projects.vdr-developer.org/issues/443 & http://www.vdrportal.de/board/thread.php?postid=955543#post955543 --- display.c | 33 ++++++++++++--------------------- display.h | 4 ++-- state.c | 12 ++++++++++++ state.h | 1 + 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/display.c b/display.c index a02c7a4..58cc0e0 100644 --- a/display.c +++ b/display.c @@ -389,8 +389,8 @@ void cGraphLCDDisplay::Action(void) { // but only, if something has changed #if VDRVERSNUM >= 10701 - if (replay.total / DEFAULTFRAMESPERSECOND != replay.totalLast / DEFAULTFRAMESPERSECOND || - replay.current / DEFAULTFRAMESPERSECOND != replay.currentLast / DEFAULTFRAMESPERSECOND || + if (replay.total / replay.framesPerSecond != replay.totalLast / replay.framesPerSecond || + replay.current / replay.framesPerSecond != replay.currentLast / replay.framesPerSecond || CurrTime/60 != LastTime/60 || update) #else @@ -1344,24 +1344,15 @@ void cGraphLCDDisplay::DisplayProgramme() } } -bool cGraphLCDDisplay::IndexIsGreaterAsOneHour(int Index) const +bool cGraphLCDDisplay::IndexIsGreaterAsOneHour(int Index, double framesPerSecond) const { -#if VDRVERSNUM >= 10701 - int h = (Index / DEFAULTFRAMESPERSECOND) / 3600; -#else - int h = (Index / FRAMESPERSEC) / 3600; -#endif - return h > 0; + return (((Index / framesPerSecond) / 3600) > 0); } -const char * cGraphLCDDisplay::IndexToMS(int Index) const +const char * cGraphLCDDisplay::IndexToMS(int Index, double framesPerSecond) const { static char buffer[16]; -#if VDRVERSNUM >= 10701 - int s = (Index / DEFAULTFRAMESPERSECOND); -#else - int s = (Index / FRAMESPERSEC); -#endif + int s = (Index / framesPerSecond); int m = s / 60; s %= 60; snprintf(buffer, sizeof(buffer), "%02d:%02d", m, s); @@ -1540,19 +1531,19 @@ void cGraphLCDDisplay::DisplayReplay(tReplayState & replay) } else { - if ((replay.total > 1 && IndexIsGreaterAsOneHour(replay.total)) || - IndexIsGreaterAsOneHour(replay.current)) // Check if any index bigger as one hour + 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); + szCurrent = (const char *) IndexToHMSF(replay.current, replay.framesPerSecond); if (replay.total > 1) // Don't draw totaltime for endless streams - szTotal = (const char *) IndexToHMSF(replay.total); + szTotal = (const char *) IndexToHMSF(replay.total, replay.framesPerSecond); } else { // Show only minutes and seconds on short replays - szCurrent = (const char *) IndexToMS(replay.current); + szCurrent = (const char *) IndexToMS(replay.current, replay.framesPerSecond); if (replay.total > 1) // Don't draw totaltime for endless streams - szTotal = (const char *) IndexToMS(replay.total); + szTotal = (const char *) IndexToMS(replay.total, replay.framesPerSecond); } } // Get width of drawable strings diff --git a/display.h b/display.h index 38ddd10..b4ae79a 100644 --- a/display.h +++ b/display.h @@ -132,9 +132,9 @@ private: bool CheckAndUpdateSymbols(); /** Check if replay index bigger as one hour */ - bool IndexIsGreaterAsOneHour(int Index) const; + bool IndexIsGreaterAsOneHour(int Index,double framesPerSecond) const; /** Translate replay index to string with minute and second MM:SS */ - const char *IndexToMS(int Index) const; + const char *IndexToMS(int Index, double framesPerSecond) const; /** 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 34446a3..6f29e9d 100644 --- a/state.c +++ b/state.c @@ -42,8 +42,10 @@ cGraphLCDState::cGraphLCDState(cGraphLCDDisplay * Display) replay.current = 0; #if VDRVERSNUM >= 10701 replay.currentLast = DEFAULTFRAMESPERSECOND; + replay.framesPerSecond = DEFAULTFRAMESPERSECOND; #else replay.currentLast = FRAMESPERSEC; + replay.framesPerSecond = FRAMESPERSEC; #endif replay.total = 0; replay.totalLast = 1; @@ -768,6 +770,11 @@ tReplayState cGraphLCDState::GetReplayState() { if (replay.control) { +#if VDRVERSNUM >= 10701 + replay.framesPerSecond = replay.control->FramesPerSecond(); +#else + replay.framesPerSecond = FRAMESPERSEC; +#endif ret = replay; replay.currentLast = replay.current; replay.totalLast = replay.total; @@ -781,6 +788,11 @@ tReplayState cGraphLCDState::GetReplayState() { if (replay.control) { +#if VDRVERSNUM >= 10701 + replay.framesPerSecond = replay.control->FramesPerSecond(); +#else + replay.framesPerSecond = FRAMESPERSEC; +#endif if (replay.control->GetIndex(replay.current, replay.total, false)) { replay.total = (replay.total == 0) ? 1 : replay.total; diff --git a/state.h b/state.h index 35e79f2..612eabf 100644 --- a/state.h +++ b/state.h @@ -53,6 +53,7 @@ struct tReplayState int currentLast; int total; int totalLast; + double framesPerSecond; }; struct tCardState -- cgit v1.2.3