1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Changed IndexToHMSF() so that it can handle negative Index values

This commit is contained in:
Klaus Schmidinger 2012-01-14 13:00:47 +01:00
parent a7d8c92ddc
commit 262f20eaa0
2 changed files with 9 additions and 5 deletions

View File

@ -6781,7 +6781,7 @@ Video Disk Recorder Revision History
- Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg). - Replaced all calls to sleep() with cCondWait::SleepMs() (thanks to Rolf Ahrenberg).
- Fixed a crash with malformed SI data (patch from vdr-portal). - Fixed a crash with malformed SI data (patch from vdr-portal).
2012-01-12: Version 1.7.23 2012-01-14: Version 1.7.23
- Removed the '.pl' suffix from svdrpsend.pl (sorry, I missed that one). - Removed the '.pl' suffix from svdrpsend.pl (sorry, I missed that one).
- Fixed bonding more than two devices. - Fixed bonding more than two devices.
@ -6825,3 +6825,4 @@ Video Disk Recorder Revision History
- The parameters that are only used by "second generation" delivery systems (DVB-S2 - The parameters that are only used by "second generation" delivery systems (DVB-S2
and DVB-T2) are no longer written into channels.conf for "first generation" and DVB-T2) are no longer written into channels.conf for "first generation"
delivery systems (DVB-S and DVB-T). delivery systems (DVB-S and DVB-T).
- Changed IndexToHMSF() so that it can handle negative Index values.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 2.41 2011/12/10 14:22:37 kls Exp $ * $Id: recording.c 2.42 2012/01/14 12:50:58 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -2035,15 +2035,18 @@ cUnbufferedFile *cFileName::NextFile(void)
cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond) cString IndexToHMSF(int Index, bool WithFrame, double FramesPerSecond)
{ {
char buffer[16]; const char *Sign = "";
if (Index < 0) {
Index = -Index;
Sign = "-";
}
double Seconds; double Seconds;
int f = int(modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1); int f = int(modf((Index + 0.5) / FramesPerSecond, &Seconds) * FramesPerSecond + 1);
int s = int(Seconds); int s = int(Seconds);
int m = s / 60 % 60; int m = s / 60 % 60;
int h = s / 3600; int h = s / 3600;
s %= 60; s %= 60;
snprintf(buffer, sizeof(buffer), WithFrame ? "%d:%02d:%02d.%02d" : "%d:%02d:%02d", h, m, s, f); return cString::sprintf(WithFrame ? "%s%d:%02d:%02d.%02d" : "%s%d:%02d:%02d", Sign, h, m, s, f);
return buffer;
} }
int HMSFToIndex(const char *HMSF, double FramesPerSecond) int HMSFToIndex(const char *HMSF, double FramesPerSecond)