summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/vdr.c b/vdr.c
index fc1f9e0..6d76f17 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
- * $Id: vdr.c 1.184 2004/06/13 13:52:09 kls Exp $
+ * $Id: vdr.c 1.187 2004/10/17 11:50:21 kls Exp $
*/
#include <getopt.h>
@@ -58,10 +58,11 @@
#include "transfer.h"
#include "videodir.h"
-#define MINCHANNELWAIT 10 // seconds to wait between failed channel switchings
-#define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping
-#define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown
-#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start
+#define MINCHANNELWAIT 10 // seconds to wait between failed channel switchings
+#define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping
+#define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown
+#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start
+#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
static int Interrupted = 0;
@@ -87,7 +88,7 @@ int main(int argc, char *argv[])
#ifdef _CS_GNU_LIBPTHREAD_VERSION
// Check for NPTL and exit if present - VDR apparently doesn't run well with NPTL:
char LibPthreadVersion[128];
- if (confstr(_CS_GNU_LIBPTHREAD_VERSION, LibPthreadVersion, sizeof(LibPthreadVersion) > 0)) {
+ if (confstr(_CS_GNU_LIBPTHREAD_VERSION, LibPthreadVersion, sizeof(LibPthreadVersion)) > 0) {
if (strstr(LibPthreadVersion, "NPTL")) {
fprintf(stderr, "vdr: please turn off NPTL by setting 'export LD_ASSUME_KERNEL=2.4.1' before starting VDR\n");
return 2;
@@ -516,6 +517,9 @@ int main(int argc, char *argv[])
esyslog("emergency exit requested - shutting down");
break;
}
+#ifdef DEBUGRINGBUFFERS
+ cRingBufferLinear::PrintDebugRBL();
+#endif
// Attach launched player control:
cControl::Attach();
// Make sure we have a visible programme in case device usage has changed:
@@ -543,10 +547,20 @@ int main(int argc, char *argv[])
}
}
// Handle channel modifications:
- if (!Channels.BeingEdited() && Channels.Modified()) {
- if (Channels.Lock(false, 100)) {
- Channels.Save(); //XXX only after user changes???
- Timers.Save();
+ if (!Channels.BeingEdited()) {
+ int modified = Channels.Modified();
+ static time_t ChannelSaveTimeout = 0;
+ if (modified == CHANNELSMOD_USER)
+ ChannelSaveTimeout = 1; // triggers an immediate save
+ else if (modified && !ChannelSaveTimeout)
+ ChannelSaveTimeout = time(NULL) + CHANNELSAVEDELTA;
+ bool timeout = ChannelSaveTimeout == 1 || ChannelSaveTimeout && time(NULL) > ChannelSaveTimeout && !cRecordControls::Active();
+ if ((modified || timeout) && Channels.Lock(false, 100)) {
+ if (timeout) {
+ Channels.Save();
+ Timers.Save();
+ ChannelSaveTimeout = 0;
+ }
for (cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) {
if (Channel->Modification(CHANNELMOD_RETUNE)) {
cRecordControls::ChannelDataModified(Channel);