diff options
author | anbr <vdr07@deltab.de> | 2011-01-12 21:15:10 +0100 |
---|---|---|
committer | anbr <vdr07@deltab.de> | 2011-01-12 21:15:10 +0100 |
commit | d5a0dbd37d69eb3eb64b86c31ca834f88ab68f60 (patch) | |
tree | 505f7c4e63fab0fcf660433dd3dc18e25660a36e | |
parent | d5005b158c2c890bea511e4b57fe063568baa2e1 (diff) | |
download | vdr-plugin-targavfd-d5a0dbd37d69eb3eb64b86c31ca834f88ab68f60.tar.gz vdr-plugin-targavfd-d5a0dbd37d69eb3eb64b86c31ca834f88ab68f60.tar.bz2 |
Wrong time on playback of HD recordings (Bug #517)
-rw-r--r-- | watch.c | 33 | ||||
-rw-r--r-- | watch.h | 4 |
2 files changed, 20 insertions, 17 deletions
@@ -603,29 +603,26 @@ eReplayState cVFDWatch::ReplayMode() const return eReplayNone; } -bool cVFDWatch::ReplayPosition(int ¤t, int &total) const +bool cVFDWatch::ReplayPosition(int ¤t, int &total, double& dFrameRate) const { if (m_pControl && ((cControl *)m_pControl)->GetIndex(current, total, false)) { total = (total == 0) ? 1 : total; +#if VDRVERSNUM >= 10703 + dFrameRate = ((cControl *)m_pControl)->FramesPerSecond(); +#endif return true; } return false; } -const char * cVFDWatch::FormatReplayTime(int current, int total) const +const char * cVFDWatch::FormatReplayTime(int current, int total, double dFrameRate) const { static char s[32]; -#if VDRVERSNUM >= 10701 - int cs = (current / DEFAULTFRAMESPERSECOND); - int ts = (total / DEFAULTFRAMESPERSECOND); - bool g = (((current / DEFAULTFRAMESPERSECOND) / 3600) > 0) - || (((total / DEFAULTFRAMESPERSECOND) / 3600) > 0); -#else - int cs = (current / FRAMESPERSEC); - int ts = (total / FRAMESPERSEC); - bool g = (((current / FRAMESPERSEC) / 3600) > 0) - || (((total / FRAMESPERSEC) / 3600) > 0); -#endif + + int cs = (int)((double)current / dFrameRate); + int ts = (int)((double)total / dFrameRate); + bool g = ((cs / 3600) > 0) || ((ts / 3600) > 0); + int cm = cs / 60; cs %= 60; int tm = ts / 60; @@ -650,8 +647,14 @@ const char * cVFDWatch::FormatReplayTime(int current, int total) const bool cVFDWatch::ReplayTime() { int current = 0,total = 0; - if(ReplayPosition(current,total)) { - const char * sz = FormatReplayTime(current,total); + double dFrameRate; +#if VDRVERSNUM >= 10701 + dFrameRate = DEFAULTFRAMESPERSECOND; +#else + dFrameRate = FRAMESPERSEC; +#endif + if(ReplayPosition(current,total,dFrameRate)) { + const char * sz = FormatReplayTime(current,total,dFrameRate); if(!replayTime || strcmp(sz,*replayTime)) { if(replayTime) delete replayTime; @@ -97,10 +97,10 @@ protected: bool RenderScreen(bool bReDraw); bool RenderSpectrumAnalyzer(); eReplayState ReplayMode() const; - bool ReplayPosition(int ¤t, int &total) const; + bool ReplayPosition(int ¤t, int &total, double& dFrameRate) const; bool CurrentTime(time_t ts); bool ReplayTime(); - const char * FormatReplayTime(int current, int total) const; + const char * FormatReplayTime(int current, int total, double dFrameRate) const; public: cVFDWatch(); virtual ~cVFDWatch(); |