summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-08-03 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-08-03 18:00:00 +0200
commit6c2c3ace8bfe8918b516cc155fbf1104baa107f9 (patch)
tree93730209c4e4a035ecaad7bb288280e069f5e6d4 /device.c
parent64ddfca3b0e37d877bb3cb247fb8b2ad810dd47f (diff)
downloadvdr-patch-lnbsharing-6c2c3ace8bfe8918b516cc155fbf1104baa107f9.tar.gz
vdr-patch-lnbsharing-6c2c3ace8bfe8918b516cc155fbf1104baa107f9.tar.bz2
Version 1.2.2vdr-1.2.2
- Fixed a bug in channel switching after Left/Right has been pressed (thanks to Michael Walle for reporting this one). - Improved channel switching in case of numerical input by switching as soon as the channel is unique (suggested by Jaakko Hyvätti). - Fixed creating a new channel in the "Channels" menu in case the 'channels.conf' contains ':@nnn' lines with no text (thanks to Guy Roussin for reporting this one). - Changed the behaviour of the '0' key in normal viewing mode so that a channel only qualifies as "previous" if it has been selected for at least 3 seconds (suggested by Thomas Keil). - Now clearing the channel info display when entering numeric keys to switch channels (suggested by Guy Roussin). - Added missing I18N entry for "Ppid" (thanks to Rolf Ahrenberg). - Fixed handling the color buttons in the "Edit channel" menu (thanks to Thomas Keil for reporting this one). - Fixed an occasional "Broken pipe" error in SVDRP connections (thanks to Gerhard Steiner for reporting this one). - Fixed checking CA capabilities with the dvb-kernel driver (thanks to Kenneth Aafløy). - Fixed selecting the device, because sometimes an FTA recording terminated a CA recording (thanks to Emil Naepflein). - Fixed a possible crash in case a VFAT file system is used without compiling VDR with VFAT=1 (thanks to Ernst Fürst for reporting this one). - Now the program uses the values of VIDEODIR and PLUGINDIR defined in Makefile or Make.config as defaults (thanks to Steffen Barszus). - Added the usual menu timeout to the CAM menus.
Diffstat (limited to 'device.c')
-rw-r--r--device.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/device.c b/device.c
index f43870a..242f59c 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.45 2003/06/08 09:19:59 kls Exp $
+ * $Id: device.c 1.46 2003/08/02 11:44:28 kls Exp $
*/
#include "device.h"
@@ -142,23 +142,34 @@ cDevice *cDevice::GetDevice(int Index)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers)
{
cDevice *d = NULL;
+ int select = 7, pri;
+
for (int i = 0; i < numDevices; i++) {
bool ndr;
- if (device[i]->ProvidesChannel(Channel, Priority, &ndr) // this device is basicly able to do the job
- && (!d // we don't have a device yet, or...
- || (device[i]->Receiving() && !ndr) // ...this one is already receiving and allows additional receivers, or...
- || !d->Receiving() // ...the one we have is not receiving...
- && (device[i]->Priority() < d->Priority() // ...this one has an even lower Priority, or...
- || device[i]->Priority() == d->Priority() // ...same Priority...
- && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()) // ...but this one provides fewer Ca values
- )
- )
- ) {
- d = device[i];
- if (NeedsDetachReceivers)
- *NeedsDetachReceivers = ndr;
+ if (device[i]->ProvidesChannel(Channel, Priority, &ndr)) { // this device is basicly able to do the job
+ if (device[i]->Receiving() && !ndr)
+ pri = 0; // receiving and allows additional receivers
+ else if (d && !device[i]->Receiving() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
+ pri = 1; // free and fewer Ca's
+ else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice())
+ pri = 2; // free and not the primary device
+ else if (!device[i]->Receiving())
+ pri = 3; // free
+ else if (d && device[i]->Priority() < d->Priority())
+ pri = 4; // receiving but priority is lower
+ else if (d && device[i]->Priority() == d->Priority() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
+ pri = 5; // receiving with same priority but fewer Ca's
+ else
+ pri = 6; // all others
+ if (pri < select) {
+ select = pri;
+ d = device[i];
+ if (NeedsDetachReceivers)
+ *NeedsDetachReceivers = ndr;
+ }
}
}
+
/*XXX+ too complex with multiple recordings per device
if (!d && Ca > MAXDEVICES) {
// We didn't find one the easy way, so now we have to try harder: