From edfe5829417bea8879bd2e45892b4465ea69b6eb Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 23 Feb 2008 13:19:10 +0100 Subject: [PATCH] Attempting to stay on the current channel in case of an upcoming recording --- HISTORY | 3 +++ device.c | 7 ++++++- device.h | 6 +++++- vdr.c | 6 ++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 7c980bd5..41b85ea3 100644 --- a/HISTORY +++ b/HISTORY @@ -5657,3 +5657,6 @@ Video Disk Recorder Revision History to Ludwig Nussel for pointing this out). - Revised the fix of calculating the scrollbar height in the skins. The scrollbar handle now always has a height that is at least the width of the scrollbar. +- When switching the device that's used for live viewing away from the current + transponder in favor of an upcoming recording, an attempt is now made to stay + on the current channel by possibly going into 'Transfer Mode'. diff --git a/device.c b/device.c index 10f6ec0d..7c82d97f 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.154 2008/02/17 15:55:06 kls Exp $ + * $Id: device.c 1.155 2008/02/23 13:09:01 kls Exp $ */ #include "device.h" @@ -218,6 +218,7 @@ int cDevice::nextCardIndex = 0; int cDevice::currentChannel = 1; cDevice *cDevice::device[MAXDEVICES] = { NULL }; cDevice *cDevice::primaryDevice = NULL; +cDevice *cDevice::avoidDevice = NULL; cDevice::cDevice(void) { @@ -356,6 +357,8 @@ cDevice *cDevice::GetDevice(int Index) cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView) { + cDevice *AvoidDevice = avoidDevice; + avoidDevice = NULL; // Collect the current priorities of all CAM slots that can decrypt the channel: int NumCamSlots = CamSlots.Count(); int SlotPriority[NumCamSlots]; @@ -385,6 +388,8 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView if (NumUsableSlots && SlotPriority[j] > MAXPRIORITY) continue; // there is no CAM available in this slot for (int i = 0; i < numDevices; i++) { + if (device[i] == AvoidDevice) + continue; // this device shall be temporarily avoided if (Channel->Ca() && Channel->Ca() <= CA_DVB_MAX && Channel->Ca() != device[i]->CardIndex() + 1) continue; // a specific card was requested, but not this one if (NumUsableSlots && !CamSlots.Get(j)->Assign(device[i], true)) diff --git a/device.h b/device.h index 376e43f0..06daa5ea 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.90 2008/02/16 13:50:11 kls Exp $ + * $Id: device.h 1.91 2008/02/23 13:13:04 kls Exp $ */ #ifndef __DEVICE_H @@ -101,6 +101,7 @@ private: static int useDevice; static cDevice *device[MAXDEVICES]; static cDevice *primaryDevice; + static cDevice *avoidDevice; public: static int NumDevices(void) { return numDevices; } ///< Returns the total number of devices. @@ -145,6 +146,9 @@ public: ///< this device/CAM combination will be skipped in the next call to ///< GetDevice(). ///< See also ProvidesChannel(). + static void SetAvoidDevice(cDevice *Device) { avoidDevice = Device; } + ///< Sets the given Device to be temporarily avoided in the next call to + ///< GetDevice(const cChannel, int, bool). static void Shutdown(void); ///< Closes down all devices. ///< Must be called at the end of the program. diff --git a/vdr.c b/vdr.c index 9f8dcdcd..ffe1ff36 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.310 2008/02/10 14:23:31 kls Exp $ + * $Id: vdr.c 1.311 2008/02/23 13:19:10 kls Exp $ */ #include @@ -877,7 +877,9 @@ int main(int argc, char *argv[]) } if (cDevice::PrimaryDevice()->HasDecoder() && !cDevice::PrimaryDevice()->HasProgramme()) { // the previous SwitchChannel() has switched away the current live channel - Channels.SwitchTo(Timer->Channel()->Number()); // avoids toggling between old channel and black screen + cDevice::SetAvoidDevice(Device); + if (!Channels.SwitchTo(cDevice::CurrentChannel())) // try to switch to the original channel on a different device... + Channels.SwitchTo(Timer->Channel()->Number()); // ...or avoid toggling between old channel and black screen Skins.Message(mtInfo, tr("Upcoming recording!")); } }