summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2011-10-04 23:06:07 +0200
committermrwastl <mrwastl@users.sourceforge.net>2011-10-04 23:06:07 +0200
commitcd447f97099fb494716a7e9c2aad1716f456ba63 (patch)
treea7cb495a4fd68d5d13ccc0cee96fa561afe00fc5
parent2d3832dd913f678f40a748faa4aeb1429bec4df1 (diff)
downloadvdr-plugin-graphlcd-cd447f97099fb494716a7e9c2aad1716f456ba63.tar.gz
vdr-plugin-graphlcd-cd447f97099fb494716a7e9c2aad1716f456ba63.tar.bz2
fixed wrong recordinglength with vdr-1.7.x (thx to copperhead for pointing out this one)
-rw-r--r--common.c13
-rw-r--r--common.h3
-rw-r--r--skinconfig.c38
3 files changed, 21 insertions, 33 deletions
diff --git a/common.c b/common.c
index 1b73d13..8f1c52a 100644
--- a/common.c
+++ b/common.c
@@ -61,7 +61,7 @@ GLCD::cType TimeType(time_t Time, const std::string &Format)
return false;
}
-GLCD::cType DurationType(int Index, const std::string &Format)
+GLCD::cType DurationType(int Index, const std::string &Format, double framesPerSecFactor = 1.0)
{
static char result[1000];
if (Index > 0)
@@ -73,13 +73,10 @@ GLCD::cType DurationType(int Index, const std::string &Format)
char *res = result;
enum { normal, format } state = normal;
int n = 0;
-#if VDRVERSNUM >= 10701
- int f = (Index % (int)DEFAULTFRAMESPERSECOND) + 1;
- int s = (Index / (int)DEFAULTFRAMESPERSECOND);
-#else
- int f = (Index % FRAMESPERSEC) + 1;
- int s = (Index / FRAMESPERSEC);
-#endif
+
+ int f = (Index % (int)framesPerSecFactor) + 1;
+ int s = (Index / (int)framesPerSecFactor);
+
int m = s / 60 % 60;
int h = s / 3600;
s %= 60;
diff --git a/common.h b/common.h
index f6c3683..9873690 100644
--- a/common.h
+++ b/common.h
@@ -1,9 +1,8 @@
#include <glcdskin/string.h>
-
GLCD::cType TimeType(time_t Time, const std::string &Format);
-GLCD::cType DurationType(int Index, const std::string &Format);
+GLCD::cType DurationType(int Index, const std::string &Format, double framesPerSecFactor = 1.0);
int ParanoiaStrcmp(const char *s1, const char *s2);
const std::string SplitText(const std::string &Text, const std::string &Delim, bool firstPart = true);
const std::string SplitToken(const std::string &Token, const struct GLCD::tSkinAttrib Attrib, bool extSplit = false);
diff --git a/skinconfig.c b/skinconfig.c
index 51ecc69..1c351e1 100644
--- a/skinconfig.c
+++ b/skinconfig.c
@@ -437,25 +437,13 @@ GLCD::cType cGraphLCDSkinConfig::GetToken(const GLCD::tSkinToken & Token)
case tokPresentEndDateTime:
return TimeType(event.startTime + event.duration, Token.Attrib.Text);
case tokPresentDuration:
-#if VDRVERSNUM >= 10701
- return DurationType(event.duration * DEFAULTFRAMESPERSECOND, Token.Attrib.Text);
-#else
- return DurationType(event.duration * FRAMESPERSEC, Token.Attrib.Text);
-#endif
+ return DurationType(event.duration, Token.Attrib.Text);
case tokPresentProgress:
-#if VDRVERSNUM >= 10701
- return DurationType((time(NULL) - event.startTime) * DEFAULTFRAMESPERSECOND, Token.Attrib.Text);
-#else
- return DurationType((time(NULL) - event.startTime) * FRAMESPERSEC, Token.Attrib.Text);
-#endif
+ return DurationType(time(NULL) - event.startTime, Token.Attrib.Text);
case tokPresentRemaining:
if ((time(NULL) - event.startTime) < event.duration)
{
-#if VDRVERSNUM >= 10701
- return DurationType((event.duration - (time(NULL) - event.startTime)) * DEFAULTFRAMESPERSECOND, Token.Attrib.Text);
-#else
- return DurationType((event.duration - (time(NULL) - event.startTime)) * FRAMESPERSEC, Token.Attrib.Text);
-#endif
+ return DurationType(event.duration - (time(NULL) - event.startTime), Token.Attrib.Text);
}
return false;
case tokPresentTitle:
@@ -482,11 +470,7 @@ GLCD::cType cGraphLCDSkinConfig::GetToken(const GLCD::tSkinToken & Token)
case tokFollowingEndDateTime:
return TimeType(event.startTime + event.duration, Token.Attrib.Text);
case tokFollowingDuration:
-#if VDRVERSNUM >= 10701
- return DurationType(event.duration * DEFAULTFRAMESPERSECOND, Token.Attrib.Text);
-#else
- return DurationType(event.duration * FRAMESPERSEC, Token.Attrib.Text);
-#endif
+ return DurationType(event.duration, Token.Attrib.Text);
case tokFollowingTitle:
return event.title;
case tokFollowingShortText:
@@ -567,20 +551,28 @@ GLCD::cType cGraphLCDSkinConfig::GetToken(const GLCD::tSkinToken & Token)
else if (Token.Id > tokPrivateReplayStart && Token.Id < tokPrivateReplayEnd)
{
tReplayState replay = mState->GetReplayState();
+ double framesPerSec =
+#if VDRVERSNUM >= 10701
+ replay.control->FramesPerSecond()
+#else
+ (double)FRAMESPERSEC
+#endif
+ ;
+
switch (Token.Id)
{
case tokReplayTitle:
return replay.name;
case tokReplayPositionIndex:
- return DurationType(replay.current, Token.Attrib.Text);
+ return DurationType(replay.current, Token.Attrib.Text, framesPerSec);
case tokReplayDurationIndex:
- return DurationType(replay.total, Token.Attrib.Text);
+ return DurationType(replay.total, Token.Attrib.Text, framesPerSec);
case tokReplayPosition:
return replay.current;
case tokReplayDuration:
return replay.total;
case tokReplayRemaining:
- return DurationType(replay.total - replay.current, Token.Attrib.Text);
+ return DurationType(replay.total - replay.current, Token.Attrib.Text, framesPerSec);
case tokIsPlaying:
case tokReplayIsPlaying:
return replay.play && replay.speed == -1;