summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranbr <vdr07@deltab.de>2011-01-12 21:14:22 +0100
committeranbr <vdr07@deltab.de>2011-01-12 21:14:22 +0100
commitf66c05b344fc865122ecb217b70a2384ce3dfbcd (patch)
treebd70eaca9ff1633b75a0db3a08d20f097cb99142
parentd63fbc75919d581938a765696468f3f97a8afbdd (diff)
downloadvdr-plugin-imonlcd-f66c05b344fc865122ecb217b70a2384ce3dfbcd.tar.gz
vdr-plugin-imonlcd-f66c05b344fc865122ecb217b70a2384ce3dfbcd.tar.bz2
Wrong time on playback of HD recordings (Bug #517)
-rw-r--r--watch.c51
-rw-r--r--watch.h6
2 files changed, 30 insertions, 27 deletions
diff --git a/watch.c b/watch.c
index 5806871..4e96c85 100644
--- a/watch.c
+++ b/watch.c
@@ -284,10 +284,7 @@ void ciMonWatch::Action(void)
if(m_eWatchMode != eLiveTV) {
current = 0;
total = 0;
- if (ReplayPosition(current,total)
- && theSetup.m_nRenderMode == eRenderMode_DualLine) {
- bReDraw |= ReplayTime(current,total);
- }
+ bReDraw |= ReplayTime(current,total);
}
}
@@ -741,29 +738,26 @@ eReplayState ciMonWatch::ReplayMode() const
return eReplayNone;
}
-bool ciMonWatch::ReplayPosition(int &current, int &total) const
+bool ciMonWatch::ReplayPosition(int &current, 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 * ciMonWatch::FormatReplayTime(int current, int total) const
+const char * ciMonWatch::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;
@@ -786,13 +780,22 @@ const char * ciMonWatch::FormatReplayTime(int current, int total) const
return s;
}
-bool ciMonWatch::ReplayTime(int current, int total) {
- const char * sz = FormatReplayTime(current,total);
- if(!replayTime || strcmp(sz,*replayTime)) {
- if(replayTime)
- delete replayTime;
- replayTime = new cString(sz);
- return replayTime != NULL;
+bool ciMonWatch::ReplayTime(int &current, int &total) {
+ double dFrameRate;
+#if VDRVERSNUM >= 10701
+ dFrameRate = DEFAULTFRAMESPERSECOND;
+#else
+ dFrameRate = FRAMESPERSEC;
+#endif
+ if(ReplayPosition(current,total,dFrameRate)
+ && theSetup.m_nRenderMode == eRenderMode_DualLine) {
+ const char * sz = FormatReplayTime(current,total,dFrameRate);
+ if(!replayTime || strcmp(sz,*replayTime)) {
+ if(replayTime)
+ delete replayTime;
+ replayTime = new cString(sz);
+ return replayTime != NULL;
+ }
}
return false;
}
diff --git a/watch.h b/watch.h
index 54e3f5b..2b1f61b 100644
--- a/watch.h
+++ b/watch.h
@@ -128,10 +128,10 @@ protected:
bool Replay();
bool RenderScreen(bool bRedraw);
eReplayState ReplayMode() const;
- bool ReplayPosition(int &current, int &total) const;
+ bool ReplayPosition(int &current, int &total, double& dFrameRate) const;
bool CurrentTime();
- bool ReplayTime(int current, int total);
- const char * FormatReplayTime(int current, int total) const;
+ bool ReplayTime(int& current, int& total);
+ const char * FormatReplayTime(int current, int total, double dFrameRate) const;
public:
ciMonWatch();
virtual ~ciMonWatch();