From 3fc00d2211c732b2b9ecdead946bb9d3a0d9c621 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 3 May 2003 13:42:37 +0200 Subject: Restoring the current channel in case a recording has switched the transponder --- HISTORY | 7 +++++-- device.c | 17 ++++++----------- device.h | 8 ++++---- vdr.c | 14 ++++++++++---- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/HISTORY b/HISTORY index a23a689b..07f1ee87 100644 --- a/HISTORY +++ b/HISTORY @@ -2085,10 +2085,10 @@ Video Disk Recorder Revision History usage (thanks to Thomas Koch). - Fixed faulty calculation of section length in eit.c (thanks to Teemu Rantanen). -2003-05-01: Version 1.1.30 +2003-05-03: Version 1.1.30 - Fixed minimum lifespan of deleted recordings (thanks to Jaakko Hyvätti). -- Updated French OSD texts (thanks to Olivier Jacques ). +- Updated French OSD texts (thanks to Olivier Jacques). - Fixed paging through lists with repeated Left/Right keys. - Fixed setting the PCR-PID in case it is equal to one of the other PIDs (thanks to Oliver Endriss for reporting this one). @@ -2100,3 +2100,6 @@ Video Disk Recorder Revision History replay continue even if a recording is started on the primary device. - The RCU channel display no longer changes when a recording on a different channel starts on the primary device. +- Restoring the current channel in case a recording has switched the transponder. + If all devices are busy and none of them can provide the current channel, the + message "Channel not available!" will be displayed. diff --git a/device.c b/device.c index 9380f1d1..9346d3b5 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.40 2003/05/02 09:18:42 kls Exp $ + * $Id: device.c 1.41 2003/05/03 13:40:15 kls Exp $ */ #include "device.h" @@ -50,8 +50,6 @@ cDevice::cDevice(void) ciHandler = NULL; player = NULL; - playerDetached = false; - for (int i = 0; i < MAXRECEIVERS; i++) receiver[i] = NULL; @@ -122,13 +120,6 @@ bool cDevice::HasDecoder(void) const return false; } -bool cDevice::PlayerDetached(void) -{ - bool result = playerDetached; - playerDetached = false; - return result; -} - cOsdBase *cDevice::NewOsd(int x, int y) { return NULL; @@ -408,6 +399,11 @@ bool cDevice::SetChannelDevice(const cChannel *Channel, bool LiveView) return false; } +bool cDevice::HasProgramme(void) +{ + return Replaying() || pidHandles[ptAudio].pid || pidHandles[ptVideo].pid; +} + void cDevice::SetVolumeDevice(int Volume) { } @@ -536,7 +532,6 @@ void cDevice::Detach(cPlayer *Player) player->device = NULL; player = NULL; SetPlayMode(pmNone); - playerDetached = true; Audios.ClearAudio(); } } diff --git a/device.h b/device.h index 38e8028d..d2cc4f83 100644 --- a/device.h +++ b/device.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.31 2003/05/02 08:21:05 kls Exp $ + * $Id: device.h 1.32 2003/05/03 13:35:55 kls Exp $ */ #ifndef __DEVICE_H @@ -181,6 +181,9 @@ protected: public: static int CurrentChannel(void) { return primaryDevice ? currentChannel : 0; } ///< Returns the number of the current channel on the primary device. + virtual bool HasProgramme(void); + ///< Returns true if the device is currently showing any programme to + ///< the user, either through replaying or live. // PID handle facilities @@ -300,7 +303,6 @@ public: private: cPlayer *player; - bool playerDetached; protected: virtual bool CanReplay(void) const; ///< Returns true if this device can currently start a replay session. @@ -349,8 +351,6 @@ public: ///< Attaches the given player to this device. void Detach(cPlayer *Player); ///< Detaches the given player from this device. - bool PlayerDetached(void); - ///< Returns true if a player has been detached and resets the 'playerDetached' flag. // Receiver facilities diff --git a/vdr.c b/vdr.c index ca16433e..ae4edd56 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.151 2003/05/02 10:59:07 kls Exp $ + * $Id: vdr.c 1.152 2003/05/03 13:39:57 kls Exp $ */ #include @@ -53,6 +53,7 @@ #include "tools.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 @@ -460,9 +461,14 @@ int main(int argc, char *argv[]) } // Attach launched player control: cControl::Attach(); - // Make sure Transfer-Mode is re-started after detaching a player: - if (cDevice::PrimaryDevice()->PlayerDetached() && !cDevice::PrimaryDevice()->Replaying()) - Channels.SwitchTo(cDevice::CurrentChannel()); + // Make sure we have a visible programme in case device usage has changed: + if (!cDevice::PrimaryDevice()->HasProgramme()) { + static time_t lastTime = 0; + if (time(NULL) - lastTime > MINCHANNELWAIT) { + if (!Channels.SwitchTo(cDevice::CurrentChannel())) + lastTime = time(NULL); // don't do this too often + } + } // Restart the Watchdog timer: if (WatchdogTimeout > 0) { int LatencyTime = WatchdogTimeout - alarm(WatchdogTimeout); -- cgit v1.2.3