Fixed selecting the device, because sometimes an FTA recording terminated a CA recording

This commit is contained in:
Klaus Schmidinger 2003-08-02 11:52:29 +02:00
parent a021b0f1bf
commit 44992533f0
3 changed files with 29 additions and 14 deletions

View File

@ -566,6 +566,8 @@ Clemens Kirchgatterer <clemens@thf.ath.cx>
Emil Naepflein <Emil.Naepflein@philosys.de> Emil Naepflein <Emil.Naepflein@philosys.de>
for suggesting to take an active SVDRP connection into account when doing shutdown or for suggesting to take an active SVDRP connection into account when doing shutdown or
housekeeping housekeeping
for fixing selecting the device, because sometimes an FTA recording terminated a
CA recording
Gerald Berwolf <genka@genka.de> Gerald Berwolf <genka@genka.de>
for suggesting to deactivate some templates in tools.h in case some plugin needs to for suggesting to deactivate some templates in tools.h in case some plugin needs to

View File

@ -2275,3 +2275,5 @@ Video Disk Recorder Revision History
Steiner for reporting this one). Steiner for reporting this one).
- Fixed checking CA capabilities with the dvb-kernel driver (thanks to Kenneth - Fixed checking CA capabilities with the dvb-kernel driver (thanks to Kenneth
Aafløy). Aafløy).
- Fixed selecting the device, because sometimes an FTA recording terminated a
CA recording (thanks to Emil Naepflein).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "device.h"
@ -142,23 +142,34 @@ cDevice *cDevice::GetDevice(int Index)
cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers) cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool *NeedsDetachReceivers)
{ {
cDevice *d = NULL; cDevice *d = NULL;
int select = 7, pri;
for (int i = 0; i < numDevices; i++) { for (int i = 0; i < numDevices; i++) {
bool ndr; bool ndr;
if (device[i]->ProvidesChannel(Channel, Priority, &ndr) // this device is basicly able to do the job 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... if (device[i]->Receiving() && !ndr)
|| (device[i]->Receiving() && !ndr) // ...this one is already receiving and allows additional receivers, or... pri = 0; // receiving and allows additional receivers
|| !d->Receiving() // ...the one we have is not receiving... else if (d && !device[i]->Receiving() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
&& (device[i]->Priority() < d->Priority() // ...this one has an even lower Priority, or... pri = 1; // free and fewer Ca's
|| device[i]->Priority() == d->Priority() // ...same Priority... else if (!device[i]->Receiving() && !device[i]->IsPrimaryDevice())
&& device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()) // ...but this one provides fewer Ca values pri = 2; // free and not the primary device
) else if (!device[i]->Receiving())
) pri = 3; // free
) { else if (d && device[i]->Priority() < d->Priority())
d = device[i]; pri = 4; // receiving but priority is lower
if (NeedsDetachReceivers) else if (d && device[i]->Priority() == d->Priority() && device[i]->ProvidesCa(Channel->Ca()) < d->ProvidesCa(Channel->Ca()))
*NeedsDetachReceivers = ndr; 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 /*XXX+ too complex with multiple recordings per device
if (!d && Ca > MAXDEVICES) { if (!d && Ca > MAXDEVICES) {
// We didn't find one the easy way, so now we have to try harder: // We didn't find one the easy way, so now we have to try harder: