summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-07-29 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2001-07-29 18:00:00 +0200
commit8f9cc68f76c4fd0960f919a77fb16a6455922deb (patch)
tree83f607160a07966e97069397580acfb0d9b1be7a /recording.c
parent610c5600df98b35226536ffe92b1fd231128c7d4 (diff)
downloadvdr-patch-lnbsharing-8f9cc68f76c4fd0960f919a77fb16a6455922deb.tar.gz
vdr-patch-lnbsharing-8f9cc68f76c4fd0960f919a77fb16a6455922deb.tar.bz2
Version 0.85vdr-0.85
- Added Norwegian language texts (thanks to Jørgen Tvedt). - Increased the usleep value in cDvbOsd::Cmd() to 5000 in order to work on systems with the KURT/utime-patch (thanks to Guido Fiala). - Changed the check whether the driver is loaded in runvdr to check for the 'dvb' module (the last one loaded). - Fixed repeat function with LIRC (thanks to Stefan Huelswitt). - Increased the upper limit for the symbol rate to 30000 (thanks to Ulrich Röder). - Made the position of the channel display configurable (thanks to Stefan Huelswitt). - Made the width and height of the OSD configurable (thanks to Stefan Huelswitt). - DiSEqC support can now be generally enabled/disabled in the Setup menu. This may be necessary if your multiswitch gets irritated by the default DiSEqC codes '0' (thanks to Markus Lang). - Fixed replaying in case there is no index file. - Fixed jumping to an editing mark when replay has been paused. - Avoiding unnecessary code execution in the replay progress display (thanks to Guido Fiala). - When entering time values the digits that still have to be entered are now shown as '-' (as in "1-:--"). - When setting an editing mark while the progress display is not active, the display will now be turned on for a short while to indicate the successful setting of the mark. - Updated 'channels.conf' for Premiere World (thanks to Helmut Schächner). Check your timers if you use this channels.conf file, since the sequence of several PW channels has been changed. - Changed the color of "Info" messages to "black on green" and that of the confirmation messages (like "Delete...") to "black on yellow". - Fixed display with DEBUG_OSD (it still crashes sometimes, esp. when replaying, but I can't seem to find what causes this... any ideas anybody?). - Avoiding audio/video distortions in 'Transfer Mode' by no longer actually tuning the primary interface (which can't receive this channel, anyway). Apparently the driver gets irritated when the channel is switched and a replay session is started immediately after that. - Increased timeout until reporting "video data stream broken" when recording. - Explicitly switching back to the previously active channel after ending a replay session (to have it shown correctly in case it was in 'Transfer Mode').
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/recording.c b/recording.c
index fc0daa5..ddca1a4 100644
--- a/recording.c
+++ b/recording.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: recording.c 1.29 2001/03/31 09:38:30 kls Exp $
+ * $Id: recording.c 1.32 2001/06/16 10:33:20 kls Exp $
*/
#define _GNU_SOURCE
@@ -39,7 +39,7 @@
#define DELETEDLIFETIME 1 // hours after which a deleted recording will be actually removed
#define REMOVECHECKDELTA 3600 // seconds between checks for removing deleted files
#define DISKCHECKDELTA 300 // seconds between checks for free disk space
-#define REMOVELATENCY 10 // seconds to wait until next check after removing a file
+#define REMOVELATENCY 10 // seconds to wait until next check after removing a file
void RemoveDeletedRecordings(void)
{
@@ -66,7 +66,7 @@ void RemoveDeletedRecordings(void)
}
}
-void AssertFreeDiskSpace(void)
+void AssertFreeDiskSpace(int Priority)
{
// With every call to this function we try to actually remove
// a file, or mark a file for removal ("delete" it), so that
@@ -94,13 +94,16 @@ void AssertFreeDiskSpace(void)
cRecording *r = Recordings.First();
cRecording *r0 = NULL;
while (r) {
- if ((time(NULL) - r->start) / SECSINDAY > r->lifetime) {
- if (r0) {
- if (r->priority < r0->priority)
+ if (r->lifetime < MAXLIFETIME) { // recordings with MAXLIFETIME live forever
+ if ((r->lifetime == 0 && Priority > r->priority) || // the recording has guaranteed lifetime and the new recording has higher priority
+ (time(NULL) - r->start) / SECSINDAY > r->lifetime) { // the recording's guaranteed lifetime has expired
+ if (r0) {
+ if (r->priority < r0->priority || (r->priority == r0->priority && r->start < r0->start))
+ r0 = r; // in any case we delete the one with the lowest priority (or the older one in case of equal priorities)
+ }
+ else
r0 = r;
}
- else
- r0 = r;
}
r = Recordings.Next(r);
}
@@ -153,7 +156,7 @@ int cResumeFile::Read(void)
bool cResumeFile::Save(int Index)
{
if (fileName) {
- int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP);
+ int f = open(fileName, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (f >= 0) {
if (write(f, &Index, sizeof(Index)) != sizeof(Index))
LOG_ERROR_STR(fileName);
@@ -174,18 +177,31 @@ void cResumeFile::Delete(void)
// --- cRecording ------------------------------------------------------------
+struct tCharExchange { char a; char b; };
+tCharExchange CharExchange[] = {
+ { ' ', '_' },
+ { '\'', '\x01' },
+ { '/', '\x02' },
+#ifdef VFAT
+ { ':', '\x03' },
+#endif
+ { 0, 0 }
+ };
+
+char *ExchangeChars(char *s, bool ToFileSystem)
+{
+ for (struct tCharExchange *ce = CharExchange; ce->a && ce->b; ce++)
+ strreplace(s, ToFileSystem ? ce->a : ce->b, ToFileSystem ? ce->b : ce->a);
+ return s;
+}
+
cRecording::cRecording(cTimer *Timer)
{
titleBuffer = NULL;
fileName = NULL;
name = strdup(Timer->file);
// substitute characters that would cause problems in file names:
- for (char *p = name; *p; p++) {
- switch (*p) {
- case '\n': *p = ' '; break;
- case '/': *p = '-'; break;
- }
- }
+ strreplace(name, '\n', ' ');
summary = Timer->summary ? strdup(Timer->summary) : NULL;
if (summary)
strreplace(summary, '|', '\n');
@@ -215,8 +231,7 @@ cRecording::cRecording(const char *FileName)
name = new char[p - FileName + 1];
strncpy(name, FileName, p - FileName);
name[p - FileName] = 0;
- strreplace(name, '_', ' ');
- strreplace(name, '\x01', '\'');
+ ExchangeChars(name, false);
}
// read an optional summary file:
char *SummaryFileName = NULL;
@@ -239,7 +254,7 @@ cRecording::cRecording(const char *FileName)
delete summary;
summary = NULL;
}
-
+
}
else
esyslog(LOG_ERR, "can't allocate %d byte of memory for summary file '%s'", size + 1, SummaryFileName);
@@ -266,11 +281,9 @@ const char *cRecording::FileName(void)
{
if (!fileName) {
struct tm *t = localtime(&start);
+ ExchangeChars(name, true);
asprintf(&fileName, NAMEFORMAT, VideoDirectory, name, t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, priority, lifetime);
- if (fileName) {
- strreplace(fileName, ' ', '_');
- strreplace(fileName, '\'', '\x01');
- }
+ ExchangeChars(name, false);
}
return fileName;
}